afsconf_SuperUser verify identity before use
authorDerrick Brashear <shadow@dementia.org>
Tue, 7 Dec 2010 06:13:09 +0000 (01:13 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 7 Dec 2010 17:20:38 +0000 (09:20 -0800)
if we didn't get an identity back, don't try to use it.

Change-Id: Iff6069b9231c3adc3f74cbf7fff4dffcfc289cd3
Reviewed-on: http://gerrit.openafs.org/3471
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/auth/userok.c

index 3be851e..f9e9c93 100644 (file)
@@ -795,15 +795,17 @@ afsconf_SuperUser(struct afsconf_dir *adir, struct rx_call *acall,
     int code;
 
     code = afsconf_SuperIdentity(adir, acall, &identity);
-    if (namep) {
-       if (identity->kind == RX_ID_KRB4) {
-           strlcpy(namep, identity->displayName, MAXKTCNAMELEN-1);
-       } else {
-           snprintf(namep, MAXKTCNAMELEN-1, "eName: %s",
-                    identity->displayName);
+    if (code) {
+       if (namep) {
+           if (identity->kind == RX_ID_KRB4) {
+               strlcpy(namep, identity->displayName, MAXKTCNAMELEN-1);
+           } else {
+               snprintf(namep, MAXKTCNAMELEN-1, "eName: %s",
+                        identity->displayName);
+           }
        }
+       rx_identity_free(&identity);
     }
-    rx_identity_free(&identity);
 
     return code;
 }