How to acknowledge a Password for a Daemon point of view ?

Neil Rickert rickert at mp.cs.niu.edu
Sun Aug 26 00:51:46 AEST 1990


In article <1990Aug25.025441.18302 at diku.dk> kimcm at diku.dk (Kim Christian Madsen) writes:
>1) Read the encrypted password from the password file and store it in
>   a variable, store the user typed password in another variable and
>   use the function below:
>
>	int authenticate(crypt_pw,typed_pw)
>	char	*crypt_pw, *typed_pw;
>	{
>		char		salt[2];
>		extern char	*crypt();
>	
>		(void) strncpy(salt,crypt_pw,2);
>		return(strcmp(crypt_pw,crypt(typed_pw,salt)) == 0);
>	}
 What is wrong with skipping 'salt[2]' and the strncpy, and using:
		return(strcmp(crypt_pw,crypt(typed_pw,crypt_pw)) == 0);

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Sci Dept, Northern Illinois U., DeKalb IL 60115
  rickert at cs.niu.edu                                        +1-815-753-6940
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=



More information about the Comp.unix.wizards mailing list