* 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:
@ -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>
|
2008-08-21 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/usermod.c: Log errors while *_close to syslog.
|
* src/usermod.c: Log errors while *_close to syslog.
|
||||||
|
@ -651,6 +651,8 @@ int main (int argc, char **argv)
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: Cannot determine your user name.\n"),
|
_("%s: Cannot determine your user name.\n"),
|
||||||
Prog);
|
Prog);
|
||||||
|
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
|
||||||
|
(unsigned long) getuid ()));
|
||||||
fail_exit (E_NOPERM);
|
fail_exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
user = xstrdup (pw->pw_name);
|
user = xstrdup (pw->pw_name);
|
||||||
|
@ -472,6 +472,8 @@ int main (int argc, char **argv)
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: Cannot determine your user name.\n"),
|
_("%s: Cannot determine your user name.\n"),
|
||||||
Prog);
|
Prog);
|
||||||
|
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
|
||||||
|
(unsigned long) getuid ()));
|
||||||
fail_exit (1);
|
fail_exit (1);
|
||||||
}
|
}
|
||||||
user = xstrdup (pw->pw_name);
|
user = xstrdup (pw->pw_name);
|
||||||
|
@ -105,7 +105,10 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
pwd = get_my_pwent ();
|
pwd = get_my_pwent ();
|
||||||
if (NULL == pwd) {
|
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);
|
exit (10);
|
||||||
}
|
}
|
||||||
spwd = getspnam (pwd->pw_name); /* !USE_PAM, No need for xgetspnam */
|
spwd = getspnam (pwd->pw_name); /* !USE_PAM, No need for xgetspnam */
|
||||||
|
@ -851,12 +851,15 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
pw = get_my_pwent ();
|
pw = get_my_pwent ();
|
||||||
if (NULL == pw) {
|
if (NULL == pw) {
|
||||||
fputs (_("Who are you?\n"), stderr);
|
fprintf (stderr, _("%s: Cannot determine your user name.\n"),
|
||||||
|
Prog);
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
"user lookup",
|
"user lookup",
|
||||||
NULL, (unsigned int) bywho, 0);
|
NULL, (unsigned int) bywho, 0);
|
||||||
#endif
|
#endif
|
||||||
|
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
|
||||||
|
(unsigned long) getuid ()));
|
||||||
failure ();
|
failure ();
|
||||||
}
|
}
|
||||||
myname = xstrdup (pw->pw_name);
|
myname = xstrdup (pw->pw_name);
|
||||||
|
@ -421,14 +421,14 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
pwd = get_my_pwent ();
|
pwd = get_my_pwent ();
|
||||||
if (NULL == pwd) {
|
if (NULL == pwd) {
|
||||||
fprintf (stderr, _("unknown UID: %lu\n"),
|
fprintf (stderr, _("%s: Cannot determine your user name.\n"),
|
||||||
(unsigned long) getuid ());
|
Prog);
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_CHGRP_ID, Prog,
|
audit_logger (AUDIT_CHGRP_ID, Prog,
|
||||||
"changing", NULL,
|
"changing", NULL,
|
||||||
(unsigned int) getuid (), 0);
|
(unsigned int) getuid (), 0);
|
||||||
#endif
|
#endif
|
||||||
SYSLOG ((LOG_WARN, "unknown UID %lu",
|
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
|
||||||
(unsigned long) getuid ()));
|
(unsigned long) getuid ()));
|
||||||
closelog ();
|
closelog ();
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -598,7 +598,7 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
grp = getgrnam (group); /* local, no need for xgetgrnam */
|
grp = getgrnam (group); /* local, no need for xgetgrnam */
|
||||||
if (NULL == grp) {
|
if (NULL == grp) {
|
||||||
fprintf (stderr, _("unknown group: %s\n"), group);
|
fprintf (stderr, _("%s: group '%s' does not exist\n"), Prog, group);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +879,9 @@ int main (int argc, char **argv)
|
|||||||
pw = get_my_pwent ();
|
pw = get_my_pwent ();
|
||||||
if (NULL == pw) {
|
if (NULL == pw) {
|
||||||
fprintf (stderr,
|
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);
|
exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
myname = xstrdup (pw->pw_name);
|
myname = xstrdup (pw->pw_name);
|
||||||
|
5
src/su.c
5
src/su.c
@ -468,7 +468,10 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
pw = get_my_pwent ();
|
pw = get_my_pwent ();
|
||||||
if (NULL == pw) {
|
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);
|
su_failure (tty);
|
||||||
}
|
}
|
||||||
STRFCPY (oldname, pw->pw_name);
|
STRFCPY (oldname, pw->pw_name);
|
||||||
|
Reference in New Issue
Block a user