diff options
Diffstat (limited to 'lib/limits.c')
-rw-r--r-- | lib/limits.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/limits.c b/lib/limits.c index c6c041c5..387a972b 100644 --- a/lib/limits.c +++ b/lib/limits.c @@ -61,7 +61,7 @@ static int setrlimit_value (unsigned int resource, limit = RLIM_INFINITY; } else { - /* We cannot use getlong here because it fails when there + /* We cannot use str2sl() here because it fails when there * is more to the value than just this number! * Also, we are limited to base 10 here (hex numbers will not * work with the limit string parser as is anyway) @@ -93,7 +93,7 @@ static int set_prio (const char *value) { long prio; - if ( (getlong(value, &prio) == -1) + if ( (str2sl(&prio, value) == -1) || (prio != (int) prio)) { return 0; } @@ -108,7 +108,7 @@ static int set_umask (const char *value) { unsigned long mask; - if ( (getulong(value, &mask) == -1) + if ( (str2ul(&mask, value) == -1) || (mask != (mode_t) mask)) { return 0; } @@ -123,7 +123,7 @@ static int check_logins (const char *name, const char *maxlogins) { unsigned long limit, count; - if (getulong(maxlogins, &limit) == -1) { + if (str2ul(&limit, maxlogins) == -1) { return 0; } @@ -486,7 +486,7 @@ void setup_limits (const struct passwd *info) if (strncmp (cp, "pri=", 4) == 0) { long inc; - if ( (getlong(cp + 4, &inc) == 0) + if ( (str2sl(&inc, cp + 4) == 0) && (inc >= -20) && (inc <= 20)) { errno = 0; if ( (nice (inc) != -1) @@ -504,7 +504,7 @@ void setup_limits (const struct passwd *info) } if (strncmp (cp, "ulimit=", 7) == 0) { long blocks; - if ( (getlong(cp + 7, &blocks) == -1) + if ( (str2sl(&blocks, cp + 7) == -1) || (blocks != (int) blocks) || (set_filesize_limit (blocks) != 0)) { SYSLOG ((LOG_WARN, @@ -516,7 +516,7 @@ void setup_limits (const struct passwd *info) if (strncmp (cp, "umask=", 6) == 0) { unsigned long mask; - if ( (getulong(cp + 6, &mask) == -1) + if ( (str2ul(&mask, cp + 6) == -1) || (mask != (mode_t) mask)) { SYSLOG ((LOG_WARN, "Can't set umask value for user %s", |