Officially declare war on LHFS
authorArt Cancro <ajc@citadel.org>
Wed, 27 Jan 2021 20:52:14 +0000 (15:52 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Jan 2021 20:52:14 +0000 (15:52 -0500)
appimage/citadel.AppDir/citadel.desktop
appimage/ctdlvisor.c
citadel/citserver.c
citadel/config.c
citadel/include/citadel_dirs.h
citadel/modules/bio/serv_bio.c
citadel/server_main.c
citadel/utillib/citadel_dirs.c
citadel/utils/setup.c

index 4560c31dccee29927fb95ce8e58d552388c0077f..8ac9118d416382d15561ae7b618a6a99d7ebb421 100644 (file)
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Version=1.0
 Type=Application
-Categories=Network
+Categories=Network;
 Terminal=true
 Exec=AppRun
 Name=Citadel
index 4bc4696b027fcd5b642124de290a3fe342a20fc8..041d1a52c552c16cda1a97866134d1b5d431a5aa 100644 (file)
@@ -107,7 +107,7 @@ pid_t start_citadel() {
        sprintf(bin, "%s/usr/local/citadel/citserver", getenv("APPDIR"));
        pid_t pid = fork();
        if (pid == 0) {
-               fprintf(stderr, "ctdlvisor: executing %s\n", bin);
+               fprintf(stderr, "ctdlvisor: executing %s with data directory %s\n", bin, getenv("CTDL_DIR"));
                detach_from_tty();
                execlp(bin, "citserver", "-x9", "-h", getenv("CTDL_DIR"), NULL);
                exit(errno);
index a071b2b72f09e42cae26b59b5b62969b4e61061e..d1271e5f91772605979b3f992b7a7ef9e58b50bd 100644 (file)
@@ -54,12 +54,13 @@ void master_startup(void)
        syslog(LOG_INFO, "Checking directory access");
        if ((pw = getpwuid(ctdluid)) == NULL) {
                gid = getgid();
-       } else {
+       }
+       else {
                gid = pw->pw_gid;
        }
 
        if (create_run_directories(CTDLUID, gid) != 0) {
-               syslog(LOG_EMERG, "failed to access & create directories");
+               syslog(LOG_EMERG, "citserver: failed to access and create directories");
                exit(1);
        }
        syslog(LOG_INFO, "Opening databases");
index 81f93989b2120dbc3d571961d1fe79eb37f8f62d..f3357d9d7b1bbc771879d007213a7a8f583e76d2 100644 (file)
@@ -232,15 +232,6 @@ void initialize_config_system(void) {
                exit(CTDLEXIT_LIBCITADEL);
        }
 
-       //if (chdir(ctdl_bbsbase_dir) != 0) {
-               //fprintf(stderr,
-                       //"This program could not be started.\nUnable to change directory to %s\nError: %s\n",
-                       //ctdl_bbsbase_dir,
-                       //strerror(errno)
-               //);
-               //exit(CTDLEXIT_HOME);
-       //}
-
        memset(&lconfig, 0, sizeof(struct legacy_config));
        cfp = fopen(file_citadel_config, "rb");
        if (cfp != NULL) {
index ee9cf444b77ca7bc6f33f460e3a7e6cc87d38f7b..b654f17db3be7b11919a602b29f2173e9a720f9e 100644 (file)
@@ -8,7 +8,6 @@ extern char ctdl_home_directory[PATH_MAX];
 
 
 /* all our directories */
-extern char ctdl_bio_dir[PATH_MAX];
 extern char ctdl_data_dir[PATH_MAX];
 extern char ctdl_file_dir[PATH_MAX];
 extern char ctdl_shared_dir[PATH_MAX];
@@ -17,7 +16,6 @@ extern char ctdl_info_dir[PATH_MAX];
 extern char ctdl_key_dir[PATH_MAX];
 extern char ctdl_message_dir[PATH_MAX];
 extern char ctdl_usrpic_dir[PATH_MAX];
-extern char ctdl_etc_dir[PATH_MAX];
 extern char ctdl_autoetc_dir[PATH_MAX];
 extern char ctdl_run_dir[PATH_MAX];
 extern char ctdl_spool_dir[PATH_MAX];
index 4246f1a3e506f5b0474a9d1032adc8383e68adb4..e6e1dd20b103112d9adaae16d9bd90b1ba77b1fc 100644 (file)
@@ -2,7 +2,7 @@
  * This module implementsserver commands related to the display and
  * manipulation of user "bio" files.
  *
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -155,7 +155,7 @@ void import_old_bio_files(void)
 
 
        syslog(LOG_DEBUG, "Importing old style bio files into the message base");
-       filedir = opendir (ctdl_bio_dir);
+       filedir = opendir("bio");
        if (filedir == NULL) {
                return;
        }
@@ -192,7 +192,7 @@ void import_old_bio_files(void)
                    (filedir_entry->d_name[1] == '.'))
                        continue;
 
-               snprintf(path, PATH_MAX, "%s/%s", ctdl_bio_dir, filedir_entry->d_name);
+               snprintf(path, PATH_MAX, "bio/%s", filedir_entry->d_name);
                if (d_type == DT_UNKNOWN) {
                        if (lstat(path, &s) == 0) {
                                d_type = IFTODT(s.st_mode);
@@ -211,7 +211,7 @@ void import_old_bio_files(void)
                }
        }
        closedir(filedir);
-       rmdir(ctdl_bio_dir);
+       rmdir("bio");
 }
 
 
index b08d070f32cf3836e56832db7edbc561a23ca03a..ece0e3cb85e2db1df6e249ed514f1b3b73d9adb2 100644 (file)
@@ -236,29 +236,13 @@ int main(int argc, char **argv)
        syslog(LOG_INFO, " ");
        syslog(LOG_INFO, "%s", libcitadel_version_string());
 
-#ifdef HAVE_RUN_DIR
-       /* on some dists rundir gets purged on startup. so we need to recreate it. */
-
-       if (stat(ctdl_run_dir, &filestats) == -1) {
-#ifdef HAVE_GETPWUID_R
-#ifdef SOLARIS_GETPWUID
-               pwp = getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf));
-#else // SOLARIS_GETPWUID
-               getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
-#endif // SOLARIS_GETPWUID
-#else // HAVE_GETPWUID_R
-               pwp = NULL;
-#endif // HAVE_GETPWUID_R
-
-               if ((mkdir(ctdl_run_dir, 0755) != 0) && (errno != EEXIST)) {
-                       syslog(LOG_ERR, "main: unable to create run directory [%s]: %m", ctdl_run_dir);
-               }
+       if ((mkdir(ctdl_run_dir, 0755) != 0) && (errno != EEXIST)) {
+               syslog(LOG_ERR, "main: unable to create run directory [%s]: %m", ctdl_run_dir);
+       }
 
-               if (chown(ctdl_run_dir, ctdluid, (pwp==NULL)?-1:pw.pw_gid) != 0) {
-                       syslog(LOG_ERR, "main: unable to set the access rights for [%s]: %m", ctdl_run_dir);
-               }
+       if (chown(ctdl_run_dir, ctdluid, (pwp==NULL)?-1:pw.pw_gid) != 0) {
+               syslog(LOG_ERR, "main: unable to set the access rights for [%s]: %m", ctdl_run_dir);
        }
-#endif
 
        ctdl_lockfile(1);
        init_sysdep();                                          // Initialize...
index c7407c4a2a90fdcd3965b8c74248f62c7c0430aa..a20db278f520e1828f38942e205713962ebfdc12 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * citadel_dirs.c : calculate pathnames for various files used in the Citadel system
  *
- * Copyright (c) 1987-2018 by the citadel.org team
+ * Copyright (c) 1987-2021 by the citadel.org team
  *
  *  This program is open source software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 3.
@@ -26,7 +26,6 @@
 
 /* our directories... */
 char ctdl_home_directory[PATH_MAX] = "";
-char ctdl_bio_dir[PATH_MAX]="bio";
 char ctdl_data_dir[PATH_MAX]="data";
 char ctdl_file_dir[PATH_MAX]="files";
 char ctdl_shared_dir[PATH_MAX]="";
@@ -36,7 +35,6 @@ char ctdl_key_dir[PATH_MAX]=SSL_DIR;
 char ctdl_message_dir[PATH_MAX]="messages";
 char ctdl_usrpic_dir[PATH_MAX]="userpics";
 char ctdl_bbsbase_dir[PATH_MAX]="";
-char ctdl_etc_dir[PATH_MAX]="";
 char ctdl_autoetc_dir[PATH_MAX]="";
 /* attention! this may be non volatile on some oses */
 char ctdl_run_dir[PATH_MAX]="";
@@ -116,9 +114,7 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        basedir=ETC_DIR;
 #endif
        COMPUTE_DIRECTORY(ctdl_netcfg_dir);
-       COMPUTE_DIRECTORY(ctdl_etc_dir);
        StripSlashes(ctdl_netcfg_dir, 1);
-       StripSlashes(ctdl_etc_dir, 1);
 
 #ifndef HAVE_UTILBIN_DIR
        basedir=ctdldir;
@@ -149,7 +145,6 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
 #else
        basedir=DATA_DIR;
 #endif
-       COMPUTE_DIRECTORY(ctdl_bio_dir);
        COMPUTE_DIRECTORY(ctdl_data_dir);
        COMPUTE_DIRECTORY(ctdl_file_dir);
        COMPUTE_DIRECTORY(ctdl_image_dir);
@@ -157,7 +152,6 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        COMPUTE_DIRECTORY(ctdl_usrpic_dir);
        COMPUTE_DIRECTORY(ctdl_bbsbase_dir);
 
-       StripSlashes(ctdl_bio_dir, 1);
        StripSlashes(ctdl_data_dir, 1);
        StripSlashes(ctdl_file_dir, 1);
        StripSlashes(ctdl_image_dir, 1);
@@ -258,15 +252,10 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        snprintf(file_mail_aliases, 
                 sizeof file_mail_aliases,
                 "%smail.aliases",
-#ifdef HAVE_ETC_DIR
-                ctdl_etc_dir
-#else
                 ctdl_spool_dir
-#endif
                );
        StripSlashes(file_mail_aliases, 0);
 
-       DBG_PRINT(ctdl_bio_dir);
        DBG_PRINT(ctdl_data_dir);
        DBG_PRINT(ctdl_file_dir);
        DBG_PRINT(ctdl_image_dir);
@@ -274,7 +263,6 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
        DBG_PRINT(ctdl_key_dir);
        DBG_PRINT(ctdl_message_dir);
        DBG_PRINT(ctdl_usrpic_dir);
-       DBG_PRINT(ctdl_etc_dir);
        DBG_PRINT(ctdl_run_dir);
        DBG_PRINT(ctdl_spool_dir);
        DBG_PRINT(ctdl_netdigest_dir);
@@ -304,33 +292,27 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char  *ctdldir,
 /*
  * Generate an associated file name for a room
  */
-size_t assoc_file_name(char *buf, size_t n,
-                    struct ctdlroom *qrbuf, const char *prefix)
-{
+size_t assoc_file_name(char *buf, size_t n, struct ctdlroom *qrbuf, const char *prefix) {
        return snprintf(buf, n, "%s%ld", prefix, qrbuf->QRnumber);
 }
 
-void remove_digest_file(struct ctdlroom *room)
-{
+
+void remove_digest_file(struct ctdlroom *room) {
        char buf[PATH_MAX];
 
-       snprintf(buf, PATH_MAX, "%s/%ld.eml", 
-                ctdl_netdigest_dir,
-                room->QRnumber);
+       snprintf(buf, PATH_MAX, "%s/%ld.eml", ctdl_netdigest_dir, room->QRnumber);
        StripSlashes(buf, 0);
        unlink(buf);
 }
 
-FILE *create_digest_file(struct ctdlroom *room, int forceCreate)
-{
+
+FILE *create_digest_file(struct ctdlroom *room, int forceCreate) {
        struct stat stbuf;
        char fn[PATH_MAX];
        int exists;
        FILE *fp;
 
-       snprintf(fn, PATH_MAX, "%s/%ld.eml", 
-                ctdl_netdigest_dir,
-                room->QRnumber);
+       snprintf(fn, PATH_MAX, "%s/%ld.eml", ctdl_netdigest_dir, room->QRnumber);
        StripSlashes(fn, 0);
 
        exists = stat(fn, &stbuf); 
@@ -339,21 +321,17 @@ FILE *create_digest_file(struct ctdlroom *room, int forceCreate)
        
        fp = fopen(fn, "w+");
        if (fp == NULL) {
-               syslog(LOG_EMERG,
-                      "failed to create digest file %s: %s",
-                      fn,
-                      strerror(errno));
+               syslog(LOG_ERR, "failed to create digest file %s: %s", fn, strerror(errno));
        }
        return fp;
 }
 
 
-int create_dir(char *which, long ACCESS, long UID, long GID)
-{
+int create_dir(char *which, long ACCESS, long UID, long GID) {
        int rv;
        rv = mkdir(which, ACCESS);
        if ((rv == -1) && (errno != EEXIST)) {
-               syslog(LOG_EMERG,
+               syslog(LOG_ERR,
                       "failed to create directory %s: %s",
                       which,
                       strerror(errno));
@@ -361,7 +339,7 @@ int create_dir(char *which, long ACCESS, long UID, long GID)
        }
        rv = chmod(which, ACCESS);
        if (rv == -1) {
-               syslog(LOG_EMERG,
+               syslog(LOG_ERR,
                       "failed to set permissions for directory %s: %s",
                       which,
                       strerror(errno));
@@ -369,7 +347,7 @@ int create_dir(char *which, long ACCESS, long UID, long GID)
        }
        rv = chown(which, UID, GID);
        if (rv == -1) {
-               syslog(LOG_EMERG,
+               syslog(LOG_ERR,
                       "failed to set owner for directory %s: %s",
                       which,
                       strerror(errno));
@@ -378,8 +356,8 @@ int create_dir(char *which, long ACCESS, long UID, long GID)
        return rv;
 }
 
-int create_run_directories(long UID, long GID)
-{
+
+int create_run_directories(long UID, long GID) {
        int rv = 0;
        rv += create_dir(ctdl_message_dir   , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
        rv += create_dir(ctdl_file_dir      , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
index 09ae02b3d0ae0998b19ea70fa6c021f06e3fc9f4..710edfad5b2f977559c2a39637cdec854904a276 100644 (file)
@@ -507,7 +507,7 @@ void check_xinetd_entry(void)
        );
        fclose(fp);
 
-       /* Now try to restart the service.  This will not have the intended effect on Solaris, but who the hell uses Solaris anymore? */
+       /* Now try to restart the service.  This will not have the intended effect on Solaris, but who uses Solaris anymore? */
        rv = system("systemctl restart xinetd >/dev/null 2>&1");
        if (rv != 0) {
                rv = system("service xinetd restart >/dev/null 2>&1");