fix audit init in vl and pr servers
[openafs.git] / src / vlserver / vlserver.c
index b7230a4..3ced2cb 100644 (file)
@@ -109,6 +109,25 @@ vldb_rxstat_userok(struct rx_call *call)
     return afsconf_SuperUser(vldb_confdir, call, NULL);
 }
 
+/**
+ * Return true if this name is a member of the local realm.
+ */
+int
+vldb_IsLocalRealmMatch(void *rock, char *name, char *inst, char *cell)
+{
+    struct afsconf_dir *dir = (struct afsconf_dir *)rock;
+    afs_int32 islocal = 0;     /* default to no */
+    int code;
+
+    code = afsconf_IsLocalRealmMatch(dir, &islocal, name, inst, cell);
+    if (code) {
+       ViceLog(0,
+               ("Failed local realm check; code=%d, name=%s, inst=%s, cell=%s\n",
+                code, name, inst, cell));
+    }
+    return islocal;
+}
+
 /* Main server module */
 
 #include "AFS_component_version_number.c"
@@ -323,6 +342,10 @@ main(int argc, char **argv)
             configDir);
        exit(1);
     }
+
+    /* initialize audit user check */
+    osi_audit_set_user_check(tdir, vldb_IsLocalRealmMatch);
+
 #ifdef AFS_NT40_ENV
     /* initialize winsock */
     if (afs_winsockInit() < 0) {
@@ -381,6 +404,16 @@ main(int argc, char **argv)
        }
     }
 
+    if (!rxJumbograms) {
+       rx_SetNoJumbo();
+    }
+    if (rxMaxMTU != -1) {
+       if (rx_SetMaxMTU(rxMaxMTU) != 0) {
+           printf("rxMaxMTU %d invalid\n", rxMaxMTU);
+           return -1;
+       }
+    }
+
     ubik_nBuffers = 512;
     ubik_SetClientSecurityProcs(afsconf_ClientAuth, afsconf_UpToDate, tdir);
     ubik_SetServerSecurityProcs(afsconf_BuildServerSecurityObjects,
@@ -394,15 +427,6 @@ main(int argc, char **argv)
        printf("vlserver: Ubik init failed: %s\n", afs_error_message(code));
        exit(2);
     }
-    if (!rxJumbograms) {
-       rx_SetNoJumbo();
-    }
-    if (rxMaxMTU != -1) {
-       if (rx_SetMaxMTU(rxMaxMTU) != 0) {
-           printf("rxMaxMTU %d invalid\n", rxMaxMTU);
-           return -1;
-       }
-    }
     rx_SetRxDeadTime(50);
 
     memset(rd_HostAddress, 0, sizeof(rd_HostAddress));