AW: getpwnam with md5 encrypted passwds

Kai Mosebach kai at freshx.de
Wed Nov 26 05:21:07 PST 2003


> -----Ursprüngliche Nachricht-----
> Von: Terry Lambert [mailto:tlambert2 at mindspring.com]
> Gesendet: Mittwoch, 26. November 2003 13:34
> An: sapdb at komadev.de
> Cc: freebsd-hackers at freebsd.org
> Betreff: Re: getpwnam with md5 encrypted passwds
> 
> "sapdb at komadev.de" wrote:
> > i am trying to validate a given user password against my local passwd-
> file with
> > this piece of code :
> >
> >         if (!( pwd = getpwnam ( user ))) {
> >                 log(ERROR,"User %s not known",user);
> >                 stat=NOUSER;
> >         }
> >         if (!strcmp( crypt(pass,pwd->pw_name), pwd->pw_passwd) ) {
> >                 log(DEBUG|MISC,"HURRAY : %s authenticated\n", user);
> >                 stat = AUTHED;
> >                 }
> 
> I know you have the fix for the crypt of the wrong field, but the
> proper thing to do is probably to use pan_authenticate() so that
> you are insensitive to the athentication method being used, rather
> than crypting and comparing it yourself.
> 

Looks interesting ... is this method also usable, when i dropped my privs ?

cheers



More information about the freebsd-hackers mailing list