]> code.citadel.org Git - citadel.git/commitdiff
* setup.c: offer to disable sendmail, postfix, and qmail if found (only if
authorArt Cancro <ajc@citadel.org>
Sun, 20 Jul 2003 03:51:46 +0000 (03:51 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 20 Jul 2003 03:51:46 +0000 (03:51 +0000)
  using the /etc/init.d type of startup scripts)

citadel/ChangeLog
citadel/setup.c

index e2c9b670f6257d1fd14a821752705131aa268098..b4afc6cbd535d93b10887c5a39055a231cb88e2b 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 608.3  2003/07/20 03:51:46  ajc
+ * setup.c: offer to disable sendmail, postfix, and qmail if found (only if
+   using the /etc/init.d type of startup scripts)
+
  Revision 608.2  2003/07/20 03:08:22  ajc
  * setup.c: offer to hack /etc/xinetd.d/telnet
 
@@ -4874,4 +4878,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index b32e6f68e6034cd625dfd630ed932f068282c2c5..2113246c3b0e2d9a2dd5687e344382ce0d2cc69c 100644 (file)
@@ -492,7 +492,7 @@ void check_xinetd_entry(void) {
        snprintf(buf, sizeof buf,
                "Setup can configure the 'xinetd' service to automatically\n"
                "connect incoming telnet sessions to Citadel, bypassing the\n"
-               "host system's login prompt.  Would you like to do this?"
+               "host system's login prompt.  Would you like to do this?\n"
        );
        if (yesno(buf) == 0)
                return;
@@ -521,6 +521,41 @@ void check_xinetd_entry(void) {
 
 
 
+/*
+ * Offer to disable other MTA's
+ */
+void disable_other_mta(char *mta) {
+       char buf[SIZ];
+       FILE *fp;
+       int lines = 0;
+
+       sprintf(buf, "/bin/ls -l /etc/rc*.d/S*%s 2>/dev/null", mta);
+       fp = popen(buf, "r");
+       if (fp == NULL) return;
+
+       while (fgets(buf, sizeof buf, fp) != NULL) {
+               ++lines;
+       }
+       fclose(fp);
+       if (lines == 0) return;         /* Nothing to do. */
+
+       /* Offer to replace other MTA with the vastly superior Citadel :)  */
+       snprintf(buf, sizeof buf,
+               "You appear to have the '%s' mail transport agent\n"
+               "running on your system.  Would you like to disable it,\n"
+               "allowing Citadel to handle your system's Internet mail\n"
+               "instead?\n",
+               mta
+       );
+       if (yesno(buf) == 0)
+               return;
+
+       sprintf(buf, "for x in /etc/rc*.d/S*%s; do mv $x `echo $x |sed s/S/K/g`; done >/dev/null 2>&1", mta);
+       system(buf);
+       sprintf(buf, "/etc/init.d/%s stop >/dev/null 2>&1", mta);
+       system(buf);
+}
+
 
 
 
@@ -936,6 +971,11 @@ NEW_INST:
 #ifndef __CYGWIN__
        check_inittab_entry();  /* Check /etc/inittab */
        check_xinetd_entry();   /* Check /etc/xinetd.d/telnet */
+
+       /* Offer to disable other MTA's on the system. */
+       disable_other_mta("sendmail");
+       disable_other_mta("postfix");
+       disable_other_mta("qmail");
 #endif
 
        if ((pw = getpwuid(config.c_bbsuid)) == NULL)