Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!mp.cs.niu.edu!rickert From: rickert@mp.cs.niu.edu (Neil Rickert) Newsgroups: comp.unix.wizards Subject: Re: How to acknowledge a Password for a Daemon point of view ? Keywords: password dameon Message-ID: <1990Aug25.145146.10570@mp.cs.niu.edu> Date: 25 Aug 90 14:51:46 GMT References: <1990Aug24.172402.21947@dg13.cec.be> <1990Aug25.025441.18302@diku.dk> Organization: Northern Illinois University Lines: 22 In article <1990Aug25.025441.18302@diku.dk> kimcm@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@cs.niu.edu +1-815-753-6940 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=