* 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.
This commit is contained in:
nekral-guest 2008-08-30 18:27:07 +00:00
parent 307f703b99
commit 38a50366bc
8 changed files with 31 additions and 8 deletions

View File

@ -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.

View 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);

View 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);

View 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 */

View 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);

View 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;
}

View 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);

View File

@ -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);