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 struct rx_securityClass *bozo_rxsc[3];
62 const char *bozo_fileName;
68 int DoSyslogFacility = LOG_DAEMON;
70 static afs_int32 nextRestart;
71 static afs_int32 nextDay;
73 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
76 int rxkadDisableDotCheck = 0;
78 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
79 afs_uint32 SHostAddrs[ADDRSPERSITE];
81 #ifdef BOS_RESTRICTED_MODE
82 int bozo_isrestricted = 0;
83 int bozo_restdisable = 0;
86 bozo_insecureme(int sig)
88 signal(SIGFPE, bozo_insecureme);
89 bozo_isrestricted = 0;
98 /* check whether caller is authorized to manage RX statistics */
100 bozo_rxstat_userok(struct rx_call *call)
102 return afsconf_SuperUser(bozo_confdir, call, NULL);
105 /* restart bozo process */
110 /* exit with restart code; SCM integrator process will restart bosserver */
111 int status = BOSEXIT_RESTART;
113 /* if noauth flag is set, pass "-noauth" to new bosserver */
114 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
115 status |= BOSEXIT_NOAUTH_FLAG;
117 /* if logging is on, pass "-log" to new bosserver */
119 status |= BOSEXIT_LOGGING_FLAG;
123 /* exec new bosserver process */
127 argv[i] = (char *)AFSDIR_SERVER_BOSVR_FILEPATH;
130 /* if noauth flag is set, pass "-noauth" to new bosserver */
131 if (afsconf_GetNoAuthFlag(bozo_confdir)) {
135 /* if logging is on, pass "-log" to new bosserver */
141 /* if syslog logging is on, pass "-syslog" to new bosserver */
143 char *arg = (char *)malloc(40); /* enough for -syslog=# */
144 if (DoSyslogFacility != LOG_DAEMON) {
145 snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
147 strcpy(arg, "-syslog");
154 /* null-terminate argument list */
157 /* close random fd's */
158 for (i = 3; i < 64; i++) {
162 execv(argv[0], argv); /* should not return */
164 #endif /* AFS_NT40_ENV */
167 /* make sure a dir exists */
169 MakeDir(const char *adir)
172 register afs_int32 code;
173 if (stat(adir, &tstat) < 0 || (tstat.st_mode & S_IFMT) != S_IFDIR) {
176 reqPerm = GetRequiredDirPerm(adir);
180 /* underlying filesystem may not support directory protection */
183 code = mkdir(adir, reqPerm);
190 /* create all the bozo dirs */
195 (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
196 strlen(AFSDIR_USR_DIRPATH)))
199 (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
200 strlen(AFSDIR_USR_DIRPATH)))) {
201 MakeDir(AFSDIR_USR_DIRPATH);
204 (AFSDIR_SERVER_AFS_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
205 strlen(AFSDIR_SERVER_AFS_DIRPATH))) {
206 MakeDir(AFSDIR_SERVER_AFS_DIRPATH);
208 MakeDir(AFSDIR_SERVER_BIN_DIRPATH);
209 MakeDir(AFSDIR_SERVER_ETC_DIRPATH);
210 MakeDir(AFSDIR_SERVER_LOCAL_DIRPATH);
211 MakeDir(AFSDIR_SERVER_DB_DIRPATH);
212 MakeDir(AFSDIR_SERVER_LOGS_DIRPATH);
215 (AFSDIR_CLIENT_VICE_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
216 strlen(AFSDIR_CLIENT_VICE_DIRPATH))) {
217 MakeDir(AFSDIR_CLIENT_VICE_DIRPATH);
219 MakeDir(AFSDIR_CLIENT_ETC_DIRPATH);
221 symlink(AFSDIR_SERVER_THISCELL_FILEPATH, AFSDIR_CLIENT_THISCELL_FILEPATH);
222 symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
223 AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
224 #endif /* AFS_NT40_ENV */
228 /* strip the \\n from the end of the line, if it is present */
230 StripLine(register char *abuffer)
234 tp = abuffer + strlen(abuffer); /* starts off pointing at the null */
236 return 0; /* null string, no last character to check */
237 tp--; /* aim at last character */
243 /* write one bnode's worth of entry into the file */
245 bzwrite(register struct bnode *abnode, void *arock)
247 register struct bztemp *at = (struct bztemp *)arock;
249 char tbuffer[BOZO_BSSIZE];
250 register afs_int32 code;
252 if (abnode->notifier)
253 fprintf(at->file, "bnode %s %s %d %s\n", abnode->type->name,
254 abnode->name, abnode->fileGoal, abnode->notifier);
256 fprintf(at->file, "bnode %s %s %d\n", abnode->type->name,
257 abnode->name, abnode->fileGoal);
259 code = bnode_GetParm(abnode, i, tbuffer, BOZO_BSSIZE);
265 fprintf(at->file, "parm %s\n", tbuffer);
267 fprintf(at->file, "end\n");
273 ReadBozoFile(char *aname)
275 register FILE *tfile;
276 char tbuffer[BOZO_BSSIZE];
278 char *instp, *typep, *notifier, *notp;
279 register afs_int32 code;
280 afs_int32 ktmask, ktday, kthour, ktmin, ktsec;
283 char *parms[MAXPARMS];
284 #ifdef BOS_RESTRICTED_MODE
288 /* rename BozoInit to BosServer for the user */
290 /* if BozoInit exists and BosConfig doesn't, try a rename */
291 if (access(AFSDIR_SERVER_BOZINIT_FILEPATH, 0) == 0
292 && access(AFSDIR_SERVER_BOZCONF_FILEPATH, 0) != 0) {
294 renamefile(AFSDIR_SERVER_BOZINIT_FILEPATH,
295 AFSDIR_SERVER_BOZCONF_FILEPATH);
297 perror("bosconfig rename");
299 if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
301 renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
302 AFSDIR_SERVER_BOZCONF_FILEPATH);
304 perror("bosconfig rename");
308 /* setup default times we want to do restarts */
309 bozo_nextRestartKT.mask = KTIME_HOUR | KTIME_MIN | KTIME_DAY;
310 bozo_nextRestartKT.hour = 4; /* 4 am */
311 bozo_nextRestartKT.min = 0;
312 bozo_nextRestartKT.day = 0; /* Sunday */
313 bozo_nextDayKT.mask = KTIME_HOUR | KTIME_MIN;
314 bozo_nextDayKT.hour = 5;
315 bozo_nextDayKT.min = 0;
317 for (code = 0; code < MAXPARMS; code++)
319 instp = typep = notifier = NULL;
322 aname = (char *)bozo_fileName;
323 tfile = fopen(aname, "r");
326 instp = (char *)malloc(BOZO_BSSIZE);
327 typep = (char *)malloc(BOZO_BSSIZE);
328 notifier = notp = (char *)malloc(BOZO_BSSIZE);
330 /* ok, read lines giving parms and such from the file */
331 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
333 break; /* all done */
335 if (strncmp(tbuffer, "restarttime", 11) == 0) {
337 sscanf(tbuffer, "restarttime %d %d %d %d %d", &ktmask, &ktday,
338 &kthour, &ktmin, &ktsec);
343 /* otherwise we've read in the proper ktime structure; now assign
344 * it and continue processing */
345 bozo_nextRestartKT.mask = ktmask;
346 bozo_nextRestartKT.day = ktday;
347 bozo_nextRestartKT.hour = kthour;
348 bozo_nextRestartKT.min = ktmin;
349 bozo_nextRestartKT.sec = ktsec;
353 if (strncmp(tbuffer, "checkbintime", 12) == 0) {
355 sscanf(tbuffer, "checkbintime %d %d %d %d %d", &ktmask,
356 &ktday, &kthour, &ktmin, &ktsec);
361 /* otherwise we've read in the proper ktime structure; now assign
362 * it and continue processing */
363 bozo_nextDayKT.mask = ktmask; /* time to restart the system */
364 bozo_nextDayKT.day = ktday;
365 bozo_nextDayKT.hour = kthour;
366 bozo_nextDayKT.min = ktmin;
367 bozo_nextDayKT.sec = ktsec;
370 #ifdef BOS_RESTRICTED_MODE
371 if (strncmp(tbuffer, "restrictmode", 12) == 0) {
372 code = sscanf(tbuffer, "restrictmode %d", &rmode);
377 if (rmode != 0 && rmode != 1) {
381 bozo_isrestricted = rmode;
386 if (strncmp("bnode", tbuffer, 5) != 0) {
392 sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
397 } else if (code == 3)
400 for (i = 0; i < MAXPARMS; i++) {
401 /* now read the parms, until we see an "end" line */
402 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
408 if (!strncmp(tbuffer, "end", 3))
410 if (strncmp(tbuffer, "parm ", 5)) {
412 goto fail; /* no "parm " either */
414 if (!parms[i]) /* make sure there's space */
415 parms[i] = (char *)malloc(BOZO_BSSIZE);
416 strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
419 /* ok, we have the type and parms, now create the object */
421 bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
422 parms[3], parms[4], notifier,
423 goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
427 /* bnode created in 'temporarily shutdown' state;
428 * check to see if we are supposed to run this guy,
429 * and if so, start the process up */
431 bnode_SetStat(tb, BSTAT_NORMAL); /* set goal, taking effect immediately */
433 bnode_SetStat(tb, BSTAT_SHUTDOWN);
444 for (i = 0; i < MAXPARMS; i++)
452 /* write a new bozo file */
454 WriteBozoFile(char *aname)
456 register FILE *tfile;
457 char tbuffer[AFSDIR_PATH_MAX];
458 register afs_int32 code;
462 aname = (char *)bozo_fileName;
463 strcpy(tbuffer, aname);
464 strcat(tbuffer, ".NBZ");
465 tfile = fopen(tbuffer, "w");
469 #ifdef BOS_RESTRICTED_MODE
470 fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
472 fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
473 bozo_nextRestartKT.day, bozo_nextRestartKT.hour,
474 bozo_nextRestartKT.min, bozo_nextRestartKT.sec);
475 fprintf(tfile, "checkbintime %d %d %d %d %d\n", bozo_nextDayKT.mask,
476 bozo_nextDayKT.day, bozo_nextDayKT.hour, bozo_nextDayKT.min,
478 code = bnode_ApplyInstance(bzwrite, &btemp);
479 if (code || (code = ferror(tfile))) { /* something went wrong */
484 /* close the file, check for errors and snap new file into place */
485 if (fclose(tfile) == EOF) {
489 code = renamefile(tbuffer, aname);
498 bdrestart(register struct bnode *abnode, void *arock)
500 register afs_int32 code;
502 if (abnode->fileGoal != BSTAT_NORMAL || abnode->goal != BSTAT_NORMAL)
503 return 0; /* don't restart stopped bnodes */
505 code = bnode_RestartP(abnode);
507 /* restart the dude */
508 bnode_SetStat(abnode, BSTAT_SHUTDOWN);
509 bnode_WaitStatus(abnode, BSTAT_SHUTDOWN);
510 bnode_SetStat(abnode, BSTAT_NORMAL);
512 bnode_Release(abnode);
513 return 0; /* keep trying all bnodes */
516 #define BOZO_MINSKIP 3600 /* minimum to advance clock */
517 /* lwp to handle system restarts */
519 BozoDaemon(void *unused)
521 register afs_int32 now;
523 /* now initialize the values */
527 now = FT_ApproxTime();
529 #ifdef BOS_RESTRICTED_MODE
530 if (bozo_restdisable) {
531 bozo_Log("Restricted mode disabled by signal\n");
532 bozo_restdisable = 0;
535 if (bozo_newKTs) { /* need to recompute restart times */
536 bozo_newKTs = 0; /* done for a while */
537 nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
538 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
541 /* see if we should do a restart */
542 if (now > nextRestart) {
543 SBOZO_ReBozo(0); /* doesn't come back */
546 /* see if we should restart a server */
548 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
550 /* call the bnode restartp function, and restart all that require it */
551 bnode_ApplyInstance(bdrestart, 0);
563 int s, sb_max, ipfragttl;
567 f = popen("/usr/sbin/no -o sb_max", "r");
568 s = fscanf(f, "sb_max = %d", &sb_max);
572 f = popen("/usr/sbin/no -o ipfragttl", "r");
573 s = fscanf(f, "ipfragttl = %d", &ipfragttl);
583 sprintf(c, "/usr/sbin/no -o sb_max=%d -o ipfragttl=%d", sb_max,
592 * This routine causes the calling process to go into the background and
593 * to lose its controlling tty.
595 * It does not close or otherwise alter the standard file descriptors.
597 * It writes warning messages to the standard error output if certain
598 * fundamental errors occur.
600 * This routine requires
602 * #include <sys/types.h>
603 * #include <sys/stat.h>
605 * #include <unistd.h>
606 * #include <stdlib.h>
608 * and has been tested on:
624 * A process is a process group leader if its process ID
625 * (getpid()) and its process group ID (getpgrp()) are the same.
629 * To create a new session (and thereby lose our controlling
630 * terminal) we cannot be a process group leader.
632 * To guarantee we are not a process group leader, we fork and
633 * let the parent process exit.
636 if (getpid() == getpgrp()) {
641 abort(); /* leave footprints */
645 default: /* parent */
652 * By here, we are not a process group leader, so we can make a
653 * new session and become the session leader.
657 pid_t sid = setsid();
660 static char err[] = "bosserver: WARNING: setsid() failed\n";
661 write(STDERR_FILENO, err, sizeof err - 1);
666 * Once we create a new session, the current process is a
667 * session leader without a controlling tty.
669 * On some systems, the first tty device the session leader
670 * opens automatically becomes the controlling tty for the
673 * So, to guarantee we do not acquire a controlling tty, we fork
674 * and let the parent process exit. The child process is not a
675 * session leader, and so it will not acquire a controlling tty
676 * even if it should happen to open a tty device.
679 if (getpid() == getpgrp()) {
684 abort(); /* leave footprints */
688 default: /* parent */
695 * check that we no longer have a controlling tty
701 fd = open("/dev/tty", O_RDONLY);
705 "bosserver: WARNING: /dev/tty still attached\n";
707 write(STDERR_FILENO, err, sizeof err - 1);
711 #endif /* ! AFS_NT40_ENV */
714 /* start a process and monitor it */
716 #include "AFS_component_version_number.c"
719 main(int argc, char **argv, char **envp)
721 struct rx_service *tservice;
722 register afs_int32 code;
723 struct afsconf_dir *tdir;
726 char namebuf[AFSDIR_PATH_MAX];
728 afs_uint32 host = htonl(INADDR_ANY);
729 char *auditFileName = NULL;
735 struct sigaction nsa;
737 /* for some reason, this permits user-mode RX to run a lot faster.
738 * we do it here in the bosserver, so we don't have to do it
739 * individually in each server.
744 * The following signal action for AIX is necessary so that in case of a
745 * crash (i.e. core is generated) we can include the user's data section
746 * in the core dump. Unfortunately, by default, only a partial core is
747 * generated which, in many cases, isn't too useful.
749 sigemptyset(&nsa.sa_mask);
750 nsa.sa_handler = SIG_DFL;
751 nsa.sa_flags = SA_FULLDUMP;
752 sigaction(SIGSEGV, &nsa, NULL);
753 sigaction(SIGABRT, &nsa, NULL);
756 #ifdef BOS_RESTRICTED_MODE
757 signal(SIGFPE, bozo_insecureme);
761 /* Initialize winsock */
762 if (afs_winsockInit() < 0) {
763 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
764 fprintf(stderr, "%s: Couldn't initialize winsock.\n", argv[0]);
769 /* Initialize dirpaths */
770 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
772 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
774 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
779 /* some path inits */
780 bozo_fileName = AFSDIR_SERVER_BOZCONF_FILEPATH;
782 /* initialize the list of dirpaths that the bosserver has
783 * an interest in monitoring */
786 #if defined(AFS_SGI_ENV)
787 /* offer some protection if AFS isn't loaded */
788 if (syscall(AFS_SYSCALL, AFSOP_ENDLOG) < 0 && errno == ENOPKG) {
789 printf("bosserver: AFS doesn't appear to be configured in O.S..\n");
795 for (code = 1; code < argc; code++) {
796 if (strcmp(argv[code], "-noauth") == 0) {
797 /* set noauth flag */
799 } else if (strcmp(argv[code], "-log") == 0) {
800 /* set extra logging flag */
804 else if (strcmp(argv[code], "-syslog") == 0) {
805 /* set syslog logging flag */
807 } else if (strncmp(argv[code], "-syslog=", 8) == 0) {
809 DoSyslogFacility = atoi(argv[code] + 8);
810 } else if (strcmp(argv[code], "-nofork") == 0) {
814 else if (strcmp(argv[code], "-enable_peer_stats") == 0) {
815 rx_enablePeerRPCStats();
816 } else if (strcmp(argv[code], "-enable_process_stats") == 0) {
817 rx_enableProcessRPCStats();
819 #ifdef BOS_RESTRICTED_MODE
820 else if (strcmp(argv[code], "-restricted") == 0) {
821 bozo_isrestricted = 1;
824 else if (strcmp(argv[code], "-rxbind") == 0) {
827 else if (strcmp(argv[code], "-allow-dotted-principals") == 0) {
828 rxkadDisableDotCheck = 1;
830 else if (!strcmp(argv[code], "-rxmaxmtu")) {
831 if ((code + 1) >= argc) {
832 fprintf(stderr, "missing argument for -rxmaxmtu\n");
835 rxMaxMTU = atoi(argv[++code]);
836 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
837 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
838 printf("rxMaxMTU %d invalid; must be between %d-%lu\n",
839 rxMaxMTU, RX_MIN_PACKET_SIZE,
840 RX_MAX_PACKET_DATA_SIZE);
844 else if (strcmp(argv[code], "-auditlog") == 0) {
845 auditFileName = argv[++code];
847 } else if (strcmp(argv[code], "-audit-interface") == 0) {
848 char *interface = argv[++code];
850 if (osi_audit_interface(interface)) {
851 printf("Invalid audit interface '%s'\n", interface);
857 /* hack to support help flag */
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 "[-syslog[=FACILITY]] "
865 "[-enable_peer_stats] [-enable_process_stats] "
866 "[-nofork] " "[-help]\n");
868 printf("Usage: bosserver [-noauth] [-log] "
869 "[-auditlog <log path>] "
870 "[-audit-interafce <file|sysvmq> (default is file)] "
871 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
872 "[-enable_peer_stats] [-enable_process_stats] "
881 osi_audit_file(auditFileName);
885 if (geteuid() != 0) {
886 printf("bosserver: must be run as root.\n");
893 printf("bosserver: could not init bnode package, code %d\n", code);
897 bnode_Register("fs", &fsbnode_ops, 3);
898 bnode_Register("dafs", &dafsbnode_ops, 4);
899 bnode_Register("simple", &ezbnode_ops, 1);
900 bnode_Register("cron", &cronbnode_ops, 2);
902 /* create useful dirs */
905 /* chdir to AFS log directory */
906 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
909 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
913 /* go into the background and remove our controlling tty, close open
920 #endif /* ! AFS_NT40_ENV */
924 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
925 !(S_ISFIFO(sb.st_mode)))
928 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
929 strcat(namebuf, ".old");
930 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
931 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
933 printf("bosserver: can't initialize log file (%s).\n",
934 AFSDIR_SERVER_BOZLOG_FILEPATH);
937 /* keep log closed normally, so can be removed */
938 fclose(bozo_logFile);
941 openlog("bosserver", LOG_PID, DoSyslogFacility);
945 /* Write current state of directory permissions to log file */
948 for (i = 0; i < 10; i++) {
949 code = rx_Init(htons(AFSCONF_NANNYPORT));
951 bozo_Log("can't initialize rx: code=%d\n", code);
957 bozo_Log("Bos giving up, can't initialize rx\n");
961 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
962 /* param */ NULL , "bozo-the-clown",
965 /* try to read the key from the config file */
966 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
968 /* try to create local cell config file */
969 struct afsconf_cell tcell;
970 strcpy(tcell.name, "localcell");
971 tcell.numServers = 1;
972 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
974 bozo_Log("failed to get hostname, code %d\n", errno);
977 if (tcell.hostName[0][0] == 0) {
978 bozo_Log("host name not set, can't start\n");
979 bozo_Log("try the 'hostname' command\n");
982 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
984 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
988 ("could not create cell database in '%s' (code %d), quitting\n",
989 AFSDIR_SERVER_ETC_DIRPATH, code);
992 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
995 ("failed to open newly-created cell database, quitting\n");
1000 /* read init file, starting up programs */
1001 if ((code = ReadBozoFile(0))) {
1003 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
1004 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
1008 /* opened the cell databse */
1009 bozo_confdir = tdir;
1011 /* allow super users to manage RX statistics */
1012 rx_SetRxStatUserOk(bozo_rxstat_userok);
1014 /* have bcrypt key now */
1016 afsconf_SetNoAuthFlag(tdir, noAuth);
1018 bozo_rxsc[0] = rxnull_NewServerSecurityObject();
1019 bozo_rxsc[1] = (struct rx_securityClass *)0;
1021 rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
1023 /* Disable jumbograms */
1026 if (rxMaxMTU != -1) {
1027 rx_SetMaxMTU(rxMaxMTU);
1032 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1033 AFSDIR_SERVER_NETINFO_FILEPATH) {
1035 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1036 ADDRSPERSITE, reason,
1037 AFSDIR_SERVER_NETINFO_FILEPATH,
1038 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1041 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1044 host = SHostAddrs[0];
1047 tservice = rx_NewServiceHost(host, /* port */ 0, /* service id */ 1,
1048 /*service name */ "bozo",
1049 /* security classes */
1051 /* numb sec classes */ 3, BOZO_ExecuteRequest);
1052 rx_SetMinProcs(tservice, 2);
1053 rx_SetMaxProcs(tservice, 4);
1054 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1055 if (rxkadDisableDotCheck) {
1056 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
1057 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
1061 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
1062 3, RXSTATS_ExecuteRequest);
1063 rx_SetMinProcs(tservice, 2);
1064 rx_SetMaxProcs(tservice, 4);
1065 rx_StartServer(1); /* donate this process */
1070 bozo_Log(char *format, ...)
1076 va_start(ap, format);
1079 #ifndef AFS_NT40_ENV
1080 vsyslog(LOG_INFO, format, ap);
1084 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1087 /* log normally closed, so can be removed */
1089 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1090 if (bozo_logFile == NULL) {
1091 printf("bosserver: WARNING: problem with %s\n",
1092 AFSDIR_SERVER_BOZLOG_FILEPATH);
1093 printf("%s ", tdate);
1094 vprintf(format, ap);
1097 fprintf(bozo_logFile, "%s ", tdate);
1098 vfprintf(bozo_logFile, format, ap);
1100 /* close so rm BosLog works */
1101 fclose(bozo_logFile);