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>
13 #ifdef IGNORE_SOME_GCC_WARNINGS
14 # pragma GCC diagnostic warning "-Wdeprecated-declarations"
18 #include <sys/types.h>
30 #include <WINNT/afsevent.h>
33 #include <netinet/in.h>
35 #endif /* AFS_NT40_ENV */
36 #include <afs/cellconfig.h>
39 #include <rx/rx_globals.h>
42 #include "bosprototypes.h"
44 #include <rx/rxstat.h>
46 #include <afs/ktime.h>
47 #include <afs/afsutil.h>
48 #include <afs/fileutil.h>
49 #include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
50 #include <afs/audit.h>
51 #include <afs/cellconfig.h>
52 #if defined(AFS_SGI_ENV)
53 #include <afs/afs_args.h>
56 #define BOZO_LWP_STACKSIZE 16000
57 extern struct bnode_ops fsbnode_ops, dafsbnode_ops, ezbnode_ops, cronbnode_ops;
59 struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
60 static PROCESS bozo_pid;
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;
75 int rxkadDisableDotCheck = 0;
77 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
78 afs_uint32 SHostAddrs[ADDRSPERSITE];
80 int bozo_isrestricted = 0;
81 int bozo_restdisable = 0;
84 bozo_insecureme(int sig)
86 signal(SIGFPE, bozo_insecureme);
87 bozo_isrestricted = 0;
95 /* check whether caller is authorized to manage RX statistics */
97 bozo_rxstat_userok(struct rx_call *call)
99 return afsconf_SuperUser(bozo_confdir, call, NULL);
102 /* restart bozo process */
107 /* exit with restart code; SCM integrator process will restart bosserver */
108 int status = BOSEXIT_RESTART;
110 /* if noauth flag is set, pass "-noauth" to new bosserver */
111 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
112 status |= BOSEXIT_NOAUTH_FLAG;
114 /* if logging is on, pass "-log" to new bosserver */
116 status |= BOSEXIT_LOGGING_FLAG;
120 /* exec new bosserver process */
124 argv[i] = (char *)AFSDIR_SERVER_BOSVR_FILEPATH;
127 /* if noauth flag is set, pass "-noauth" to new bosserver */
128 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
132 /* if logging is on, pass "-log" to new bosserver */
138 /* if syslog logging is on, pass "-syslog" to new bosserver */
140 char *arg = (char *)malloc(40); /* enough for -syslog=# */
141 if (DoSyslogFacility != LOG_DAEMON) {
142 snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
144 strcpy(arg, "-syslog");
151 /* null-terminate argument list */
154 /* close random fd's */
155 for (i = 3; i < 64; i++) {
159 execv(argv[0], argv); /* should not return */
161 #endif /* AFS_NT40_ENV */
164 /* make sure a dir exists */
166 MakeDir(const char *adir)
169 register afs_int32 code;
170 if (stat(adir, &tstat) < 0 || (tstat.st_mode & S_IFMT) != S_IFDIR) {
173 reqPerm = GetRequiredDirPerm(adir);
177 /* underlying filesystem may not support directory protection */
180 code = mkdir(adir, reqPerm);
187 /* create all the bozo dirs */
192 (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
193 strlen(AFSDIR_USR_DIRPATH)))
196 (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
197 strlen(AFSDIR_USR_DIRPATH)))) {
198 MakeDir(AFSDIR_USR_DIRPATH);
201 (AFSDIR_SERVER_AFS_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
202 strlen(AFSDIR_SERVER_AFS_DIRPATH))) {
203 MakeDir(AFSDIR_SERVER_AFS_DIRPATH);
205 MakeDir(AFSDIR_SERVER_BIN_DIRPATH);
206 MakeDir(AFSDIR_SERVER_ETC_DIRPATH);
207 MakeDir(AFSDIR_SERVER_LOCAL_DIRPATH);
208 MakeDir(AFSDIR_SERVER_DB_DIRPATH);
209 MakeDir(AFSDIR_SERVER_LOGS_DIRPATH);
212 (AFSDIR_CLIENT_VICE_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
213 strlen(AFSDIR_CLIENT_VICE_DIRPATH))) {
214 MakeDir(AFSDIR_CLIENT_VICE_DIRPATH);
216 MakeDir(AFSDIR_CLIENT_ETC_DIRPATH);
218 symlink(AFSDIR_SERVER_THISCELL_FILEPATH, AFSDIR_CLIENT_THISCELL_FILEPATH);
219 symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
220 AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
221 #endif /* AFS_NT40_ENV */
225 /* strip the \\n from the end of the line, if it is present */
227 StripLine(register char *abuffer)
231 tp = abuffer + strlen(abuffer); /* starts off pointing at the null */
233 return 0; /* null string, no last character to check */
234 tp--; /* aim at last character */
240 /* write one bnode's worth of entry into the file */
242 bzwrite(register struct bnode *abnode, void *arock)
244 register struct bztemp *at = (struct bztemp *)arock;
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];
283 /* rename BozoInit to BosServer for the user */
285 /* if BozoInit exists and BosConfig doesn't, try a rename */
286 if (access(AFSDIR_SERVER_BOZINIT_FILEPATH, 0) == 0
287 && access(AFSDIR_SERVER_BOZCONF_FILEPATH, 0) != 0) {
289 renamefile(AFSDIR_SERVER_BOZINIT_FILEPATH,
290 AFSDIR_SERVER_BOZCONF_FILEPATH);
292 perror("bosconfig rename");
294 if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
296 renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
297 AFSDIR_SERVER_BOZCONF_FILEPATH);
299 perror("bosconfig rename");
303 /* don't do server restarts by default */
304 bozo_nextRestartKT.mask = KTIME_NEVER;
305 bozo_nextRestartKT.hour = 0;
306 bozo_nextRestartKT.min = 0;
307 bozo_nextRestartKT.day = 0;
309 /* restart processes at 5am if their binaries have changed */
310 bozo_nextDayKT.mask = KTIME_HOUR | KTIME_MIN;
311 bozo_nextDayKT.hour = 5;
312 bozo_nextDayKT.min = 0;
314 for (code = 0; code < MAXPARMS; code++)
316 instp = typep = notifier = NULL;
319 aname = (char *)bozo_fileName;
320 tfile = fopen(aname, "r");
323 instp = (char *)malloc(BOZO_BSSIZE);
324 typep = (char *)malloc(BOZO_BSSIZE);
325 notifier = notp = (char *)malloc(BOZO_BSSIZE);
327 /* ok, read lines giving parms and such from the file */
328 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
330 break; /* all done */
332 if (strncmp(tbuffer, "restarttime", 11) == 0) {
334 sscanf(tbuffer, "restarttime %d %d %d %d %d", &ktmask, &ktday,
335 &kthour, &ktmin, &ktsec);
340 /* otherwise we've read in the proper ktime structure; now assign
341 * it and continue processing */
342 bozo_nextRestartKT.mask = ktmask;
343 bozo_nextRestartKT.day = ktday;
344 bozo_nextRestartKT.hour = kthour;
345 bozo_nextRestartKT.min = ktmin;
346 bozo_nextRestartKT.sec = ktsec;
350 if (strncmp(tbuffer, "checkbintime", 12) == 0) {
352 sscanf(tbuffer, "checkbintime %d %d %d %d %d", &ktmask,
353 &ktday, &kthour, &ktmin, &ktsec);
358 /* otherwise we've read in the proper ktime structure; now assign
359 * it and continue processing */
360 bozo_nextDayKT.mask = ktmask; /* time to restart the system */
361 bozo_nextDayKT.day = ktday;
362 bozo_nextDayKT.hour = kthour;
363 bozo_nextDayKT.min = ktmin;
364 bozo_nextDayKT.sec = ktsec;
368 if (strncmp(tbuffer, "restrictmode", 12) == 0) {
369 code = sscanf(tbuffer, "restrictmode %d", &rmode);
374 if (rmode != 0 && rmode != 1) {
378 bozo_isrestricted = rmode;
382 if (strncmp("bnode", tbuffer, 5) != 0) {
388 sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
393 } else if (code == 3)
396 for (i = 0; i < MAXPARMS; i++) {
397 /* now read the parms, until we see an "end" line */
398 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
404 if (!strncmp(tbuffer, "end", 3))
406 if (strncmp(tbuffer, "parm ", 5)) {
408 goto fail; /* no "parm " either */
410 if (!parms[i]) /* make sure there's space */
411 parms[i] = (char *)malloc(BOZO_BSSIZE);
412 strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
415 /* ok, we have the type and parms, now create the object */
417 bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
418 parms[3], parms[4], notifier,
419 goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
423 /* bnode created in 'temporarily shutdown' state;
424 * check to see if we are supposed to run this guy,
425 * and if so, start the process up */
427 bnode_SetStat(tb, BSTAT_NORMAL); /* set goal, taking effect immediately */
429 bnode_SetStat(tb, BSTAT_SHUTDOWN);
440 for (i = 0; i < MAXPARMS; i++)
448 /* write a new bozo file */
450 WriteBozoFile(char *aname)
452 register FILE *tfile;
453 char tbuffer[AFSDIR_PATH_MAX];
454 register afs_int32 code;
458 aname = (char *)bozo_fileName;
459 strcpy(tbuffer, aname);
460 strcat(tbuffer, ".NBZ");
461 tfile = fopen(tbuffer, "w");
466 fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
467 fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
468 bozo_nextRestartKT.day, bozo_nextRestartKT.hour,
469 bozo_nextRestartKT.min, bozo_nextRestartKT.sec);
470 fprintf(tfile, "checkbintime %d %d %d %d %d\n", bozo_nextDayKT.mask,
471 bozo_nextDayKT.day, bozo_nextDayKT.hour, bozo_nextDayKT.min,
473 code = bnode_ApplyInstance(bzwrite, &btemp);
474 if (code || (code = ferror(tfile))) { /* something went wrong */
479 /* close the file, check for errors and snap new file into place */
480 if (fclose(tfile) == EOF) {
484 code = renamefile(tbuffer, aname);
493 bdrestart(register struct bnode *abnode, void *arock)
495 register afs_int32 code;
497 if (abnode->fileGoal != BSTAT_NORMAL || abnode->goal != BSTAT_NORMAL)
498 return 0; /* don't restart stopped bnodes */
500 code = bnode_RestartP(abnode);
502 /* restart the dude */
503 bnode_SetStat(abnode, BSTAT_SHUTDOWN);
504 bnode_WaitStatus(abnode, BSTAT_SHUTDOWN);
505 bnode_SetStat(abnode, BSTAT_NORMAL);
507 bnode_Release(abnode);
508 return 0; /* keep trying all bnodes */
511 #define BOZO_MINSKIP 3600 /* minimum to advance clock */
512 /* lwp to handle system restarts */
514 BozoDaemon(void *unused)
516 register afs_int32 now;
518 /* now initialize the values */
522 now = FT_ApproxTime();
524 if (bozo_restdisable) {
525 bozo_Log("Restricted mode disabled by signal\n");
526 bozo_restdisable = 0;
529 if (bozo_newKTs) { /* need to recompute restart times */
530 bozo_newKTs = 0; /* done for a while */
531 nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
532 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
535 /* see if we should do a restart */
536 if (now > nextRestart) {
537 SBOZO_ReBozo(0); /* doesn't come back */
540 /* see if we should restart a server */
542 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
544 /* call the bnode restartp function, and restart all that require it */
545 bnode_ApplyInstance(bdrestart, 0);
557 int s, sb_max, ipfragttl;
561 f = popen("/usr/sbin/no -o sb_max", "r");
562 s = fscanf(f, "sb_max = %d", &sb_max);
566 f = popen("/usr/sbin/no -o ipfragttl", "r");
567 s = fscanf(f, "ipfragttl = %d", &ipfragttl);
577 sprintf(c, "/usr/sbin/no -o sb_max=%d -o ipfragttl=%d", sb_max,
586 * This routine causes the calling process to go into the background and
587 * to lose its controlling tty.
589 * It does not close or otherwise alter the standard file descriptors.
591 * It writes warning messages to the standard error output if certain
592 * fundamental errors occur.
594 * This routine requires
596 * #include <sys/types.h>
597 * #include <sys/stat.h>
599 * #include <unistd.h>
600 * #include <stdlib.h>
602 * and has been tested on:
618 * A process is a process group leader if its process ID
619 * (getpid()) and its process group ID (getpgrp()) are the same.
623 * To create a new session (and thereby lose our controlling
624 * terminal) we cannot be a process group leader.
626 * To guarantee we are not a process group leader, we fork and
627 * let the parent process exit.
630 if (getpid() == getpgrp()) {
635 abort(); /* leave footprints */
639 default: /* parent */
646 * By here, we are not a process group leader, so we can make a
647 * new session and become the session leader.
651 pid_t sid = setsid();
654 static char err[] = "bosserver: WARNING: setsid() failed\n";
655 write(STDERR_FILENO, err, sizeof err - 1);
660 * Once we create a new session, the current process is a
661 * session leader without a controlling tty.
663 * On some systems, the first tty device the session leader
664 * opens automatically becomes the controlling tty for the
667 * So, to guarantee we do not acquire a controlling tty, we fork
668 * and let the parent process exit. The child process is not a
669 * session leader, and so it will not acquire a controlling tty
670 * even if it should happen to open a tty device.
673 if (getpid() == getpgrp()) {
678 abort(); /* leave footprints */
682 default: /* parent */
689 * check that we no longer have a controlling tty
695 fd = open("/dev/tty", O_RDONLY);
699 "bosserver: WARNING: /dev/tty still attached\n";
701 write(STDERR_FILENO, err, sizeof err - 1);
705 #endif /* ! AFS_NT40_ENV */
708 /* start a process and monitor it */
710 #include "AFS_component_version_number.c"
713 main(int argc, char **argv, char **envp)
715 struct rx_service *tservice;
716 register afs_int32 code;
717 struct afsconf_dir *tdir;
720 char namebuf[AFSDIR_PATH_MAX];
722 afs_uint32 host = htonl(INADDR_ANY);
723 char *auditFileName = NULL;
724 struct rx_securityClass **securityClasses;
725 afs_int32 numClasses;
731 struct sigaction nsa;
733 /* for some reason, this permits user-mode RX to run a lot faster.
734 * we do it here in the bosserver, so we don't have to do it
735 * individually in each server.
740 * The following signal action for AIX is necessary so that in case of a
741 * crash (i.e. core is generated) we can include the user's data section
742 * in the core dump. Unfortunately, by default, only a partial core is
743 * generated which, in many cases, isn't too useful.
745 sigemptyset(&nsa.sa_mask);
746 nsa.sa_handler = SIG_DFL;
747 nsa.sa_flags = SA_FULLDUMP;
748 sigaction(SIGSEGV, &nsa, NULL);
749 sigaction(SIGABRT, &nsa, NULL);
752 signal(SIGFPE, bozo_insecureme);
755 /* Initialize winsock */
756 if (afs_winsockInit() < 0) {
757 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
758 fprintf(stderr, "%s: Couldn't initialize winsock.\n", argv[0]);
763 /* Initialize dirpaths */
764 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
766 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
768 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
773 /* some path inits */
774 bozo_fileName = AFSDIR_SERVER_BOZCONF_FILEPATH;
776 /* initialize the list of dirpaths that the bosserver has
777 * an interest in monitoring */
780 #if defined(AFS_SGI_ENV)
781 /* offer some protection if AFS isn't loaded */
782 if (syscall(AFS_SYSCALL, AFSOP_ENDLOG) < 0 && errno == ENOPKG) {
783 printf("bosserver: AFS doesn't appear to be configured in O.S..\n");
789 for (code = 1; code < argc; code++) {
790 if (strcmp(argv[code], "-noauth") == 0) {
791 /* set noauth flag */
793 } else if (strcmp(argv[code], "-log") == 0) {
794 /* set extra logging flag */
798 else if (strcmp(argv[code], "-syslog") == 0) {
799 /* set syslog logging flag */
801 } else if (strncmp(argv[code], "-syslog=", 8) == 0) {
803 DoSyslogFacility = atoi(argv[code] + 8);
804 } else if (strcmp(argv[code], "-nofork") == 0) {
808 else if (strcmp(argv[code], "-enable_peer_stats") == 0) {
809 rx_enablePeerRPCStats();
810 } else if (strcmp(argv[code], "-enable_process_stats") == 0) {
811 rx_enableProcessRPCStats();
813 else if (strcmp(argv[code], "-restricted") == 0) {
814 bozo_isrestricted = 1;
816 else if (strcmp(argv[code], "-rxbind") == 0) {
819 else if (strcmp(argv[code], "-allow-dotted-principals") == 0) {
820 rxkadDisableDotCheck = 1;
822 else if (!strcmp(argv[code], "-rxmaxmtu")) {
823 if ((code + 1) >= argc) {
824 fprintf(stderr, "missing argument for -rxmaxmtu\n");
827 rxMaxMTU = atoi(argv[++code]);
828 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
829 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
830 printf("rxMaxMTU %d invalid; must be between %d-%" AFS_SIZET_FMT "\n",
831 rxMaxMTU, RX_MIN_PACKET_SIZE,
832 RX_MAX_PACKET_DATA_SIZE);
836 else if (strcmp(argv[code], "-auditlog") == 0) {
837 auditFileName = argv[++code];
839 } else if (strcmp(argv[code], "-audit-interface") == 0) {
840 char *interface = argv[++code];
842 if (osi_audit_interface(interface)) {
843 printf("Invalid audit interface '%s'\n", interface);
849 /* hack to support help flag */
852 printf("Usage: bosserver [-noauth] [-log] "
853 "[-auditlog <log path>] "
854 "[-audit-interafce <file|sysvmq> (default is file)] "
855 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
856 "[-syslog[=FACILITY]] "
857 "[-enable_peer_stats] [-enable_process_stats] "
858 "[-nofork] " "[-help]\n");
860 printf("Usage: bosserver [-noauth] [-log] "
861 "[-auditlog <log path>] "
862 "[-audit-interafce <file|sysvmq> (default is file)] "
863 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
864 "[-enable_peer_stats] [-enable_process_stats] "
873 osi_audit_file(auditFileName);
877 if (geteuid() != 0) {
878 printf("bosserver: must be run as root.\n");
885 printf("bosserver: could not init bnode package, code %d\n", code);
889 bnode_Register("fs", &fsbnode_ops, 3);
890 bnode_Register("dafs", &dafsbnode_ops, 4);
891 bnode_Register("simple", &ezbnode_ops, 1);
892 bnode_Register("cron", &cronbnode_ops, 2);
894 /* create useful dirs */
897 /* chdir to AFS log directory */
898 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
901 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
905 /* go into the background and remove our controlling tty, close open
912 #endif /* ! AFS_NT40_ENV */
916 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
917 !(S_ISFIFO(sb.st_mode)))
920 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
921 strcat(namebuf, ".old");
922 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
923 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
925 printf("bosserver: can't initialize log file (%s).\n",
926 AFSDIR_SERVER_BOZLOG_FILEPATH);
929 /* keep log closed normally, so can be removed */
930 fclose(bozo_logFile);
933 openlog("bosserver", LOG_PID, DoSyslogFacility);
937 /* Write current state of directory permissions to log file */
940 for (i = 0; i < 10; i++) {
941 code = rx_Init(htons(AFSCONF_NANNYPORT));
943 bozo_Log("can't initialize rx: code=%d\n", code);
949 bozo_Log("Bos giving up, can't initialize rx\n");
953 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
954 /* param */ NULL , "bozo-the-clown",
957 /* try to read the key from the config file */
958 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
960 /* try to create local cell config file */
961 struct afsconf_cell tcell;
962 strcpy(tcell.name, "localcell");
963 tcell.numServers = 1;
964 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
966 bozo_Log("failed to get hostname, code %d\n", errno);
969 if (tcell.hostName[0][0] == 0) {
970 bozo_Log("host name not set, can't start\n");
971 bozo_Log("try the 'hostname' command\n");
974 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
976 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
980 ("could not create cell database in '%s' (code %d), quitting\n",
981 AFSDIR_SERVER_ETC_DIRPATH, code);
984 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
987 ("failed to open newly-created cell database, quitting\n");
992 /* read init file, starting up programs */
993 if ((code = ReadBozoFile(0))) {
995 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
996 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
1000 /* opened the cell databse */
1001 bozo_confdir = tdir;
1003 /* allow super users to manage RX statistics */
1004 rx_SetRxStatUserOk(bozo_rxstat_userok);
1006 afsconf_SetNoAuthFlag(tdir, noAuth);
1007 afsconf_BuildServerSecurityObjects(tdir, 0, &securityClasses, &numClasses);
1009 /* Disable jumbograms */
1012 if (rxMaxMTU != -1) {
1013 rx_SetMaxMTU(rxMaxMTU);
1018 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1019 AFSDIR_SERVER_NETINFO_FILEPATH) {
1021 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1022 ADDRSPERSITE, reason,
1023 AFSDIR_SERVER_NETINFO_FILEPATH,
1024 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1027 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1030 host = SHostAddrs[0];
1033 tservice = rx_NewServiceHost(host, 0, /* service id */ 1,
1034 "bozo", securityClasses, numClasses,
1035 BOZO_ExecuteRequest);
1036 rx_SetMinProcs(tservice, 2);
1037 rx_SetMaxProcs(tservice, 4);
1038 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1039 if (rxkadDisableDotCheck) {
1040 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
1041 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
1045 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats",
1046 securityClasses, numClasses, RXSTATS_ExecuteRequest);
1047 rx_SetMinProcs(tservice, 2);
1048 rx_SetMaxProcs(tservice, 4);
1049 rx_StartServer(1); /* donate this process */
1054 bozo_Log(char *format, ...)
1060 va_start(ap, format);
1063 #ifndef AFS_NT40_ENV
1064 vsyslog(LOG_INFO, format, ap);
1068 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1071 /* log normally closed, so can be removed */
1073 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1074 if (bozo_logFile == NULL) {
1075 printf("bosserver: WARNING: problem with %s\n",
1076 AFSDIR_SERVER_BOZLOG_FILEPATH);
1077 printf("%s ", tdate);
1078 vprintf(format, ap);
1081 fprintf(bozo_logFile, "%s ", tdate);
1082 vfprintf(bozo_logFile, format, ap);
1084 /* close so rm BosLog works */
1085 fclose(bozo_logFile);