Path: utzoo!attcan!uunet!samsung!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!dkuug!freja.diku.dk!kimcm From: kimcm@diku.dk (Kim Christian Madsen) Newsgroups: comp.unix.wizards Subject: Re: How to acknowledge a Password for a Daemon point of view ? Keywords: password dameon Message-ID: <1990Aug25.025441.18302@diku.dk> Date: 25 Aug 90 02:54:41 GMT References: <1990Aug24.172402.21947@dg13.cec.be> Organization: Department Of Computer Science, University Of Copenhagen Lines: 33 pnoe@dg13.cec.be (Pierre Noel) writes: >I would then know how it is possible, for the daemon process, to check the >validity of the tuple UserName-Password as a real logname to the system. >In fact, what I'm looking for is kind of a function which takes the >Name and the Password as parameter and reply Yes or No depending on >the validity. 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); } >By the way, I don't have crypt function (as we are in Europe, not in USA). I'm pretty sure you have mixed two different issues up, the crypt missing outside USA is the UNIX command (crypt(1)), the C library routine crypt(3) is another matter, it has to be there for jos like these, otherwise you could grap the code from reverse-engineering of the su(1) program, since it has to be there as well. Best Regards Kim Chr. Madsen