Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/newusers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)) {
Comment thread
alejandro-colomar marked this conversation as resolved.
/*
* The GID is a number, which means either this is a brand
* new group, or an existing group.
Expand Down Expand Up @@ -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)) {
Comment thread
alejandro-colomar marked this conversation as resolved.
grent.gr_name = xstrdup (gid);
} else {
grent.gr_name = xstrdup (name);
Expand Down Expand Up @@ -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"),
Expand Down
Loading