]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/: str2*(): Rename functions and reorder parameters
authorAlejandro Colomar <alx@kernel.org>
Tue, 16 Jan 2024 20:38:24 +0000 (21:38 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 29 Mar 2024 19:29:13 +0000 (14:29 -0500)
This makes them compatible with liba2i's functions.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 files changed:
lib/atoi/str2i.c
lib/atoi/str2i.h
lib/getdef.c
lib/idmapping.c
lib/limits.c
lib/rlogin.c
lib/sgetspent.c
lib/shadow.c
lib/strtoday.c
lib/subordinateio.c
src/chage.c
src/chgpasswd.c
src/chpasswd.c
src/faillog.c
src/lastlog.c
src/newusers.c
src/passwd.c
src/useradd.c
src/usermod.c

index 1fae5a3ab1c0eef245a0a6aea01f754f808cfab6..127ac82798d81615aa3268deda5f82f9a1ed0cea 100644 (file)
@@ -8,5 +8,5 @@
 #include "atoi/str2i.h"
 
 
-extern inline int getlong(const char *restrict s, long *restrict n);
-extern inline int getulong(const char *restrict s, unsigned long *restrict n);
+extern inline int str2sl(long *restrict n, const char *restrict s);
+extern inline int str2ul(unsigned long *restrict n, const char *restrict s);
index b72c509ff66e26dd62ddac7279765a01977ca030..ee3cece17af9ecbef5775b1f82ab55cbc40febcd 100644 (file)
 #include "attr.h"
 
 
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
-inline int getlong(const char *restrict s, long *restrict n);
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
-inline int getulong(const char *restrict s, unsigned long *restrict n);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2sl(long *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2ul(unsigned long *restrict n, const char *restrict s);
 
 
 inline int
-getlong(const char *restrict s, long *restrict n)
+str2sl(long *restrict n, const char *restrict s)
 {
        return a2sl(n, s, NULL, 0, LONG_MIN, LONG_MAX);
 }
 
 
 inline int
-getulong(const char *restrict s, unsigned long *restrict n)
+str2ul(unsigned long *restrict n, const char *restrict s)
 {
        return a2ul(n, s, NULL, 0, 0, ULONG_MAX);
 }
index 41a330fa83e8b0e7f5c11be94c41b9c174f22785..30f54bab3159ca618c89ff4c8488b42063a83b11 100644 (file)
@@ -246,7 +246,7 @@ int getdef_num (const char *item, int dflt)
                return dflt;
        }
 
-       if (   (getlong(d->value, &val) == -1)
+       if (   (str2sl(&val, d->value) == -1)
            || (val > INT_MAX)
            || (val < -1)) {
                fprintf (shadow_logfd,
@@ -281,7 +281,7 @@ unsigned int getdef_unum (const char *item, unsigned int dflt)
                return dflt;
        }
 
-       if (   (getlong(d->value, &val) == -1)
+       if (   (str2sl(&val, d->value) == -1)
            || (val < 0)
            || (val > INT_MAX)) {
                fprintf (shadow_logfd,
@@ -316,7 +316,7 @@ long getdef_long (const char *item, long dflt)
                return dflt;
        }
 
-       if (getlong(d->value, &val) == -1 || val < -1) {
+       if (str2sl(&val, d->value) == -1 || val < -1) {
                fprintf (shadow_logfd,
                         _("configuration error - cannot parse %s value: '%s'"),
                         item, d->value);
@@ -348,7 +348,7 @@ unsigned long getdef_ulong (const char *item, unsigned long dflt)
                return dflt;
        }
 
-       if (getulong(d->value, &val) == -1) {
+       if (str2ul(&val, d->value) == -1) {
                fprintf (shadow_logfd,
                         _("configuration error - cannot parse %s value: '%s'"),
                         item, d->value);
index b8f0e0102023f9cdf1efbf9f87579a7e07fd936b..56c72eae8f9f98a4d3b69f59bfd8b1e7b75de85a 100644 (file)
@@ -51,15 +51,15 @@ struct map_range *get_map_ranges(int ranges, int argc, char **argv)
        /* Gather up the ranges from the command line */
        mapping = mappings;
        for (idx = 0, argidx = 0; idx < ranges; idx++, argidx += 3, mapping++) {
-               if (getulong(argv[argidx + 0], &mapping->upper) == -1) {
+               if (str2ul(&mapping->upper, argv[argidx + 0]) == -1) {
                        free(mappings);
                        return NULL;
                }
-               if (getulong(argv[argidx + 1], &mapping->lower) == -1) {
+               if (str2ul(&mapping->lower, argv[argidx + 1]) == -1) {
                        free(mappings);
                        return NULL;
                }
-               if (getulong(argv[argidx + 2], &mapping->count) == -1) {
+               if (str2ul(&mapping->count, argv[argidx + 2]) == -1) {
                        free(mappings);
                        return NULL;
                }
index c6c041c558f247c7788c3d41c5b6a571cdf001c2..387a972b2a69a7b32440ea6e0a8fe3024a252938 100644 (file)
@@ -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",
index 792dc9f8784f63833e89c391700e58a8a580833e..cbc05dd8d16092d2d0c738b6f53a485dbbec0a86 100644 (file)
@@ -86,9 +86,8 @@ do_rlogin(const char *remote_host, char *name, size_t namesize, char *term,
                *cp = '\0';
                cp++;
 
-               if (getulong(cp, &remote_speed) == -1) {
+               if (str2ul(&remote_speed, cp) == -1)
                        remote_speed = 9600;
-               }
        }
        for (i = 0;
             (   (speed_table[i].spd_baud != remote_speed)
index 64a9c54ad1ff3186869825750b48c3b9890e3fdd..bd2ef8b8de97e776d9c669fd90548ea08ace55dc 100644 (file)
@@ -98,7 +98,7 @@ sgetspent(const char *string)
 
        if (fields[2][0] == '\0') {
                spwd.sp_lstchg = -1;
-       } else if (   (getlong(fields[2], &spwd.sp_lstchg) == -1)
+       } else if (   (str2sl(&spwd.sp_lstchg, fields[2]) == -1)
                   || (spwd.sp_lstchg < 0)) {
                return NULL;
        }
@@ -109,7 +109,7 @@ sgetspent(const char *string)
 
        if (fields[3][0] == '\0') {
                spwd.sp_min = -1;
-       } else if (   (getlong(fields[3], &spwd.sp_min) == -1)
+       } else if (   (str2sl(&spwd.sp_min, fields[3]) == -1)
                   || (spwd.sp_min < 0)) {
                return NULL;
        }
@@ -120,7 +120,7 @@ sgetspent(const char *string)
 
        if (fields[4][0] == '\0') {
                spwd.sp_max = -1;
-       } else if (   (getlong(fields[4], &spwd.sp_max) == -1)
+       } else if (   (str2sl(&spwd.sp_max, fields[4]) == -1)
                   || (spwd.sp_max < 0)) {
                return NULL;
        }
@@ -145,7 +145,7 @@ sgetspent(const char *string)
 
        if (fields[5][0] == '\0') {
                spwd.sp_warn = -1;
-       } else if (   (getlong(fields[5], &spwd.sp_warn) == -1)
+       } else if (   (str2sl(&spwd.sp_warn, fields[5]) == -1)
                   || (spwd.sp_warn < 0)) {
                return NULL;
        }
@@ -157,7 +157,7 @@ sgetspent(const char *string)
 
        if (fields[6][0] == '\0') {
                spwd.sp_inact = -1;
-       } else if (   (getlong(fields[6], &spwd.sp_inact) == -1)
+       } else if (   (str2sl(&spwd.sp_inact, fields[6]) == -1)
                   || (spwd.sp_inact < 0)) {
                return NULL;
        }
@@ -169,7 +169,7 @@ sgetspent(const char *string)
 
        if (fields[7][0] == '\0') {
                spwd.sp_expire = -1;
-       } else if (   (getlong(fields[7], &spwd.sp_expire) == -1)
+       } else if (   (str2sl(&spwd.sp_expire, fields[7]) == -1)
                   || (spwd.sp_expire < 0)) {
                return NULL;
        }
@@ -181,7 +181,7 @@ sgetspent(const char *string)
 
        if (fields[8][0] == '\0') {
                spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
-       } else if (getulong(fields[8], &spwd.sp_flag) == -1) {
+       } else if (str2ul(&spwd.sp_flag, fields[8]) == -1) {
                return NULL;
        }
 
index f14f493755cecae98d35b38deac51d4ac305fe82..f17d09ee71fb08cf3c60a8862e31d459f5134bab 100644 (file)
@@ -118,7 +118,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[2][0] == '\0') {
                spwd.sp_lstchg = -1;
        } else {
-               if (getlong(fields[2], &spwd.sp_lstchg) == -1)
+               if (str2sl(&spwd.sp_lstchg, fields[2]) == -1)
                        return 0;
                if (spwd.sp_lstchg < 0)
                        return 0;
@@ -131,7 +131,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[3][0] == '\0') {
                spwd.sp_min = -1;
        } else {
-               if (getlong(fields[3], &spwd.sp_min) == -1)
+               if (str2sl(&spwd.sp_min, fields[3]) == -1)
                        return 0;
                if (spwd.sp_min < 0)
                        return 0;
@@ -144,7 +144,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[4][0] == '\0') {
                spwd.sp_max = -1;
        } else {
-               if (getlong(fields[4], &spwd.sp_max) == -1)
+               if (str2sl(&spwd.sp_max, fields[4]) == -1)
                        return 0;
                if (spwd.sp_max < 0)
                        return 0;
@@ -171,7 +171,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[5][0] == '\0') {
                spwd.sp_warn = -1;
        } else {
-               if (getlong(fields[5], &spwd.sp_warn) == -1)
+               if (str2sl(&spwd.sp_warn, fields[5]) == -1)
                        return 0;
                if (spwd.sp_warn < 0)
                        return 0;
@@ -185,7 +185,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[6][0] == '\0') {
                spwd.sp_inact = -1;
        } else {
-               if (getlong(fields[6], &spwd.sp_inact) == -1)
+               if (str2sl(&spwd.sp_inact, fields[6]) == -1)
                        return 0;
                if (spwd.sp_inact < 0)
                        return 0;
@@ -199,7 +199,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[7][0] == '\0') {
                spwd.sp_expire = -1;
        } else {
-               if (getlong(fields[7], &spwd.sp_expire) == -1)
+               if (str2sl(&spwd.sp_expire, fields[7]) == -1)
                        return 0;
                if (spwd.sp_expire < 0)
                        return 0;
@@ -213,7 +213,7 @@ static struct spwd *my_sgetspent (const char *string)
        if (fields[8][0] == '\0') {
                spwd.sp_flag = SHADOW_SP_FLAG_UNSET;
        } else {
-               if (getulong(fields[8], &spwd.sp_flag) == -1)
+               if (str2ul(&spwd.sp_flag, fields[8]) == -1)
                        return 0;
                if (spwd.sp_flag < 0)
                        return 0;
index 46766a68e6fd34349c83a1082bb97c26b731bb57..dabd5b5299c2df857832c43bf6eb115846f8e7a7 100644 (file)
@@ -64,9 +64,8 @@ long strtoday (const char *str)
        }
        if (isnum) {
                long retdate;
-               if (getlong(str, &retdate) == -1) {
+               if (str2sl(&retdate, str) == -1)
                        return -2;
-               }
                return retdate;
        }
 
index 38b09a5ed813ea33e0252d3e57f331ce29cba8f3..e7cd4b48207a5a00e84714115767b2e0ab52aaa0 100644 (file)
@@ -108,9 +108,9 @@ subordinate_parse(const char *line)
        if (i != SUBID_NFIELDS || *fields[0] == '\0' || *fields[1] == '\0' || *fields[2] == '\0')
                return NULL;
        range.owner = fields[0];
-       if (getulong(fields[1], &range.start) == -1)
+       if (str2ul(&range.start, fields[1]) == -1)
                return NULL;
-       if (getulong(fields[2], &range.count) == -1)
+       if (str2ul(&range.count, fields[2]) == -1)
                return NULL;
 
        return &range;
index 20a1c29642a9f500fd9549e1f724af64aacd8c39..1edab47fa41c8b60cae1a26d31d1ef16c667da4c 100644 (file)
@@ -171,14 +171,14 @@ static int new_fields (void)
 
        SNPRINTF(buf, "%ld", mindays);
        change_field (buf, sizeof buf, _("Minimum Password Age"));
-       if (   (getlong(buf, &mindays) == -1)
+       if (   (str2sl(&mindays, buf) == -1)
            || (mindays < -1)) {
                return 0;
        }
 
        SNPRINTF(buf, "%ld", maxdays);
        change_field (buf, sizeof buf, _("Maximum Password Age"));
-       if (   (getlong(buf, &maxdays) == -1)
+       if (   (str2sl(&maxdays, buf) == -1)
            || (maxdays < -1)) {
                return 0;
        }
@@ -201,14 +201,14 @@ static int new_fields (void)
 
        SNPRINTF(buf, "%ld", warndays);
        change_field (buf, sizeof buf, _("Password Expiration Warning"));
-       if (   (getlong(buf, &warndays) == -1)
+       if (   (str2sl(&warndays, buf) == -1)
            || (warndays < -1)) {
                return 0;
        }
 
        SNPRINTF(buf, "%ld", inactdays);
        change_field (buf, sizeof buf, _("Password Inactive"));
-       if (   (getlong(buf, &inactdays) == -1)
+       if (   (str2sl(&inactdays, buf) == -1)
            || (inactdays < -1)) {
                return 0;
        }
@@ -397,7 +397,7 @@ static void process_flags (int argc, char **argv)
                        break;
                case 'I':
                        Iflg = true;
-                       if (   (getlong(optarg, &inactdays) == -1)
+                       if (   (str2sl(&inactdays, optarg) == -1)
                            || (inactdays < -1)) {
                                fprintf (stderr,
                                         _("%s: invalid numeric argument '%s'\n"),
@@ -410,7 +410,7 @@ static void process_flags (int argc, char **argv)
                        break;
                case 'm':
                        mflg = true;
-                       if (   (getlong(optarg, &mindays) == -1)
+                       if (   (str2sl(&mindays, optarg) == -1)
                            || (mindays < -1)) {
                                fprintf (stderr,
                                         _("%s: invalid numeric argument '%s'\n"),
@@ -420,7 +420,7 @@ static void process_flags (int argc, char **argv)
                        break;
                case 'M':
                        Mflg = true;
-                       if (   (getlong(optarg, &maxdays) == -1)
+                       if (   (str2sl(&maxdays, optarg) == -1)
                            || (maxdays < -1)) {
                                fprintf (stderr,
                                         _("%s: invalid numeric argument '%s'\n"),
@@ -434,7 +434,7 @@ static void process_flags (int argc, char **argv)
                        break;
                case 'W':
                        Wflg = true;
-                       if (   (getlong(optarg, &warndays) == -1)
+                       if (   (str2sl(&warndays, optarg) == -1)
                            || (warndays < -1)) {
                                fprintf (stderr,
                                         _("%s: invalid numeric argument '%s'\n"),
index 61aa10fbdb213772d3fb7898a06294e79a9e82f6..1ff6776b1295ca5624d6e8e2e797862ee8c52ff1 100644 (file)
@@ -198,19 +198,19 @@ static void process_flags (int argc, char **argv)
                        }
 #if defined(USE_SHA_CRYPT)
                        if (  (   ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512")))
-                              && (-1 == getlong(optarg, &sha_rounds)))) {
+                              && (-1 == str2sl(&sha_rounds, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_SHA_CRYPT */
 #if defined(USE_BCRYPT)
                         if ((   (0 == strcmp (crypt_method, "BCRYPT"))
-                              && (-1 == getlong(optarg, &bcrypt_rounds)))) {
+                              && (-1 == str2sl(&bcrypt_rounds, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_BCRYPT */
 #if defined(USE_YESCRYPT)
                         if ((   (0 == strcmp (crypt_method, "YESCRYPT"))
-                              && (-1 == getlong(optarg, &yescrypt_cost)))) {
+                              && (-1 == str2sl(&yescrypt_cost, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_YESCRYPT */
index 2e865e90d56d9a9f6e4fe5c59dfe5e5e09494d0f..79880f568e9febce823b373ab4cd0548fb1c0a8b 100644 (file)
@@ -193,19 +193,19 @@ static void process_flags (int argc, char **argv)
                         bad_s = 0;
 #if defined(USE_SHA_CRYPT)
                        if ((IS_CRYPT_METHOD("SHA256") || IS_CRYPT_METHOD("SHA512"))
-                           && (-1 == getlong(optarg, &sha_rounds))) {
+                           && (-1 == str2sl(&sha_rounds, optarg))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_SHA_CRYPT */
 #if defined(USE_BCRYPT)
                         if (IS_CRYPT_METHOD("BCRYPT")
-                           && (-1 == getlong(optarg, &bcrypt_rounds))) {
+                           && (-1 == str2sl(&bcrypt_rounds, optarg))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_BCRYPT */
 #if defined(USE_YESCRYPT)
                         if (IS_CRYPT_METHOD("YESCRYPT")
-                           && (-1 == getlong(optarg, &yescrypt_cost))) {
+                           && (-1 == str2sl(&yescrypt_cost, optarg))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_YESCRYPT */
index 689b1fba76551940eef0a149e2a9d18c63e7a608..77c25b8ac38d502b059b4789cd3378d9b98264d4 100644 (file)
@@ -547,7 +547,7 @@ int main (int argc, char **argv)
                                usage (E_SUCCESS);
                                /*@notreached@*/break;
                        case 'l':
-                               if (getlong(optarg, &fail_locktime) == -1) {
+                               if (str2sl(&fail_locktime, optarg) == -1) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
                                                 Prog, optarg);
@@ -559,7 +559,7 @@ int main (int argc, char **argv)
                        {
                                long  lmax;
 
-                               if (   (getlong(optarg, &lmax) == -1)
+                               if (   (str2sl(&lmax, optarg) == -1)
                                    || ((long)(short) lmax != lmax)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
@@ -576,7 +576,7 @@ int main (int argc, char **argv)
                        case 'R': /* no-op, handled in process_root_flag () */
                                break;
                        case 't':
-                               if (getlong(optarg, &days) == -1) {
+                               if (str2sl(&days, optarg) == -1) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
                                                 Prog, optarg);
index f5c42be466c6f3eb16f40cfd36220c545a36de88..3914b72bbefa91ec457419d91e0e30bffe50d43d 100644 (file)
@@ -328,7 +328,7 @@ int main (int argc, char **argv)
                        case 'b':
                        {
                                unsigned long inverse_days;
-                               if (getulong(optarg, &inverse_days) == -1) {
+                               if (str2ul(&inverse_days, optarg) == -1) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
                                                 Prog, optarg);
@@ -356,7 +356,7 @@ int main (int argc, char **argv)
                        case 't':
                        {
                                unsigned long days;
-                               if (getulong(optarg, &days) == -1) {
+                               if (str2ul(&days, optarg) == -1) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
                                                 Prog, optarg);
index 4f6677713597a4366d97a68f3890066bdc0086d4..0705b57975a9a9ef69f7a1dc80cbfdc8ad7fb3bb 100644 (file)
@@ -674,19 +674,19 @@ static void process_flags (int argc, char **argv)
                        }
 #if defined(USE_SHA_CRYPT)
                        if (  (   ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512")))
-                              && (-1 == getlong(optarg, &sha_rounds)))) {
+                              && (-1 == str2sl(&sha_rounds, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_SHA_CRYPT */
 #if defined(USE_BCRYPT)
                         if ((   (0 == strcmp (crypt_method, "BCRYPT"))
-                              && (-1 == getlong(optarg, &bcrypt_rounds)))) {
+                              && (-1 == str2sl(&bcrypt_rounds, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_BCRYPT */
 #if defined(USE_YESCRYPT)
                         if ((   (0 == strcmp (crypt_method, "YESCRYPT"))
-                              && (-1 == getlong(optarg, &yescrypt_cost)))) {
+                              && (-1 == str2sl(&yescrypt_cost, optarg)))) {
                             bad_s = 1;
                         }
 #endif                         /* USE_YESCRYPT */
index df566fccbd76c93676b74a521609de76af6bf6f3..2999a3c88f84c5d3a62e7f8f4701bead3c80f9e2 100644 (file)
@@ -801,7 +801,7 @@ int main (int argc, char **argv)
                                usage (E_SUCCESS);
                                /*@notreached@*/break;
                        case 'i':
-                               if (   (getlong(optarg, &inact) == -1)
+                               if (   (str2sl(&inact, optarg) == -1)
                                    || (inact < -1)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
@@ -820,7 +820,7 @@ int main (int argc, char **argv)
                                anyflag = true;
                                break;
                        case 'n':
-                               if (   (getlong(optarg, &age_min) == -1)
+                               if (   (str2sl(&age_min, optarg) == -1)
                                    || (age_min < -1)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
@@ -855,7 +855,7 @@ int main (int argc, char **argv)
                                anyflag = true;
                                break;
                        case 'w':
-                               if (   (getlong(optarg, &warn) == -1)
+                               if (   (str2sl(&warn, optarg) == -1)
                                    || (warn < -1)) {
                                        (void) fprintf (stderr,
                                                        _("%s: invalid numeric argument '%s'\n"),
@@ -866,7 +866,7 @@ int main (int argc, char **argv)
                                anyflag = true;
                                break;
                        case 'x':
-                               if (   (getlong(optarg, &age_max) == -1)
+                               if (   (str2sl(&age_max, optarg) == -1)
                                    || (age_max < -1)) {
                                        (void) fprintf (stderr,
                                                        _("%s: invalid numeric argument '%s'\n"),
index 5f5cdfca21f14a3e1d04cbc99120315afb09fdde..ec21814c91c689dc49e5f00984565321b48d091a 100644 (file)
@@ -416,7 +416,7 @@ static void get_defaults (void)
                 * Default Password Inactive value
                 */
                else if (MATCH (buf, DINACT)) {
-                       if (   (getlong(ccp, &def_inactive) == -1)
+                       if (   (str2sl(&def_inactive, ccp) == -1)
                            || (def_inactive < -1)) {
                                fprintf (stderr,
                                         _("%s: invalid numeric argument '%s'\n"),
@@ -1302,7 +1302,7 @@ static void process_flags (int argc, char **argv)
                                eflg = true;
                                break;
                        case 'f':
-                               if (   (getlong(optarg, &def_inactive) == -1)
+                               if (   (str2sl(&def_inactive, optarg) == -1)
                                    || (def_inactive < -1)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),
index c11e275e5d8ec11bfddc09a56d882fdc60405afa..0fcf0325b05860b706d8233ca7f3f26e85baf841 100644 (file)
@@ -1062,7 +1062,7 @@ static void process_flags (int argc, char **argv)
                                eflg = true;
                                break;
                        case 'f':
-                               if (   (getlong(optarg, &user_newinactive) == -1)
+                               if (   (str2sl(&user_newinactive, optarg) == -1)
                                    || (user_newinactive < -1)) {
                                        fprintf (stderr,
                                                 _("%s: invalid numeric argument '%s'\n"),