pts: Prevent creating negative user ids
[openafs.git] / src / ptserver / pts.c
index 3a74c5e..17a9944 100644 (file)
@@ -340,6 +340,12 @@ CreateUser(struct cmd_syndesc *as, void *arock)
                printf("0 isn't a valid user id; aborting\n");
                return EINVAL;
            }
+           if (id < 0) {
+               code = PRBADARG;
+               afs_com_err(whoami, code, "because user id %d was not positive",
+                       id);
+               return code;
+           }
            idi = idi->next;
        } else
            id = 0;