vlserver: Handle logging of non-rxkad classes
authorSimon Wilkinson <sxw@your-file-system.com>
Mon, 23 May 2011 06:40:14 +0000 (07:40 +0100)
committerDerrick Brashear <shadow@dementia.org>
Mon, 18 Jul 2011 05:27:12 +0000 (22:27 -0700)
Expand the 'rxinfo' function so that it is not rxkad specific, and
add the framework to allow other security classes to be added to it.

Change-Id: Idb514be6aafbc69154a7aba4b0ece3330b8b3aed
Reviewed-on: http://gerrit.openafs.org/5031
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vlserver/vlprocs.c

index 984e6f6..b117ee4 100644 (file)
@@ -150,35 +150,53 @@ multiHomedExtent(struct vl_ctx *ctx, int srvidx, struct extentaddr **exp)
     return multiHomedExtentBase(ctx, srvidx, exp, &base);
 }
 
-
 #define AFS_RXINFO_LEN 128
 static char *
-rxinfo(char * str, struct rx_call *rxcall)
+rxkadInfo(char *str, struct rx_connection *conn, struct in_addr hostAddr)
 {
     int code;
-    struct rx_connection *tconn;
     char tname[64] = "";
     char tinst[64] = "";
     char tcell[64] = "";
     afs_uint32 exp;
-    struct in_addr hostAddr;
 
-    tconn = rx_ConnectionOf(rxcall);
-    hostAddr.s_addr = rx_HostOf(rx_PeerOf(tconn));
-    code =
-       rxkad_GetServerInfo(rxcall->conn, NULL, &exp, tname, tinst, tcell,
-                           NULL);
+    code = rxkad_GetServerInfo(conn, NULL, &exp, tname, tinst, tcell,
+                              NULL);
     if (!code)
-       sprintf(str, "%s %s%s%s%s%s", inet_ntoa(hostAddr), tname,
+       snprintf(str, AFS_RXINFO_LEN,
+                "%s rxkad:%s%s%s%s%s", inet_ntoa(hostAddr), tname,
                (tinst[0] == '\0') ? "" : ".",
                (tinst[0] == '\0') ? "" : tinst,
                (tcell[0] == '\0') ? "" : "@",
                (tcell[0] == '\0') ? "" : tcell);
     else
-       sprintf(str, "%s noauth", inet_ntoa(hostAddr));
+       snprintf(str, AFS_RXINFO_LEN, "%s noauth", inet_ntoa(hostAddr));
     return (str);
 }
 
+static char *
+rxinfo(char *str, struct rx_call *rxcall)
+{
+    struct rx_connection *conn;
+    struct in_addr hostAddr;
+    rx_securityIndex authClass;
+
+    conn = rx_ConnectionOf(rxcall);
+    authClass = rx_SecurityClassOf(conn);
+    hostAddr.s_addr = rx_HostOf(rx_PeerOf(conn));
+
+    switch(authClass) {
+    case RX_SECIDX_KAD:
+       return rxkadInfo(str, conn, hostAddr);
+    default:
+       ;
+    }
+
+    snprintf(str, AFS_RXINFO_LEN, "%s noauth", inet_ntoa(hostAddr));
+    return str;
+}
+
+
 /* This is called to initialize the database, set the appropriate locks and make sure that the vldb header is valid */
 int
 Init_VLdbase(struct vl_ctx *ctx,