Date: Mon, 25 Sep 2006 11:44:57 +0400 (MSD) From: Dmitry Morozovsky <marck@rinet.ru> To: stable@freebsd.org Cc: des@freebsd.org Subject: chpass(1) patch for changing only crypted passwords Message-ID: <20060925114102.F79983@woozle.rinet.ru>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Dear colleagues, chpass is a bit broken since chpass.c:1.23 - it uses pw_equal which does not check crypted password field; so, you can not change _only_ crypt pass with chpass. Attached patch fixes this. Any thoughts/objections? Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ [-- Attachment #2 --] Index: usr.bin/chpass/chpass.c =================================================================== RCS file: /home/ncvs/src/usr.bin/chpass/chpass.c,v retrieving revision 1.27 diff -u -r1.27 chpass.c --- usr.bin/chpass/chpass.c 18 Jan 2004 21:46:39 -0000 1.27 +++ usr.bin/chpass/chpass.c 25 Sep 2006 07:42:25 -0000 @@ -217,7 +217,12 @@ pw_fini(); if (pw == NULL) err(1, "edit()"); - if (pw_equal(old_pw, pw)) + /* + * pw_equal does not check for crypted passwords, so we + * should do it explicitly + */ + if (pw_equal(old_pw, pw) && + strcmp(old_pw->pw_passwd, pw->pw_passwd) == 0) errx(0, "user information unchanged"); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060925114102.F79983>
