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>
15 #include <sys/types.h>
27 #include <WINNT/afsevent.h>
30 #include <netinet/in.h>
32 #endif /* AFS_NT40_ENV */
33 #include <afs/cellconfig.h>
36 #include <rx/rx_globals.h>
39 #include "bosprototypes.h"
41 #include <rx/rxstat.h>
43 #include <afs/ktime.h>
44 #include <afs/afsutil.h>
45 #include <afs/fileutil.h>
46 #include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
47 #include <afs/audit.h>
48 #include <afs/cellconfig.h>
49 #if defined(AFS_SGI_ENV)
50 #include <afs/afs_args.h>
53 #define BOZO_LWP_STACKSIZE 16000
54 extern struct bnode_ops fsbnode_ops, dafsbnode_ops, ezbnode_ops, cronbnode_ops;
56 struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
57 static PROCESS bozo_pid;
58 struct rx_securityClass *bozo_rxsc[3];
59 const char *bozo_fileName;
65 int DoSyslogFacility = LOG_DAEMON;
67 static afs_int32 nextRestart;
68 static afs_int32 nextDay;
70 struct ktime bozo_nextRestartKT, bozo_nextDayKT;
73 int rxkadDisableDotCheck = 0;
75 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
76 afs_uint32 SHostAddrs[ADDRSPERSITE];
78 #ifdef BOS_RESTRICTED_MODE
79 int bozo_isrestricted = 0;
80 int bozo_restdisable = 0;
83 bozo_insecureme(int sig)
85 signal(SIGFPE, bozo_insecureme);
86 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];
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 if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
298 renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
299 AFSDIR_SERVER_BOZCONF_FILEPATH);
301 perror("bosconfig rename");
305 /* setup default times we want to do restarts */
306 bozo_nextRestartKT.mask = KTIME_HOUR | KTIME_MIN | KTIME_DAY;
307 bozo_nextRestartKT.hour = 4; /* 4 am */
308 bozo_nextRestartKT.min = 0;
309 bozo_nextRestartKT.day = 0; /* Sunday */
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;
367 #ifdef BOS_RESTRICTED_MODE
368 if (strncmp(tbuffer, "restrictmode", 12) == 0) {
369 code = sscanf(tbuffer, "restrictmode %d", &rmode);
374 if (rmode != 0 && rmode != 1) {
378 bozo_isrestricted = rmode;
383 if (strncmp("bnode", tbuffer, 5) != 0) {
389 sscanf(tbuffer, "bnode %s %s %d %s", typep, instp, &goal,
394 } else if (code == 3)
397 for (i = 0; i < MAXPARMS; i++) {
398 /* now read the parms, until we see an "end" line */
399 tp = fgets(tbuffer, sizeof(tbuffer), tfile);
405 if (!strncmp(tbuffer, "end", 3))
407 if (strncmp(tbuffer, "parm ", 5)) {
409 goto fail; /* no "parm " either */
411 if (!parms[i]) /* make sure there's space */
412 parms[i] = (char *)malloc(BOZO_BSSIZE);
413 strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
416 /* ok, we have the type and parms, now create the object */
418 bnode_Create(typep, instp, &tb, parms[0], parms[1], parms[2],
419 parms[3], parms[4], notifier,
420 goal ? BSTAT_NORMAL : BSTAT_SHUTDOWN, 0);
424 /* bnode created in 'temporarily shutdown' state;
425 * check to see if we are supposed to run this guy,
426 * and if so, start the process up */
428 bnode_SetStat(tb, BSTAT_NORMAL); /* set goal, taking effect immediately */
430 bnode_SetStat(tb, BSTAT_SHUTDOWN);
441 for (i = 0; i < MAXPARMS; i++)
449 /* write a new bozo file */
451 WriteBozoFile(char *aname)
453 register FILE *tfile;
454 char tbuffer[AFSDIR_PATH_MAX];
455 register afs_int32 code;
459 aname = (char *)bozo_fileName;
460 strcpy(tbuffer, aname);
461 strcat(tbuffer, ".NBZ");
462 tfile = fopen(tbuffer, "w");
466 #ifdef BOS_RESTRICTED_MODE
467 fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
469 fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
470 bozo_nextRestartKT.day, bozo_nextRestartKT.hour,
471 bozo_nextRestartKT.min, bozo_nextRestartKT.sec);
472 fprintf(tfile, "checkbintime %d %d %d %d %d\n", bozo_nextDayKT.mask,
473 bozo_nextDayKT.day, bozo_nextDayKT.hour, bozo_nextDayKT.min,
475 code = bnode_ApplyInstance(bzwrite, &btemp);
476 if (code || (code = ferror(tfile))) { /* something went wrong */
481 /* close the file, check for errors and snap new file into place */
482 if (fclose(tfile) == EOF) {
486 code = renamefile(tbuffer, aname);
495 bdrestart(register struct bnode *abnode, void *arock)
497 register afs_int32 code;
499 if (abnode->fileGoal != BSTAT_NORMAL || abnode->goal != BSTAT_NORMAL)
500 return 0; /* don't restart stopped bnodes */
502 code = bnode_RestartP(abnode);
504 /* restart the dude */
505 bnode_SetStat(abnode, BSTAT_SHUTDOWN);
506 bnode_WaitStatus(abnode, BSTAT_SHUTDOWN);
507 bnode_SetStat(abnode, BSTAT_NORMAL);
509 bnode_Release(abnode);
510 return 0; /* keep trying all bnodes */
513 #define BOZO_MINSKIP 3600 /* minimum to advance clock */
514 /* lwp to handle system restarts */
516 BozoDaemon(void *unused)
518 register afs_int32 now;
520 /* now initialize the values */
524 now = FT_ApproxTime();
526 #ifdef BOS_RESTRICTED_MODE
527 if (bozo_restdisable) {
528 bozo_Log("Restricted mode disabled by signal\n");
529 bozo_restdisable = 0;
532 if (bozo_newKTs) { /* need to recompute restart times */
533 bozo_newKTs = 0; /* done for a while */
534 nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
535 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
538 /* see if we should do a restart */
539 if (now > nextRestart) {
540 SBOZO_ReBozo(0); /* doesn't come back */
543 /* see if we should restart a server */
545 nextDay = ktime_next(&bozo_nextDayKT, BOZO_MINSKIP);
547 /* call the bnode restartp function, and restart all that require it */
548 bnode_ApplyInstance(bdrestart, 0);
560 int s, sb_max, ipfragttl;
564 f = popen("/usr/sbin/no -o sb_max", "r");
565 s = fscanf(f, "sb_max = %d", &sb_max);
569 f = popen("/usr/sbin/no -o ipfragttl", "r");
570 s = fscanf(f, "ipfragttl = %d", &ipfragttl);
580 sprintf(c, "/usr/sbin/no -o sb_max=%d -o ipfragttl=%d", sb_max,
589 * This routine causes the calling process to go into the background and
590 * to lose its controlling tty.
592 * It does not close or otherwise alter the standard file descriptors.
594 * It writes warning messages to the standard error output if certain
595 * fundamental errors occur.
597 * This routine requires
599 * #include <sys/types.h>
600 * #include <sys/stat.h>
602 * #include <unistd.h>
603 * #include <stdlib.h>
605 * and has been tested on:
621 * A process is a process group leader if its process ID
622 * (getpid()) and its process group ID (getpgrp()) are the same.
626 * To create a new session (and thereby lose our controlling
627 * terminal) we cannot be a process group leader.
629 * To guarantee we are not a process group leader, we fork and
630 * let the parent process exit.
633 if (getpid() == getpgrp()) {
638 abort(); /* leave footprints */
642 default: /* parent */
649 * By here, we are not a process group leader, so we can make a
650 * new session and become the session leader.
654 pid_t sid = setsid();
657 static char err[] = "bosserver: WARNING: setsid() failed\n";
658 write(STDERR_FILENO, err, sizeof err - 1);
663 * Once we create a new session, the current process is a
664 * session leader without a controlling tty.
666 * On some systems, the first tty device the session leader
667 * opens automatically becomes the controlling tty for the
670 * So, to guarantee we do not acquire a controlling tty, we fork
671 * and let the parent process exit. The child process is not a
672 * session leader, and so it will not acquire a controlling tty
673 * even if it should happen to open a tty device.
676 if (getpid() == getpgrp()) {
681 abort(); /* leave footprints */
685 default: /* parent */
692 * check that we no longer have a controlling tty
698 fd = open("/dev/tty", O_RDONLY);
702 "bosserver: WARNING: /dev/tty still attached\n";
704 write(STDERR_FILENO, err, sizeof err - 1);
708 #endif /* ! AFS_NT40_ENV */
711 /* start a process and monitor it */
713 #include "AFS_component_version_number.c"
716 main(int argc, char **argv, char **envp)
718 struct rx_service *tservice;
719 register afs_int32 code;
720 struct afsconf_dir *tdir;
723 char namebuf[AFSDIR_PATH_MAX];
725 afs_uint32 host = htonl(INADDR_ANY);
726 char *auditFileName = NULL;
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[code], "-rxmaxmtu")) {
828 if ((code + 1) >= argc) {
829 fprintf(stderr, "missing argument for -rxmaxmtu\n");
832 rxMaxMTU = atoi(argv[++code]);
833 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
834 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
835 printf("rxMaxMTU %d invalid; must be between %d-%lu\n",
836 rxMaxMTU, RX_MIN_PACKET_SIZE,
837 RX_MAX_PACKET_DATA_SIZE);
841 else if (strcmp(argv[code], "-auditlog") == 0) {
842 auditFileName = argv[++code];
844 } else if (strcmp(argv[code], "-audit-interface") == 0) {
845 char *interface = argv[++code];
847 if (osi_audit_interface(interface)) {
848 printf("Invalid audit interface '%s'\n", interface);
854 /* hack to support help flag */
857 printf("Usage: bosserver [-noauth] [-log] "
858 "[-auditlog <log path>] "
859 "[-audit-interafce <file|sysvmq> (default is file)] "
860 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
861 "[-syslog[=FACILITY]] "
862 "[-enable_peer_stats] [-enable_process_stats] "
863 "[-nofork] " "[-help]\n");
865 printf("Usage: bosserver [-noauth] [-log] "
866 "[-auditlog <log path>] "
867 "[-audit-interafce <file|sysvmq> (default is file)] "
868 "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
869 "[-enable_peer_stats] [-enable_process_stats] "
878 osi_audit_file(auditFileName);
882 if (geteuid() != 0) {
883 printf("bosserver: must be run as root.\n");
890 printf("bosserver: could not init bnode package, code %d\n", code);
894 bnode_Register("fs", &fsbnode_ops, 3);
895 bnode_Register("dafs", &dafsbnode_ops, 4);
896 bnode_Register("simple", &ezbnode_ops, 1);
897 bnode_Register("cron", &cronbnode_ops, 2);
899 /* create useful dirs */
902 /* chdir to AFS log directory */
903 chdir(AFSDIR_SERVER_LOGS_DIRPATH);
906 fputs(AFS_GOVERNMENT_MESSAGE, stdout);
910 /* go into the background and remove our controlling tty, close open
917 #endif /* ! AFS_NT40_ENV */
921 && ((lstat(AFSDIR_BOZLOG_FILE, &sb) == 0) &&
922 !(S_ISFIFO(sb.st_mode)))
925 strcpy(namebuf, AFSDIR_BOZLOG_FILE);
926 strcat(namebuf, ".old");
927 renamefile(AFSDIR_BOZLOG_FILE, namebuf); /* try rename first */
928 bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
930 printf("bosserver: can't initialize log file (%s).\n",
931 AFSDIR_SERVER_BOZLOG_FILEPATH);
934 /* keep log closed normally, so can be removed */
935 fclose(bozo_logFile);
938 openlog("bosserver", LOG_PID, DoSyslogFacility);
942 /* Write current state of directory permissions to log file */
945 for (i = 0; i < 10; i++) {
946 code = rx_Init(htons(AFSCONF_NANNYPORT));
948 bozo_Log("can't initialize rx: code=%d\n", code);
954 bozo_Log("Bos giving up, can't initialize rx\n");
958 code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
959 /* param */ NULL , "bozo-the-clown",
962 /* try to read the key from the config file */
963 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
965 /* try to create local cell config file */
966 struct afsconf_cell tcell;
967 strcpy(tcell.name, "localcell");
968 tcell.numServers = 1;
969 code = gethostname(tcell.hostName[0], MAXHOSTCHARS);
971 bozo_Log("failed to get hostname, code %d\n", errno);
974 if (tcell.hostName[0][0] == 0) {
975 bozo_Log("host name not set, can't start\n");
976 bozo_Log("try the 'hostname' command\n");
979 memset(tcell.hostAddr, 0, sizeof(tcell.hostAddr)); /* not computed */
981 afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH,
985 ("could not create cell database in '%s' (code %d), quitting\n",
986 AFSDIR_SERVER_ETC_DIRPATH, code);
989 tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
992 ("failed to open newly-created cell database, quitting\n");
997 /* read init file, starting up programs */
998 if ((code = ReadBozoFile(0))) {
1000 ("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
1001 code, AFSDIR_SERVER_BOZCONF_FILEPATH);
1005 /* opened the cell databse */
1006 bozo_confdir = tdir;
1008 /* allow super users to manage RX statistics */
1009 rx_SetRxStatUserOk(bozo_rxstat_userok);
1011 /* have bcrypt key now */
1013 afsconf_SetNoAuthFlag(tdir, noAuth);
1015 bozo_rxsc[0] = rxnull_NewServerSecurityObject();
1016 bozo_rxsc[1] = (struct rx_securityClass *)0;
1018 rxkad_NewServerSecurityObject(0, tdir, afsconf_GetKey, NULL);
1020 /* Disable jumbograms */
1023 if (rxMaxMTU != -1) {
1024 rx_SetMaxMTU(rxMaxMTU);
1029 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
1030 AFSDIR_SERVER_NETINFO_FILEPATH) {
1032 ccode = parseNetFiles(SHostAddrs, NULL, NULL,
1033 ADDRSPERSITE, reason,
1034 AFSDIR_SERVER_NETINFO_FILEPATH,
1035 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1038 ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
1041 host = SHostAddrs[0];
1044 tservice = rx_NewServiceHost(host, /* port */ 0, /* service id */ 1,
1045 /*service name */ "bozo",
1046 /* security classes */
1048 /* numb sec classes */ 3, BOZO_ExecuteRequest);
1049 rx_SetMinProcs(tservice, 2);
1050 rx_SetMaxProcs(tservice, 4);
1051 rx_SetStackSize(tservice, BOZO_LWP_STACKSIZE); /* so gethostbyname works (in cell stuff) */
1052 if (rxkadDisableDotCheck) {
1053 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
1054 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
1058 rx_NewServiceHost(host, 0, RX_STATS_SERVICE_ID, "rpcstats", bozo_rxsc,
1059 3, RXSTATS_ExecuteRequest);
1060 rx_SetMinProcs(tservice, 2);
1061 rx_SetMaxProcs(tservice, 4);
1062 rx_StartServer(1); /* donate this process */
1067 bozo_Log(char *format, ...)
1073 va_start(ap, format);
1076 #ifndef AFS_NT40_ENV
1077 vsyslog(LOG_INFO, format, ap);
1081 strcpy(tdate, ctime(&myTime)); /* copy out of static area asap */
1084 /* log normally closed, so can be removed */
1086 bozo_logFile = fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
1087 if (bozo_logFile == NULL) {
1088 printf("bosserver: WARNING: problem with %s\n",
1089 AFSDIR_SERVER_BOZLOG_FILEPATH);
1090 printf("%s ", tdate);
1091 vprintf(format, ap);
1094 fprintf(bozo_logFile, "%s ", tdate);
1095 vfprintf(bozo_logFile, format, ap);
1097 /* close so rm BosLog works */
1098 fclose(bozo_logFile);