[Pkg-shadow-commits] r2579 - in upstream/trunk: . lib
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sat Mar 21 20:29:58 UTC 2009
Author: nekral-guest
Date: 2009-03-21 20:29:58 +0000 (Sat, 21 Mar 2009)
New Revision: 2579
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/sgetgrent.c
upstream/trunk/lib/sgetpwent.c
Log:
* lib/sgetpwent.c, lib/sgetgrent.c: Use get_uid and get_gid to
validate the UIDs or GIDs instead of atoi/strtol.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2009-03-21 20:24:37 UTC (rev 2578)
+++ upstream/trunk/ChangeLog 2009-03-21 20:29:58 UTC (rev 2579)
@@ -1,5 +1,10 @@
2009-03-21 Nicolas François <nicolas.francois at centraliens.net>
+ * lib/sgetpwent.c, lib/sgetgrent.c: Use get_uid and get_gid to
+ validate the UIDs or GIDs instead of atoi/strtol.
+
+2009-03-21 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/get_gid.c, libmisc/get_uid.c, libmisc/Makefile.am,
lib/get_gid.c, lib/get_uid.c, lib/Makefile.am: get_uid.c and
get_gid.c moved from libmisc/ to lib/.
Modified: upstream/trunk/lib/sgetgrent.c
===================================================================
--- upstream/trunk/lib/sgetgrent.c 2009-03-21 20:24:37 UTC (rev 2578)
+++ upstream/trunk/lib/sgetgrent.c 2009-03-21 20:29:58 UTC (rev 2579)
@@ -141,7 +141,9 @@
}
grent.gr_name = grpfields[0];
grent.gr_passwd = grpfields[1];
- grent.gr_gid = atoi (grpfields[2]);
+ if (get_gid (grpfields[2], &grent.gr_gid) == 0) {
+ return (struct group *) 0;
+ }
grent.gr_mem = list (grpfields[3]);
if (NULL == grent.gr_mem) {
return (struct group *) 0; /* out of memory */
Modified: upstream/trunk/lib/sgetpwent.c
===================================================================
--- upstream/trunk/lib/sgetpwent.c 2009-03-21 20:24:37 UTC (rev 2578)
+++ upstream/trunk/lib/sgetpwent.c 2009-03-21 20:29:58 UTC (rev 2579)
@@ -108,14 +108,10 @@
pwent.pw_name = fields[0];
pwent.pw_passwd = fields[1];
- pwent.pw_uid = strtol (fields[2], &ep, 10);
- /* FIXME: (0 == pwent.pw_uid) does not look correct -- nekral */
- if ((0 == pwent.pw_uid) && ('\0' != *ep)) {
+ if (get_uid (fields[2], &pwent.pw_uid) == 0) {
return NULL;
}
- /* FIXME: (0 == pwent.pw_gid) does not look correct -- nekral */
- pwent.pw_gid = strtol (fields[3], &ep, 10);
- if ((0 == pwent.pw_gid) && ('\0' != *ep)) {
+ if (get_gid (fields[3], &pwent.pw_gid) == 0) {
return NULL;
}
pwent.pw_gecos = fields[4];
More information about the Pkg-shadow-commits
mailing list