[dovecot-cvs] dovecot/src/lib restrict-access.c,1.19,1.20

cras at dovecot.org cras at dovecot.org
Thu Jun 9 16:44:55 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv517

Modified Files:
	restrict-access.c 
Log Message:
32bit UID/GIDs were truncated



Index: restrict-access.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/restrict-access.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- restrict-access.c	12 Mar 2005 23:10:33 -0000	1.19
+++ restrict-access.c	9 Jun 2005 13:44:53 -0000	1.20
@@ -61,9 +61,9 @@
 	int i, used, gid_count;
 
 	env = getenv("RESTRICT_GID_FIRST");
-	first_valid_gid = env == NULL ? 0 : (gid_t)atol(env);
+	first_valid_gid = env == NULL ? 0 : (gid_t)strtoul(env, NULL, 10);
 	env = getenv("RESTRICT_GID_LAST");
-	last_valid_gid = env == NULL ? 0 : (gid_t)atol(env);
+	last_valid_gid = env == NULL ? 0 : (gid_t)strtoul(env, NULL, 10);
 
 	if (first_valid_gid == 0 && last_valid_gid == 0)
 		return;
@@ -90,7 +90,7 @@
 	struct group *group;
 
 	if (is_numeric(name, '\0'))
-		return (gid_t)atol(name);
+		return (gid_t)strtoul(name, NULL, 10);
 
 	group = getgrnam(name);
 	if (group == NULL)
@@ -132,7 +132,7 @@
 	   not running as root and try to just use our own GID. Do this
 	   before chrooting so initgroups() actually works. */
 	env = getenv("RESTRICT_SETGID");
-	gid = env == NULL ? 0 : (gid_t)atol(env);
+	gid = env == NULL ? 0 : (gid_t)strtoul(env, NULL, 10);
 	if (gid != 0 && (gid != getgid() || gid != getegid())) {
 		if (setgid(gid) != 0)
 			i_fatal("setgid(%s) failed: %m", dec2str(gid));
@@ -176,7 +176,7 @@
 
 	/* uid last */
 	env = getenv("RESTRICT_SETUID");
-	uid = env == NULL ? 0 : (uid_t)atol(env);
+	uid = env == NULL ? 0 : (uid_t)strtoul(env, NULL, 10);
 	if (uid != 0) {
 		if (setuid(uid) != 0)
 			i_fatal("setuid(%s) failed: %m", dec2str(uid));



More information about the dovecot-cvs mailing list