Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 09:41:46 +0100
From:      "sapdb@komadev.de" <kai@freshx.de>
To:        Q <q_dolan@yahoo.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: getpwnam with md5 encrypted passwds
Message-ID:  <1069836106.3fc4674ab26f6@localhost>
In-Reply-To: <1069813848.99808.8.camel@boxster.onthenet.com.au>
References:  <1069810210.3fc40222e2bca@localhost> <1069813848.99808.8.camel@boxster.onthenet.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Zitat von Q <q_dolan@yahoo.com.au>:

This was a stupid mistake ! 

Thanks 

> Change your crypt line to:
> 
> if (!strcmp( crypt(pass,pwd->pw_passwd), pwd->pw_passwd) ) {
> 
> Seeya...Q
> 
> On Wed, 2003-11-26 at 11:30, sapdb@komadev.de wrote:
> 
> > Hi,
> > 
> > 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;
> >                 }
> > 
> > The problem is, that my passwords are encrypted in md5-format, so the
> strcmp 
> > fails always. Now i did not find any usable information on how to work this
> out 
> > on FreeBSD, and how to be independent from the settings in the login-conf ?
> 
> > (that i dont have to check whether its using crypt,md5 or blowfish)
> > 
> > The code should be running on 4.x and 5.x
> > 
> > Any ideas ?
> > 
> > Kind regards 
> > 
> > Kai
> > _______________________________________________
> > freebsd-hackers@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1069836106.3fc4674ab26f6>