2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
17 #include <sys/types.h>
28 #include <WINNT/afsevent.h>
31 #include <netinet/in.h>
33 #endif /* AFS_NT40_ENV */
34 #include <afs/cellconfig.h>
37 #include <rx/rx_globals.h>
42 #include <afs/ktime.h>
43 #include <afs/afsutil.h>
44 #include <afs/fileutil.h>
45 #include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
46 #if defined(AFS_SGI_ENV)
47 #include <afs/afs_args.h>
51 #define BOZO_LWP_STACKSIZE 16000
52 extern int BOZO_ExecuteRequest();
53 extern int RXSTATS_ExecuteRequest();
54 extern struct bnode_ops fsbnode_ops, dafsbnode_ops, ezbnode_ops, cronbnode_ops;
58 struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
59 static PROCESS bozo_pid;
60 struct rx_securityClass *bozo_rxsc[3];
61 const char *bozo_fileName;
67 int DoSyslogFacility = LOG_DAEMON;
69 static afs_int32 nextRestart;
70 static afs_int32 nextDay;
72 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
76 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
77 afs_uint32 SHostAddrs[ADDRSPERSITE];
79 #ifdef BOS_RESTRICTED_MODE
80 int bozo_isrestricted = 0;
81 int bozo_restdisable = 0;
84 bozo_insecureme(int sig)
86 signal(SIGFPE, bozo_insecureme);
87 bozo_isrestricted = 0;
96 /* check whether caller is authorized to manage RX statistics */
98 bozo_rxstat_userok(struct rx_call *call)
100 return afsconf_SuperUser(bozo_confdir, call, NULL);
103 /* restart bozo process */
108 /* exit with restart code; SCM integrator process will restart bosserver */
109 int status = BOSEXIT_RESTART;
111 /* if noauth flag is set, pass "-noauth" to new bosserver */
112 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
113 status |= BOSEXIT_NOAUTH_FLAG;
115 /* if logging is on, pass "-log" to new bosserver */
117 status |= BOSEXIT_LOGGING_FLAG;
121 /* exec new bosserver process */
125 argv[i] = (char *)AFSDIR_SERVER_BOSVR_FILEPATH;
128 /* if noauth flag is set, pass "-noauth" to new bosserver */
129 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
133 /* if logging is on, pass "-log" to new bosserver */
139 /* if syslog logging is on, pass "-syslog" to new bosserver */
141 char *arg = (char *)malloc(40); /* enough for -syslog=# */
142 if (DoSyslogFacility != LOG_DAEMON) {
143 snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
145 strcpy(arg, "-syslog");
152 /* null-terminate argument list */
155 /* close random fd's */
156 for (i = 3; i < 64; i++) {
160 execv(argv[0], argv); /* should not return */
162 #endif /* AFS_NT40_ENV */
165 /* make sure a dir exists */
167 MakeDir(const char *adir)
170 register afs_int32 code;
171 if (stat(adir, &tstat) < 0 || (tstat.st_mode & S_IFMT) != S_IFDIR) {
174 reqPerm = GetRequiredDirPerm(adir);
178 /* underlying filesystem may not support directory protection */
181 code = mkdir(adir, reqPerm);
188 /* create all the bozo dirs */
193 (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
194 strlen(AFSDIR_USR_DIRPATH)))
197 (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
198 strlen(AFSDIR_USR_DIRPATH)))) {
199 MakeDir(AFSDIR_USR_DIRPATH);
202 (AFSDIR_SERVER_AFS_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
203 strlen(AFSDIR_SERVER_AFS_DIRPATH))) {
204 MakeDir(AFSDIR_SERVER_AFS_DIRPATH);
206 MakeDir(AFSDIR_SERVER_BIN_DIRPATH);
207 MakeDir(AFSDIR_SERVER_ETC_DIRPATH);
208 MakeDir(AFSDIR_SERVER_LOCAL_DIRPATH);
209 MakeDir(AFSDIR_SERVER_DB_DIRPATH);
210 MakeDir(AFSDIR_SERVER_LOGS_DIRPATH);
213 (AFSDIR_CLIENT_VICE_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
214 strlen(AFSDIR_CLIENT_VICE_DIRPATH))) {
215 MakeDir(AFSDIR_CLIENT_VICE_DIRPATH);
217 MakeDir(AFSDIR_CLIENT_ETC_DIRPATH);
219 symlink(AFSDIR_SERVER_THISCELL_FILEPATH, AFSDIR_CLIENT_THISCELL_FILEPATH);
220 symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
221 AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
222 #endif /* AFS_NT40_ENV */
226 /* strip the \\n from the end of the line, if it is present */
228 StripLine(register char *abuffer)
232 tp = abuffer + strlen(abuffer); /* starts off pointing at the null */
234 return 0; /* null string, no last character to check */
235 tp--; /* aim at last character */
241 /* write one bnode's worth of entry into the file */
243 bzwrite(register struct bnode *abnode, register struct bztemp *at)
246 char tbuffer[BOZO_BSSIZE];
247 register afs_int32 code;
249 if (abnode->notifier)
250 fprintf(at->file, "bnode %s %s %d %s\n", abnode->type->name,
251 abnode->name, abnode->fileGoal, abnode->notifier);
253 fprintf(at->file, "bnode %s %s %d\n", abnode->type->name,
254 abnode->name, abnode->fileGoal);
256 code = bnode_GetParm(abnode, i, tbuffer, BOZO_BSSIZE);
262 fprintf(at->file, "parm %s\n", tbuffer);
264 fprintf(at->file, "end\n");
270 ReadBozoFile(char *aname)
272 register FILE *tfile;
273 char tbuffer[BOZO_BSSIZE];
275 char *instp, *typep, *notifier, *notp;
276 register afs_int32 code;
277 afs_int32 ktmask, ktday, kthour, ktmin, ktsec;
280 char *parms[MAXPARMS];
281 #ifdef BOS_RESTRICTED_MODE
285 /* rename BozoInit to BosServer for the user */
287 /* if BozoInit exists and BosConfig doesn't, try a rename */
288 if (access(AFSDIR_SERVER_BOZINIT_FILEPATH, 0) == 0
289 && access(AFSDIR_SERVER_BOZCONF_FILEPATH, 0) != 0) {
291 renamefile(AFSDIR_SERVER_BOZINIT_FILEPATH,
292 AFSDIR_SERVER_BOZCONF_FILEPATH);
294 perror("bosconfig rename");
296 #ifdef BOS_NEW_CONFIG
297 if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
299 renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
300 AFSDIR_SERVER_BOZCONF_FILEPATH);
302 perror("bosconfig rename");
307 /* setup default times we want to do restarts */
308 bozo_nextRestartKT.mask = KTIME_HOUR | KTIME_MIN | KTIME_DAY;
309 bozo_nextRestartKT.hour = 4; /* 4 am */
310 bozo_nextRestartKT.min = 0;
311 bozo_nextRestartKT.day = 0; /* Sunday */
312 bozo_nextDayKT.mask = KTIME_HOUR | KTIME_MIN;
313 bozo_nextDayKT.hour = 5;
314 bozo_nextDayKT.min = 0;
316 for (code = 0; code < MAXPARMS; code++)
318 instp = typep = notifier = NULL;
321 aname = (char *)bozo_fileName;
322 tfile = fopen(aname, "r");
325 instp = (char *)malloc(BOZO_BSSIZE);
326 typep = (char *)malloc(BOZO_BSSIZE);
327 notifier = notp = (char *)malloc(BOZO_BSSIZE);
329 /* ok, read lines giving parms and such from the file */
330 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
332 break; /* all done */
334 if (strncmp(tbuffer, "restarttime", 11) == 0) {
336 sscanf(tbuffer, "restarttime %d %d %d %d %d", &ktmask, &ktday,
337 &kthour, &ktmin, &ktsec);
342 /* otherwise we've read in the proper ktime structure; now assign
343 * it and continue processing */
344 bozo_nextRestartKT.mask = ktmask;
345 bozo_nextRestartKT.day = ktday;
346 bozo_nextRestartKT.hour = kthour;
347 bozo_nextRestartKT.min = ktmin;
348 bozo_nextRestartKT.sec = ktsec;
352 if (strncmp(tbuffer, "checkbintime", 12) == 0) {
354 sscanf(tbuffer, "checkbintime %d %d %d %d %d", &ktmask,
355 &ktday, &kthour, &ktmin, &ktsec);
360 /* otherwise we've read in the proper ktime structure; now assign
361 * it and continue processing */
362 bozo_nextDayKT.mask = ktmask; /* time to restart the system */
363 bozo_nextDayKT.day = ktday;
364 bozo_nextDayKT.hour = kthour;
365 bozo_nextDayKT.min = ktmin;
366 bozo_nextDayKT.sec = ktsec;
369 #ifdef BOS_RESTRICTED_MODE
370 if (strncmp(tbuffer, "restrictmode", 12) == 0) {
371 code = sscanf(tbuffer, "restrictmode %d", &rmode);
376 if (rmode != 0 && rmode != 1) {
380 bozo_isrestricted = rmode;
385 if (strncmp("bnode", tbuffer, 5) != 0) {
391 sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
396 } else if (code == 3)
399 for (i = 0; i < MAXPARMS; i++) {
400 /* now read the parms, until we see an "end" line */
401 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
407 if (!strncmp(tbuffer, "end", 3))
409 if (strncmp(tbuffer, "parm ", 5)) {
411 goto fail; /* no "parm " either */
413 if (!parms[i]) /* make sure there's space */
414 parms[i] = (char *)malloc(BOZO_BSSIZE);
415 strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
418 /* ok, we have the type and parms, now create the object */
420 bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
421 parms[3], parms[4], notifier,
422 goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
426 /* bnode created in 'temporarily shutdown' state;
427 * check to see if we are supposed to run this guy,
428 * and if so, start the process up */
430 bnode_SetStat(tb, BSTAT_NORMAL); /* set goal, taking effect immediately */
432 bnode_SetStat(tb, BSTAT_SHUTDOWN);
443 for (i = 0; i < MAXPARMS; i++)
451 /* write a new bozo file */
453 WriteBozoFile(char *aname)
455 register FILE *tfile;
456 char tbuffer[AFSDIR_PATH_MAX];
457 register afs_int32 code;
461 aname = (char *)bozo_fileName;
462 strcpy(tbuffer, aname);
463 strcat(tbuffer, ".NBZ");
464 tfile = fopen(tbuffer, "w");
468 #ifdef BOS_RESTRICTED_MODE
469 fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
471 fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
472 bozo_nextRestartKT.day, bozo_nextRestartKT.hour,
473 bozo_nextRestartKT.min, bozo_nextRestartKT.sec);
474 fprintf(tfile, "checkbintime %d %d %d %d %d\n", bozo_nextDayKT.mask,
475 bozo_nextDayKT.day, bozo_nextDayKT.hour, bozo_nextDayKT.min,
477 code = bnode_ApplyInstance(bzwrite, &btemp);
478 if (code || (code = ferror(tfile))) { /* something went wrong */
483 /* close the file, check for errors and snap new file into place */
484 if (fclose(tfile) == EOF) {
488 code = renamefile(tbuffer, aname);
497 bdrestart(register struct bnode *abnode, char *arock)
499 register afs_int32 code;
501 if (abnode->fileGoal != BSTAT_NORMAL || abnode->goal != BSTAT_NORMAL)
502 return 0; /* don't restart stopped bnodes */
504 code = bnode_RestartP(abnode);
506 /* restart the dude */
507 bnode_SetStat(abnode, BSTAT_SHUTDOWN);
508 bnode_WaitStatus(abnode, BSTAT_SHUTDOWN);
509 bnode_SetStat(abnode, BSTAT_NORMAL);
511 bnode_Release(abnode);
512 return 0; /* keep trying all bnodes */
515 #define BOZO_MINSKIP 3600 /* minimum to advance clock */
516 /* lwp to handle system restarts */
520 register afs_int32 now;
522 /* now initialize the values */
526 now = FT_ApproxTime();
528 #ifdef BOS_RESTRICTED_MODE
529 if (bozo_restdisable) {
530 bozo_Log("Restricted mode disabled by signal\n");
531 bozo_restdisable = 0;
534 if (bozo_newKTs) { /* need to recompute restart times */
535 bozo_newKTs = 0; /* done for a while */
536 nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
537 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
540 /* see if we should do a restart */
541 if (now > nextRestart) {
542 SBOZO_ReBozo(0); /* doesn't come back */
545 /* see if we should restart a server */
547 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
549 /* call the bnode restartp function, and restart all that require it */
550 bnode_ApplyInstance(bdrestart, 0);
561 int s, sb_max, ipfragttl;
565 f = popen("/usr/sbin/no -o sb_max", "r");
566 s = fscanf(f, "sb_max = %d", &sb_max);
570 f = popen("/usr/sbin/no -o ipfragttl", "r");
571 s = fscanf(f, "ipfragttl = %d", &ipfragttl);
581 sprintf(c, "/usr/sbin/no -o sb_max=%d -o ipfragttl=%d", sb_max,
590 * This routine causes the calling process to go into the background and
591 * to lose its controlling tty.
593 * It does not close or otherwise alter the standard file descriptors.
595 * It writes warning messages to the standard error output if certain
596 * fundamental errors occur.
598 * This routine requires
600 * #include <sys/types.h>
601 * #include <sys/stat.h>
603 * #include <unistd.h>
604 * #include <stdlib.h>
606 * and has been tested on:
622 * A process is a process group leader if its process ID
623 * (getpid()) and its process group ID (getpgrp()) are the same.
627 * To create a new session (and thereby lose our controlling
628 * terminal) we cannot be a process group leader.
630 * To guarantee we are not a process group leader, we fork and
631 * let the parent process exit.
634 if (getpid() == getpgrp()) {
639 abort(); /* leave footprints */
643 default: /* parent */
650 * By here, we are not a process group leader, so we can make a
651 * new session and become the session leader.
655 pid_t sid = setsid();
658 static char err[] = "bosserver: WARNING: setsid() failed\n";
659 write(STDERR_FILENO, err, sizeof err - 1);
664 * Once we create a new session, the current process is a
665 * session leader without a controlling tty.
667 * On some systems, the first tty device the session leader
668 * opens automatically becomes the controlling tty for the
671 * So, to guarantee we do not acquire a controlling tty, we fork
672 * and let the parent process exit. The child process is not a
673 * session leader, and so it will not acquire a controlling tty
674 * even if it should happen to open a tty device.
677 if (getpid() == getpgrp()) {
682 abort(); /* leave footprints */
686 default: /* parent */
693 * check that we no longer have a controlling tty
699 fd = open("/dev/tty", O_RDONLY);
703 "bosserver: WARNING: /dev/tty still attached\n";
705 write(STDERR_FILENO, err, sizeof err - 1);
709 #endif /* ! AFS_NT40_ENV */
712 /* start a process and monitor it */
714 #include "AFS_component_version_number.c"
717 main(int argc, char **argv, char **envp)
719 struct rx_service *tservice;
720 register afs_int32 code;
721 struct afsconf_dir *tdir;
724 char namebuf[AFSDIR_PATH_MAX];
726 afs_uint32 host = htonl(INADDR_ANY);
732 struct sigaction nsa;
734 /* for some reason, this permits user-mode RX to run a lot faster.
735 * we do it here in the bosserver, so we don't have to do it
736 * individually in each server.
741 * The following signal action for AIX is necessary so that in case of a
742 * crash (i.e. core is generated) we can include the user's data section
743 * in the core dump. Unfortunately, by default, only a partial core is
744 * generated which, in many cases, isn't too useful.
746 sigemptyset(&nsa.sa_mask);
747 nsa.sa_handler = SIG_DFL;
748 nsa.sa_flags = SA_FULLDUMP;
749 sigaction(SIGSEGV, &nsa, NULL);
750 sigaction(SIGABRT, &nsa, NULL);
753 #ifdef BOS_RESTRICTED_MODE
754 signal(SIGFPE, bozo_insecureme);
758 /* Initialize winsock */
759 if (afs_winsockInit() < 0) {
760 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
761 fprintf(stderr, "%s: Couldn't initialize winsock.\n", argv[0]);
766 /* Initialize dirpaths */
767 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
769 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
771 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
776 /* some path inits */
777 bozo_fileName = AFSDIR_SERVER_BOZCONF_FILEPATH;
779 /* initialize the list of dirpaths that the bosserver has
780 * an interest in monitoring */
783 #if defined(AFS_SGI_ENV)
784 /* offer some protection if AFS isn't loaded */
785 if (syscall(AFS_SYSCALL, AFSOP_ENDLOG) < 0 && errno == ENOPKG) {
786 printf("bosserver: AFS doesn't appear to be configured in O.S..\n");
792 for (code = 1; code < argc; code++) {
793 if (strcmp(argv[code], "-noauth") == 0) {
794 /* set noauth flag */
796 } else if (strcmp(argv[code], "-log") == 0) {
797 /* set extra logging flag */
801 else if (strcmp(argv[code], "-syslog") == 0) {
802 /* set syslog logging flag */
804 } else if (strncmp(argv[code], "-syslog=", 8) == 0) {
806 DoSyslogFacility = atoi(argv[code] + 8);
807 } else if (strcmp(argv[code], "-nofork") == 0) {
811 else if (strcmp(argv[code], "-enable_peer_stats") == 0) {
812 rx_enablePeerRPCStats();
813 } else if (strcmp(argv[code], "-enable_process_stats") == 0) {
814 rx_enableProcessRPCStats();
816 #ifdef BOS_RESTRICTED_MODE
817 else if (strcmp(argv[code], "-restricted") == 0) {
818 bozo_isrestricted = 1;
821 else if (strcmp(argv[code], "-rxbind") == 0) {
824 else if (!strcmp(argv[i], "-rxmaxmtu")) {
825 if ((i + 1) >= argc) {
826 fprintf(stderr, "missing argument for -rxmaxmtu\n");
829 rxMaxMTU = atoi(argv[++i]);
830 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
831 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
832 printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
833 rxMaxMTU, RX_MIN_PACKET_SIZE,
834 RX_MAX_PACKET_DATA_SIZE);
838 else if (strcmp(argv[code], "-auditlog") == 0) {
841 char oldName[MAXPATHLEN];
842 char *fileName = argv[++code];
847 if ((lstat(fileName, &statbuf) == 0)
848 && (S_ISFIFO(statbuf.st_mode))) {
849 flags = O_WRONLY | O_NONBLOCK;
853 strcpy(oldName, fileName);
854 strcat(oldName, ".old");
855 renamefile(fileName, oldName);
856 flags = O_WRONLY | O_TRUNC | O_CREAT;
858 tempfd = open(fileName, flags, 0666);
860 auditout = fdopen(tempfd, "a");
862 osi_audit_file(auditout);
864 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
866 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
870 /* hack to support help flag */
873 printf("Usage: bosserver [-noauth] [-log] "
874 "[-auditlog <log path>] "
875 "[-rxmaxmtu <bytes>] [-rxbind] "
876 "[-syslog[=FACILITY]] "
877 "[-enable_peer_stats] [-enable_process_stats] "
878 "[-nofork] " "[-help]\n");
880 printf("Usage: bosserver [-noauth] [-log] "
881 "[-auditlog <log path>] "
882 "[-rxmaxmtu <bytes>] [-rxbind] "
883 "[-enable_peer_stats] [-enable_process_stats] "
893 if (geteuid() != 0) {
894 printf("bosserver: must be run as root.\n");
901 printf("bosserver: could not init bnode package, code %d\n", code);
905 bnode_Register("fs", &fsbnode_ops, 3);
906 bnode_Register("dafs", &dafsbnode_ops, 4);
907 bnode_Register("simple", &ezbnode_ops, 1);
908 bnode_Register("cron", &cronbnode_ops, 2);
910 /* create useful dirs */
913 /* chdir to AFS log directory */
914 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
917 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
921 /* go into the background and remove our controlling tty, close open
928 #endif /* ! AFS_NT40_ENV */
932 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
933 !(S_ISFIFO(sb.st_mode)))
936 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
937 strcat(namebuf, ".old");
938 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
939 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
941 printf("bosserver: can't initialize log file (%s).\n",
942 AFSDIR_SERVER_BOZLOG_FILEPATH);
945 /* keep log closed normally, so can be removed */
946 fclose(bozo_logFile);
949 openlog("bosserver", LOG_PID, DoSyslogFacility);
953 /* Write current state of directory permissions to log file */
956 for (i = 0; i < 10; i++) {
957 code = rx_Init(htons(AFSCONF_NANNYPORT));
959 bozo_Log("can't initialize rx: code=%d\n", code);
965 bozo_Log("Bos giving up, can't initialize rx\n");
969 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
970 (void *) /*parm */ 0, "bozo-the-clown",
973 /* try to read the key from the config file */
974 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
976 /* try to create local cell config file */
977 struct afsconf_cell tcell;
978 strcpy(tcell.name, "localcell");
979 tcell.numServers = 1;
980 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
982 bozo_Log("failed to get hostname, code %d\n", errno);
985 if (tcell.hostName[0][0] == 0) {
986 bozo_Log("host name not set, can't start\n");
987 bozo_Log("try the 'hostname' command\n");
990 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
992 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
996 ("could not create cell database in '%s' (code %d), quitting\n",
997 AFSDIR_SERVER_ETC_DIRPATH, code);
1000 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
1003 ("failed to open newly-created cell database, quitting\n");
1008 /* read init file, starting up programs */
1009 if (code = ReadBozoFile(0)) {
1011 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
1012 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
1016 /* opened the cell databse */
1017 bozo_confdir = tdir;
1019 /* allow super users to manage RX statistics */
1020 rx_SetRxStatUserOk(bozo_rxstat_userok);
1022 /* have bcrypt key now */
1024 afsconf_SetNoAuthFlag(tdir, noAuth);
1026 bozo_rxsc[0] = rxnull_NewServerSecurityObject();
1027 bozo_rxsc[1] = (struct rx_securityClass *)0;
1029 rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
1031 /* Disable jumbograms */
1034 if (rxMaxMTU != -1) {
1035 rx_SetMaxMTU(rxMaxMTU);
1040 #ifndef AFS_NT40_ENV
1041 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1042 AFSDIR_SERVER_NETINFO_FILEPATH) {
1044 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1045 ADDRSPERSITE, reason,
1046 AFSDIR_SERVER_NETINFO_FILEPATH,
1047 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1051 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1054 host = SHostAddrs[0];
1057 tservice = rx_NewServiceHost(host, /* port */ 0, /* service id */ 1,
1058 /*service name */ "bozo",
1059 /* security classes */
1061 /* numb sec classes */ 3, BOZO_ExecuteRequest);
1062 rx_SetMinProcs(tservice, 2);
1063 rx_SetMaxProcs(tservice, 4);
1064 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1067 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
1068 3, RXSTATS_ExecuteRequest);
1069 rx_SetMinProcs(tservice, 2);
1070 rx_SetMaxProcs(tservice, 4);
1071 rx_StartServer(1); /* donate this process */
1075 bozo_Log(char *a, char *b, char *c, char *d, char *e, char *f)
1081 #ifndef AFS_NT40_ENV
1082 syslog(LOG_INFO, a, b, c, d, e, f);
1086 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1089 /* log normally closed, so can be removed */
1091 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1092 if (bozo_logFile == NULL) {
1093 printf("bosserver: WARNING: problem with %s\n",
1094 AFSDIR_SERVER_BOZLOG_FILEPATH);
1095 printf("%s ", tdate);
1096 printf(a, b, c, d, e, f);
1099 fprintf(bozo_logFile, "%s ", tdate);
1100 fprintf(bozo_logFile, a, b, c, d, e, f);
1102 /* close so rm BosLog works */
1103 fclose(bozo_logFile);