[Pkg-shadow-devel] [PATCH_01] a Debian patch for passwd.c

Nicolas François nicolas.francois@centraliens.net
Fri, 15 Apr 2005 22:33:33 +0200


--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Tomasz,

I found this patch in Debian:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
--- shadow-4.0.3/src/passwd.c=BB=B7=B72002-01-05 16:41:43.000000000 +0100
+++ shadow-4.0.3_30.4/src/passwd.c=BB=B7=B7=B7=B7=B72004-11-02 22:17:38.0=
00000000 +0100
@@ -1173,8 +1173,8 @@

        if (!amroot && pw->pw_uid !=3D getuid ()) {
                fprintf (stderr,
-                        _("You may not change the password for %s.\n"),
-                        name);
+                        _("%s: You may not view or modify password infor=
mation for %s.\n"),
+                        Prog, name);
                SYSLOG ((LOG_WARN, "can't change pwd for `%s'", name));
                closelog ();
                exit (E_NOPERM);
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D

This patch was done to fix #61313:
"passwd -S root" (as a normal user) should not display "You may not chang=
e
the password for root."

I've also updated updated the syslog message.
The attached patch is against your CVS.



For the debian folks:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
I'm trying to exclude some parts of the 0xx dpatches and move them to 3xx
or 4xx.
I will first try to pick up some simple patches that Tomasz could apply
safely before his 4.0.8 release.

--=20
Nekral

--uAKRQypu60I7Lcqm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="passwd.c.patch"

Index: src/passwd.c
===================================================================
RCS file: /cvsroot/shadow/src/passwd.c,v
retrieving revision 1.34
diff -u -r1.34 passwd.c
--- src/passwd.c	6 Apr 2005 04:26:06 -0000	1.34
+++ src/passwd.c	15 Apr 2005 20:08:58 -0000
@@ -873,8 +873,8 @@
 
 	if (!amroot && pw->pw_uid != getuid ()) {
 		fprintf (stderr,
-			 _("You may not change the password for %s.\n"), name);
-		SYSLOG ((LOG_WARN, "can't change pwd for `%s'", name));
+			 _("%s: You may not view or modify password information for %s.\n"), Prog, name);
+		SYSLOG ((LOG_WARN, "%s: can't view or modify password information for `%s'", Prog, name));
 		closelog ();
 		exit (E_NOPERM);
 	}
@@ -886,9 +886,9 @@
 
 	if ((pw->pw_uid != getuid ())
 	    && (checkPasswdAccess (PASSWD__PASSWD) != 0)) {
-		fprintf (stderr, _("You may not change the password for %s.\n"),
-			 name);
-		SYSLOG ((LOG_WARN, "can't change pwd for `%s'", name));
+		fprintf (stderr, _("%s: You may not view or modify password information for %s.\n"),
+			 Prog, name);
+		SYSLOG ((LOG_WARN, "%s: can't view or modify password information for `%s'", Prog, name));
 		closelog ();
 		exit (E_NOPERM);
 	}

--uAKRQypu60I7Lcqm--