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"
43 #include <rx/rxstat.h>
44 #include <rxstat/rxstat_prototypes.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 #ifdef BOS_NEW_CONFIG
300 if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
302 renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
303 AFSDIR_SERVER_BOZCONF_FILEPATH);
305 perror("bosconfig rename");
310 /* setup default times we want to do restarts */
311 bozo_nextRestartKT.mask = KTIME_HOUR | KTIME_MIN | KTIME_DAY;
312 bozo_nextRestartKT.hour = 4; /* 4 am */
313 bozo_nextRestartKT.min = 0;
314 bozo_nextRestartKT.day = 0; /* Sunday */
315 bozo_nextDayKT.mask = KTIME_HOUR | KTIME_MIN;
316 bozo_nextDayKT.hour = 5;
317 bozo_nextDayKT.min = 0;
319 for (code = 0; code < MAXPARMS; code++)
321 instp = typep = notifier = NULL;
324 aname = (char *)bozo_fileName;
325 tfile = fopen(aname, "r");
328 instp = (char *)malloc(BOZO_BSSIZE);
329 typep = (char *)malloc(BOZO_BSSIZE);
330 notifier = notp = (char *)malloc(BOZO_BSSIZE);
332 /* ok, read lines giving parms and such from the file */
333 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
335 break; /* all done */
337 if (strncmp(tbuffer, "restarttime", 11) == 0) {
339 sscanf(tbuffer, "restarttime %d %d %d %d %d", &ktmask, &ktday,
340 &kthour, &ktmin, &ktsec);
345 /* otherwise we've read in the proper ktime structure; now assign
346 * it and continue processing */
347 bozo_nextRestartKT.mask = ktmask;
348 bozo_nextRestartKT.day = ktday;
349 bozo_nextRestartKT.hour = kthour;
350 bozo_nextRestartKT.min = ktmin;
351 bozo_nextRestartKT.sec = ktsec;
355 if (strncmp(tbuffer, "checkbintime", 12) == 0) {
357 sscanf(tbuffer, "checkbintime %d %d %d %d %d", &ktmask,
358 &ktday, &kthour, &ktmin, &ktsec);
363 /* otherwise we've read in the proper ktime structure; now assign
364 * it and continue processing */
365 bozo_nextDayKT.mask = ktmask; /* time to restart the system */
366 bozo_nextDayKT.day = ktday;
367 bozo_nextDayKT.hour = kthour;
368 bozo_nextDayKT.min = ktmin;
369 bozo_nextDayKT.sec = ktsec;
372 #ifdef BOS_RESTRICTED_MODE
373 if (strncmp(tbuffer, "restrictmode", 12) == 0) {
374 code = sscanf(tbuffer, "restrictmode %d", &rmode);
379 if (rmode != 0 && rmode != 1) {
383 bozo_isrestricted = rmode;
388 if (strncmp("bnode", tbuffer, 5) != 0) {
394 sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
399 } else if (code == 3)
402 for (i = 0; i < MAXPARMS; i++) {
403 /* now read the parms, until we see an "end" line */
404 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
410 if (!strncmp(tbuffer, "end", 3))
412 if (strncmp(tbuffer, "parm ", 5)) {
414 goto fail; /* no "parm " either */
416 if (!parms[i]) /* make sure there's space */
417 parms[i] = (char *)malloc(BOZO_BSSIZE);
418 strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
421 /* ok, we have the type and parms, now create the object */
423 bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
424 parms[3], parms[4], notifier,
425 goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
429 /* bnode created in 'temporarily shutdown' state;
430 * check to see if we are supposed to run this guy,
431 * and if so, start the process up */
433 bnode_SetStat(tb, BSTAT_NORMAL); /* set goal, taking effect immediately */
435 bnode_SetStat(tb, BSTAT_SHUTDOWN);
446 for (i = 0; i < MAXPARMS; i++)
454 /* write a new bozo file */
456 WriteBozoFile(char *aname)
458 register FILE *tfile;
459 char tbuffer[AFSDIR_PATH_MAX];
460 register afs_int32 code;
464 aname = (char *)bozo_fileName;
465 strcpy(tbuffer, aname);
466 strcat(tbuffer, ".NBZ");
467 tfile = fopen(tbuffer, "w");
471 #ifdef BOS_RESTRICTED_MODE
472 fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
474 fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
475 bozo_nextRestartKT.day, bozo_nextRestartKT.hour,
476 bozo_nextRestartKT.min, bozo_nextRestartKT.sec);
477 fprintf(tfile, "checkbintime %d %d %d %d %d\n", bozo_nextDayKT.mask,
478 bozo_nextDayKT.day, bozo_nextDayKT.hour, bozo_nextDayKT.min,
480 code = bnode_ApplyInstance(bzwrite, &btemp);
481 if (code || (code = ferror(tfile))) { /* something went wrong */
486 /* close the file, check for errors and snap new file into place */
487 if (fclose(tfile) == EOF) {
491 code = renamefile(tbuffer, aname);
500 bdrestart(register struct bnode *abnode, void *arock)
502 register afs_int32 code;
504 if (abnode->fileGoal != BSTAT_NORMAL || abnode->goal != BSTAT_NORMAL)
505 return 0; /* don't restart stopped bnodes */
507 code = bnode_RestartP(abnode);
509 /* restart the dude */
510 bnode_SetStat(abnode, BSTAT_SHUTDOWN);
511 bnode_WaitStatus(abnode, BSTAT_SHUTDOWN);
512 bnode_SetStat(abnode, BSTAT_NORMAL);
514 bnode_Release(abnode);
515 return 0; /* keep trying all bnodes */
518 #define BOZO_MINSKIP 3600 /* minimum to advance clock */
519 /* lwp to handle system restarts */
521 BozoDaemon(void *unused)
523 register afs_int32 now;
525 /* now initialize the values */
529 now = FT_ApproxTime();
531 #ifdef BOS_RESTRICTED_MODE
532 if (bozo_restdisable) {
533 bozo_Log("Restricted mode disabled by signal\n");
534 bozo_restdisable = 0;
537 if (bozo_newKTs) { /* need to recompute restart times */
538 bozo_newKTs = 0; /* done for a while */
539 nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
540 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
543 /* see if we should do a restart */
544 if (now > nextRestart) {
545 SBOZO_ReBozo(0); /* doesn't come back */
548 /* see if we should restart a server */
550 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
552 /* call the bnode restartp function, and restart all that require it */
553 bnode_ApplyInstance(bdrestart, 0);
565 int s, sb_max, ipfragttl;
569 f = popen("/usr/sbin/no -o sb_max", "r");
570 s = fscanf(f, "sb_max = %d", &sb_max);
574 f = popen("/usr/sbin/no -o ipfragttl", "r");
575 s = fscanf(f, "ipfragttl = %d", &ipfragttl);
585 sprintf(c, "/usr/sbin/no -o sb_max=%d -o ipfragttl=%d", sb_max,
594 * This routine causes the calling process to go into the background and
595 * to lose its controlling tty.
597 * It does not close or otherwise alter the standard file descriptors.
599 * It writes warning messages to the standard error output if certain
600 * fundamental errors occur.
602 * This routine requires
604 * #include <sys/types.h>
605 * #include <sys/stat.h>
607 * #include <unistd.h>
608 * #include <stdlib.h>
610 * and has been tested on:
626 * A process is a process group leader if its process ID
627 * (getpid()) and its process group ID (getpgrp()) are the same.
631 * To create a new session (and thereby lose our controlling
632 * terminal) we cannot be a process group leader.
634 * To guarantee we are not a process group leader, we fork and
635 * let the parent process exit.
638 if (getpid() == getpgrp()) {
643 abort(); /* leave footprints */
647 default: /* parent */
654 * By here, we are not a process group leader, so we can make a
655 * new session and become the session leader.
659 pid_t sid = setsid();
662 static char err[] = "bosserver: WARNING: setsid() failed\n";
663 write(STDERR_FILENO, err, sizeof err - 1);
668 * Once we create a new session, the current process is a
669 * session leader without a controlling tty.
671 * On some systems, the first tty device the session leader
672 * opens automatically becomes the controlling tty for the
675 * So, to guarantee we do not acquire a controlling tty, we fork
676 * and let the parent process exit. The child process is not a
677 * session leader, and so it will not acquire a controlling tty
678 * even if it should happen to open a tty device.
681 if (getpid() == getpgrp()) {
686 abort(); /* leave footprints */
690 default: /* parent */
697 * check that we no longer have a controlling tty
703 fd = open("/dev/tty", O_RDONLY);
707 "bosserver: WARNING: /dev/tty still attached\n";
709 write(STDERR_FILENO, err, sizeof err - 1);
713 #endif /* ! AFS_NT40_ENV */
716 /* start a process and monitor it */
718 #include "AFS_component_version_number.c"
721 main(int argc, char **argv, char **envp)
723 struct rx_service *tservice;
724 register afs_int32 code;
725 struct afsconf_dir *tdir;
728 char namebuf[AFSDIR_PATH_MAX];
730 afs_uint32 host = htonl(INADDR_ANY);
736 struct sigaction nsa;
738 /* for some reason, this permits user-mode RX to run a lot faster.
739 * we do it here in the bosserver, so we don't have to do it
740 * individually in each server.
745 * The following signal action for AIX is necessary so that in case of a
746 * crash (i.e. core is generated) we can include the user's data section
747 * in the core dump. Unfortunately, by default, only a partial core is
748 * generated which, in many cases, isn't too useful.
750 sigemptyset(&nsa.sa_mask);
751 nsa.sa_handler = SIG_DFL;
752 nsa.sa_flags = SA_FULLDUMP;
753 sigaction(SIGSEGV, &nsa, NULL);
754 sigaction(SIGABRT, &nsa, NULL);
757 #ifdef BOS_RESTRICTED_MODE
758 signal(SIGFPE, bozo_insecureme);
762 /* Initialize winsock */
763 if (afs_winsockInit() < 0) {
764 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
765 fprintf(stderr, "%s: Couldn't initialize winsock.\n", argv[0]);
770 /* Initialize dirpaths */
771 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
773 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
775 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
780 /* some path inits */
781 bozo_fileName = AFSDIR_SERVER_BOZCONF_FILEPATH;
783 /* initialize the list of dirpaths that the bosserver has
784 * an interest in monitoring */
787 #if defined(AFS_SGI_ENV)
788 /* offer some protection if AFS isn't loaded */
789 if (syscall(AFS_SYSCALL, AFSOP_ENDLOG) < 0 && errno == ENOPKG) {
790 printf("bosserver: AFS doesn't appear to be configured in O.S..\n");
796 for (code = 1; code < argc; code++) {
797 if (strcmp(argv[code], "-noauth") == 0) {
798 /* set noauth flag */
800 } else if (strcmp(argv[code], "-log") == 0) {
801 /* set extra logging flag */
805 else if (strcmp(argv[code], "-syslog") == 0) {
806 /* set syslog logging flag */
808 } else if (strncmp(argv[code], "-syslog=", 8) == 0) {
810 DoSyslogFacility = atoi(argv[code] + 8);
811 } else if (strcmp(argv[code], "-nofork") == 0) {
815 else if (strcmp(argv[code], "-enable_peer_stats") == 0) {
816 rx_enablePeerRPCStats();
817 } else if (strcmp(argv[code], "-enable_process_stats") == 0) {
818 rx_enableProcessRPCStats();
820 #ifdef BOS_RESTRICTED_MODE
821 else if (strcmp(argv[code], "-restricted") == 0) {
822 bozo_isrestricted = 1;
825 else if (strcmp(argv[code], "-rxbind") == 0) {
828 else if (strcmp(argv[code], "-allow-dotted-principals") == 0) {
829 rxkadDisableDotCheck = 1;
831 else if (!strcmp(argv[code], "-rxmaxmtu")) {
832 if ((code + 1) >= argc) {
833 fprintf(stderr, "missing argument for -rxmaxmtu\n");
836 rxMaxMTU = atoi(argv[++code]);
837 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
838 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
839 printf("rxMaxMTU %d invalid; must be between %d-%lu\n",
840 rxMaxMTU, RX_MIN_PACKET_SIZE,
841 RX_MAX_PACKET_DATA_SIZE);
845 else if (strcmp(argv[code], "-auditlog") == 0) {
846 char *fileName = argv[++code];
848 osi_audit_file(fileName);
852 /* hack to support help flag */
855 printf("Usage: bosserver [-noauth] [-log] "
856 "[-auditlog <log path>] "
857 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
858 "[-syslog[=FACILITY]] "
859 "[-enable_peer_stats] [-enable_process_stats] "
860 "[-nofork] " "[-help]\n");
862 printf("Usage: bosserver [-noauth] [-log] "
863 "[-auditlog <log path>] "
864 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
865 "[-enable_peer_stats] [-enable_process_stats] "
875 if (geteuid() != 0) {
876 printf("bosserver: must be run as root.\n");
883 printf("bosserver: could not init bnode package, code %d\n", code);
887 bnode_Register("fs", &fsbnode_ops, 3);
888 bnode_Register("dafs", &dafsbnode_ops, 4);
889 bnode_Register("simple", &ezbnode_ops, 1);
890 bnode_Register("cron", &cronbnode_ops, 2);
892 /* create useful dirs */
895 /* chdir to AFS log directory */
896 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
899 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
903 /* go into the background and remove our controlling tty, close open
910 #endif /* ! AFS_NT40_ENV */
914 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
915 !(S_ISFIFO(sb.st_mode)))
918 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
919 strcat(namebuf, ".old");
920 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
921 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
923 printf("bosserver: can't initialize log file (%s).\n",
924 AFSDIR_SERVER_BOZLOG_FILEPATH);
927 /* keep log closed normally, so can be removed */
928 fclose(bozo_logFile);
931 openlog("bosserver", LOG_PID, DoSyslogFacility);
935 /* Write current state of directory permissions to log file */
938 for (i = 0; i < 10; i++) {
939 code = rx_Init(htons(AFSCONF_NANNYPORT));
941 bozo_Log("can't initialize rx: code=%d\n", code);
947 bozo_Log("Bos giving up, can't initialize rx\n");
951 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
952 /* param */ NULL , "bozo-the-clown",
955 /* try to read the key from the config file */
956 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
958 /* try to create local cell config file */
959 struct afsconf_cell tcell;
960 strcpy(tcell.name, "localcell");
961 tcell.numServers = 1;
962 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
964 bozo_Log("failed to get hostname, code %d\n", errno);
967 if (tcell.hostName[0][0] == 0) {
968 bozo_Log("host name not set, can't start\n");
969 bozo_Log("try the 'hostname' command\n");
972 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
974 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
978 ("could not create cell database in '%s' (code %d), quitting\n",
979 AFSDIR_SERVER_ETC_DIRPATH, code);
982 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
985 ("failed to open newly-created cell database, quitting\n");
990 /* read init file, starting up programs */
991 if ((code = ReadBozoFile(0))) {
993 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
994 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
998 /* opened the cell databse */
1001 /* allow super users to manage RX statistics */
1002 rx_SetRxStatUserOk(bozo_rxstat_userok);
1004 /* have bcrypt key now */
1006 afsconf_SetNoAuthFlag(tdir, noAuth);
1008 bozo_rxsc[0] = rxnull_NewServerSecurityObject();
1009 bozo_rxsc[1] = (struct rx_securityClass *)0;
1011 rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
1013 /* Disable jumbograms */
1016 if (rxMaxMTU != -1) {
1017 rx_SetMaxMTU(rxMaxMTU);
1022 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1023 AFSDIR_SERVER_NETINFO_FILEPATH) {
1025 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1026 ADDRSPERSITE, reason,
1027 AFSDIR_SERVER_NETINFO_FILEPATH,
1028 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1031 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1034 host = SHostAddrs[0];
1037 tservice = rx_NewServiceHost(host, /* port */ 0, /* service id */ 1,
1038 /*service name */ "bozo",
1039 /* security classes */
1041 /* numb sec classes */ 3, BOZO_ExecuteRequest);
1042 rx_SetMinProcs(tservice, 2);
1043 rx_SetMaxProcs(tservice, 4);
1044 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1045 if (rxkadDisableDotCheck) {
1046 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
1047 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
1051 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
1052 3, RXSTATS_ExecuteRequest);
1053 rx_SetMinProcs(tservice, 2);
1054 rx_SetMaxProcs(tservice, 4);
1055 rx_StartServer(1); /* donate this process */
1060 bozo_Log(char *format, ...)
1066 va_start(ap, format);
1069 #ifndef AFS_NT40_ENV
1070 vsyslog(LOG_INFO, format, ap);
1074 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1077 /* log normally closed, so can be removed */
1079 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1080 if (bozo_logFile == NULL) {
1081 printf("bosserver: WARNING: problem with %s\n",
1082 AFSDIR_SERVER_BOZLOG_FILEPATH);
1083 printf("%s ", tdate);
1084 vprintf(format, ap);
1087 fprintf(bozo_logFile, "%s ", tdate);
1088 vfprintf(bozo_logFile, format, ap);
1090 /* close so rm BosLog works */
1091 fclose(bozo_logFile);