kauth: Fix some unnecessary variable assignments
[openafs.git] / src / kauth / admin_tools.c
index f65c9ae..b7899a1 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <roken.h>
 #include <afs/opr.h>
+#include <afs/opr_assert.h>
 
 #include <ctype.h>
 
@@ -27,6 +28,7 @@
 #include <rx/xdr.h>
 #include <rx/rx.h>
 #include <rx/rxkad.h>
+#include <rx/rxkad_convert.h>
 #include <lock.h>
 #define UBIK_LEGACY_CALLITER 1
 #include <ubik.h>
@@ -553,8 +555,8 @@ Unlock(struct cmd_syndesc *as, void *arock)
        if (code && (code != UNOSERVERS)) {
            server = 0;
            if (conn && conn->conns[count - 1]
-               && conn->conns[count - 1]->peer) {
-               server = conn->conns[count - 1]->peer->host;
+               && rx_PeerOf(conn->conns[count - 1])) {
+               server = rx_HostOf(rx_PeerOf(conn->conns[count - 1]));
            }
            afs_com_err(whoami, code,
                    "so %s.%s may still be locked (on server %d.%d.%d.%d)",
@@ -873,7 +875,6 @@ PrintName(char *name, char *inst, char *acell, int buflen, char *buf)
            left = ka_ConvertBytes(buf + nlen, buflen - nlen, acell, len);
            if (left)
                goto bad_name;
-           nlen += len;
        }
     }
     return 0;
@@ -1316,7 +1317,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
 
     /* MyAfterProc() destroys the conn, but just to be sure */
     if (conn) {
-       code = ubik_ClientDestroy(conn);
+       ubik_ClientDestroy(conn);
        conn = 0;
     }
 
@@ -1520,10 +1521,9 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
                        afs_com_err(whoami, code, "prompting for %s", p + 1);
                        return code;
                    }
-                   ip = (struct cmd_item *)malloc(sizeof(struct cmd_item));
-                   ip->data = (char *)malloc(strlen(password) + 1);
+                   ip = malloc(sizeof(struct cmd_item));
+                   ip->data = strdup(password);
                    ip->next = 0;
-                   strcpy(ip->data, password);
                    as->parms[i].items = ip;
                }
            }
@@ -1669,8 +1669,8 @@ ka_AdminInteractive(int cmd_argc, char *cmd_argv[])
                          "enter interactive mode");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("noauthentication", NoAuth, NULL,
-                         "connect to AuthServer w/o using token");
+    cmd_CreateSyntax("noauthentication", NoAuth, NULL,
+                    "connect to AuthServer w/o using token");
 
     ts = cmd_CreateSyntax("list", ListUsers, NULL,
                          "list all users in database");
@@ -1804,7 +1804,7 @@ ka_AdminInteractive(int cmd_argc, char *cmd_argv[])
     cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL,
                "show session key and ticket");
 
-    ts = cmd_CreateSyntax("quit", Quit, NULL, "exit program");
+    cmd_CreateSyntax("quit", Quit, NULL, "exit program");
 
     finished = 1;
     conn = 0;                  /* no connection yet */