int ScheduledShutdown = 0;
int do_defrag = 0;
time_t server_startup_time;
-char pid_file_name[PATH_MAX];
/*
* Various things that need to be initialized at startup
unsigned int seed;
FILE *urandom;
struct ctdlroom qrbuf;
- FILE *pidfile_fp;
lprintf(CTDL_DEBUG, "master_startup() started\n");
time(&server_startup_time);
- /* pid file. If we go FSSTND this should end up in 'localstatedir' */
- snprintf(pid_file_name, sizeof pid_file_name, "./citadel.pid");
- pidfile_fp = fopen(pid_file_name, "w");
- if (pidfile_fp != NULL) {
- fprintf(pidfile_fp, "%d\n", (int)getpid());
- fclose(pidfile_fp);
- }
-
lprintf(CTDL_INFO, "Opening databases\n");
open_databases();
lputroom(&qrbuf);
}
- /*
- * Create a room in which we can deposit "deleted" messages for
- * deferred deletion. This will silently fail if the room already
- * exists, and that's perfectly ok, because we want it to exist.
- */
- create_room(DELETED_MSGS_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX);
-
- /*
- * Make sure it's set to be a "system room" so it doesn't show up
- * in the <K>nown rooms list for Aides. Also set the message expire
- * policy to "by count, 1 message" so everything gets deleted all
- * the time (we can't set it to 0 because that's invalid, so we keep
- * a single message around).
- */
- if (lgetroom(&qrbuf, DELETED_MSGS_ROOM) == 0) {
- qrbuf.QRflags2 |= QR2_SYSTEM;
- qrbuf.QRep.expire_mode = EXPIRE_NUMMSGS;
- qrbuf.QRep.expire_value = 1;
- lputroom(&qrbuf);
- }
-
lprintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
urandom = fopen("/dev/urandom", "r");
if (urandom != NULL) {
(*fcn->h_function_pointer)();
}
+ /* Close the AdjRefCount queue file */
+ AdjRefCount(-1, 0);
+
/* Shut down the indexer thread */
lprintf(CTDL_INFO, "Waiting for the indexer thread to shut down\n");
pthread_join(indexer_thread_tid, NULL);
sleep(32767);
}
}
+
+ release_control();
/* Now go away. */
lprintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
fflush(stdout); fflush(stderr);
-
- unlink(pid_file_name);
+
exit(exitcode);
}
cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */
#endif
-#ifdef ENABLE_AUTOLOGIN
- cprintf("1\n"); /* "create new user" never works with autologin */
-#else
- cprintf("%d\n", config.c_disable_newu); /* otherwise, site defined */
-#endif
+ if (config.c_auth_mode == 1) {
+ cprintf("1\n"); /* "create new user" never works with host auth */
+ }
+ else {
+ cprintf("%d\n", config.c_disable_newu); /* otherwise, site defined */
+ }
cprintf("%s\n", config.c_default_cal_zone);
lprintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
if ((addr.s_addr = inet_addr(from_host)) != -1) {
locate_host(CC->cs_host, sizeof CC->cs_host,
- NULL, 0,
+ CC->cs_addr, sizeof CC->cs_addr,
&addr);
}
else {