# HG changeset patch # User Timo Sirainen # Date 1118324693 -10800 # Node ID 27312b7941e998fb51baab1710e7cba6eb583181 # Parent 4e36a99268dd2a26e7ea6373aa64d7e204e1f9ef 32bit UID/GIDs were truncated diff -r 4e36a99268dd -r 27312b7941e9 src/lib/restrict-access.c --- a/src/lib/restrict-access.c Wed Jun 08 18:45:41 2005 +0300 +++ b/src/lib/restrict-access.c Thu Jun 09 16:44:53 2005 +0300 @@ -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));