Windows: aklog must reset viceId to 0 before pr_CreateUser call
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 25 Mar 2010 04:40:29 +0000 (00:40 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Thu, 25 Mar 2010 04:58:04 +0000 (21:58 -0700)
If the viceId is not reset to 0, the ptserver believes the
client is attempting to request the anonymous id value
and fails the registration request with permission denied.

LICENSE MIT

Change-Id: I82cc6105ad9d08b2f460b0c08cf7de500cea8537
Reviewed-on: http://gerrit.openafs.org/1659
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/aklog/aklog.c

index 04907af..ee66000 100644 (file)
@@ -364,18 +364,16 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell,
             /* copy the name because pr_CreateUser lowercases the realm */
             strncpy(username_copy, username, BUFSIZ);
 
-            *status = pr_CreateUser(username, &viceId);
-
-            /* and restore the name to the original state */
-            strncpy(username, username_copy, BUFSIZ);
+            viceId = 0;
+            *status = pr_CreateUser(username_copy, &viceId);
 
             if (*status) {
                 printf("%s: unable to create remote PTS "
                         "user %s in cell %s (status: %s).\n", progname,
-                        username, cell_to_use, afs_error_message(*status));
+                        username_copy, cell_to_use, afs_error_message(*status));
             } else {
                 printf("created cross-cell entry for %s (Id %d) at %s\n",
-                        username, viceId, cell_to_use);
+                        username_copy, viceId, cell_to_use);
 #ifdef AFS_ID_TO_NAME
                 snprintf (username, BUFSIZ, "%s (AFS ID %d)", username_copy, (int) viceId);
 #endif /* AFS_ID_TO_NAME */