]> code.citadel.org Git - citadel.git/blobdiff - citadel/citserver.c
* Applied a patch sent in by Wilfried Goesgens which allows the various
[citadel.git] / citadel / citserver.c
index 9240f4ac416d880513e944bf2841ea493169b5fb..2a19df2a856c0199942a3f31076cb69467c54020 100644 (file)
@@ -101,7 +101,7 @@ void master_startup(void) {
        check_ref_counts();
 
        lprintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
-       create_room(BASEROOM,           0, "", 0, 1, 0, VIEW_BBS);
+       create_room(config.c_baseroom,  0, "", 0, 1, 0, VIEW_BBS);
        create_room(AIDEROOM,           3, "", 0, 1, 0, VIEW_BBS);
        create_room(SYSCONFIGROOM,      3, "", 0, 1, 0, VIEW_BBS);
        create_room(config.c_twitroom,  0, "", 0, 1, 0, VIEW_BBS);
@@ -148,6 +148,14 @@ void master_cleanup(int exitcode) {
                (*fcn->h_function_pointer)();
        }
 
+       /* Shut down the indexer thread */
+       lprintf(CTDL_INFO, "Waiting for the indexer thread to shut down\n");
+       pthread_join(indexer_thread_tid, NULL);
+
+       /* Shut down the checkpoint thread */
+       lprintf(CTDL_INFO, "Waiting for the checkpoint thread to shut down\n");
+       pthread_join(checkpoint_thread_tid, NULL);
+
        /* Close databases */
        lprintf(CTDL_INFO, "Closing databases\n");
        close_databases();
@@ -193,7 +201,6 @@ void RemoveContext (struct CitContext *con)
        lprintf(CTDL_DEBUG, "Calling logout(%d)\n", con->cs_pid);
        logout(con);
 
-       unlink(con->temp);
        lprintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
 
        /* If the client is still connected, blow 'em away. */
@@ -218,7 +225,7 @@ void cmd_info(void) {
        cprintf("%s\n", config.c_fqdn);
        cprintf("%s\n", CITADEL);
        cprintf("%d\n", REV_LEVEL);
-       cprintf("%s\n", config.c_bbs_city);
+       cprintf("%s\n", config.c_site_location);
        cprintf("%s\n", config.c_sysadm);
        cprintf("%d\n", SERVER_TYPE);
        cprintf("%s\n", config.c_moreprompt);
@@ -281,7 +288,11 @@ int is_public_client(void)
        static time_t pc_timestamp = 0;
        static char public_clients[SIZ];
 
+#ifndef HAVE_ETC
 #define PUBLIC_CLIENTS "./public_clients"
+#else
+#define PUBLIC_CLIENTS ETC_DIR"/public_clients"
+#endif
 
        /*
         * Check the time stamp on the public_clients file.  If it's been
@@ -305,7 +316,13 @@ int is_public_client(void)
                        strcat(public_clients, addrbuf);
                }
 
-               fp = fopen("public_clients", "r");
+               fp = fopen(
+#ifndef HAVE_ETC
+                                  "."
+#else
+                                  ETC_DIR
+#endif
+                                  "/public_clients", "r");
                if (fp != NULL) while (fgets(buf, sizeof buf, fp)!=NULL) {
                        for (i=0; i<strlen(buf); ++i) {
                                if (buf[i] == '#') buf[i] = 0;
@@ -417,8 +434,16 @@ void cmd_mesg(char *mname)
 
        extract_token(buf, mname, 0, '|', sizeof buf);
 
-       dirs[0] = strdup("messages");
-       dirs[1] = strdup("help");
+       dirs[0] = strdup(
+#ifdef HAVE_DATA_DIR
+                                        DATA_DIR"/"
+#endif
+                                        "messages");
+       dirs[1] = strdup(
+#ifdef HAVE_DATA_DIR
+                                        DATA_DIR"/"
+#endif
+                                        "help");
        snprintf(buf2, sizeof buf2, "%s.%d.%d", buf, CC->cs_clientdev, CC->cs_clienttyp);
        mesg_locate(targ, sizeof targ, buf2, 2, (const char **)dirs);
        if (strlen(targ) == 0) {
@@ -475,14 +500,28 @@ void cmd_emsg(char *mname)
                if (buf[a] == '/') buf[a] = '.';
        }
 
-       dirs[0] = strdup("messages");
-       dirs[1] = strdup("help");
+       dirs[0] = strdup(
+#ifdef HAVE_DATA_DIR
+                                        DATA_DIR"/"
+#endif
+                                        "messages");
+       dirs[1] = strdup(
+#ifdef HAVE_DATA_DIR
+                                        DATA_DIR"/"
+#endif
+                                        "help");
        mesg_locate(targ, sizeof targ, buf, 2, (const char**)dirs);
        free(dirs[0]);
        free(dirs[1]);
 
        if (strlen(targ)==0) {
-               snprintf(targ, sizeof targ, "./help/%s", buf);
+               snprintf(targ, sizeof targ, 
+#ifndef HAVE_DATA_DIR
+                        "." /* FIXME: should here be CTDLDIR ? */
+#else
+                        DATA_DIR
+#endif
+                                "/help/%s", buf);
        }
 
        mfp = fopen(targ,"w");
@@ -761,13 +800,12 @@ void begin_session(struct CitContext *con)
        strcpy(con->lastcmdname, "    ");
        strcpy(con->cs_clientname, "(unknown)");
        strcpy(con->curr_user, NLI);
-       strcpy(con->net_node,"");
+       strcpy(con->net_node, "");
        strcpy(con->fake_username, "");
        strcpy(con->fake_postname, "");
        strcpy(con->fake_hostname, "");
        strcpy(con->fake_roomname, "");
        generate_nonce(con);
-       safestrncpy(con->temp, tmpnam(NULL), sizeof con->temp);
        safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
        safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
        con->cs_host[sizeof con->cs_host - 1] = 0;
@@ -1053,7 +1091,7 @@ void do_command_loop(void) {
        }
 
        else if (!strncasecmp(cmdbuf,"LIST",4)) {
-               cmd_list();
+               cmd_list(&cmdbuf[5]);
        }
 
        else if (!strncasecmp(cmdbuf,"CHEK",4)) {