Przeglądaj źródła

* Remove remaining email code, as well as OWNEREMAIL

Bryan Drewery 16 lat temu
rodzic
commit
5c142e3dc1
5 zmienionych plików z 4 dodań i 54 usunięć
  1. 1 0
      doc/UPDATES
  2. 1 6
      src/binary.c
  3. 2 3
      src/settings.h
  4. 0 42
      src/shell.c
  5. 0 3
      src/shell.h

+ 1 - 0
doc/UPDATES

@@ -6,6 +6,7 @@
   * Fix problem of upgrading with uninitialized binaries causing corruption (will kick in on future upgrades)
   * Optimized how some shell operations are executed.
   * Uname checking (and associated emails) have been removed.
+  * Email functionality has been removed.
   * Fix crash on OpenBSD due to mmap(2) bug.
 * Cookie op changes
   * Cookie op algorithm changed again, they can no longer be easily reused (fixes #402) Thank you mulder.

+ 1 - 6
src/binary.c

@@ -31,7 +31,7 @@
 settings_t settings = {
   SETTINGS_HEADER,
   /* -- STATIC -- */
-  "", "", "", "", "", "", "", "", "", "",
+  "", "", "", "", "", "", "", "", "",
   /* -- DYNAMIC -- */
   "", "", "", "", "", "", "", "", "",
   /* -- PADDING */
@@ -366,9 +366,6 @@ readcfg(const char *cfgfile, bool read_stdin)
         } else if (!strcasecmp(buffer, STR("owner"))) {
           strlcat(settings.owners, trim(p), sizeof(settings.owners));
           strlcat(settings.owners, ",", sizeof(settings.owners));
-        } else if (!strcasecmp(buffer, STR("owneremail"))) {
-          strlcat(settings.owneremail, trim(p), sizeof(settings.owneremail));
-          strlcat(settings.owneremail, ",", sizeof(settings.owneremail));
         } else if (!strcasecmp(buffer, STR("hub"))) {
           strlcat(settings.hubs, trim(p), sizeof(settings.hubs));
           strlcat(settings.hubs, ",", sizeof(settings.hubs));
@@ -467,7 +464,6 @@ static void edpack(settings_t *incfg, const char *in_hash, int what)
   dofield(incfg->dcc_prefix);
   dofield(incfg->features);
   dofield(incfg->owners);
-  dofield(incfg->owneremail);
   dofield(incfg->hubs);
 
   dohash(incfg->salt1);
@@ -504,7 +500,6 @@ tellconfig(settings_t *incfg)
   dofield(incfg->dcc_prefix);
   dofield(incfg->features);
   dofield(incfg->owners);
-  dofield(incfg->owneremail);
   dofield(incfg->hubs);
 //  dofield(incfg->salt1);
 //  dofield(incfg->salt2);

+ 2 - 3
src/settings.h

@@ -19,7 +19,6 @@ typedef struct settings_struct {
   char shellhash[65];
   char owners[513];
   char hubs[513];
-  char owneremail[385];
   char salt1[33];
   char salt2[17];
   char dcc_prefix[17];
@@ -35,7 +34,7 @@ typedef struct settings_struct {
   char portmin[17];       /* for hubs, the reserved port range for incoming connections */
   char portmax[17];       /* for hubs, the reserved port range for incoming connections */
   /* -- PADDING -- */
-  char padding[13];        // (16 - (sizeof(settings_t) % 16)) % 16]
+  char padding[14];        // (16 - (sizeof(settings_t) % 16)) % 16]
 } settings_t;
 
 #define SALT1 {s1_1[0],s1_1[1],s1_5[0],s1_5[1],s1_8[0],s1_8[1],s1_4[0],s1_9[1],s1_2[0],s1_13[0],s1_6[0],s1_6[1],s1_7[0],s1_7[1],s1_3[0],s1_13[1],s1_16[1],s1_4[1],s1_15[0],s1_10[1],s1_14[0],s1_14[1],s1_12[0],s1_12[1],s1_2[1],s1_3[1],s1_11[0],s1_11[1],s1_10[0],s1_15[1],s1_16[0],s1_9[0],'\0'}
@@ -47,7 +46,7 @@ typedef struct settings_struct {
 extern char s1_3[3],s1_2[3],s1_1[3],s2_7[3],s1_9[3],s1_13[3],s1_14[3],s2_2[3],s1_10[3],s2_4[3],s1_4[3],s2_3[3],s2_1[3],s2_6[3],s1_7[3],s1_12[3],s2_5[3],s1_5[3],s1_6[3],s1_11[3],s2_8[3],s1_8[3],s1_16[3],s1_15[3];
 
 #define SIZE_PACK sizeof(settings.hash) + sizeof(settings.packname) + sizeof(settings.shellhash) + \
-sizeof(settings.owners) + sizeof(settings.hubs) + sizeof(settings.owneremail) + \
+sizeof(settings.owners) + sizeof(settings.hubs) + \
 sizeof(settings.salt1) + sizeof(settings.salt2) + sizeof(settings.dcc_prefix) + sizeof(settings.features)
 
 #define SIZE_CONF sizeof(settings.dynamic_initialized) + sizeof(settings.bots) + sizeof(settings.uid) + \

+ 0 - 42
src/shell.c

@@ -644,48 +644,6 @@ void werr(int errnum)
   exit(0);				//gcc is stupid :)
 }
 
-int email(char *subject, char *msg, int who)
-{
-  struct utsname un;
-  char run[2048] = "", addrs[100] = "";
-  bool mail = 0, sendmail = 0;
-  FILE *f = NULL;
-
-  uname(&un);
-  if (is_file(STR("/usr/sbin/sendmail")))
-    sendmail = 1;
-  else if (is_file(STR("/usr/bin/mail")))
-    mail = 1;
-  else {
-    putlog(LOG_WARN, "*", STR("I Have no usable mail client."));
-    return 1;
-  }
-
-  if (who & EMAIL_OWNERS)
-    strlcpy(addrs, replace(settings.owneremail, ",", " "), sizeof(addrs));
-
-  if (sendmail)
-    strlcpy(run, STR("/usr/sbin/sendmail -t"), sizeof(run));
-  else if (mail)
-    simple_snprintf(run, sizeof(run), STR("/usr/bin/mail %s -a \"From: %s@%s\" -s \"%s\" -a \"Content-Type: text/plain\""), addrs, conf.bot->nick ? conf.bot->nick : "none", un.nodename, subject);
-
-  if ((f = popen(run, "w"))) {
-    if (sendmail) {
-      fprintf(f, STR("To: %s\n"), addrs);
-      fprintf(f, STR("From: %s@%s\n"), origbotname[0] ? origbotname : (conf.username ? conf.username : "WRAITH"), un.nodename);
-      fprintf(f, STR("Subject: %s\n"), subject);
-      fprintf(f, STR("Content-Type: text/plain\n"));
-    }
-    fprintf(f, "%s\n", msg);
-    if (fflush(f))
-      return 1;
-    if (pclose(f))
-      return 1;
-  } else
-    return 1;
-  return 0;
-}
-
 char *homedir(bool useconf)
 {
   static char homedir_buf[PATH_MAX] = "";

+ 0 - 3
src/shell.h

@@ -24,8 +24,6 @@
 #define ERR_NOTINIT	22
 #define ERR_MAX         23
 
-#define EMAIL_OWNERS    BIT0
-
 #define DETECT_LOGIN 	1
 #define DETECT_TRACE 	2
 #define DETECT_PROMISC 	3
@@ -50,7 +48,6 @@ void clear_tmp();
 char *homedir(bool = 1);
 char *my_username();
 void expand_tilde(char **);
-int email(char *, char *, int);
 int shell_exec(char *, char *, char **, char **, bool = 0);
 int simple_exec(const char* argv[]);
 #ifndef CYGWIN_HACKS