summaryrefslogtreecommitdiff
path: root/source3/groupdb/mapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/groupdb/mapping.c')
-rw-r--r--source3/groupdb/mapping.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 43722e777d4..77eb0d6e5cd 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -208,6 +208,7 @@ int smb_create_group(const char *unix_group, gid_t *new_gid)
char *add_script = NULL;
int ret = -1;
int fd = 0;
+ int error = 0;
*new_gid = 0;
@@ -244,7 +245,15 @@ int smb_create_group(const char *unix_group, gid_t *new_gid)
nread = read(fd, output, sizeof(output)-1);
if (nread > 0) {
output[nread] = '\0';
- *new_gid = (gid_t)strtoul(output, NULL, 10);
+ *new_gid = (gid_t)strtoul_err(output,
+ NULL,
+ 10,
+ &error);
+ if (error != 0) {
+ *new_gid = 0;
+ close(fd);
+ return -1;
+ }
}
close(fd);