libadmin: Don't pass garbage to pts_UserCreate
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 2 Mar 2013 11:36:31 +0000 (11:36 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 7 Mar 2013 16:05:33 +0000 (08:05 -0800)
The libadmin pts_UserCreate function uses the value passed to
it in newUserId to control whether the user is being created
with a user supplied ID or not.

Initialise this value in the caller, so we don't end up creating
users with corrupt ids.

Caught by clang (#985979)

Change-Id: I89492a02db9f981a4d2040ea913a7e75f5f0b272
Reviewed-on: http://gerrit.openafs.org/9401
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/libadmin/test/pts.c

index 109dda9..504b32c 100644 (file)
@@ -327,7 +327,7 @@ DoPtsUserCreate(struct cmd_syndesc *as, void *arock)
     enum { USER };
     afs_status_t st = 0;
     char *user = as->parms[USER].items->data;
-    int new_user_id;
+    int new_user_id = 0;
 
     if (!pts_UserCreate(cellHandle, user, &new_user_id, &st)) {
        ERR_ST_EXT("pts_UserCreate", st);