]> granicus.if.org Git - shadow/commitdiff
* src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 30 Aug 2008 18:27:07 +0000 (18:27 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 30 Aug 2008 18:27:07 +0000 (18:27 +0000)
src/newgrp.c, src/passwd.c, src/su.c: Use the same stderr and
syslog warnings when the username cannot be determined.
* src/newgrp.c: Reuse the same stderr message for groups which do
not exist in the system.

ChangeLog
src/chfn.c
src/chsh.c
src/expiry.c
src/gpasswd.c
src/newgrp.c
src/passwd.c
src/su.c

index 46a1d09affc61443563f0f5986760d06005be958..013b201462c294a00d1b6cce5de2f772d13e64a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/chfn.c, src/chsh.c, src/expiry.c, src/gpasswd.c,
+       src/newgrp.c, src/passwd.c, src/su.c: Use the same stderr and
+       syslog warnings when the username cannot be determined.
+       * src/newgrp.c: Reuse the same stderr message for groups which do
+       not exist in the system.
+
 2008-08-21  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/usermod.c: Log errors while *_close to syslog.
index d614ad6601217b100804f93af57bd17b42471275..3a940d16ca51b85c82022d7c57c718cd1a3c1bf2 100644 (file)
@@ -651,6 +651,8 @@ int main (int argc, char **argv)
                        fprintf (stderr,
                                 _("%s: Cannot determine your user name.\n"),
                                 Prog);
+                       SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                                (unsigned long) getuid ()));
                        fail_exit (E_NOPERM);
                }
                user = xstrdup (pw->pw_name);
index ffc771b04e1b6599b882cb882a9a517339cc84cb..e2093cfc53f8aa2a06861c6d0a9fcb8564f008a3 100644 (file)
@@ -472,6 +472,8 @@ int main (int argc, char **argv)
                        fprintf (stderr,
                                 _("%s: Cannot determine your user name.\n"),
                                 Prog);
+                       SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                                (unsigned long) getuid ()));
                        fail_exit (1);
                }
                user = xstrdup (pw->pw_name);
index 50632be320b12252b23b74915bfbaed38b428fe4..78d282fd24ecea8e74b17d45a5f9f9b8b4ef4a12 100644 (file)
@@ -105,7 +105,10 @@ int main (int argc, char **argv)
         */
        pwd = get_my_pwent ();
        if (NULL == pwd) {
-               fprintf (stderr, _("%s: unknown user\n"), Prog);
+               fprintf (stderr, _("%s: Cannot determine your user name.\n"),
+                        Prog);
+               SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                        (unsigned long) getuid ()));
                exit (10);
        }
        spwd = getspnam (pwd->pw_name); /* !USE_PAM, No need for xgetspnam */
index e79614f8c1ce1d9c51be1ddfe6b9e83002739097..3ccd1249c9c1da31f7b6ccc2965cf44554603c0a 100644 (file)
@@ -851,12 +851,15 @@ int main (int argc, char **argv)
 
        pw = get_my_pwent ();
        if (NULL == pw) {
-               fputs (_("Who are you?\n"), stderr);
+               fprintf (stderr, _("%s: Cannot determine your user name.\n"),
+                        Prog);
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
                              "user lookup",
                              NULL, (unsigned int) bywho, 0);
 #endif
+               SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                        (unsigned long) getuid ()));
                failure ();
        }
        myname = xstrdup (pw->pw_name);
index 7ae2f52120332bd639c3b1c95e51de1391892000..5a814ebf5ba89f57e56644776a25c0fe0e2d17c6 100644 (file)
@@ -421,14 +421,14 @@ int main (int argc, char **argv)
 
        pwd = get_my_pwent ();
        if (NULL == pwd) {
-               fprintf (stderr, _("unknown UID: %lu\n"),
-                        (unsigned long) getuid ());
+               fprintf (stderr, _("%s: Cannot determine your user name.\n"),
+                        Prog);
 #ifdef WITH_AUDIT
                audit_logger (AUDIT_CHGRP_ID, Prog,
                              "changing", NULL,
                              (unsigned int) getuid (), 0);
 #endif
-               SYSLOG ((LOG_WARN, "unknown UID %lu",
+               SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
                         (unsigned long) getuid ()));
                closelog ();
                exit (1);
@@ -598,7 +598,7 @@ int main (int argc, char **argv)
         */
        grp = getgrnam (group); /* local, no need for xgetgrnam */
        if (NULL == grp) {
-               fprintf (stderr, _("unknown group: %s\n"), group);
+               fprintf (stderr, _("%s: group '%s' does not exist\n"), Prog, group);
                goto failure;
        }
 
index 92873764c86ed60c86987078be6f55a9dbe2bcd0..b4fe6da400e439938831e299336e239eb7cacdc3 100644 (file)
@@ -879,7 +879,9 @@ int main (int argc, char **argv)
        pw = get_my_pwent ();
        if (NULL == pw) {
                fprintf (stderr,
-                        _("%s: Cannot determine your user name.\n"), Prog);
+                        _("%s: Cannot determine your user name.\n"), Prog);
+               SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                        (unsigned long) getuid ()));
                exit (E_NOPERM);
        }
        myname = xstrdup (pw->pw_name);
index 77f864f633e60cbb0569832fb59e9cdee21f32c9..d25bd134c99f9e88da2e292651651e476fd6c74b 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -468,7 +468,10 @@ int main (int argc, char **argv)
         */
        pw = get_my_pwent ();
        if (NULL == pw) {
-               SYSLOG ((LOG_CRIT, "Unknown UID: %u", my_uid));
+               fprintf (stderr, _("%s: Cannot determine your user name.\n"),
+                        Prog);
+               SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
+                        (unsigned long) my_uid));
                su_failure (tty);
        }
        STRFCPY (oldname, pw->pw_name);