From ebfc586fd2d00085a384763cc519c2af6ce5223e Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 15 Oct 2010 16:37:55 -0500 Subject: [PATCH] pts: Prevent creating negative user ids User ids cannot be negative (those are groups). So, error out if a negative id is specified for createuser. FIXES 128343 Change-Id: I6e81a419c797944bfed569aac529b9694702823d Reviewed-on: http://gerrit.openafs.org/2993 Tested-by: Andrew Deason Reviewed-by: Phillip Moore Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/ptserver/pts.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ptserver/pts.c b/src/ptserver/pts.c index 3a74c5eae..17a99442c 100644 --- a/src/ptserver/pts.c +++ b/src/ptserver/pts.c @@ -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; -- 2.39.5