OPENAFS-SA-2018-001 butc: remove dummy osi_audit() routine
[openafs.git] / src / butc / tcmain.c
index 3bf6f2d..89b711a 100644 (file)
@@ -56,6 +56,7 @@
 #define XBSA_TCMAIN
 #include "butc_xbsa.h"
 #include "butc_prototypes.h"
+#include "butc_internal.h"
 
 #define N_SECURITY_OBJECTS 3
 #define ERRCODE_RANGE 8                /* from error_table.h */
@@ -108,14 +109,6 @@ int rxBind = 0;
 #define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */
 afs_uint32 SHostAddrs[ADDRSPERSITE];
 
-/* dummy routine for the audit work.  It should do nothing since audits */
-/* occur at the server level and bos is not a server. */
-int
-osi_audit(void)
-{
-    return 0;
-}
-
 static afs_int32
 SafeATOL(char *anum)
 {
@@ -288,10 +281,9 @@ stringNowReplace(char *logFile, char *deviceName)
        *pos = '_';
     strcat(logFile, deviceName);
     /* now put back deviceName to the way it was */
-    if (mvFlag) {
-       mvFlag = 0;
+    if (mvFlag)
        deviceName -= devPrefLen;
-    }
+
     strcpy(deviceName, storeDevice);
 
     return (0);
@@ -835,7 +827,7 @@ static int
 WorkerBee(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 code;
-    struct rx_securityClass *(securityObjects[3]);
+    struct rx_securityClass *(securityObjects[1]);
     struct rx_service *service;
     time_t tokenExpires;
     char cellName[64];
@@ -955,7 +947,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
        struct stat sbuf;
        afs_int32 statcode;
 #ifndef AFS_NT40_ENV
-       char path[AFSDIR_PATH_MAX];
+       char *path;
 #endif
 
        statcode = stat(centralLogFile, &sbuf);
@@ -967,7 +959,8 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
        }
 #ifndef AFS_NT40_ENV
        /* Make sure it is not in AFS, has to have been created first */
-       if (!realpath(centralLogFile, path)) {
+       path = malloc(AFSDIR_PATH_MAX);
+       if (path == NULL || !realpath(centralLogFile, path)) {
            fprintf(stderr,
                    "Warning: can't determine real path of '%s' (%d)\n",
                    centralLogFile, errno);
@@ -978,6 +971,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
                exit(1);
            }
        }
+       free(path);
 #endif
 
        /* Write header if created it */
@@ -1082,15 +1076,14 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
      * security on connections made to this server
      */
 
-    securityObjects[0] = rxnull_NewServerSecurityObject();
-    securityObjects[1] = (struct rx_securityClass *)0; /* don't bother with rxvab */
-    if (!securityObjects[0]) {
+    securityObjects[RX_SECIDX_NULL] = rxnull_NewServerSecurityObject();
+    if (!securityObjects[RX_SECIDX_NULL]) {
        TLog(0, "rxnull_NewServerSecurityObject");
        exit(1);
     }
 
     service =
-       rx_NewServiceHost(host, 0, 1, "BUTC", securityObjects, 3, TC_ExecuteRequest);
+       rx_NewServiceHost(host, 0, 1, "BUTC", securityObjects, 1, TC_ExecuteRequest);
     if (!service) {
        TLog(0, "rx_NewService");
        exit(1);
@@ -1177,7 +1170,7 @@ main(int argc, char **argv)
 
     setlinebuf(stdout);
 
-    ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, "tape coordinator");
+    ts = cmd_CreateSyntax(NULL, WorkerBee, NULL, 0, "tape coordinator");
     cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "port offset");
     cmd_AddParm(ts, "-debuglevel", CMD_SINGLE, CMD_OPTIONAL, "0 | 1 | 2");
     cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
@@ -1226,10 +1219,10 @@ main(int argc, char **argv)
        ti->next = 0;
        ti->data = "0";
        ts->parms[1].items = ti;
-       ts->parms[2].items = (struct cmd_item *)NULL;
-       ts->parms[3].items = (struct cmd_item *)NULL;
-       ts->parms[4].items = (struct cmd_item *)NULL;
-       ts->parms[5].items = (struct cmd_item *)NULL;
+       ts->parms[2].items = NULL;
+       ts->parms[3].items = NULL;
+       ts->parms[4].items = NULL;
+       ts->parms[5].items = NULL;
        return WorkerBee(ts, NULL);
     } else
        return cmd_Dispatch(argc, argv);