Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2008 08:11:20 +0100 (CET)
From:      =?ISO-8859-1?Q?Trond_Endrest=F8l?= <Trond.Endrestol@fagskolen.gjovik.no>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Small Change to chpass.c
Message-ID:  <20081211080955.T60586@ramstind.fig.ol.no>
In-Reply-To: <87vdtr9q8a.fsf@kobe.laptop>
References:  <f4ecc0930812101800g601d9f10jc008e83d82b54a81@mail.gmail.com> <87vdtr9q8a.fsf@kobe.laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
  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" <sheldon@sigsegv.ca> 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<max_retries;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--



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