[Pkg-shadow-commits] r2404 - in upstream/trunk: . lib libmisc src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sat Sep 13 18:03:51 UTC 2008
Author: nekral-guest
Date: 2008-09-13 18:03:50 +0000 (Sat, 13 Sep 2008)
New Revision: 2404
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/getdef.c
upstream/trunk/libmisc/setugid.c
upstream/trunk/src/login_nopam.c
upstream/trunk/src/suauth.c
Log:
* libmisc/setugid.c, src/login_nopam.c, src/suauth.c,
lib/getdef.c: Replace the %m format string by strerror(). This
avoids errno to be reset between the system call error and the
report function.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-09-13 17:53:56 UTC (rev 2403)
+++ upstream/trunk/ChangeLog 2008-09-13 18:03:50 UTC (rev 2404)
@@ -1,5 +1,12 @@
2008-09-13 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/setugid.c, src/login_nopam.c, src/suauth.c,
+ lib/getdef.c: Replace the %m format string by strerror(). This
+ avoids errno to be reset between the system call error and the
+ report function.
+
+2008-09-13 Nicolas François <nicolas.francois at centraliens.net>
+
* lib/commonio.c: Ignore the return value of umask() when the mask
is set to the old value.
Modified: upstream/trunk/lib/getdef.c
===================================================================
--- upstream/trunk/lib/getdef.c 2008-09-13 17:53:56 UTC (rev 2403)
+++ upstream/trunk/lib/getdef.c 2008-09-13 18:03:50 UTC (rev 2404)
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <errno.h>
#include "getdef.h"
/*
* A configuration item definition.
@@ -377,8 +378,9 @@
*/
fp = fopen (def_fname, "r");
if (NULL == fp) {
- SYSLOG ((LOG_CRIT, "cannot open login definitions %s [%m]",
- def_fname));
+ int err = errno;
+ SYSLOG ((LOG_CRIT, "cannot open login definitions %s [%s]",
+ def_fname, strerror (err)));
exit (1);
}
@@ -426,8 +428,9 @@
}
if (ferror (fp) != 0) {
- SYSLOG ((LOG_CRIT, "cannot read login definitions %s [%m]",
- def_fname));
+ int err = errno;
+ SYSLOG ((LOG_CRIT, "cannot read login definitions %s [%s]",
+ def_fname, strerror (err)));
exit (1);
}
Modified: upstream/trunk/libmisc/setugid.c
===================================================================
--- upstream/trunk/libmisc/setugid.c 2008-09-13 17:53:56 UTC (rev 2403)
+++ upstream/trunk/libmisc/setugid.c 2008-09-13 18:03:50 UTC (rev 2404)
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <grp.h>
+#include <errno.h>
#include "prototypes.h"
#include "defines.h"
#include <pwd.h>
@@ -56,9 +57,10 @@
* file.
*/
if (setgid (info->pw_gid) == -1) {
+ int err = errno;
perror ("setgid");
- SYSLOG ((LOG_ERR, "bad group ID `%d' for user `%s': %m\n",
- info->pw_gid, info->pw_name));
+ SYSLOG ((LOG_ERR, "bad group ID `%d' for user `%s': %s\n",
+ info->pw_gid, info->pw_name, strerror (err)));
closelog ();
return -1;
}
@@ -68,9 +70,10 @@
* the group set from the /etc/group file.
*/
if (initgroups (info->pw_name, info->pw_gid) == -1) {
+ int err = errno;
perror ("initgroups");
- SYSLOG ((LOG_ERR, "initgroups failed for user `%s': %m\n",
- info->pw_name));
+ SYSLOG ((LOG_ERR, "initgroups failed for user `%s': %s\n",
+ info->pw_name, strerror (err)));
closelog ();
return -1;
}
@@ -84,9 +87,10 @@
* Set the real UID to the UID value in the password file.
*/
if (setuid (info->pw_uid) != 0) {
+ int err = errno;
perror ("setuid");
- SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %m\n",
- (int) info->pw_uid, info->pw_name));
+ SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %s\n",
+ (int) info->pw_uid, info->pw_name, strerror (err)));
closelog ();
return -1;
}
Modified: upstream/trunk/src/login_nopam.c
===================================================================
--- upstream/trunk/src/login_nopam.c 2008-09-13 17:53:56 UTC (rev 2403)
+++ upstream/trunk/src/login_nopam.c 2008-09-13 18:03:50 UTC (rev 2404)
@@ -133,7 +133,8 @@
}
(void) fclose (fp);
} else if (errno != ENOENT) {
- SYSLOG ((LOG_ERR, "cannot open %s: %m", TABLE));
+ int err = errno;
+ SYSLOG ((LOG_ERR, "cannot open %s: %s", TABLE, strerror (err)));
}
return (!match || (line[0] == '+'))?1:0;
}
Modified: upstream/trunk/src/suauth.c
===================================================================
--- upstream/trunk/src/suauth.c 2008-09-13 17:53:56 UTC (rev 2403)
+++ upstream/trunk/src/suauth.c 2008-09-13 18:03:50 UTC (rev 2404)
@@ -76,17 +76,19 @@
char *action;
if (!(authfile_fd = fopen (SUAUTHFILE, "r"))) {
+ int err = errno;
/*
* If the file doesn't exist - default to the standard su
* behaviour (no access control). If open fails for some
* other reason - maybe someone is trying to fool us with
* file descriptors limit etc., so deny access. --marekm
*/
- if (errno == ENOENT)
+ if (ENOENT == err) {
return NOACTION;
+ }
SYSLOG ((LOG_ERR,
- "could not open/read config file '%s': %m\n",
- SUAUTHFILE));
+ "could not open/read config file '%s': %s\n",
+ SUAUTHFILE, strerror (err)));
return DENY;
}
More information about the Pkg-shadow-commits
mailing list