kauth: fix klog principal name parsing
[openafs.git] / src / kauth / klog.c
index 927f459..9116a88 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -9,23 +9,17 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#include <afs/stds.h>
-#include <sys/types.h>
 #include <rx/xdr.h>
-#ifdef AFS_AIX32_ENV
-#include <signal.h>
-#endif
-#include <string.h>
 #include <lock.h>
 #include <ubik.h>
-
-#include <stdio.h>
-#include <pwd.h>
 #include <afs/com_err.h>
 #include <afs/cellconfig.h>
 #include <afs/cmd.h>
+
 #include "kauth.h"
 #include "kautils.h"
 #include "kauth_internal.h"
@@ -80,8 +74,8 @@ main(int argc, char *argv[])
     afs_int32 code;
 #ifdef AFS_AIX32_ENV
     /*
-     * The following signal action for AIX is necessary so that in case of a 
-     * crash (i.e. core is generated) we can include the user's data section 
+     * The following signal action for AIX is necessary so that in case of a
+     * crash (i.e. core is generated) we can include the user's data section
      * in the core dump. Unfortunately, by default, only a partial core is
      * generated which, in many cases, isn't too useful.
      */
@@ -96,7 +90,7 @@ main(int argc, char *argv[])
     zero_argc = argc;
     zero_argv = argv;
 
-    ts = cmd_CreateSyntax(NULL, CommandProc, NULL,
+    ts = cmd_CreateSyntax(NULL, CommandProc, NULL, 0,
                          "obtain Kerberos authentication");
 
 #define aXFLAG 0
@@ -164,7 +158,6 @@ CommandProc(struct cmd_syndesc *as, void *arock)
 
     struct passwd pwent;
     struct passwd *pw = &pwent;
-    struct passwd *lclpw = &pwent;
     char passwd[BUFSIZ];
 
     static char rn[] = "klog"; /*Routine name */
@@ -275,7 +268,7 @@ CommandProc(struct cmd_syndesc *as, void *arock)
            foundExplicitCell = 1;
            strncpy(realm, cell, sizeof(realm));
        }
-       lclpw->pw_name = name;
+       pw->pw_name = name;
     } else {
        /* No explicit name provided: use Unix uid. */
        pw = getpwuid(getuid());
@@ -288,7 +281,6 @@ CommandProc(struct cmd_syndesc *as, void *arock)
            }
            KLOGEXIT(KABADARGUMENT);
        }
-       lclpw = pw;
     }
 
     if (as->parms[aPASSWORD].items) {