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>
29 #include <WINNT/afsevent.h>
32 #include <netinet/in.h>
34 #endif /* AFS_NT40_ENV */
35 #include <afs/cellconfig.h>
38 #include <rx/rx_globals.h>
41 #include "bosprototypes.h"
44 #include <afs/ktime.h>
45 #include <afs/afsutil.h>
46 #include <afs/fileutil.h>
47 #include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
48 #if defined(AFS_SGI_ENV)
49 #include <afs/afs_args.h>
52 #define BOZO_LWP_STACKSIZE 16000
53 extern int BOZO_ExecuteRequest();
54 extern int RXSTATS_ExecuteRequest();
55 extern struct bnode_ops fsbnode_ops, dafsbnode_ops, ezbnode_ops, cronbnode_ops;
57 struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
58 static PROCESS bozo_pid;
59 struct rx_securityClass *bozo_rxsc[3];
60 const char *bozo_fileName;
66 int DoSyslogFacility = LOG_DAEMON;
68 static afs_int32 nextRestart;
69 static afs_int32 nextDay;
71 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
74 int rxkadDisableDotCheck = 0;
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[code], "-allow-dotted-principals") == 0) {
825 rxkadDisableDotCheck = 1;
827 else if (!strcmp(argv[i], "-rxmaxmtu")) {
828 if ((i + 1) >= argc) {
829 fprintf(stderr, "missing argument for -rxmaxmtu\n");
832 rxMaxMTU = atoi(argv[++i]);
833 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
834 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
835 printf("rxMaxMTU %d% invalid; must be between %d-%d\n",
836 rxMaxMTU, RX_MIN_PACKET_SIZE,
837 RX_MAX_PACKET_DATA_SIZE);
841 else if (strcmp(argv[code], "-auditlog") == 0) {
844 char oldName[MAXPATHLEN];
845 char *fileName = argv[++code];
850 if ((lstat(fileName, &statbuf) == 0)
851 && (S_ISFIFO(statbuf.st_mode))) {
852 flags = O_WRONLY | O_NONBLOCK;
856 strcpy(oldName, fileName);
857 strcat(oldName, ".old");
858 renamefile(fileName, oldName);
859 flags = O_WRONLY | O_TRUNC | O_CREAT;
861 tempfd = open(fileName, flags, 0666);
863 auditout = fdopen(tempfd, "a");
865 osi_audit_file(auditout);
867 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
869 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
873 /* hack to support help flag */
876 printf("Usage: bosserver [-noauth] [-log] "
877 "[-auditlog <log path>] "
878 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
879 "[-syslog[=FACILITY]] "
880 "[-enable_peer_stats] [-enable_process_stats] "
881 "[-nofork] " "[-help]\n");
883 printf("Usage: bosserver [-noauth] [-log] "
884 "[-auditlog <log path>] "
885 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
886 "[-enable_peer_stats] [-enable_process_stats] "
896 if (geteuid() != 0) {
897 printf("bosserver: must be run as root.\n");
904 printf("bosserver: could not init bnode package, code %d\n", code);
908 bnode_Register("fs", &fsbnode_ops, 3);
909 bnode_Register("dafs", &dafsbnode_ops, 4);
910 bnode_Register("simple", &ezbnode_ops, 1);
911 bnode_Register("cron", &cronbnode_ops, 2);
913 /* create useful dirs */
916 /* chdir to AFS log directory */
917 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
920 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
924 /* go into the background and remove our controlling tty, close open
931 #endif /* ! AFS_NT40_ENV */
935 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
936 !(S_ISFIFO(sb.st_mode)))
939 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
940 strcat(namebuf, ".old");
941 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
942 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
944 printf("bosserver: can't initialize log file (%s).\n",
945 AFSDIR_SERVER_BOZLOG_FILEPATH);
948 /* keep log closed normally, so can be removed */
949 fclose(bozo_logFile);
952 openlog("bosserver", LOG_PID, DoSyslogFacility);
956 /* Write current state of directory permissions to log file */
959 for (i = 0; i < 10; i++) {
960 code = rx_Init(htons(AFSCONF_NANNYPORT));
962 bozo_Log("can't initialize rx: code=%d\n", code);
968 bozo_Log("Bos giving up, can't initialize rx\n");
972 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
973 (void *) /*parm */ 0, "bozo-the-clown",
976 /* try to read the key from the config file */
977 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
979 /* try to create local cell config file */
980 struct afsconf_cell tcell;
981 strcpy(tcell.name, "localcell");
982 tcell.numServers = 1;
983 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
985 bozo_Log("failed to get hostname, code %d\n", errno);
988 if (tcell.hostName[0][0] == 0) {
989 bozo_Log("host name not set, can't start\n");
990 bozo_Log("try the 'hostname' command\n");
993 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
995 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
999 ("could not create cell database in '%s' (code %d), quitting\n",
1000 AFSDIR_SERVER_ETC_DIRPATH, code);
1003 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
1006 ("failed to open newly-created cell database, quitting\n");
1011 /* read init file, starting up programs */
1012 if (code = ReadBozoFile(0)) {
1014 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
1015 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
1019 /* opened the cell databse */
1020 bozo_confdir = tdir;
1022 /* allow super users to manage RX statistics */
1023 rx_SetRxStatUserOk(bozo_rxstat_userok);
1025 /* have bcrypt key now */
1027 afsconf_SetNoAuthFlag(tdir, noAuth);
1029 bozo_rxsc[0] = rxnull_NewServerSecurityObject();
1030 bozo_rxsc[1] = (struct rx_securityClass *)0;
1032 rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
1034 /* Disable jumbograms */
1037 if (rxMaxMTU != -1) {
1038 rx_SetMaxMTU(rxMaxMTU);
1043 #ifndef AFS_NT40_ENV
1044 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1045 AFSDIR_SERVER_NETINFO_FILEPATH) {
1047 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1048 ADDRSPERSITE, reason,
1049 AFSDIR_SERVER_NETINFO_FILEPATH,
1050 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1054 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1057 host = SHostAddrs[0];
1060 tservice = rx_NewServiceHost(host, /* port */ 0, /* service id */ 1,
1061 /*service name */ "bozo",
1062 /* security classes */
1064 /* numb sec classes */ 3, BOZO_ExecuteRequest);
1065 rx_SetMinProcs(tservice, 2);
1066 rx_SetMaxProcs(tservice, 4);
1067 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1068 if (rxkadDisableDotCheck) {
1069 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
1070 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK,
1075 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
1076 3, RXSTATS_ExecuteRequest);
1077 rx_SetMinProcs(tservice, 2);
1078 rx_SetMaxProcs(tservice, 4);
1079 rx_StartServer(1); /* donate this process */
1084 bozo_Log(char *format, ...)
1090 va_start(ap, format);
1093 #ifndef AFS_NT40_ENV
1094 vsyslog(LOG_INFO, format, ap);
1098 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1101 /* log normally closed, so can be removed */
1103 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1104 if (bozo_logFile == NULL) {
1105 printf("bosserver: WARNING: problem with %s\n",
1106 AFSDIR_SERVER_BOZLOG_FILEPATH);
1107 printf("%s ", tdate);
1108 vprintf(format, ap);
1111 fprintf(bozo_logFile, "%s ", tdate);
1112 vfprintf(bozo_logFile, format, ap);
1114 /* close so rm BosLog works */
1115 fclose(bozo_logFile);