From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 11 20:39:54 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 4E1DD106564A for ; Thu, 11 Dec 2008 20:39:54 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.228]) by mx1.freebsd.org (Postfix) with ESMTP id 1FD5B8FC1F for ; Thu, 11 Dec 2008 20:39:54 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so1025911rvf.43 for ; Thu, 11 Dec 2008 12:39:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=kF95ohR+ivH8gzksLARBPZtn4BNBSYwWwMWjcpvLvkY=; b=MUlXpqRSeYEaer9w5WKeUShFSw5/5Vvwz1yvR7jc6yJzTjID0jmag8QrNfFtakYpFL mshAV4rj2eh90Y6P5w1S+nFooAzmEnWBYiyhleQvOOo7gCZaPESJdcrbN40PmHy1rOmX 8zkB6dn6g3YkMMvBlaTEa+hwyggB+d7O23Z1M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Z5t/LPgJq6gizJuPRur4t5+Wb5DvbZTV0o1OgvdXTCfYj0Y1A/FE1deQw3zS7tm1b8 CQvsEuy2PbrFBrPwvz4wjNs7YiMADmkvvAjzhQlWhxEYfS0ZhzZobJujlOYUaB40r4D2 XHT4HYGhQD8iK9Hv5TVdypNuHiVpoZthSO1S4= Received: by 10.141.29.16 with SMTP id g16mr1451514rvj.287.1229027993870; Thu, 11 Dec 2008 12:39:53 -0800 (PST) Received: by 10.140.158.13 with HTTP; Thu, 11 Dec 2008 12:39:53 -0800 (PST) Message-ID: <7d6fde3d0812111239i7a47037mf9b5e4e5386b540@mail.gmail.com> Date: Thu, 11 Dec 2008 12:39:53 -0800 From: "Garrett Cooper" To: "Giorgos Keramidas" In-Reply-To: <87zlj2kg4e.fsf@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <87vdtr9q8a.fsf@kobe.laptop> <20081211080955.T60586@ramstind.fig.ol.no> <87zlj2kg4e.fsf@kobe.laptop> Cc: freebsd-hackers@freebsd.org, =?ISO-8859-1?Q?Trond_Endrest=F8l?= 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 20:39:54 -0000 On Thu, Dec 11, 2008 at 5:15 AM, Giorgos Keramidas wrote: > On Thu, 11 Dec 2008 08:11:20 +0100 (CET), Trond Endrest=F8l wrote: >>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 =3D NULL; >>> > uid_t uid; >>> > + int max_retries =3D 3; >>> > #ifdef YP >>> > struct ypclnt *ypclnt; >>> > const char *yp_domain =3D NULL, *yp_host =3D NULL; >>> > @@ -227,9 +228,16 @@ >>> > } >>> > >>> > if (old_pw && !master_mode) { >>> > - password =3D 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) !=3D 0) >>> > + auth =3D 0; >>> > + for(itr=3D0;itr>> > + password =3D getpass("Password:"); >> >> The space's missing in this string. It might be better to stay >> consistent with the original code. > > Good catch. No, I didn't notice the missing space the first time I read > the diff :/ A better way to solve this may be to add an option to set the number of retries before failure and then just pass it through to this function. -Garrett