ubik-serverinit-clones-correction-20081222
[openafs.git] / src / kauth / kaserver.c
index 1ce89cf..ff00fff 100644 (file)
@@ -26,13 +26,7 @@ RCSID
 #include "kalog.h"             /* for OpenLog() */
 #include <time.h>
 #include <stdio.h>
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
@@ -47,6 +41,7 @@ RCSID
 #include <afs/cellconfig.h>
 #include <lock.h>
 #include <afs/afsutil.h>
+#include <afs/com_err.h>
 #include <ubik.h>
 #include <sys/stat.h>
 #include "kauth.h"
@@ -254,34 +249,9 @@ main(argc, argv)
                lclpath = dbpath;
        }
        else if (strncmp(arg, "-auditlog", arglen) == 0) {
-           int tempfd, flags;
-           FILE *auditout;
-           char oldName[MAXPATHLEN];
            char *fileName = argv[++a];
            
-#ifndef AFS_NT40_ENV
-           struct stat statbuf;
-           
-           if ((lstat(fileName, &statbuf) == 0) 
-               && (S_ISFIFO(statbuf.st_mode))) {
-               flags = O_WRONLY | O_NONBLOCK;
-           } else 
-#endif
-           {
-               strcpy(oldName, fileName);
-               strcat(oldName, ".old");
-               renamefile(fileName, oldName);
-               flags = O_WRONLY | O_TRUNC | O_CREAT;
-           }
-           tempfd = open(fileName, flags, 0666);
-           if (tempfd > -1) {
-               auditout = fdopen(tempfd, "a");
-               if (auditout) {
-                   osi_audit_file(auditout);
-               } else
-                   printf("Warning: auditlog %s not writable, ignored.\n", fileName);
-           } else
-               printf("Warning: auditlog %s not writable, ignored.\n", fileName);
+           osi_audit_file(fileName);
        } else if (strcmp(arg, "-localfiles") == 0)
            lclpath = argv[++a];
        else if (strcmp(arg, "-servers") == 0)
@@ -330,7 +300,7 @@ main(argc, argv)
     if (!KA_conf) {
        code = KANOCELLS;
       abort:
-       com_err(whoami, code, "Failed getting cell info");
+       afs_com_err(whoami, code, "Failed getting cell info");
        exit(1);
     }
 #ifdef        AUTH_DBM_LOG
@@ -356,7 +326,7 @@ main(argc, argv)
                                    &cellinfo, &clones);
     if (servers) {
        if (code = ubik_ParseServerList(argc, argv, &myHost, serverList)) {
-           com_err(whoami, code, "Couldn't parse server list");
+           afs_com_err(whoami, code, "Couldn't parse server list");
            exit(1);
        }
        cellinfo.hostAddr[0].sin_addr.s_addr = myHost;
@@ -395,7 +365,6 @@ main(argc, argv)
 
     if (rxBind) {
        afs_int32 ccode;
-#ifndef AFS_NT40_ENV
         if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
             AFSDIR_SERVER_NETINFO_FILEPATH) {
             char reason[1024];
@@ -404,7 +373,6 @@ main(argc, argv)
                                            AFSDIR_SERVER_NETINFO_FILEPATH,
                                            AFSDIR_SERVER_NETRESTRICT_FILEPATH);
         } else 
-#endif 
        {
             ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
         }
@@ -421,10 +389,10 @@ main(argc, argv)
     else
        code =
            ubik_ServerInitByInfo(myHost, htons(AFSCONF_KAUTHPORT), &cellinfo,
-                                 &clones, dbpath, &KA_dbase);
+                                 clones, dbpath, &KA_dbase);
 
     if (code) {
-       com_err(whoami, code, "Ubik init failed");
+       afs_com_err(whoami, code, "Ubik init failed");
        exit(2);
     }
 
@@ -496,6 +464,6 @@ main(argc, argv)
     }
 
     ViceLog(0, ("Starting to process AuthServer requests\n"));
-    rx_ServerProc();           /* donate this LWP */
+    rx_ServerProc(NULL);               /* donate this LWP */
     return 0;
 }