From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 11 07:11:31 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20FC6106567B for ; Thu, 11 Dec 2008 07:11:31 +0000 (UTC) (envelope-from trond@fagskolen.gjovik.no) Received: from ramstind.fig.ol.no (ramstind.fig.ol.no [IPv6:2001:700:1100:1:250:4ff:fe43:9d15]) by mx1.freebsd.org (Postfix) with ESMTP id 8E5CE8FC21 for ; Thu, 11 Dec 2008 07:11:30 +0000 (UTC) (envelope-from trond@fagskolen.gjovik.no) Received: from ramstind.fig.ol.no (trond@localhost [127.0.0.1]) by ramstind.fig.ol.no (8.13.8/8.13.8) with ESMTP id mBB7BPiv019074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 11 Dec 2008 08:11:26 +0100 (CET) (envelope-from trond@fagskolen.gjovik.no) Received: from localhost (trond@localhost) by ramstind.fig.ol.no (8.13.8/8.13.8/Submit) with ESMTP id mBB7BPf7019071 for ; Thu, 11 Dec 2008 08:11:25 +0100 (CET) (envelope-from trond@fagskolen.gjovik.no) X-Authentication-Warning: ramstind.fig.ol.no: trond owned process doing -bs Date: Thu, 11 Dec 2008 08:11:20 +0100 (CET) From: =?ISO-8859-1?Q?Trond_Endrest=F8l?= Sender: Trond.Endrestol@fagskolen.gjovik.no To: freebsd-hackers@freebsd.org In-Reply-To: <87vdtr9q8a.fsf@kobe.laptop> Message-ID: <20081211080955.T60586@ramstind.fig.ol.no> References: <87vdtr9q8a.fsf@kobe.laptop> Organization: =?ISO-8859-1?Q?Fagskolen_i_Gj=F8vik?= OpenPGP: url=http://fagskolen.gjovik.no/~trond/trond.key MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1840817174-1228979480=:60586" X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=failed X-Spam-Checker-Version: SpamAssassin on ramstind.fig.ol.no Subject: Re: Small Change to chpass.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 07:11:31 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1840817174-1228979480=:60586 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 11 Dec 2008 08:32+0200, Giorgos Keramidas wrote: > On Wed, 10 Dec 2008 18:00:25 -0800, "Sheldon Givens" wrote: > > --- /usr/src/usr.bin/chpass.c 2008-12-11 01:55:27.000000000 -0800 > > +++ /usr/src/usr.bin/chpass.c 2008-12-11 01:57:09.000000000 -0800 > > @@ -80,10 +80,11 @@ > > { > > enum { NEWSH, LOADENTRY, EDITENTRY, NEWPW, NEWEXP } op; > > struct passwd lpw, *old_pw, *pw; > > - int ch, pfd, tfd; > > + int ch, pfd, tfd, itr, auth; > > const char *password; > > char *arg = NULL; > > uid_t uid; > > + int max_retries = 3; > > #ifdef YP > > struct ypclnt *ypclnt; > > const char *yp_domain = NULL, *yp_host = NULL; > > @@ -227,9 +228,16 @@ > > } > > > > if (old_pw && !master_mode) { > > - password = getpass("Password: "); I'm sure you have noticed the trailing space in the string. > > - if (strcmp(crypt(password, old_pw->pw_passwd), > > - old_pw->pw_passwd) != 0) > > + auth = 0; > > + for(itr=0;itr > + password = getpass("Password:"); The space's missing in this string. It might be better to stay consistent with the original code. > > + if(strcmp(crypt(password, old_pw->pw_passwd), > > + old_pw->pw_passwd) == 0) { > > + auth=1; > > + break; > > + } > > + } > > + if (!auth) > > baduser(); > > } else { > > password = ""; - -- - ---------------------------------------------------------------------- Trond Endrestøl | Trond.Endrestol@fagskolen.gjovik.no ACM, NAS, NUUG, SAGE, USENIX | FreeBSD 6.2-STABLE & Pine 4.64 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFJQL0dbYWZalUoElsRAolhAJoC4iTyrVY3xeoChg3iWRsDLpvonwCeP0yT 1kM28vaxZtNH9LGqyZzZCTA= =0+CT -----END PGP SIGNATURE----- --0-1840817174-1228979480=:60586--