X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Futils%2Fsetup.c;h=9083fb8d48d77ed85d7808f161f2192c2ae2c69b;hb=b9a2089d59579d13694e08b299c2aaf44ef9df6c;hp=b8dd9825bcec41cc9dffd6994741d2f65b54b8d9;hpb=55d2810730edbcf5724b020132ef714ea8d25644;p=citadel.git diff --git a/citadel/utils/setup.c b/citadel/utils/setup.c index b8dd9825b..9083fb8d4 100644 --- a/citadel/utils/setup.c +++ b/citadel/utils/setup.c @@ -1,7 +1,7 @@ /* * Citadel setup utility * - * Copyright (c) 1987-2019 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. @@ -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"); @@ -518,15 +518,6 @@ void check_xinetd_entry(void) } -void disable_other_mtas(void) -{ - if ((getenv("ACT_AS_MTA") == NULL) || (getenv("ACT_AS_MTA") && strcasecmp(getenv("ACT_AS_MTA"), "yes") == 0)) { - /* Offer to disable other MTA's on the system. */ - /* FIXME this has to be rewritten to work in the new systemd-based world. */ - } -} - - void strprompt(const char *prompt_title, const char *prompt_text, char *Target, char *DefValue) { char buf[SIZ] = ""; @@ -679,98 +670,6 @@ void edit_value(int curr) } -#if 0 -/* - * Strip "db" entries out of /etc/nsswitch.conf - */ -void fixnss(void) { - FILE *fp_read; - int fd_write; - char buf[256]; - char buf_nc[256]; - char question[512]; - int i; - int file_changed = 0; - char new_filename[64]; - int rv; - - fp_read = fopen(NSSCONF, "r"); - if (fp_read == NULL) { - return; - } - - strcpy(new_filename, "/tmp/ctdl_fixnss_XXXXXX"); - fd_write = mkstemp(new_filename); - if (fd_write < 0) { - fclose(fp_read); - return; - } - - while (fgets(buf, sizeof buf, fp_read) != NULL) { - strcpy(buf_nc, buf); - for (i=0; buf_nc[i]; ++i) { - if (buf_nc[i] == '#') { - buf_nc[i] = 0; - break; - } - } - for (i=0; i 0) { - if ((isspace(buf_nc[i+2])) || (buf_nc[i+2]==0)) { - file_changed = 1; - strcpy(&buf_nc[i], &buf_nc[i+2]); - strcpy(&buf[i], &buf[i+2]); - if (buf[i]==32) { - strcpy(&buf_nc[i], &buf_nc[i+1]); - strcpy(&buf[i], &buf[i+1]); - } - } - } - } - } - long buflen = strlen(buf); - if (write(fd_write, buf, buflen) != buflen) { - fclose(fp_read); - close(fd_write); - unlink(new_filename); - return; - } - } - - fclose(fp_read); - - if (!file_changed) { - unlink(new_filename); - return; - } - - snprintf(question, sizeof question, - _( - "\n" - "/etc/nsswitch.conf is configured to use the 'db' module for\n" - "one or more services. This is not necessary on most systems,\n" - "and it is known to crash the Citadel server when delivering\n" - "mail to the Internet.\n" - "\n" - "Do you want this module to be automatically disabled?\n" - "\n" - ) - ); - - if (yesno(question, 1)) { - snprintf(buf, sizeof buf, "/bin/mv -f %s %s", new_filename, NSSCONF); - rv = system(buf); - if (rv != 0) { - fprintf(stderr, "failed to edit %s.\n", NSSCONF); - } - chmod(NSSCONF, 0644); - } - unlink(new_filename); -} -#endif - - /* * Messages that are no longer in use. * We keep them here so we don't lose the translations if we need them later. @@ -795,9 +694,6 @@ int main(int argc, char *argv[]) int curr; char buf[1024]; char aaa[128]; - int relh = 0; - int home = 0; - char relhome[PATH_MAX]=""; char ctdldir[PATH_MAX]=CTDLDIR; struct passwd *pw; gid_t gid; @@ -817,26 +713,16 @@ int main(int argc, char *argv[]) setup_type = atoi(aaa); } else if (!strncmp(argv[a], "-h", 2)) { - relh=argv[a][2]!='/'; - if (!relh) { - safestrncpy(ctdl_home_directory, &argv[a][2], sizeof ctdl_home_directory); - } else { - safestrncpy(relhome, &argv[a][2], sizeof relhome); - } - home = 1; + safestrncpy(ctdldir, &argv[a][2], sizeof ctdldir); } } - calc_dirs_n_files(relh, home, relhome, ctdldir, 0); - SetTitles(); - - enable_home = ( relh | home ); - - if (chdir(ctdl_run_dir) != 0) { - display_error("%s: [%s]\n", _("The directory you specified does not exist"), ctdl_run_dir); + if (chdir(ctdldir) != 0) { + fprintf(stderr, "sendcommand: %s: %s\n", ctdldir, strerror(errno)); exit(errno); } + SetTitles(); /* * Connect to the running Citadel server. @@ -966,8 +852,6 @@ int main(int argc, char *argv[]) progress(activity, 5, 5); check_xinetd_entry(); /* Check /etc/xinetd.d/telnet */ - disable_other_mtas(); /* Offer to disable other MTAs */ - // fixnss(); (No longer needed) /* * Restart citserver