Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3416:27312b7941e9 HEAD
32bit UID/GIDs were truncated
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 09 Jun 2005 16:44:53 +0300 |
parents | 4e36a99268dd |
children | b0bdf32564b7 |
files | src/lib/restrict-access.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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));