diff --git a/src/newusers.c b/src/newusers.c index 1f58b77530..d5d4222c29 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -51,6 +51,7 @@ #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" #include "sssd.h" +#include "string/ctype/strisascii/strisdigit.h" #include "string/sprintf/snprintf.h" #include "string/strcmp/streq.h" #include "string/strdup/strdup.h" @@ -234,7 +235,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) return 0; } - if (isdigit (gid[0])) { + if (!streq(gid, "") && strisdigit(gid)) { /* * The GID is a number, which means either this is a brand * new group, or an existing group. @@ -278,7 +279,7 @@ static int add_group (const char *name, const char *gid, gid_t *ngid, uid_t uid) /* * Now I have all of the fields required to create the new group. */ - if (!streq(gid, "") && (!isdigit(gid[0]))) { + if (!streq(gid, "") && !strisdigit(gid)) { grent.gr_name = xstrdup (gid); } else { grent.gr_name = xstrdup (name); @@ -343,7 +344,7 @@ static int get_user_id (const char *uid, uid_t *nuid) { * The first guess for the UID is either the numerical UID that the * caller provided, or the next available UID. */ - if (isdigit (uid[0])) { + if (!streq(uid, "") && strisdigit(uid)) { if ((get_uid(uid, nuid) == -1) || (*nuid == (uid_t)-1)) { fprintf (stderr, _("%s: invalid user ID '%s'\n"),