From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 26 04:35:51 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C36316A4CE for ; Wed, 26 Nov 2003 04:35:51 -0800 (PST) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F00143FEC for ; Wed, 26 Nov 2003 04:35:50 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-38lc18e.dialup.mindspring.com ([209.86.5.14] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1AOysf-0002Mp-00; Wed, 26 Nov 2003 04:34:53 -0800 Message-ID: <3FC49DA6.54459AD6@mindspring.com> Date: Wed, 26 Nov 2003 04:33:42 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "sapdb@komadev.de" References: <1069810210.3fc40222e2bca@localhost> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a49569e19862215bed8ea1288cca802645a7ce0e8f8d31aa3f350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: getpwnam with md5 encrypted passwds X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2003 12:35:51 -0000 "sapdb@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. -- Terry