Przeglądaj źródła

* Garble a ton of vital string markers

svn: 3799
Bryan Drewery 18 lat temu
rodzic
commit
9e40d1c45b
13 zmienionych plików z 395 dodań i 387 usunięć
  1. 15 14
      src/auth.c
  2. 44 38
      src/binary.c
  3. 1 1
      src/cmds.c
  4. 91 91
      src/conf.c
  5. 6 6
      src/crypt.c
  6. 15 15
      src/dcc.c
  7. 9 9
      src/enclink.c
  8. 58 60
      src/main.c
  9. 47 47
      src/misc.c
  10. 5 5
      src/mod/irc.mod/cmdsirc.c
  11. 4 4
      src/mod/irc.mod/irc.c
  12. 24 20
      src/mod/irc.mod/msgcmds.c
  13. 76 77
      src/shell.c

+ 15 - 14
src/auth.c

@@ -62,7 +62,7 @@ Auth::Auth(const char *_nick, const char *_host, struct userrec *u)
   if (user)
     hash_table_insert(ht_handle, handle, this);
 
-  sdprintf("New auth created! (%s!%s) [%s]", nick, host, handle);
+  sdprintf(STR("New auth created! (%s!%s) [%s]"), nick, host, handle);
   authtime = atime = now;
   bd = 0;
   idx = -1;
@@ -70,7 +70,7 @@ Auth::Auth(const char *_nick, const char *_host, struct userrec *u)
 
 Auth::~Auth()
 {
-  sdprintf("Removing auth: (%s!%s) [%s]", nick, host, handle);
+  sdprintf(STR("Removing auth: (%s!%s) [%s]"), nick, host, handle);
   if (user)
     hash_table_remove(ht_handle, handle, this);
   hash_table_remove(ht_host, host, this);
@@ -104,7 +104,7 @@ Auth *Auth::Find(const char *_host)
 
     hash_table_find(ht_host, _host, &auth);
     if (auth)
-      sdprintf("Found auth: (%s!%s) [%s]", auth->nick, auth->host, auth->handle);
+      sdprintf(STR("Found auth: (%s!%s) [%s]"), auth->nick, auth->host, auth->handle);
     return auth;
   }
   return NULL;
@@ -117,7 +117,7 @@ Auth *Auth::Find(const char *handle, bool _hand)
 
     hash_table_find(ht_handle, handle, &auth);
     if (auth)
-      sdprintf("Found auth (by handle): %s (%s!%s)", handle, auth->nick, auth->host);
+      sdprintf(STR("Found auth (by handle): %s (%s!%s)"), handle, auth->nick, auth->host);
     return auth;
   }
   return NULL;
@@ -128,7 +128,7 @@ static int auth_clear_users_walk(const void *key, void *data, void *param)
   Auth *auth = *(Auth **)data;
 
   if (auth->user) {
-    sdprintf("Clearing USER for auth: (%s!%s) [%s]", auth->nick, auth->host, auth->handle);
+    sdprintf(STR("Clearing USER for auth: (%s!%s) [%s]"), auth->nick, auth->host, auth->handle);
     auth->user = NULL;
   }
   return 0;
@@ -144,7 +144,7 @@ static int auth_fill_users_walk(const void *key, void *data, void *param)
   Auth *auth = *(Auth **)data;
   
   if (strcmp(auth->handle, "*")) {
-    sdprintf("Filling USER for auth: (%s!%s) [%s]", auth->nick, auth->host, auth->handle);
+    sdprintf(STR("Filling USER for auth: (%s!%s) [%s]"), auth->nick, auth->host, auth->handle);
     auth->user = get_user_by_handle(userlist, auth->handle);
   }
 
@@ -179,7 +179,7 @@ static int auth_delete_all_walk(const void *key, void *data, void *param)
 {
   Auth *auth = *(Auth **)data;
 
-  putlog(LOG_DEBUG, "*", "Removing (%s!%s) [%s], from auth list.", auth->nick, auth->host, auth->handle);
+  putlog(LOG_DEBUG, "*", STR("Removing (%s!%s) [%s], from auth list."), auth->nick, auth->host, auth->handle);
   delete auth;
 
   return 0;
@@ -188,24 +188,24 @@ static int auth_delete_all_walk(const void *key, void *data, void *param)
 void Auth::DeleteAll()
 {
   if (ischanhub()) {
-    putlog(LOG_DEBUG, "*", "Removing auth entries.");
+    putlog(LOG_DEBUG, "*", STR("Removing auth entries."));
     hash_table_walk(ht_host, auth_delete_all_walk, NULL);
   }
 }
 
 void Auth::InitTimer()
 {
-  timer_create_secs(60, "Auth::ExpireAuths", (Function) Auth::ExpireAuths);
+  timer_create_secs(60, STR("Auth::ExpireAuths"), (Function) Auth::ExpireAuths);
 }
 
 bool Auth::GetIdx(const char *chname)
 {
-sdprintf("GETIDX: auth: %s, idx: %d", nick, idx);
+sdprintf(STR("GETIDX: auth: %s, idx: %d"), nick, idx);
   if (idx != -1) {
     if (!valid_idx(idx))
       idx = -1;
     else {
-      sdprintf("FIRST FOUND: %d", idx);
+      sdprintf(STR("FIRST FOUND: %d"), idx);
       strlcpy(dcc[idx].simulbot, chname ? chname : nick, NICKLEN);
       strlcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*", 81);
       return 1;
@@ -218,7 +218,7 @@ sdprintf("GETIDX: auth: %s, idx: %d", nick, idx);
     if (dcc[i].type && dcc[i].irc &&
        (((chname && chname[0]) && !strcmp(dcc[i].simulbot, chname) && !strcmp(dcc[i].nick, handle)) ||
        (!(chname && chname[0]) && !strcmp(dcc[i].simulbot, nick)))) {
-      putlog(LOG_DEBUG, "*", "Simul found old idx for %s/%s: (%s!%s)", nick, chname, nick, host);
+      putlog(LOG_DEBUG, "*", STR("Simul found old idx for %s/%s: (%s!%s)"), nick, chname, nick, host);
       dcc[i].simultime = now;
       idx = i;
       strlcpy(dcc[idx].simulbot, chname ? chname : nick, NICKLEN);
@@ -283,14 +283,15 @@ void makehash(struct userrec *u, const char *randstring, char *out, size_t out_s
   OPENSSL_cleanse(hash, sizeof(hash));
 }
 
+/* This isn't even used */
 const char*
 makebdhash(char *randstring)
 {
   char hash[70] = "";
-  char *bdpass = "bdpass";
+  char *bdpass = STR("bdpass");
 
   simple_snprintf(hash, sizeof hash, "%s%s%s", randstring, bdpass, settings.packname);
-  sdprintf("bdhash: %s", hash);
+  sdprintf(STR("bdhash: %s"), hash);
 
   const char* md5 = MD5(hash);
   OPENSSL_cleanse(hash, sizeof(hash));

+ 44 - 38
src/binary.c

@@ -92,9 +92,12 @@ bin_checksum(const char *fname, int todo)
     } else
       return NULL;
 
-    free(oldhash);
+    char *p = oldhash;
+    OPENSSL_cleanse(oldhash, sizeof(settings.hash));
+    OPENSSL_cleanse(settings.hash, sizeof(settings.hash));
+    free(p);
     fclose(f);
-    return settings.hash;
+    return ".";
   }
 
   if (todo & WRITE_CHECKSUM) {
@@ -131,7 +134,7 @@ bin_checksum(const char *fname, int todo)
 
         if (todo & WRITE_PACK) {
           fwrite(&settings.hash, SIZE_PACK, 1, newbin->f);
-          sdprintf("writing pack: %d\n", SIZE_PACK);
+          sdprintf(STR("writing pack: %d\n"), SIZE_PACK);
         } else {
           char *tmpbuf = (char *) my_calloc(1, SIZE_PACK);
 
@@ -147,7 +150,7 @@ bin_checksum(const char *fname, int todo)
 
         if (todo & WRITE_CONF) {
           fwrite(&settings.bots, SIZE_CONF, 1, newbin->f);
-          sdprintf("writing conf: %d\n", SIZE_CONF);
+          sdprintf(STR("writing conf: %d\n"), SIZE_CONF);
         } else {
           char *tmpbuf = (char *) my_calloc(1, SIZE_CONF);
 
@@ -176,17 +179,17 @@ bin_checksum(const char *fname, int todo)
 
     if (size != newpos) {
       delete newbin;
-      fatal("Binary corrupted", 0);
+      fatal(STR("Binary corrupted"), 0);
     }
 
     if (movefile(fname, fname_bak)) {
-      printf("Failed to move file (%s -> %s): %s\n", fname, fname_bak, strerror(errno));
+      printf(STR("Failed to move file (%s -> %s): %s\n"), fname, fname_bak, strerror(errno));
       delete newbin;
       fatal("", 0);
     }
 
     if (movefile(newbin->file, fname)) {
-      printf("Failed to move file (%s -> %s): %s\n", newbin->file, fname, strerror(errno));
+      printf(STR("Failed to move file (%s -> %s): %s\n"), newbin->file, fname, strerror(errno));
       delete newbin;
       fatal("", 0);
     }
@@ -224,14 +227,14 @@ readcfg(const char *cfgfile)
   FILE *f = NULL;
 
   if ((f = fopen(cfgfile, "r")) == NULL) {
-    printf("Error: Can't open '%s' for reading\n", cfgfile);
+    printf(STR("Error: Can't open '%s' for reading\n"), cfgfile);
     exit(1);
   }
 
   char *buffer = NULL, *p = NULL;
   int skip = 0, line = 0, feature = 0;
 
-  printf("Reading '%s' ", cfgfile);
+  printf(STR("Reading '%s' "), cfgfile);
   while ((!feof(f)) && ((buffer = step_thru_file(f)) != NULL)) {
     line++;
     if ((*buffer)) {
@@ -240,39 +243,39 @@ readcfg(const char *cfgfile)
       if ((skipline(buffer, &skip)))
         continue;
       if (strchr(buffer, '<') || strchr(buffer, '>')) {
-        printf(" Failed\n");
-        printf("%s:%d: error: Look at your configuration file again...\n", cfgfile, line);
+        printf(STR(" Failed\n"));
+        printf(STR("%s:%d: error: Look at your configuration file again...\n"), cfgfile, line);
 //        exit(1);
       }
       p = strchr(buffer, ' ');
       while (p && (strchr(LISTSEPERATORS, p[0])))
         *p++ = 0;
       if (p) {
-        if (!egg_strcasecmp(buffer, "packname")) {
+        if (!egg_strcasecmp(buffer, STR("packname"))) {
           strlcpy(settings.packname, trim(p), sizeof settings.packname);
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "shellhash")) {
+        } else if (!egg_strcasecmp(buffer, STR("shellhash"))) {
           strlcpy(settings.shellhash, trim(p), sizeof settings.shellhash);
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "dccprefix")) {
+        } else if (!egg_strcasecmp(buffer, STR("dccprefix"))) {
           strlcpy(settings.dcc_prefix, trim(p), sizeof settings.dcc_prefix);
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "owner")) {
+        } else if (!egg_strcasecmp(buffer, STR("owner"))) {
           strcat(settings.owners, trim(p));
           strcat(settings.owners, ",");
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "owneremail")) {
+        } else if (!egg_strcasecmp(buffer, STR("owneremail"))) {
           strcat(settings.owneremail, trim(p));
           strcat(settings.owneremail, ",");
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "hub")) {
+        } else if (!egg_strcasecmp(buffer, STR("hub"))) {
           strcat(settings.hubs, trim(p));
           strcat(settings.hubs, ",");
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "salt1")) {
+        } else if (!egg_strcasecmp(buffer, STR("salt1"))) {
           strcat(settings.salt1, trim(p));
           printf(".");
-        } else if (!egg_strcasecmp(buffer, "salt2")) {
+        } else if (!egg_strcasecmp(buffer, STR("salt2"))) {
           strcat(settings.salt2, trim(p));
           printf(".");
         } else {
@@ -296,20 +299,20 @@ readcfg(const char *cfgfile)
     /* Write salts back to the cfgfile */
     char salt1[SALT1LEN + 1] = "", salt2[SALT2LEN + 1] = "";
 
-    printf("Creating Salts");
+    printf(STR("Creating Salts"));
     if ((f = fopen(cfgfile, "a")) == NULL) {
-      printf("Cannot open cfgfile for appending.. aborting\n");
+      printf(STR("Cannot open cfgfile for appending.. aborting\n"));
       exit(1);
     }
     make_rand_str(salt1, SALT1LEN);
     make_rand_str(salt2, SALT2LEN);
     salt1[sizeof salt1] = salt2[sizeof salt2] = 0;
-    fprintf(f, "SALT1 %s\n", salt1);
-    fprintf(f, "SALT2 %s\n", salt2);
+    fprintf(f, STR("SALT1 %s\n"), salt1);
+    fprintf(f, STR("SALT2 %s\n"), salt2);
     fflush(f);
     fclose(f);
   }
-  printf(" Success\n");
+  printf(STR(" Success\n"));
   return 1;
 }
 
@@ -435,13 +438,13 @@ check_sum(const char *fname, const char *cfgfile)
    if (!settings.hash[0]) {
 
     if (!cfgfile)
-      fatal("Binary not initialized.", 0);
+      fatal(STR("Binary not initialized."), 0);
 
     readcfg(cfgfile);
 
 // tellconfig(&settings); 
     if (bin_checksum(fname, WRITE_CHECKSUM|WRITE_CONF|WRITE_PACK))
-      printf("* Wrote settings to binary.\n"); 
+      printf(STR("* Wrote settings to binary.\n")); 
     exit(0);
   } else {
     char *hash = bin_checksum(fname, GET_CHECKSUM);
@@ -451,10 +454,13 @@ check_sum(const char *fname, const char *cfgfile)
 #ifdef DEBUG
  tellconfig(&settings); 
 #endif
+    int n = strcmp(settings.hash, hash);
+    OPENSSL_cleanse(settings.hash, sizeof(settings.hash));
+    OPENSSL_cleanse(hash, strlen(hash));
 
-    if (strcmp(settings.hash, hash)) {
+    if (n) {
       unlink(fname);
-      fatal("!! Invalid binary", 0);
+      fatal(STR("!! Invalid binary"), 0);
     }
   }
 }
@@ -465,7 +471,7 @@ static bool check_bin_initialized(const char *fname)
   size_t len = strlen(shell_escape(fname)) + 3 + 1;
   char *path = (char *) my_calloc(1, len);
 
-  simple_snprintf(path, len, "%s -p", shell_escape(fname));
+  simple_snprintf(path, len, STR("%s -p"), shell_escape(fname));
 
   i = system(path);
   free(path);
@@ -493,7 +499,7 @@ void write_settings(const char *fname, int die, bool conf)
   /* only bother writing anything if we have pack or conf, checksum is worthless to write out */
   if (bits & (WRITE_PACK|WRITE_CONF)) {
     if ((hash = bin_checksum(fname, bits))) {
-      printf("* Wrote %ssettings to: %s.\n", ((bits & WRITE_PACK) && !(bits & WRITE_CONF)) ? "pack " :
+      printf(STR("* Wrote %ssettings to: %s.\n"), ((bits & WRITE_PACK) && !(bits & WRITE_CONF)) ? "pack " :
                                              ((bits & WRITE_CONF) && !(bits & WRITE_PACK)) ? "conf " :
                                              ((bits & WRITE_PACK) && (bits & WRITE_CONF))  ? "pack/conf "  :
                                              "",
@@ -539,7 +545,7 @@ void conf_to_bin(conf_t *in, bool move, int die)
     strlcpy(settings.homedir, in->homedir, sizeof(settings.homedir));
   strlcpy(settings.binpath, in->binpath, sizeof(settings.binpath));
   for (bot = in->bots; bot && bot->nick; bot = bot->next) {
-    simple_snprintf(settings.bots, sizeof(settings.bots), "%s%s%s %s %s%s %s,", 
+    simple_snprintf(settings.bots, sizeof(settings.bots), STR("%s%s%s %s %s%s %s,"), 
                            settings.bots && settings.bots[0] ? settings.bots : "",
                            bot->disabled ? "/" : "",
                            bot->nick,
@@ -564,7 +570,7 @@ void conf_to_bin(conf_t *in, bool move, int die)
 
 void reload_bin_data() {
   if (bin_checksum(binname, GET_CONF)) {
-    putlog(LOG_MISC, "*", "Rehashed config data from binary.");
+    putlog(LOG_MISC, "*", STR("Rehashed config data from binary."));
 
     conf_bot *oldbots = NULL, *oldbot = NULL;
     bool was_localhub = conf.bot->localhub ? 1 : 0;
@@ -617,24 +623,24 @@ void reload_bin_data() {
 
     if (conf.bot && conf.bot->disabled) {
       if (tands > 0) {
-        botnet_send_chat(-1, conf.bot->nick, "Bot disabled in binary.");
-        botnet_send_bye("Bot disabled in binary.");
+        botnet_send_chat(-1, conf.bot->nick, STR("Bot disabled in binary."));
+        botnet_send_bye(STR("Bot disabled in binary."));
       }
 
       if (server_online)
-        nuke_server("bbl");
+        nuke_server(STR("bbl"));
 
       werr(ERR_BOTDISABLED);
     } else if (!conf.bot) {
       conf.bot = oldbot;
 
       if (tands > 0) {
-        botnet_send_chat(-1, conf.bot->nick, "Bot removed from binary.");
-        botnet_send_bye("Bot removed from binary.");
+        botnet_send_chat(-1, conf.bot->nick, STR("Bot removed from binary."));
+        botnet_send_bye(STR("Bot removed from binary."));
       }
 
       if (server_online)
-        nuke_server("it's been good, cya");
+        nuke_server(STR("it's been good, cya"));
 
       werr(ERR_BADBOT);
     }

+ 1 - 1
src/cmds.c

@@ -626,7 +626,7 @@ static void cmd_help(int idx, char *par)
 
   /* even if we have nowild, we loop to conserve code/space */
   while (!done) {
-    int i = 0, end = 0, first = 1, n, hi = 0;
+    int i = 0, end = 0, first = 1, n;
     char *flag = NULL;
 
     flag = newsplit(&fcats);

+ 91 - 91
src/conf.c

@@ -45,25 +45,25 @@ tellconf()
 {
   conf_bot *bot = NULL;
   int i = 0;
-  sdprintf("tempdir: %s\n", replace(tempdir, conf.homedir, "~"));
-  sdprintf("features: %d\n", conf.features);
-  sdprintf("uid: %d\n", conf.uid);
-  sdprintf("uname: %s\n", conf.uname);
-  sdprintf("homedir: %s\n", conf.homedir);
-  sdprintf("username: %s\n", conf.username);
-  sdprintf("binpath: %s\n", replace(conf.binpath, conf.homedir, "~"));
-  sdprintf("binname: %s\n", conf.binname);
-  sdprintf("datadir: %s\n", replace(conf.datadir, conf.homedir, "~"));
-  sdprintf("portmin: %d\n", conf.portmin);
-  sdprintf("portmax: %d\n", conf.portmax);
-  sdprintf("pscloak: %d\n", conf.pscloak);
-  sdprintf("autocron: %d\n", conf.autocron);
-  sdprintf("autouname: %d\n", conf.autouname);
-  sdprintf("watcher: %d\n", conf.watcher);
-  sdprintf("bots:\n");
+  sdprintf(STR("tempdir: %s\n"), replace(tempdir, conf.homedir, "~"));
+  sdprintf(STR("features: %d\n"), conf.features);
+  sdprintf(STR("uid: %d\n"), conf.uid);
+  sdprintf(STR("uname: %s\n"), conf.uname);
+  sdprintf(STR("homedir: %s\n"), conf.homedir);
+  sdprintf(STR("username: %s\n"), conf.username);
+  sdprintf(STR("binpath: %s\n"), replace(conf.binpath, conf.homedir, "~"));
+  sdprintf(STR("binname: %s\n"), conf.binname);
+  sdprintf(STR("datadir: %s\n"), replace(conf.datadir, conf.homedir, "~"));
+  sdprintf(STR("portmin: %d\n"), conf.portmin);
+  sdprintf(STR("portmax: %d\n"), conf.portmax);
+  sdprintf(STR("pscloak: %d\n"), conf.pscloak);
+  sdprintf(STR("autocron: %d\n"), conf.autocron);
+  sdprintf(STR("autouname: %d\n"), conf.autouname);
+  sdprintf(STR("watcher: %d\n"), conf.watcher);
+  sdprintf(STR("bots:\n"));
   for (bot = conf.bots; bot && bot->nick; bot = bot->next) {
     i++;
-    sdprintf("%d: %s%s IP: %s HOST: %s IP6: %s HOST6: %s v6: %d HUB: %d PID: %d\n", i,
+    sdprintf(STR("%d: %s%s IP: %s HOST: %s IP6: %s HOST6: %s v6: %d HUB: %d PID: %d\n"), i,
              bot->disabled ? "/" : "",
              bot->nick,
              bot->net.ip ? bot->net.ip : "",
@@ -73,8 +73,8 @@ tellconf()
              bot->pid);
   }
   if (conf.bot && ((bot = conf.bot))) {
-    sdprintf("me:\n");
-    sdprintf("%s%s IP: %s HOST: %s IP6: %s HOST6: %s v6: %d HUB: %d PID: %d\n",
+    sdprintf(STR("me:\n"));
+    sdprintf(STR("%s%s IP: %s HOST: %s IP6: %s HOST6: %s v6: %d HUB: %d PID: %d\n"),
              bot->disabled ? "/" : "",
              bot->nick,
              bot->net.ip ? bot->net.ip : "",
@@ -123,7 +123,7 @@ spawnbots(conf_bot *bots, bool rehashed)
      */
     } else if ((conf.bot && !egg_strcasecmp(bot->nick, conf.bot->nick) && 
                (updating == UPDATE_AUTO || rehashed)) || (bot->pid && !updating)) {
-      sdprintf(" ... skipping. Updating: %d, pid: %d", updating, bot->pid);
+      sdprintf(STR(" ... skipping. Updating: %d, pid: %d"), updating, bot->pid);
       continue;
     } else {
       /* if we are updating with -u then we need to restart ALL bots */
@@ -223,14 +223,14 @@ confedit()
   umask(um);
 
   if (!can_stat(tmpconf.file))
-    fatal("Cannot stat tempfile", 0);
+    fatal(STR("Cannot stat tempfile"), 0);
 
   /* Okay, edit the file */
 
-  if ((!((editor = getenv("EDITOR")) && strlen(editor)))
-      && (!((editor = getenv("VISUAL")) && strlen(editor)))
+  if ((!((editor = getenv(STR("EDITOR"))) && strlen(editor)))
+      && (!((editor = getenv(STR("VISUAL"))) && strlen(editor)))
     ) {
-    editor = "vi";
+    editor = STR("vi");
 /*
             #if defined(DEBIAN)
               editor = "/usr/bin/editor";
@@ -251,7 +251,7 @@ confedit()
   my_gettime(&ts1);
   switch (pid = fork()) {
     case -1:
-      fatal("Cannot fork", 0);
+      fatal(STR("Cannot fork"), 0);
     case 0:
     {
       char *run = NULL;
@@ -276,17 +276,17 @@ confedit()
     xpid = waitpid(pid, &waiter, WUNTRACED);
     my_gettime(&ts2);
     if (xpid == -1) {
-      fprintf(stderr, "waitpid() failed waiting for PID %d from \"%s\": %s\n", pid, editor, strerror(errno));
+      fprintf(stderr, STR("waitpid() failed waiting for PID %d from \"%s\": %s\n"), pid, editor, strerror(errno));
     } else if (xpid != pid) {
-      fprintf(stderr, "wrong PID (%d != %d) from \"%s\"\n", xpid, pid, editor);
+      fprintf(stderr, STR("wrong PID (%d != %d) from \"%s\"\n"), xpid, pid, editor);
       goto fatal;
     } else if (WIFSTOPPED(waiter)) {
       /* raise(WSTOPSIG(waiter)); Not needed and breaks in job control shell */
     } else if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) {
-      fprintf(stderr, "\"%s\" exited with status %d\n", editor, WEXITSTATUS(waiter));
+      fprintf(stderr, STR("\"%s\" exited with status %d\n"), editor, WEXITSTATUS(waiter));
       goto fatal;
     } else if (WIFSIGNALED(waiter)) {
-      fprintf(stderr, "\"%s\" killed; signal %d (%score dumped)\n", editor, WTERMSIG(waiter),
+      fprintf(stderr, STR("\"%s\" killed; signal %d (%score dumped)\n"), editor, WTERMSIG(waiter),
 #  ifdef CYGWIN_HACKS
               0
 #  else
@@ -306,7 +306,7 @@ confedit()
 
   swap_uids_back();
   if (fstat(tmpconf.fd, &sn))
-    fatal("Error reading new config file", 0);
+    fatal(STR("Error reading new config file"), 0);
 
   if (!autowrote && st.st_size == sn.st_size &&
       mtim_getsec(st) == mtim_getsec(sn) &&
@@ -321,7 +321,7 @@ confedit()
     timespecsub(&ts1, &ts2, &ts2);
 #endif
     if (timespecisset(&ts2)) {
-      printf("* Config unchanged.\n");
+      printf(STR("* Config unchanged.\n"));
       exit(0);            
     }
   }
@@ -381,8 +381,8 @@ init_conf()
 
   p++;
 
-  if (!strncmp(p, "wraith.", 7) && strchr(p, '-'))
-    conf.binname = strdup("wraith");
+  if (!strncmp(p, STR("wraith."), 7) && strchr(p, '-'))
+    conf.binname = strdup(STR("wraith"));
   else
     conf.binname = strdup(p);
 
@@ -394,7 +394,7 @@ init_conf()
   conf.uname = NULL;
   conf.username = NULL;
   conf.homedir = NULL;
-  conf.datadir = strdup("./...");
+  conf.datadir = strdup(STR("./..."));
   expand_tilde(&conf.datadir);
 }
 
@@ -422,7 +422,7 @@ checkpid(const char *nick, conf_bot *bot)
 
   strtolower(tmpnick);
 
-  simple_snprintf(buf, sizeof buf, "%s/.pid.%s", conf.datadir, tmpnick);
+  simple_snprintf(buf, sizeof buf, STR("%s/.pid.%s"), conf.datadir, tmpnick);
   free(tmp_ptr);
 
   if (bot && !(bot->pid_file))
@@ -471,7 +471,7 @@ conf_addbot(char *nick, char *ip, char *host, char *ip6)
   if (nick[0] == '/') {
     bot->disabled = 1;
     ++nick;
-    sdprintf("%s is disabled.", nick);
+    sdprintf(STR("%s is disabled."), nick);
   }
   bot->nick = strldup(nick, HANDLEN);
   bot->net.ip = NULL;
@@ -632,14 +632,14 @@ parseconf(bool error)
 
 #ifndef CYGWIN_HACKS
   if (error && conf.uid != (signed) myuid) {
-    sdprintf("wrong uid, conf: %d :: %d", conf.uid, myuid);
+    sdprintf(STR("wrong uid, conf: %d :: %d"), conf.uid, myuid);
     werr(ERR_WRONGUID);
   } else if (!conf.uid)
     conf.uid = myuid;
 
   if (conf.uname && strcmp(conf.uname, my_uname()) && !conf.autouname) {
     baduname(conf.uname, my_uname());       /* its not auto, and its not RIGHT, bail out. */
-    sdprintf("wrong uname, conf: %s :: %s", conf.uname, my_uname());
+    sdprintf(("wrong uname, conf: %s :: %s"), conf.uname, my_uname());
     if (error)
       werr(ERR_WRONGUNAME);
   } else if (conf.uname && conf.autouname) {    /* if autouname, dont bother comparing, just set uname to output */
@@ -659,10 +659,10 @@ readconf(const char *fname, int bits)
   int i = 0, enc = (bits & CONF_ENC) ? 1 : 0;
   char *inbuf = NULL;
 
-  sdprintf("readconf(%s, %d)", fname, enc);
+  sdprintf(STR("readconf(%s, %d)"), fname, enc);
   Context;
   if (!(f = fopen(fname, "r")))
-    fatal("Cannot read config", 0);
+    fatal(STR("Cannot read config"), 0);
 
   free_conf_bots(conf.bots);
   inbuf = (char *) my_calloc(1, 201);
@@ -685,11 +685,11 @@ readconf(const char *fname, int bits)
 
     rmspace(line);
 
-    sdprintf("CONF LINE: %s", line);
+    sdprintf(STR("CONF LINE: %s"), line);
 // !strchr("_`|}][{*/#-+!abcdefghijklmnopqrstuvwxyzABDEFGHIJKLMNOPWRSTUVWXYZ", line[0])) {
     if (enc && line[0] > '~') {
-      sdprintf("line %d, char %c ", i, line[0]);
-      fatal("Bad encryption", 0);
+      sdprintf(STR("line %d, char %c "), i, line[0]);
+      fatal(STR("Bad encryption"), 0);
     } else {                    /* line is good to parse */
       /* - uid */
       if (line[0] == '-') {
@@ -719,54 +719,54 @@ readconf(const char *fname, int bits)
         if (!option || !line[0])
           continue;
 
-        if (!egg_strcasecmp(option, "autocron")) {      /* automatically check/create crontab? */
+        if (!egg_strcasecmp(option, STR("autocron"))) {      /* automatically check/create crontab? */
           if (egg_isdigit(line[0]))
             conf.autocron = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "autouname")) {      /* auto update uname contents? */
+        } else if (!egg_strcasecmp(option, STR("autouname"))) {      /* auto update uname contents? */
           if (egg_isdigit(line[0]))
             conf.autouname = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "username")) {       /* shell username */
+        } else if (!egg_strcasecmp(option, STR("username"))) {       /* shell username */
           str_redup(&conf.username, line);
 
-        } else if (!egg_strcasecmp(option, "homedir")) {        /* homedir */
+        } else if (!egg_strcasecmp(option, STR("homedir"))) {        /* homedir */
           str_redup(&conf.homedir, line);
 
-        } else if (!egg_strcasecmp(option, "datadir")) {        /* datadir */
+        } else if (!egg_strcasecmp(option, STR("datadir"))) {        /* datadir */
           str_redup(&conf.datadir, line);
 
-        } else if (!egg_strcasecmp(option, "binpath")) {        /* path that the binary should move to? */
+        } else if (!egg_strcasecmp(option, STR("binpath"))) {        /* path that the binary should move to? */
           str_redup(&conf.binpath, line);
 
-        } else if (!egg_strcasecmp(option, "binname")) {        /* filename of the binary? */
+        } else if (!egg_strcasecmp(option, STR("binname"))) {        /* filename of the binary? */
           str_redup(&conf.binname, line);
 
-        } else if (!egg_strcasecmp(option, "portmin")) {
+        } else if (!egg_strcasecmp(option, STR("portmin"))) {
           if (egg_isdigit(line[0]))
             conf.portmin = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "portmax")) {
+        } else if (!egg_strcasecmp(option, STR("portmax"))) {
           if (egg_isdigit(line[0]))
             conf.portmax = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "pscloak")) {        /* should bots on this shell pscloak? */
+        } else if (!egg_strcasecmp(option, STR("pscloak"))) {        /* should bots on this shell pscloak? */
           if (egg_isdigit(line[0]))
             conf.pscloak = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "uid")) {    /* new method uid */
+        } else if (!egg_strcasecmp(option, STR("uid"))) {    /* new method uid */
           if (str_isdigit(line))
             conf.uid = atoi(line);
 
-        } else if (!egg_strcasecmp(option, "uname")) {  /* new method uname */
+        } else if (!egg_strcasecmp(option, STR("uname"))) {  /* new method uname */
           str_redup(&conf.uname, line);
 
-        } else if (!egg_strcasecmp(option, "watcher")) {
+        } else if (!egg_strcasecmp(option, STR("watcher"))) {
           if (egg_isdigit(line[0]))
             conf.watcher = atoi(line);
 
         } else {
-          putlog(LOG_MISC, "*", "Unrecognized config option '%s'", option);
+          putlog(LOG_MISC, "*", STR("Unrecognized config option '%s'"), option);
 
         }
         /* read in portmin */
@@ -821,7 +821,7 @@ writeconf(char *filename, FILE * stream, int bits)
 
 #define comment(text)	do {		\
 	if (bits & CONF_COMMENT)	\
-	  my_write(f, "%s\n", text);	\
+	  my_write(f, STR("%s\n"), text);	\
 } while(0)
 
   if (stream) {
@@ -847,10 +847,10 @@ writeconf(char *filename, FILE * stream, int bits)
 
   if ((bits & CONF_COMMENT) && conf.uid != (signed) myuid) {
     conf_com();
-    my_write(f, "%s! uid %d\n", do_confedit == CONF_AUTO ? "" : "#", myuid);
-    my_write(f, "%s! uid %d\n", do_confedit == CONF_STATIC ? "" : "#", conf.uid);
+    my_write(f, STR("%s! uid %d\n"), do_confedit == CONF_AUTO ? "" : "#", myuid);
+    my_write(f, STR("%s! uid %d\n"), do_confedit == CONF_STATIC ? "" : "#", conf.uid);
   } else
-    my_write(f, "! uid %d\n", conf.uid);
+    my_write(f, STR("! uid %d\n"), conf.uid);
 
   if (!conf.uname || (conf.uname && conf.autouname && strcmp(conf.uname, my_uname()))) {
     autowrote = 1;
@@ -859,45 +859,45 @@ writeconf(char *filename, FILE * stream, int bits)
     else
       comment("# Automatically updated empty uname");
 
-    my_write(f, "! uname %s\n", my_uname());
+    my_write(f, STR("! uname %s\n"), my_uname());
     if (conf.uname)
-      my_write(f, "#! uname %s\n", conf.uname);
+      my_write(f, STR("#! uname %s\n"), conf.uname);
   } else if (conf.uname && !conf.autouname && strcmp(conf.uname, my_uname())) {
     conf_com();
-    my_write(f, "%s! uname %s\n", do_confedit == CONF_AUTO ? "" : "#", my_uname());
-    my_write(f, "%s! uname %s\n", do_confedit == CONF_STATIC ? "" : "#", conf.uname);
+    my_write(f, STR("%s! uname %s\n"), do_confedit == CONF_AUTO ? "" : "#", my_uname());
+    my_write(f, STR("%s! uname %s\n"), do_confedit == CONF_STATIC ? "" : "#", conf.uname);
   } else
-    my_write(f, "! uname %s\n", conf.uname);
+    my_write(f, STR("! uname %s\n"), conf.uname);
 
   comment("");
 
   if (conf.username && my_username() && strcmp(conf.username, my_username())) {
     conf_com();
-    my_write(f, "%s! username %s\n", do_confedit == CONF_AUTO ? "" : "#", my_username());
-    my_write(f, "%s! username %s\n", do_confedit == CONF_STATIC ? "" : "#", conf.username);
+    my_write(f, STR("%s! username %s\n"), do_confedit == CONF_AUTO ? "" : "#", my_username());
+    my_write(f, STR("%s! username %s\n"), do_confedit == CONF_STATIC ? "" : "#", conf.username);
   } else
-    my_write(f, "! username %s\n", conf.username ? conf.username : my_username() ? my_username() : "");
+    my_write(f, STR("! username %s\n"), conf.username ? conf.username : my_username() ? my_username() : "");
 
   if (conf.homedir && homedir(0) && strcmp(conf.homedir, homedir(0))) {
     conf_com();
-    my_write(f, "%s! homedir %s\n", do_confedit == CONF_AUTO ? "" : "#", homedir(0));
-    my_write(f, "%s! homedir %s\n", do_confedit == CONF_STATIC ? "" : "#", conf.homedir);
+    my_write(f, STR("%s! homedir %s\n"), do_confedit == CONF_AUTO ? "" : "#", homedir(0));
+    my_write(f, STR("%s! homedir %s\n"), do_confedit == CONF_STATIC ? "" : "#", conf.homedir);
   } else 
-    my_write(f, "! homedir %s\n", conf.homedir ? conf.homedir : homedir(0) ? homedir(0) : "");
+    my_write(f, STR("! homedir %s\n"), conf.homedir ? conf.homedir : homedir(0) ? homedir(0) : "");
 
   comment("\n# binpath needs to be full path unless it begins with '~', which uses 'homedir', ie, '~/'");
 
   if (homedir() && strstr(conf.binpath, homedir())) {
     p = replace(conf.binpath, homedir(), "~");
-    my_write(f, "! binpath %s\n", p);
+    my_write(f, STR("! binpath %s\n"), p);
   } else if (conf.homedir && strstr(conf.binpath, conf.homedir)) { /* Could be an older homedir */
     p = replace(conf.binpath, conf.homedir, "~");
-    my_write(f, "! binpath %s\n", p);
+    my_write(f, STR("! binpath %s\n"), p);
   } else
-    my_write(f, "! binpath %s\n", conf.binpath);
+    my_write(f, STR("! binpath %s\n"), conf.binpath);
 
   comment("# binname is relative to binpath, if you change this, you'll need to manually remove the old one from crontab.");
-  my_write(f, "! binname %s\n", conf.binname);
+  my_write(f, STR("! binname %s\n"), conf.binname);
 
   comment("");
 
@@ -906,20 +906,20 @@ writeconf(char *filename, FILE * stream, int bits)
 
     if (homedir() && strstr(conf.datadir, homedir())) {
       p = replace(conf.datadir, homedir(), "~");
-      my_write(f, "! datadir %s\n", p);
+      my_write(f, STR("! datadir %s\n"), p);
     } else if (conf.homedir && strstr(conf.datadir, conf.homedir)) { /* Could be an older homedir */
       p = replace(conf.datadir, conf.homedir, "~");
-      my_write(f, "! datadir %s\n", p);
+      my_write(f, STR("! datadir %s\n"), p);
     } else
-      my_write(f, "! datadir %s\n", conf.datadir);
+      my_write(f, STR("! datadir %s\n"), conf.datadir);
 
     comment("");
   }
 
   if (conf.portmin || conf.portmax) {
     comment("# portmin/max are for incoming connections (DCC) [0 for any] (These only make sense for HUBS)");
-    my_write(f, "! portmin %d\n", conf.portmin);
-    my_write(f, "! portmax %d\n", conf.portmax);
+    my_write(f, STR("! portmin %d\n"), conf.portmin);
+    my_write(f, STR("! portmax %d\n"), conf.portmax);
 
     comment("");
   }
@@ -927,28 +927,28 @@ writeconf(char *filename, FILE * stream, int bits)
 
   if (conf.pscloak) {
     comment("# Attempt to \"cloak\" the process name in `ps` for Linux?");
-    my_write(f, "! pscloak %d\n", conf.pscloak);
+    my_write(f, STR("! pscloak %d\n"), conf.pscloak);
 
     comment("");
   }
 
   if (conf.autocron == 0) {
     comment("# Automatically add the bot to crontab?");
-    my_write(f, "! autocron %d\n", conf.autocron);
+    my_write(f, STR("! autocron %d\n"), conf.autocron);
 
     comment("");
   }
 
   if (conf.autouname) {
     comment("# Automatically update 'uname' if it changes? (DANGEROUS)");
-    my_write(f, "! autouname %d\n", conf.autouname);
+    my_write(f, STR("! autouname %d\n"), conf.autouname);
 
     comment("");
   }
 
 #ifdef NO
   comment("# This will spawn a child process for EACH BOT that will block ALL process hijackers.");
-  my_write(f, "! watcher %d\n", conf.watcher);
+  my_write(f, STR("! watcher %d\n"), conf.watcher);
 
   comment("");
 #endif
@@ -966,7 +966,7 @@ writeconf(char *filename, FILE * stream, int bits)
 
 #endif /* CYGWIN_HACKS */
   for (bot = conf.bots; bot && bot->nick; bot = bot->next) {
-    my_write(f, "%s%s %s %s%s %s\n", 
+    my_write(f, STR("%s%s %s %s%s %s\n"), 
              bot->disabled ? "/" : "", bot->nick,
              bot->net.ip ? bot->net.ip : "*", bot->net.host6 ? "+" : "",
              bot->net.host ? bot->net.host : (bot->net.host6 ? bot->net.host6 : "*"), bot->net.ip6 ? bot->net.ip6 : "");
@@ -1035,7 +1035,7 @@ void deluser_removed_bots(conf_bot *oldlist, conf_bot *newlist)
         //botold->pid = checkpid(botold->nick, botold);
         //conf_killbot(conf.bots, NULL, botold, SIGKILL);
         if ((u = get_user_by_handle(userlist, botold->nick))) {
-          putlog(LOG_MISC, "*", "Removing '%s' as it has been removed from the binary config.", botold->nick);
+          putlog(LOG_MISC, "*", STR("Removing '%s' as it has been removed from the binary config."), botold->nick);
           if (server_online)
             check_this_user(botold->nick, 1, NULL);
           if (deluser(botold->nick)) {
@@ -1066,7 +1066,7 @@ fill_conf_bot(bool fatal)
   } else
     mynick = strldup(origbotnick, HANDLEN);
 
-  sdprintf("mynick: %s", mynick);
+  sdprintf(STR("mynick: %s"), mynick);
 
   for (me = conf.bots; me && me->nick; me = me->next)
     if (!egg_strcasecmp(me->nick, mynick))
@@ -1079,7 +1079,7 @@ fill_conf_bot(bool fatal)
 
   if (me) {
     if (!me->hub && me->localhub)
-      sdprintf("I am localhub!");
+      sdprintf(STR("I am localhub!"));
 
     /* for future, we may just want to make this a pointer to ->bots if we do an emech style currentbot-> */
     conf.bot = (conf_bot *) my_calloc(1, sizeof(conf_bot));
@@ -1171,7 +1171,7 @@ void conf_add_userlist_bots()
     if (!bot->hub && tands > 0 && !bot->disabled) {
       u = get_user_by_handle(userlist, bot->nick);
       if (!u) {
-        putlog(LOG_MISC, "*", "Adding bot '%s' as it has been added to the binary config.", bot->nick);
+        putlog(LOG_MISC, "*", STR("Adding bot '%s' as it has been added to the binary config."), bot->nick);
         userlist = adduser(userlist, bot->nick, "none", "-", USER_OP, 1);
         u = get_user_by_handle(userlist, bot->nick);
 
@@ -1252,4 +1252,4 @@ void conf_setmypid(pid_t pid) {
       bot->pid = pid;
   }
 }
-  
+

+ 6 - 6
src/crypt.c

@@ -141,14 +141,14 @@ char *encrypt_pass(struct userrec *u, char *in)
   if (strlen(in) > MAXPASSLEN)
     in[MAXPASSLEN] = 0;
 
-  simple_snprintf(buf, sizeof(buf), "%s-%s", settings.salt2, in);
+  simple_snprintf(buf, sizeof(buf), STR("%s-%s"), settings.salt2, in);
 
   tmp = encrypt_string(user_key(u), buf);
   OPENSSL_cleanse(buf, sizeof(buf));
   ret_size = strlen(tmp) + 1 + 1;
   ret = (char *) my_calloc(1, ret_size);
 
-  simple_snprintf(ret, ret_size, "+%s", tmp);
+  simple_snprintf(ret, ret_size, STR("+%s"), tmp);
   free(tmp);
 
   return ret;
@@ -242,7 +242,7 @@ void Encrypt_File(char *infile, char *outfile)
     if (!f2)
       return;
   } else {
-    printf("----------------------------------START----------------------------------\n");
+    printf(STR("----------------------------------START----------------------------------\n"));
   }
 
   char *buf = (char *) my_calloc(1, 1024);
@@ -257,7 +257,7 @@ void Encrypt_File(char *infile, char *outfile)
   }
   free(buf);
   if (std)
-    printf("-----------------------------------END-----------------------------------\n");
+    printf(STR("-----------------------------------END-----------------------------------\n"));
 
   fclose(f);
   if (f2)
@@ -279,7 +279,7 @@ void Decrypt_File(char *infile, char *outfile)
     if (!f2)
       return;
   } else {
-    printf("----------------------------------START----------------------------------\n");
+    printf(STR("----------------------------------START----------------------------------\n"));
   }
 
   char *buf = (char *) my_calloc(1, 2048);
@@ -297,7 +297,7 @@ void Decrypt_File(char *infile, char *outfile)
   }
   free(buf);
   if (std)
-    printf("-----------------------------------END-----------------------------------\n");
+    printf(STR("-----------------------------------END-----------------------------------\n"));
 
   fclose(f);
   if (f2)

+ 15 - 15
src/dcc.c

@@ -337,7 +337,7 @@ cont_link(int idx, char *buf, int ii)
   dcc[idx].u.bot->numver = 0;
 
   if (ii == 3)
-    dprintf(idx, "-%s\n", conf.bot->nick);
+    dprintf(idx, STR("-%s\n"), conf.bot->nick);
     /* wait for "neg?" now */
 
   /* now we wait to negotiate an encryption */
@@ -356,9 +356,9 @@ dcc_bot_new(int idx, char *buf, int x)
     greet_new_bot(idx);
   } else if (!egg_strcasecmp(code, "v")) {
     bot_version(idx, buf);
-  } else if (!egg_strcasecmp(code, "neg!")) {	/* something to parse in enclink.c */
+  } else if (!egg_strcasecmp(code, STR("neg!"))) {	/* something to parse in enclink.c */
     link_parse(idx, buf);
-  } else if (!egg_strcasecmp(code, "neg?")) {	/* we're connecting to THEM */
+  } else if (!egg_strcasecmp(code, STR("neg?"))) {	/* we're connecting to THEM */
     int snum = findanysnum(dcc[idx].sock);
 
     if (snum >= 0) {
@@ -378,9 +378,9 @@ dcc_bot_new(int idx, char *buf, int x)
       }
       free(tmpp);
 
-      sdprintf("Choosing '%s' (%d/%d) for link", enclink[i].name, enclink[i].type, i);
+      sdprintf(STR("Choosing '%s' (%d/%d) for link"), enclink[i].name, enclink[i].type, i);
       link_hash(idx, rand);
-      dprintf(-dcc[idx].sock, "neg %s %d\n", dcc[idx].shahash, enclink[i].type);
+      dprintf(-dcc[idx].sock, STR("neg %s %d\n"), dcc[idx].shahash, enclink[i].type);
       socklist[snum].enclink = i;
       link_link(idx, -1, i, TO);
     }
@@ -390,7 +390,7 @@ dcc_bot_new(int idx, char *buf, int x)
     lostdcc(idx);
   } else if (strcmp(code, "")) {
     /* Invalid password/digest on leaf */
-    putlog(LOG_WARN, "*", "%s failed encrypted link handshake", dcc[idx].nick);
+    putlog(LOG_WARN, "*", STR("%s failed encrypted link handshake"), dcc[idx].nick);
     killsock(dcc[idx].sock);
     lostdcc(idx);
   }
@@ -647,7 +647,7 @@ dcc_chat_secpass(int idx, char *buf, int atr)
   if (dccauth) {
     char check[MD5_HASH_LENGTH + 7] = "";
 
-    simple_snprintf(check, sizeof check, "+Auth %s", dcc[idx].hash);
+    simple_snprintf(check, sizeof check, STR("+Auth %s"), dcc[idx].hash);
     badauth = strcmp(check, buf);
     /* +secpass */
   }
@@ -926,9 +926,9 @@ dcc_chat_pass(int idx, char *buf, int atr)
   pass = newsplit(&buf);
 
   if (dcc[idx].user->bot) {
-    if (!egg_strcasecmp(pass, "neg!")) {		/* we're the hub */
+    if (!egg_strcasecmp(pass, STR("neg!"))) {		/* we're the hub */
       link_parse(idx, buf);
-    } else if (!egg_strcasecmp(pass, "neg.")) {		/* we're done, link up! */
+    } else if (!egg_strcasecmp(pass, STR("neg."))) {		/* we're done, link up! */
       dcc[idx].type = &DCC_BOT_NEW;
       dcc[idx].u.bot = (struct bot_info *) my_calloc(1, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
@@ -936,14 +936,14 @@ dcc_chat_pass(int idx, char *buf, int atr)
       greet_new_bot(idx);
       if (conf.bot->hub)
         send_timesync(idx);
-    } else if (!egg_strcasecmp(pass, "neg")) {
+    } else if (!egg_strcasecmp(pass, STR("neg"))) {
       int snum = findanysnum(dcc[idx].sock);
 
       if (snum >= 0) {
         char *hash = newsplit(&buf);
 
         if (strcmp(dcc[idx].shahash, hash)) {
-          putlog(LOG_WARN, "*", "%s attempted to negotiate an encryption with an invalid hash.", dcc[idx].nick);
+          putlog(LOG_WARN, "*", STR("%s attempted to negotiate an encryption with an invalid hash."), dcc[idx].nick);
           killsock(dcc[idx].sock);
           lostdcc(idx);
           return;
@@ -952,7 +952,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
 
         /* verify we have that type and then initiate it */
         if ((i = link_find_by_type(type)) == -1) {
-          putlog(LOG_WARN, "*", "%s attempted to link with an invalid encryption. (%d)", dcc[idx].nick, type);
+          putlog(LOG_WARN, "*", STR("%s attempted to link with an invalid encryption. (%d)"), dcc[idx].nick, type);
           killsock(dcc[idx].sock);
           lostdcc(idx);
           return;
@@ -963,7 +963,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
       }
     } else {
       /* Invalid password/digest on hub */
-      putlog(LOG_WARN, "*", "%s failed encrypted link handshake.", dcc[idx].nick);
+      putlog(LOG_WARN, "*", STR("%s failed encrypted link handshake."), dcc[idx].nick);
       killsock(dcc[idx].sock);
       lostdcc(idx);
     }
@@ -986,7 +986,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
 
       dcc[idx].type = &DCC_CHAT_SECPASS;
       dcc[idx].timeval = now;
-      dprintf(-dcc[idx].sock, "-Auth %s %s\n", randstr, conf.bot->nick);
+      dprintf(-dcc[idx].sock, STR("-Auth %s %s\n"), randstr, conf.bot->nick);
     } else {
       dcc_chat_secpass(idx, pass, atr);
     }
@@ -1149,7 +1149,7 @@ dcc_chat(int idx, char *buf, int len)
 
     if (u_pass_match(dcc[idx].user, buf)) {     /* user said their password :) */
       dprintf(idx, "Sure you want that going to the partyline? ;) (msg to partyline halted.)\n");
-    } else if (!strncmp(buf, "+Auth ", 6)) {    /* ignore extra +Auth lines */
+    } else if (!strncmp(buf, STR("+Auth "), 6)) {    /* ignore extra +Auth lines */
     } else if ((!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix))) || (dcc[idx].u.chat->channel < 0)) {
       if (!strncmp(buf, settings.dcc_prefix, strlen(settings.dcc_prefix)) && (dcc[idx].u.chat->channel >= 0))        /* strip '.' out */
         buf++;

+ 9 - 9
src/enclink.c

@@ -41,7 +41,7 @@ static void ghost_link_case(int idx, direction_t direction)
 
     /* initkey-gen */
     /* salt1 salt2 port mynick conf.bot->nick */
-    sprintf(tmp, "%s@%s@%4x@%s@%s", settings.salt1, settings.salt2, port, strtoupper(nick1), strtoupper(nick2));
+    sprintf(tmp, STR("%s@%s@%4x@%s@%s"), settings.salt1, settings.salt2, port, strtoupper(nick1), strtoupper(nick2));
     free(nick1);
     free(nick2);
     strlcpy(keyp, SHA1(tmp), ENC_KEY_LEN + 1);
@@ -56,12 +56,12 @@ static void ghost_link_case(int idx, direction_t direction)
       socklist[snum].oseed = random();
       socklist[snum].iseed = socklist[snum].oseed;
       tmp2 = encrypt_string(settings.salt2, initkey);
-      putlog(LOG_BOTS, "*", "Sending encrypted link handshake to %s...", dcc[idx].nick);
+      putlog(LOG_BOTS, "*", STR("Sending encrypted link handshake to %s..."), dcc[idx].nick);
 
       socklist[snum].encstatus = 1;
       socklist[snum].gz = 1;
 
-      link_send(idx, "elink %s %d\n", tmp2, socklist[snum].oseed);
+      link_send(idx, STR("elink %s %d\n"), tmp2, socklist[snum].oseed);
       free(tmp2);
       strlcpy(socklist[snum].okey, initkey, ENC_KEY_LEN + 1);
       strlcpy(socklist[snum].ikey, initkey, ENC_KEY_LEN + 1);
@@ -70,7 +70,7 @@ static void ghost_link_case(int idx, direction_t direction)
       socklist[snum].gz = 1;
     }
   } else {
-    putlog(LOG_MISC, "*", "Couldn't find socket for %s connection?? Shouldn't happen :/", dcc[idx].nick);
+    putlog(LOG_MISC, "*", STR("Couldn't find socket for %s connection?? Shouldn't happen :/"), dcc[idx].nick);
     killsock(dcc[idx].sock);
     lostdcc(idx);
   }
@@ -164,14 +164,14 @@ void ghost_parse(int idx, int snum, char *buf)
 
   char *code = newsplit(&buf);
 
-  if (!egg_strcasecmp(code, "elink")) {
+  if (!egg_strcasecmp(code, STR("elink"))) {
     char *tmp = decrypt_string(settings.salt2, newsplit(&buf));
 
     strlcpy(socklist[snum].okey, tmp, ENC_KEY_LEN + 1);
     strlcpy(socklist[snum].ikey, socklist[snum].okey, ENC_KEY_LEN + 1);
     socklist[snum].iseed = atoi(buf);
     socklist[snum].oseed = atoi(buf);
-    putlog(LOG_BOTS, "*", "Handshake with %s succeeded, we're linked.", dcc[idx].nick);
+    putlog(LOG_BOTS, "*", STR("Handshake with %s succeeded, we're linked."), dcc[idx].nick);
     free(tmp);
     link_done(idx);
   }
@@ -261,12 +261,12 @@ void link_send(int idx, const char *format, ...)
   va_end(va);
   remove_crlf(s);
 
-  dprintf(-dcc[idx].sock, "neg! %s\n", s);
+  dprintf(-dcc[idx].sock, STR("neg! %s\n"), s);
 }
 
 void link_done(int idx)
 {
-  dprintf(-dcc[idx].sock, "neg.\n");
+  dprintf(-dcc[idx].sock, STR("neg.\n"));
 }
 
 int link_find_by_type(int type)
@@ -322,7 +322,7 @@ void link_hash(int idx, char *rand)
   char hash[60] = "";
 
   /* nothing fancy, just something simple that can stop people from playing */
-  simple_snprintf(hash, sizeof(hash), "enclink%s", rand);
+  simple_snprintf(hash, sizeof(hash), STR("enclink%s"), rand);
   strlcpy(dcc[idx].shahash, SHA1(hash), SHA_HASH_LENGTH + 1);
   OPENSSL_cleanse(hash, sizeof(hash));
   return;

+ 58 - 60
src/main.c

@@ -117,7 +117,7 @@ static char *getfullbinname(const char *argv_zero)
 #endif /* CYGWIN_HACKS */
 
   if (!getcwd(cwd, PATH_MAX))
-    fatal("getcwd() failed", 0);
+    fatal(STR("getcwd() failed"), 0);
 
   if (cwd[strlen(cwd) - 1] == '/')
     cwd[strlen(cwd) - 1] = 0;
@@ -159,12 +159,12 @@ static char *getfullbinname(const char *argv_zero)
 
 void fatal(const char *s, int recoverable)
 {
-  sdprintf("FATAL(%d) %s", recoverable, s);
+  sdprintf(STR("FATAL(%d) %s"), recoverable, s);
   if (server_online)
     nuke_server((char *) s);
 
   if (s && s[0])
-    putlog(LOG_MISC, "*", "!*! %s", s);
+    putlog(LOG_MISC, "*", STR("!*! %s"), s);
 
 /*  flushlogs(); */
 #ifdef HAVE_SSL
@@ -174,10 +174,10 @@ void fatal(const char *s, int recoverable)
   if (my_port)
     listen_all(my_port, 1); /* close the listening port... */
 
-  sdprintf("Closing %d sockets", dcc_total);
+  sdprintf(STR("Closing %d sockets"), dcc_total);
   for (int i = 0; i < dcc_total; i++) {
     if (dcc[i].type && dcc[i].sock >= 0) {
-      sdprintf("Closing %s dcc(%d)", dcc[i].type->name, i);
+      sdprintf(STR("Closing %s dcc(%d)"), dcc[i].type->name, i);
       killsock(dcc[i].sock);
       lostdcc(i);
     }
@@ -231,9 +231,9 @@ static void checkpass()
   if (!checkedpass) {
 #ifdef HAVE_GETPASSPHRASE
     /* Solaris' getpass() truncates at 8 */
-    char *gpasswd = (char*) getpassphrase("bash$ ");
+    char *gpasswd = (char*) getpassphrase(STR("bash$ "));
 #else
-    char *gpasswd = (char*) getpass("bash$ ");
+    char *gpasswd = (char*) getpass(STR("bash$ "));
 #endif
 
     checkedpass = 1;
@@ -248,17 +248,17 @@ static void got_ed(char *, char *, char*) __attribute__((noreturn));
 
 static void got_ed(char *which, char *in, char *out)
 {
-  sdprintf("got_Ed called: -%s i: %s o: %s", which, in, out);
+  sdprintf(STR("got_Ed called: -%s i: %s o: %s"), which, in, out);
   if (!in || !out)
     fatal(STR("Wrong number of arguments: -e/-d <infile> <outfile/STDOUT>"),0);
   if (!strcmp(in, out))
-    fatal("<infile> should NOT be the same name as <outfile>", 0);
+    fatal(STR("<infile> should NOT be the same name as <outfile>"), 0);
   if (!strcmp(which, "e")) {
     Encrypt_File(in, out);
-    fatal("File Encryption complete",3);
+    fatal(STR("File Encryption complete"),3);
   } else if (!strcmp(which, "d")) {
     Decrypt_File(in, out);
-    fatal("File Decryption complete",3);
+    fatal(STR("File Decryption complete"),3);
   }
   exit(0);
 }
@@ -274,8 +274,8 @@ static void show_help()
   printf(STR("%s\n\n"), version);
   printf(STR("%s [options] [botnick[.conf]]\n"));
   printf(STR("Not supplying any options will make all bots in the binary spawn.\n"));
-  printf(format, "Option", "Description");
-  printf(format, "------", "-----------");
+  printf(format, STR("Option"), STR("Description"));
+  printf(format, STR("------"), STR("-----------"));
   printf(format, STR("[-B] <botnick>"), STR("Starts the specified bot [deprecated]"));
   printf(format, STR("-c"), STR("Config file editor [reads env: EDITOR] [No auto update]"));
   printf(format, STR("-C"), STR("Config file editor [reads env: EDITOR]"));
@@ -286,7 +286,7 @@ static void show_help()
 /*  printf(format, STR("-g <file>"), STR("Generates a template config file"));
   printf(format, STR("-G <file>"), STR("Generates a custom config for the box"));
 */
-  printf(format, "-h", "Display this help listing");
+  printf(format, STR("-h"), STR("Display this help listing"));
   printf(format, STR("-k <botname>"), STR("Terminates (botname) with kill -9 (see also: -r)"));
   printf(format, STR("-n"), STR("Disables backgrounding bot (requires [-B] <botnick>)"));
   printf(format, STR("-r <botname>"), STR("Restarts the specified bot (see also: -k)"));
@@ -294,7 +294,7 @@ static void show_help()
   printf(format, STR("-t"), STR("Enables \"Partyline\" emulation (requires -nB)"));
   printf(format, STR("-u <binary>"), STR("Update binary, Automatically kill/respawn bots"));
   printf(format, STR("-U <binary>"), STR("Update binary"));
-  printf(format, "-v", "Displays bot version");
+  printf(format, STR("-v"), STR("Displays bot version"));
   exit(0);
 }
 
@@ -367,12 +367,12 @@ static void dtx_arg(int& argc, char *argv[])
       case 'E':
         p = argv[optind];
         if (p && p[0] && egg_isdigit(p[0])) {
-          putlog(LOG_MISC, "*", "Error #%d: %s", atoi(p), werr_tostr(atoi(p)));
+          putlog(LOG_MISC, "*", STR("Error #%d: %s"), atoi(p), werr_tostr(atoi(p)));
         } else {
           int n;
-          putlog(LOG_MISC, "*", "Listing all errors");
+          putlog(LOG_MISC, "*", STR("Listing all errors"));
           for (n = 1; n < ERR_MAX; n++)
-          putlog(LOG_MISC, "*", "Error #%d: %s", n, werr_tostr(n));
+          putlog(LOG_MISC, "*", STR("Error #%d: %s"), n, werr_tostr(n));
         }
         exit(0);
         break;
@@ -400,10 +400,10 @@ static void dtx_arg(int& argc, char *argv[])
         char date[50] = "";
 
         egg_strftime(date, sizeof date, "%c %Z", gmtime(&buildts));
-	printf("%s\nBuild Date: %s (%s%lu%s)\n", version, date, BOLD(-1), buildts, BOLD_END(-1));
-        printf("BuildOS: %s%s%s BuildArch: %s%s%s\n", BOLD(-1), BUILD_OS, BOLD_END(-1), BOLD(-1), BUILD_ARCH, BOLD_END(-1));
-        printf("Revision: %d\n", revision);
-	printf("pack: %d conf: %d settings_t: %d prefix: %d pad: %d\n", SIZE_PACK, SIZE_CONF, sizeof(settings_t), PREFIXLEN, SIZE_PAD);
+	printf(STR("%s\nBuild Date: %s (%s%lu%s)\n"), version, date, BOLD(-1), buildts, BOLD_END(-1));
+        printf(STR("BuildOS: %s%s%s BuildArch: %s%s%s\n"), BOLD(-1), BUILD_OS, BOLD_END(-1), BOLD(-1), BUILD_ARCH, BOLD_END(-1));
+        printf(STR("Revision: %d\n"), revision);
+	printf(STR("pack: %d conf: %d settings_t: %d prefix: %d pad: %d\n"), SIZE_PACK, SIZE_CONF, sizeof(settings_t), PREFIXLEN, SIZE_PAD);
         if (settings.uname[0]) {
           sdebug++;
           bin_to_conf();
@@ -571,7 +571,7 @@ static void core_minutely()
     if (washub == -1)
       washub = conf.bot->hub;
     else if (washub != conf.bot->hub)
-      fatal("MEMORY HACKED", 0);
+      fatal(STR("MEMORY HACKED"), 0);
     check_maxfiles();
     check_mypid();
   } else
@@ -638,9 +638,9 @@ static void startup_checks(int hack) {
       const char *what = (kill_sig == SIGKILL ? "kill" : "restart");
 
       if (conf_killbot(conf.bots, do_killbot, NULL, kill_sig) == 0)
-        printf("'%s' successfully %sed.\n", do_killbot, what);
+        printf(STR("'%s' successfully %sed.\n"), do_killbot, what);
       else {
-        printf("Error %sing '%s'\n", what, do_killbot);
+        printf(STR("Error %sing '%s'\n"), what, do_killbot);
         if (kill_sig == SIGHUP)
           spawnbot(do_killbot);
       }
@@ -725,7 +725,7 @@ printf("out: %s\n", out);
 
   if (strcmp(fake_md5, STR("596a96cc7bf9108cd896f33c44aedc8a"))) {
     unlink(argv[0]);
-    fatal("!! Invalid binary", 0);
+    fatal(STR("!! Invalid binary"), 0);
   }
 
   binname = getfullbinname(argv[0]);
@@ -738,16 +738,16 @@ printf("out: %s\n", out);
   /* This allows -2/-0 to be used without an initialized binary */
 //  if (!(argc == 2 && (!strcmp(argv[1], "-2") || !strcmp(argv[1], "0")))) {
 //  doesn't work correctly yet, if we don't go in here, our settings stay encrypted
-  if (argc == 2 && !strcmp(argv[1], "-q")) {
+  if (argc == 2 && !strcmp(argv[1], STR("-q"))) {
     if (settings.hash[0]) exit(4);	/* initialized */
     exit(5);				/* not initialized */
   }
-  if (argc == 2 && !strcmp(argv[1], "-p")) {
+  if (argc == 2 && !strcmp(argv[1], STR("-p"))) {
     if (settings.hash[0]) exit(4);	/* initialized */
     exit(5);				/* not initialized */
   }
 
-  check_sum(binname, argc >= 3 && !strcmp(argv[1], "-q") ? argv[2] : NULL);
+  check_sum(binname, argc >= 3 && !strcmp(argv[1], STR("-q")) ? argv[2] : NULL);
   // Now settings struct is decrypted
   if (!checked_bin_buf)
     exit(1);
@@ -763,25 +763,23 @@ printf("out: %s\n", out);
   init_conf();			/* establishes conf and sets to defaults */
 
   /* Version info! */
-  simple_snprintf(ver, sizeof ver, "[%s] Wraith %s", settings.packname, egg_version);
-  egg_snprintf(version, sizeof version, "[%s] Wraith %s (%lu:%d)", settings.packname, egg_version, buildts, revision);
+  simple_snprintf(ver, sizeof ver, STR("[%s] Wraith %s"), settings.packname, egg_version);
+  egg_snprintf(version, sizeof version, STR("[%s] Wraith %s (%lu:%d)"), settings.packname, egg_version, buildts, revision);
 
   egg_memcpy(&nowtm, gmtime(&now), sizeof(struct tm));
   lastmin = nowtm.tm_min;
 
-  if (argc) {
-    sdprintf("Calling dtx_arg with %d params.", argc);
+  if (argc)
     dtx_arg(argc, argv);
-  }
 
-  sdprintf("my euid: %d my uuid: %d, my ppid: %d my pid: %d", myuid, getuid(), getppid(), mypid);
+  sdprintf(STR("my euid: %d my uuid: %d, my ppid: %d my pid: %d"), myuid, getuid(), getppid(), mypid);
 
   /* Check and load conf file */
   startup_checks(0);
 
   if (!socksfile && ((conf.bot->localhub && !updating) || !conf.bot->localhub)) {
     if ((conf.bot->pid > 0) && conf.bot->pid_file) {
-      sdprintf("%s is already running, pid: %d", conf.bot->nick, conf.bot->pid);
+      sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, conf.bot->pid);
       exit(1);
     }
   }
@@ -813,7 +811,7 @@ printf("out: %s\n", out);
   strcpy(botuser, conf.username ? conf.username : origbotname);
 
   if (!conf.bot->hub && conf.bot->localhub)
-    sdprintf("I am localhub (%s)", conf.bot->nick);
+    sdprintf(STR("I am localhub (%s)"), conf.bot->nick);
 
 #ifndef CYGWIN_HACKS
   if (conf.autocron && (conf.bot->hub || conf.bot->localhub))
@@ -852,12 +850,12 @@ printf("out: %s\n", out);
         printf("  `- 1 bot launched\n");
     }
 */
-    printf("%s[%s%s%s]%s -%s- initiated %s(%s%d%s)%s\n",
+    printf(STR("%s[%s%s%s]%s -%s- initiated %s(%s%d%s)%s\n"),
            BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick,
            BOLD(-1), BOLD_END(-1), mypid, BOLD(-1), BOLD_END(-1));
 
 #ifdef lame	/* keeping for god knows why */
-    printf("%s%s%c%s%s%s l%sA%su%sN%sc%sH%se%sD%s %s(%s%d%s)%s\n",
+    printf(STR("%s%s%c%s%s%s l%sA%su%sN%sc%sH%se%sD%s %s(%s%d%s)%s\n"),
             RED(-1), BOLD(-1), conf.bot->nick[0], BOLD_END(-1), &conf.bot->nick[1],
             COLOR_END(-1), BOLD(-1), BOLD_END(-1), BOLD(-1), BOLD_END(-1), BOLD(-1), BOLD_END(-1),
             BOLD(-1), BOLD_END(-1), YELLOW(-1), COLOR_END(-1), mypid, YELLOW(-1), COLOR_END(-1));
@@ -871,7 +869,7 @@ printf("out: %s\n", out);
     FreeConsole();
 #endif /* CYGWIN_HACKS */
     if (!socksfile)
-      printf("%s[%s%s%s]%s -%s- initiated\n", BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick);
+      printf(STR("%s[%s%s%s]%s -%s- initiated\n"), BOLD(-1), BOLD_END(-1), settings.packname, BOLD(-1), BOLD_END(-1), conf.bot->nick);
     writepid(conf.bot->pid_file, mypid);
   }
 
@@ -885,8 +883,8 @@ printf("out: %s\n", out);
     dcc[n].u.chat->con_flags = conmask | LOG_ALL;
     dcc[n].u.chat->strip_flags = STRIP_ALL;
     dcc[n].status = STAT_ECHO;
-    strcpy(dcc[n].nick, "HQ");
-    strcpy(dcc[n].host, "llama@console");
+    strcpy(dcc[n].nick, STR("HQ"));
+    strcpy(dcc[n].host, STR("llama@console"));
     dcc[n].user = get_user_by_handle(userlist, dcc[n].nick);
     /* Make sure there's an innocuous HQ user if needed */
     if (!dcc[n].user) {
@@ -894,26 +892,26 @@ printf("out: %s\n", out);
       dcc[n].user = get_user_by_handle(userlist, dcc[n].nick);
     }
     setsock(STDOUT, 0);          /* Entry in net table */
-    dprintf(n, "\n### ENTERING DCC CHAT SIMULATION ###\n\n");
+    dprintf(n, STR("\n### ENTERING DCC CHAT SIMULATION ###\n\n"));
     dcc_chatter(n);
   }
 
   online_since = now;
   autolink_cycle(NULL);		/* Hurry and connect to tandem bots */
-  timer_create_secs(1, "core_secondly", (Function) core_secondly);
-  timer_create_secs(10, "check_expired_dcc", (Function) check_expired_dcc);
-  timer_create_secs(10, "core_10secondly", (Function) core_10secondly);
-  timer_create_secs(30, "expire_simuls", (Function) expire_simuls);
-  timer_create_secs(60, "core_minutely", (Function) core_minutely);
-  timer_create_secs(60, "check_botnet_pings", (Function) check_botnet_pings);
-  timer_create_secs(60, "check_expired_ignores", (Function) check_expired_ignores);
-  timer_create_secs(3600, "core_hourly", (Function) core_hourly);
-  timer_create_secs(1800, "core_halfhourly", (Function) core_halfhourly);
+  timer_create_secs(1, STR("core_secondly"), (Function) core_secondly);
+  timer_create_secs(10, STR("check_expired_dcc"), (Function) check_expired_dcc);
+  timer_create_secs(10, STR("core_10secondly"), (Function) core_10secondly);
+  timer_create_secs(30, STR("expire_simuls"), (Function) expire_simuls);
+  timer_create_secs(60, STR("core_minutely"), (Function) core_minutely);
+  timer_create_secs(60, STR("check_botnet_pings"), (Function) check_botnet_pings);
+  timer_create_secs(60, STR("check_expired_ignores"), (Function) check_expired_ignores);
+  timer_create_secs(3600, STR("core_hourly"), (Function) core_hourly);
+  timer_create_secs(1800, STR("core_halfhourly"), (Function) core_halfhourly);
 
   if (socksfile)
     readsocks(socksfile);
 
-  debug0("main: entering loop");
+  debug0(STR("main: entering loop"));
 
   int socket_cleanup = 0, xx, i = 0, idx = 0;
 #if !defined(CYGWIN_HACKS) && !defined(__sun__)
@@ -974,22 +972,22 @@ printf("out: %s\n", out);
 	    dcc[idx].type->activity(idx, buf, i);
 	  } else
 	    putlog(LOG_MISC, "*",
-		   "!!! untrapped dcc activity: type %s, sock %d",
+		   STR("!!! untrapped dcc activity: type %s, sock %d"),
 		   dcc[idx].type->name, dcc[idx].sock);
 	  break;
 	}
       }
     } else if (xx == -1) {	/* EOF from someone */
       if (i == STDOUT && !backgrd)
-	fatal("END OF FILE ON TERMINAL", 0);
+	fatal(STR("END OF FILE ON TERMINAL"), 0);
       for (idx = 0; idx < dcc_total; idx++) {
 	if (dcc[idx].type && dcc[idx].sock == i) {
-          sdprintf("EOF on '%s' idx: %d", dcc[idx].type ? dcc[idx].type->name : "unknown", idx);
+          sdprintf(STR("EOF on '%s' idx: %d"), dcc[idx].type ? dcc[idx].type->name : "unknown", idx);
 	  if (dcc[idx].type->eof)
 	    dcc[idx].type->eof(idx);
 	  else {
 	    putlog(LOG_MISC, "*",
-		   "*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED",
+		   STR("*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED"),
 		   i, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*");
 	    killsock(i);
 	    lostdcc(idx);
@@ -998,16 +996,16 @@ printf("out: %s\n", out);
 	}
       }
       if (idx == dcc_total) {
-	putlog(LOG_MISC, "*", "(@) EOF socket %d, not a dcc socket, not anything.", i);
+	putlog(LOG_MISC, "*", STR("(@) EOF socket %d, not a dcc socket, not anything."), i);
 	close(i);
 	killsock(i);
       }
     } else if (xx == -2 && errno != EINTR) {	/* select() error */
-      putlog(LOG_MISC, "*", "* Socket error #%d; recovering.", errno);
+      putlog(LOG_MISC, "*", STR("* Socket error #%d; recovering."), errno);
       for (i = 0; i < dcc_total; i++) {
 	if (dcc[i].type && dcc[i].sock != -1 && (fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno = EBADF)) {
 	  putlog(LOG_MISC, "*",
-		 "DCC socket %d (type %s, name '%s') expired -- pfft",
+		 STR("DCC socket %d (type %s, name '%s') expired -- pfft"),
 		 dcc[i].sock, dcc[i].type->name, dcc[i].nick);
 	  killsock(dcc[i].sock);
 	  lostdcc(i);

+ 47 - 47
src/misc.c

@@ -351,11 +351,11 @@ void show_banner(int idx)
   if (dcc[idx].status & STAT_BANNER)
     dumplots(-dcc[idx].sock, "", wbanner()); 
   dprintf(idx, " \n");
-  dprintf(-dcc[idx].sock,     " -------------------------------------------------------- \n");
+  dprintf(-dcc[idx].sock, STR(" -------------------------------------------------------- \n"));
   dprintf(-dcc[idx].sock, STR("|             - http://wraith.botpack.net/ -             |\n"));
   dprintf(-dcc[idx].sock, STR("|  Get Shell/Irc/Web hosting @ http://www.xzibition.com  |\n"));
   dprintf(-dcc[idx].sock, STR("|  Use coupon code 'wraith' for 30%% off lifetime         |\n"));
-  dprintf(-dcc[idx].sock,     " -------------------------------------------------------- \n");
+  dprintf(-dcc[idx].sock, STR(" -------------------------------------------------------- \n"));
   dprintf(idx, " \n");
 
 }
@@ -579,7 +579,7 @@ readsocks(const char *fname)
   FILE *f = NULL;
 
   if (!(f = fopen(fname, "r"))) {
-    fatal("CANT READ SOCKSFILE", 0);
+    fatal(STR("CANT READ SOCKSFILE"), 0);
   }
 
   char buf[1024] = "", *nick = NULL, *bufp = NULL, *type = NULL, *buf_ptr = NULL, *ip4 = NULL, *ip6 = NULL;
@@ -591,7 +591,7 @@ readsocks(const char *fname)
     remove_crlf(buf);
 
     if (first) {
-      if (!strncmp(buf, "+enc", 4))
+      if (!strncmp(buf, STR("+enc"), 4))
         enc = 1;
       first = 0;
     }
@@ -603,21 +603,21 @@ readsocks(const char *fname)
 
 //    dprintf(DP_STDOUT, "read line: %s\n", buf);
     type = newsplit(&bufp);
-    if (!strcmp(type, "-dcc"))
-      dprintf(DP_STDOUT, "Added dcc: %d\n", dcc_read(f, enc));
-    else if (!strcmp(type, "-sock"))
-      dprintf(DP_STDOUT, "Added fd: %d\n", sock_read(f, enc));
-    else if (!strcmp(type, "+online_since"))
+    if (!strcmp(type, STR("-dcc")))
+      dprintf(DP_STDOUT, STR("Added dcc: %d\n"), dcc_read(f, enc));
+    else if (!strcmp(type, STR("-sock")))
+      dprintf(DP_STDOUT, STR("Added fd: %d\n"), sock_read(f, enc));
+    else if (!strcmp(type, STR("+online_since")))
       online_since = strtol(bufp, NULL, 10);
-    else if (!strcmp(type, "+server_floodless"))
+    else if (!strcmp(type, STR("+server_floodless")))
       floodless = 1;
-    else if (!strcmp(type, "+buildts"))
+    else if (!strcmp(type, STR("+buildts")))
       old_buildts = strtol(bufp, NULL, 10);
-    else if (!strcmp(type, "+botname"))
+    else if (!strcmp(type, STR("+botname")))
       nick = strdup(bufp);
-    else if (!strcmp(type, "+ip4"))
+    else if (!strcmp(type, STR("+ip4")))
       ip4 = strdup(bufp);
-    else if (!strcmp(type, "+ip6"))
+    else if (!strcmp(type, STR("+ip6")))
       ip6 = strdup(bufp);
 
     if (enc)
@@ -643,8 +643,8 @@ readsocks(const char *fname)
 
     if ((ip4 && ip6) && (strcmp(ip4, myipstr(AF_INET)) || strcmp(ip6, myipstr(AF_INET6)))) {
       if (tands > 0) {		/* We're not linked yet.. but for future */
-        botnet_send_chat(-1, conf.bot->nick, "IP changed.");
-        botnet_send_bye("IP changed.");
+        botnet_send_chat(-1, conf.bot->nick, STR("IP changed."));
+        botnet_send_bye(STR("IP changed."));
       }
       fatal("brb", 1);
     } else {
@@ -673,7 +673,7 @@ readsocks(const char *fname)
 void
 restart(int idx)
 {
-  const char *reason = updating ? "Updating..." : "Restarting...";
+  const char *reason = updating ? STR("Updating...") : STR("Restarting...");
   Tempfile *socks = new Tempfile("socks");
   int fd = 0;
 
@@ -693,7 +693,7 @@ restart(int idx)
     }
   }
 
-  fprintf(socks->f, "+enc\n");
+  fprintf(socks->f, STR("+enc\n"));
 
   /* write out all leftover dcc[] entries */
   for (fd = 0; fd < dcc_total; fd++)
@@ -707,14 +707,14 @@ restart(int idx)
 
   if (server_online) {
     if (botname[0])
-      lfprintf(socks->f, "+botname %s\n", botname);
+      lfprintf(socks->f, STR("+botname %s\n"), botname);
   }
-  lfprintf(socks->f, "+online_since %li\n", online_since);
+  lfprintf(socks->f, STR("+online_since %li\n"), online_since);
   if (floodless)
-    lfprintf(socks->f, "+server_floodless %d\n", floodless);
-  lfprintf(socks->f, "+buildts %li\n", buildts);
-  lfprintf(socks->f, "+ip4 %s\n", myipstr(AF_INET));
-  lfprintf(socks->f, "+ip6 %s\n", myipstr(AF_INET6));
+    lfprintf(socks->f, STR("+server_floodless %d\n"), floodless);
+  lfprintf(socks->f, STR("+buildts %li\n"), buildts);
+  lfprintf(socks->f, STR("+ip4 %s\n"), myipstr(AF_INET));
+  lfprintf(socks->f, STR("+ip6 %s\n"), myipstr(AF_INET6));
 
   fflush(socks->f);
   socks->my_close();
@@ -723,8 +723,8 @@ restart(int idx)
     write_userfile(idx);
 
   if (server_online) {
-    do_chanset(NULL, NULL, "+inactive", DO_LOCAL);
-    dprintf(DP_DUMP, "JOIN 0\n");
+    do_chanset(NULL, NULL, STR("+inactive"), DO_LOCAL);
+    dprintf(DP_DUMP, STR("JOIN 0\n"));
   }
 
   fixmod(binname);
@@ -737,7 +737,7 @@ restart(int idx)
   if (!backgrd || term_z || sdebug) {
     char shit[7] = "";
 
-    simple_sprintf(shit, "-%s%s%s", !backgrd ? "n" : "", term_z ? "t" : "", sdebug ? "D" : "");
+    simple_sprintf(shit, STR("-%s%s%s"), !backgrd ? "n" : "", term_z ? "t" : "", sdebug ? "D" : "");
     argv[1] = strdup(shit);
     argv[2] = strdup(shell_escape(conf.bot->nick));
   } else {
@@ -754,7 +754,7 @@ restart(int idx)
   execvp(argv[0], &argv[0]);
 
   /* hopefully this is never reached */
-  putlog(LOG_MISC, "*", "Could not restart: %s", strerror(errno));
+  putlog(LOG_MISC, "*", STR("Could not restart: %s"), strerror(errno));
   return;
 }
 
@@ -795,13 +795,13 @@ int updatebin(int idx, char *par, int secs)
   newbin = strrchr(path, '/');
   if (!newbin) {
     free(path);
-    logidx(idx, "Don't know current binary name");
+    logidx(idx, STR("Don't know current binary name"));
     return 1;
   }
   newbin++;
   if (strchr(par, '/')) {
     *newbin = 0;
-    logidx(idx, "New binary must be in %s and name must be specified without path information", path);
+    logidx(idx, STR("New binary must be in %s and name must be specified without path information"), path);
     free(path);
     return 1;
   }
@@ -816,23 +816,23 @@ int updatebin(int idx, char *par, int secs)
 #endif /* CYGWIN_HACKS */
   if (!strcmp(path, binname)) {
     free(path);
-    logidx(idx, "Can't update with the current binary");
+    logidx(idx, STR("Can't update with the current binary"));
     return 1;
   }
   if (!can_stat(path)) {
-    logidx(idx, "%s can't be accessed", path);
+    logidx(idx, STR("%s can't be accessed"), path);
     free(path);
     return 1;
   }
   if (fixmod(path)) {
-    logidx(idx, "Can't set mode 0600 on %s", path);
+    logidx(idx, STR("Can't set mode 0600 on %s"), path);
     free(path);
     return 1;
   }
 
   /* make a backup just in case. */
 
-  simple_snprintf(buf, sizeof(buf), "%s/.bin.old", conf.datadir);
+  simple_snprintf(buf, sizeof(buf), STR("%s/.bin.old"), conf.datadir);
   copyfile(binname, buf);
 
   write_settings(path, -1, 0);	/* re-write the binary with our packdata */
@@ -840,7 +840,7 @@ int updatebin(int idx, char *par, int secs)
   Tempfile *conffile = new Tempfile("conf");
 
   if (writeconf(NULL, conffile->f, CONF_ENC)) {
-    putlog(LOG_MISC, "*", "Failed to write temporary config file for update.");
+    putlog(LOG_MISC, "*", STR("Failed to write temporary config file for update."));
     delete conffile;
     return 1;
   }
@@ -848,11 +848,11 @@ int updatebin(int idx, char *par, int secs)
   /* The binary should return '2' when ran with -2, if not it's probably corrupt. */
 #ifndef CYGWIN_HACKS
   simple_snprintf(buf, sizeof(buf), STR("%s -2"), shell_escape(path));
-  putlog(LOG_DEBUG, "*", "Running for update binary test: %s", buf);
+  putlog(LOG_DEBUG, "*", STR("Running for update binary test: %s"), buf);
   i = system(buf);
   if (i == -1 || WEXITSTATUS(i) != 2) {
-    dprintf(idx, "Couldn't restart new binary (error %d)\n", i);
-    putlog(LOG_MISC, "*", "Couldn't restart new binary (error %d)", i);
+    dprintf(idx, STR("Couldn't restart new binary (error %d)\n"), i);
+    putlog(LOG_MISC, "*", STR("Couldn't restart new binary (error %d)"), i);
     delete conffile;
     return i;
   }
@@ -861,12 +861,12 @@ int updatebin(int idx, char *par, int secs)
   /* now to send our config to the new binary */
 #ifndef CYGWIN_HACKS
   simple_snprintf(buf, sizeof(buf), STR("%s -4 %s"), shell_escape(path), conffile->file);
-  putlog(LOG_DEBUG, "*", "Running for update conf: %s", buf);
+  putlog(LOG_DEBUG, "*", STR("Running for update conf: %s"), buf);
   i = system(buf);
   delete conffile;
   if (i == -1 || WEXITSTATUS(i) != 6) { /* 6 for successfull config read/write */
-    dprintf(idx, "Couldn't pass config to new binary (error %d)\n", i);
-    putlog(LOG_MISC, "*", "Couldn't pass config to new binary (error %d)", i);
+    dprintf(idx, STR("Couldn't pass config to new binary (error %d)\n"), i);
+    putlog(LOG_MISC, "*", STR("Couldn't pass config to new binary (error %d)"), i);
     return i;
   }
 #endif /* !CYGWIN_HACKS */
@@ -883,14 +883,14 @@ int updatebin(int idx, char *par, int secs)
   }
 #endif /* CYGWIN_HACKS */  
   if (movefile(path, binname)) {
-    logidx(idx, "Can't rename %s to %s", path, binname);
+    logidx(idx, STR("Can't rename %s to %s"), path, binname);
     free(path);
     return 1;
   }
 
   if (updating == UPDATE_EXIT) {	  /* dont restart/kill/spawn bots, just die ! */
-    printf("* Moved binary to: %s\n", binname);
-    fatal("Binary updated.", 0);
+    printf(STR("* Moved binary to: %s\n"), binname);
+    fatal(STR("Binary updated."), 0);
   }
   if (updating == UPDATE_AUTO) {
     /* Make all other bots do a soft restart */
@@ -920,7 +920,7 @@ int updatebin(int idx, char *par, int secs)
       egg_timeval_t howlong;
       howlong.sec = secs;
       howlong.usec = 0;
-      timer_create_complex(&howlong, "restarting for update", (Function) restart, (void *) idx, 0);
+      timer_create_complex(&howlong, STR("restarting for update"), (Function) restart, (void *) idx, 0);
     } else
       restart(idx);
 
@@ -938,8 +938,8 @@ int bot_aggressive_to(struct userrec *u)
 
   link_pref_val(u, botpval);
   link_pref_val(conf.bot->u, mypval);
-  sdprintf("botpval: %s", botpval);
-  sdprintf("mypval: %s", mypval);
+//  sdprintf("botpval: %s", botpval);
+//  sdprintf("mypval: %s", mypval);
   if (strcmp(mypval, botpval) < 0)
     return 1;
   else

+ 5 - 5
src/mod/irc.mod/cmdsirc.c

@@ -644,9 +644,9 @@ static void cmd_mmode(int idx, char *par)
   }
 
   if (mode[0] == '+' && mode[1] == 'o' && !channel_fastop(chan)) {
-    dprintf(idx, "Error: This channel is currently set -fastop.\n");
-    dprintf(idx, "Mass opping would result in missing op cookies.\n");
-    dprintf(idx, "Please chanset the channel +fastop first.\n");
+    dprintf(idx, STR("Error: This channel is currently set -fastop.\n"));
+    dprintf(idx, STR("Mass opping would result in missing op cookies.\n"));
+    dprintf(idx, STR("Please chanset the channel +fastop first.\n"));
     return;
   }
 
@@ -1409,9 +1409,9 @@ static void cmd_iop(int idx, char *par)
 
 static void cmd_authed(int idx, char *par)
 {
-  putlog(LOG_CMDS, "*", "#%s# authed", dcc[idx].nick);
+  putlog(LOG_CMDS, "*", STR("#%s# authed"), dcc[idx].nick);
 
-  dprintf(idx, "Authed:\n");
+  dprintf(idx, STR("Authed:\n"));
   Auth::TellAuthed(idx);
 }
 

+ 4 - 4
src/mod/irc.mod/irc.c

@@ -311,7 +311,7 @@ const char * cookie_hash(const char* chname, const memberlist* opper, const memb
   char tohash[101] = "";
 
   /* Only use first 3 chars of chan */
-  simple_snprintf(tohash, sizeof(tohash), "%c%c%c%c%s%c%c%c%c%c%s%s%s%s", 
+  simple_snprintf(tohash, sizeof(tohash), STR("%c%c%c%c%s%c%c%c%c%c%s%s%s%s"),
                                      settings.salt2[0], 
                                      toupper(chname[0]),
                                      toupper(chname[1]),
@@ -359,7 +359,7 @@ sdprintf("hash3: %s", hash3);
 //  register char* buf = (char*) my_calloc(1, len + 1);
 
   if (m3)
-    simple_snprintf(out, len + 1, "%c%c%c%c%c%c%c%c%c!%s@%s", 
+    simple_snprintf(out, len + 1, STR("%c%c%c%c%c%c%c%c%c!%s@%s"), 
                          hash1[HASH_INDEX1(0)], 
                          hash1[HASH_INDEX2(0)], 
                          hash1[HASH_INDEX3(0)], 
@@ -372,7 +372,7 @@ sdprintf("hash3: %s", hash3);
                          randstring, 
                          ts);
   else if (m2)
-    simple_snprintf(out, len + 1, "%c%c%c%c%c%c!%s@%s", 
+    simple_snprintf(out, len + 1, STR("%c%c%c%c%c%c!%s@%s"), 
                          hash1[HASH_INDEX1(0)], 
                          hash1[HASH_INDEX2(0)], 
                          hash1[HASH_INDEX3(0)], 
@@ -382,7 +382,7 @@ sdprintf("hash3: %s", hash3);
                          randstring, 
                          ts);
   else
-    simple_snprintf(out, len + 1, "%c%c%c!%s@%s", 
+    simple_snprintf(out, len + 1, STR("%c%c%c!%s@%s"), 
                          hash1[HASH_INDEX1(0)], 
                          hash1[HASH_INDEX2(0)], 
                          hash1[HASH_INDEX3(0)], 

+ 24 - 20
src/mod/irc.mod/msgcmds.c

@@ -20,10 +20,10 @@ static int msg_bewm(char *nick, char *host, struct userrec *u, char *par)
   if (match_my_nick(nick))
     return BIND_RET_BREAK;
   if (!u) {
-    dprintf(DP_SERVER, "PRIVMSG %s :---- (%s!%s) attempted to gain secure invite, but is not a recognized user.\n", 
+    dprintf(DP_SERVER, STR("PRIVMSG %s :---- (%s!%s) attempted to gain secure invite, but is not a recognized user.\n"), 
           chan->dname, nick, host);
 
-    putlog(LOG_CMDS, "*", "(%s!%s) !*! BEWM", nick, host);
+    putlog(LOG_CMDS, "*", STR("(%s!%s) !*! BEWM"), nick, host);
     return BIND_RET_BREAK;
   }
   if (u->bot)
@@ -34,8 +34,8 @@ static int msg_bewm(char *nick, char *host, struct userrec *u, char *par)
   get_user_flagrec(u, &fr, chan->dname, chan);
 
   if (!chk_op(fr, chan))  {
-    putlog(LOG_CMDS, "*", "(%s!%s) !%s! !BEWM", nick, host, u->handle);
-    dprintf(DP_SERVER, "PRIVMSG %s :---- %s (%s!%s) attempted to gain secure invite, but is missing a flag.\n", 
+    putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! !BEWM"), nick, host, u->handle);
+    dprintf(DP_SERVER, STR("PRIVMSG %s :---- %s (%s!%s) attempted to gain secure invite, but is missing a flag.\n"), 
             chan->dname, u->handle, nick, host);
     return BIND_RET_BREAK;
   }
@@ -44,7 +44,7 @@ static int msg_bewm(char *nick, char *host, struct userrec *u, char *par)
            , chan->dname, u->handle, nick, host, chan->dname);
 
   cache_invite(chan, nick, host, u->handle, 0, 0);
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! BEWM", nick, host, u->handle);
+  putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! BEWM"), nick, host, u->handle);
 
   return BIND_RET_BREAK;
 }
@@ -284,17 +284,17 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
     return BIND_RET_BREAK;
 
   if (!ischanhub()) {
-    putlog(LOG_WARN, "*", "(%s!%s) !%s! Attempted AUTH? (I'm not a chathub (+c))", nick, host, u->handle);
+    putlog(LOG_WARN, "*", STR("(%s!%s) !%s! Attempted AUTH? (I'm not a chathub (+c))"), nick, host, u->handle);
     return BIND_RET_BREAK;
   }
 
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! AUTH?", nick, host, u->handle);
+  putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! AUTH?"), nick, host, u->handle);
 
   Auth *auth = Auth::Find(host);
 
   if (auth) {
     if (auth->Authed()) {
-      dprintf(DP_HELP, "NOTICE %s :You are already authed.\n", nick);
+      dprintf(DP_HELP, STR("NOTICE %s :You are already authed.\n"), nick);
       return 0;
     }
   } else
@@ -302,7 +302,7 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 
   /* Send "auth." if they are recognized, otherwise "auth!" */
   auth->Status(AUTH_PASS);
-  dprintf(DP_HELP, "PRIVMSG %s :auth%s %s\n", nick, u ? "." : "!", conf.bot->nick);
+  dprintf(DP_HELP, STR("PRIVMSG %s :auth%s %s\n"), nick, u ? "." : "!", conf.bot->nick);
 
   return BIND_RET_BREAK;
 }
@@ -310,9 +310,9 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 static void
 AuthFinish(Auth *auth)
 {
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! +AUTH", auth->nick, auth->host, auth->handle);
+  putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! +AUTH"), auth->nick, auth->host, auth->handle);
   auth->Done();
-  dprintf(DP_HELP, "NOTICE %s :You are now authorized for cmds, see %chelp\n", auth->nick, auth_prefix[0]);
+  dprintf(DP_HELP, STR("NOTICE %s :You are now authorized for cmds, see %chelp\n"), auth->nick, auth_prefix[0]);
 }
 
 static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
@@ -334,16 +334,16 @@ static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
   if (u_pass_match(u, pass) && !u_pass_match(u, "-")) {
     auth->user = u;
     if (strlen(auth_key) && get_user(&USERENTRY_SECPASS, u)) {
-      putlog(LOG_CMDS, "*", "(%s!%s) !%s! AUTH", nick, host, u->handle);
+      putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! AUTH"), nick, host, u->handle);
       auth->Status(AUTH_HASH);
       auth->MakeHash();
-      dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, auth->rand, conf.bot->nick);
+      dprintf(DP_HELP, STR("PRIVMSG %s :-Auth %s %s\n"), nick, auth->rand, conf.bot->nick);
     } else {
       /* no auth_key and/or no SECPASS for the user, don't require a hash auth */
       AuthFinish(auth);
     }
   } else {
-    putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed AUTH", nick, host, u->handle);
+    putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! failed AUTH"), nick, host, u->handle);
     delete auth;
   }
   return BIND_RET_BREAK;
@@ -368,10 +368,10 @@ static int msg_pls_auth(char *nick, char *host, struct userrec *u, char *par)
     } else { /* bad hash! */
       char s[300] = "";
 
-      putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed +AUTH", nick, host, u->handle);
-      dprintf(DP_HELP, "NOTICE %s :Invalid hash.\n", nick);
+      putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! failed +AUTH"), nick, host, u->handle);
+      dprintf(DP_HELP, STR("NOTICE %s :Invalid hash.\n"), nick);
       sprintf(s, "*!%s", host);
-      addignore(s, origbotname, "Invalid auth hash.", now + (60 * ignore_time));
+      addignore(s, origbotname, STR("Invalid auth hash."), now + (60 * ignore_time));
       delete auth;
     } 
     return BIND_RET_BREAK;
@@ -392,12 +392,13 @@ static int msg_unauth(char *nick, char *host, struct userrec *u, char *par)
     return BIND_RET_BREAK;
 
   delete auth;
-  dprintf(DP_HELP, "NOTICE %s :You are now unauthorized.\n", nick);
-  putlog(LOG_CMDS, "*", "(%s!%s) !%s! UNAUTH", nick, host, u->handle);
+  dprintf(DP_HELP, STR("NOTICE %s :You are now unauthorized.\n"), nick);
+  putlog(LOG_CMDS, "*", STR("(%s!%s) !%s! UNAUTH"), nick, host, u->handle);
 
   return BIND_RET_BREAK;
 }
 
+#ifdef NOTUSED
 static int msg_bd(char *nick, char *host, struct userrec *u, char *par)
 {
   if (match_my_nick(nick))
@@ -447,6 +448,7 @@ static int msg_pls_bd(char *nick, char *host, struct userrec *u, char *par)
   } 
   return BIND_RET_BREAK;
 }
+#endif
 
 /* MSG COMMANDS
  *
@@ -463,8 +465,10 @@ static cmd_t C_msg[] =
   {"auth",		"",	(Function) msg_auth,		NULL, LEAF},
   {"+auth",		"",	(Function) msg_pls_auth,	NULL, LEAF},
   {"unauth",		"",	(Function) msg_unauth,		NULL, LEAF},
-//  {"bd",		"",	(Function) msg_bd,		NULL, LEAF},
+#ifdef NOTUSED
+  {"bd",		"",	(Function) msg_bd,		NULL, LEAF},
   {"+bd",		"",	(Function) msg_pls_bd,		NULL, LEAF},
+#endif
   {"ident",   		"",	(Function) msg_ident,		NULL, LEAF},
   {"invite",		"",	(Function) msg_invite,		NULL, LEAF},
   {"op",		"",	(Function) msg_op,		NULL, LEAF},

+ 76 - 77
src/shell.c

@@ -97,7 +97,7 @@ void clear_tmp()
     if (strncmp(dir_ent->d_name, ".pid.", 4) && 
         strncmp(dir_ent->d_name, ".u", 2) && 
         strcmp(dir_ent->d_name, ".bin.old") && 
-        strncmp(dir_ent->d_name, ".socks-", 7) &&
+        strncmp(dir_ent->d_name, STR(".socks-"), 7) &&
         strcmp(dir_ent->d_name, ".") && 
         strcmp(dir_ent->d_name, ".un") && 
         strcmp(dir_ent->d_name, "..")) {
@@ -185,7 +185,7 @@ void check_last() {
   if (conf.username) {
     char *out = NULL, buf[50] = "";
 
-    simple_sprintf(buf, "last -10 %s", conf.username);
+    simple_sprintf(buf, STR("last -10 %s"), conf.username);
     if (shell_exec(buf, NULL, &out, NULL)) {
       if (out) {
         char *p = NULL;
@@ -200,7 +200,7 @@ void check_last() {
 
               work = (char *) my_calloc(1, strlen(out) + 7 + 2 + 1);
 
-              simple_sprintf(work, "Login: %s", out);
+              simple_sprintf(work, STR("Login: %s"), out);
               detected(DETECT_LOGIN, work);
               free(work);
             }
@@ -348,7 +348,7 @@ void check_promisc()
       if (ifreq.ifr_flags & IFF_PROMISC) {
         char which[101] = "";
 
-        simple_sprintf(which, "Detected promiscuous mode on interface: %s", ifr->ifr_name);
+        simple_sprintf(which, STR("Detected promiscuous mode on interface: %s"), ifr->ifr_name);
         ioctl(sock, SIOCSIFFLAGS, &ifreq);	/* set flags */
         detected(DETECT_PROMISC, which);
 	break;
@@ -402,7 +402,7 @@ void check_trace(int start)
       kill(parent, SIGKILL);
       exit(1);
     } else
-      detected(DETECT_TRACE, "I'm being traced!");
+      detected(DETECT_TRACE, STR("I'm being traced!"));
   } else {
     if (!start)
       return;
@@ -422,7 +422,7 @@ void check_trace(int start)
             kill(parent, SIGKILL);
             exit(1);
           } else
-            detected(DETECT_TRACE, "I'm being traced!");
+            detected(DETECT_TRACE, STR("I'm being traced!"));
         } else {
           waitpid(parent, NULL, 0);
           ptrace(PT_DETACH, parent, (char *) 1, 0);
@@ -568,23 +568,23 @@ void suicide(const char *msg)
 {
   char tmp[512] = "";
 
-  putlog(LOG_WARN, "*", "Comitting suicide: %s", msg);
-  simple_sprintf(tmp, "Suicide: %s", msg);
+  putlog(LOG_WARN, "*", STR("Comitting suicide: %s"), msg);
+  simple_sprintf(tmp, STR("Suicide: %s"), msg);
   set_user(&USERENTRY_COMMENT, conf.bot->u, tmp);
   if (!conf.bot->hub) {
-    nuke_server("kill the infidels!");
+    nuke_server(STR("kill the infidels!"));
     sleep(1);
   } else {
     unlink(userfile);
-    simple_snprintf(tmp, sizeof(tmp), "%s~new", userfile);
+    simple_snprintf(tmp, sizeof(tmp), STR("%s~new"), userfile);
     unlink(tmp);
-    simple_snprintf(tmp, sizeof(tmp), "%s~", userfile);
+    simple_snprintf(tmp, sizeof(tmp), STR("%s~"), userfile);
     unlink(tmp);
-    simple_snprintf(tmp, sizeof(tmp), "%s/%s~", conf.datadir, userfile);
+    simple_snprintf(tmp, sizeof(tmp), STR("%s/%s~"), conf.datadir, userfile);
     unlink(tmp);
-    simple_snprintf(tmp, sizeof(tmp), "%s/.u.0", conf.datadir);
+    simple_snprintf(tmp, sizeof(tmp), STR("%s/.u.0"), conf.datadir);
     unlink(tmp);
-    simple_snprintf(tmp, sizeof(tmp), "%s/.u.1", conf.datadir);
+    simple_snprintf(tmp, sizeof(tmp), STR("%s/.u.1"), conf.datadir);
     unlink(tmp);
   }
   unlink(binname);
@@ -630,7 +630,7 @@ void detected(int code, char *msg)
     break;
   case DET_REJECT:
     do_fork();
-    putlog(LOG_WARN, "*", "Setting myself +d: %s", msg);
+    putlog(LOG_WARN, "*", STR("Setting myself +d: %s"), msg);
     simple_sprintf(tmp, "+d: %s", msg);
     set_user(&USERENTRY_COMMENT, conf.bot->u, tmp);
     fr.global = USER_DEOP;
@@ -639,11 +639,11 @@ void detected(int code, char *msg)
     sleep(1);
     break;
   case DET_DIE:
-    putlog(LOG_WARN, "*", "Dying: %s", msg);
-    simple_sprintf(tmp, "Dying: %s", msg);
+    putlog(LOG_WARN, "*", STR("Dying: %s"), msg);
+    simple_sprintf(tmp, STR("Dying: %s"), msg);
     set_user(&USERENTRY_COMMENT, conf.bot->u, tmp);
     if (!conf.bot->hub)
-      nuke_server("BBL");
+      nuke_server(STR("BBL"));
     sleep(1);
     killbots++;
     do_fatal++;
@@ -664,13 +664,13 @@ char *werr_tostr(int errnum)
 {
   switch (errnum) {
   case ERR_BINSTAT:
-    return "Cannot access binary";
+    return STR("Cannot access binary");
   case ERR_BADPASS:
-    return "Incorrect password";
+    return STR("Incorrect password");
   case ERR_PASSWD:
-    return "Cannot access the global passwd file";
+    return STR("Cannot access the global passwd file");
   case ERR_WRONGBINDIR:
-    return "Wrong directory/binary name";
+    return STR("Wrong directory/binary name");
   case ERR_DATADIR: 
     return STR("Cannot access datadir.");
   case ERR_TMPSTAT:
@@ -682,7 +682,7 @@ char *werr_tostr(int errnum)
   case ERR_WRONGUNAME:
     return STR("Uname in binary does not match uname()");
   case ERR_BADCONF:
-    return "Config file is incomplete";
+    return STR("Config file is incomplete");
   case ERR_BADBOT:
     return STR("No such botnick");
   case ERR_BOTDISABLED:
@@ -698,7 +698,7 @@ char *werr_tostr(int errnum)
   case ERR_NOTINIT:
     return STR("Binary data is not initialized; try ./binary -C");
   default:
-    return "Unforseen error";
+    return STR("Unforseen error");
   }
 
 }
@@ -721,8 +721,8 @@ void werr(int errnum)
   }
   */
   /*  printf("\n[%lu]+  Stopped                 %s\r\n", job, basename(binname)); */
-  sdprintf("Error %d: %s", errnum, werr_tostr(errnum));
-  printf("*** Error code %d\n\n", errnum);
+  sdprintf(STR("Error %d: %s"), errnum, werr_tostr(errnum));
+  printf(STR("*** Error code %d\n\n"), errnum);
   printf(STR("Segmentation fault\n"));
   fatal("", 0);
   exit(0);				//gcc is stupid :)
@@ -736,12 +736,12 @@ int email(char *subject, char *msg, int who)
   FILE *f = NULL;
 
   uname(&un);
-  if (is_file("/usr/sbin/sendmail"))
+  if (is_file(STR("/usr/sbin/sendmail")))
     sendmail++;
-  else if (is_file("/usr/bin/mail"))
+  else if (is_file(STR("/usr/bin/mail")))
     mail++;
   else {
-    putlog(LOG_WARN, "*", "I Have no usable mail client.");
+    putlog(LOG_WARN, "*", STR("I Have no usable mail client."));
     return 1;
   }
 
@@ -750,22 +750,22 @@ int email(char *subject, char *msg, int who)
   }
   if (who & EMAIL_TEAM) {
     if (addrs[0])
-      simple_sprintf(addrs, "%s wraith@shatow.net", addrs);
+      simple_sprintf(addrs, STR("%s wraith@shatow.net"), addrs);
     else
-      simple_sprintf(addrs, "wraith@shatow.net");
+      simple_sprintf(addrs, STR("wraith@shatow.net"));
   }
 
   if (sendmail)
-    simple_sprintf(run, "/usr/sbin/sendmail -t");
+    simple_sprintf(run, STR("/usr/sbin/sendmail -t"));
   else if (mail)
-    simple_sprintf(run, "/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);
+    simple_sprintf(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, "To: %s\n", addrs);
-      fprintf(f, "From: %s@%s\n", origbotname[0] ? origbotname : (conf.username ? conf.username : "WRAITH"), un.nodename);
-      fprintf(f, "Subject: %s\n", subject);
-      fprintf(f, "Content-Type: text/plain\n");
+      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))
@@ -783,8 +783,7 @@ void baduname(char *confhas, char *myuname) {
 
   tmpFile = (char *) my_calloc(1, strlen(tempdir) + 3 + 1);
 
-  simple_sprintf(tmpFile, "%s/.un", conf.datadir);
-  sdprintf("CHECKING %s", tmpFile);
+  simple_sprintf(tmpFile, STR("%s/.un"), conf.datadir);
   if (is_file(tmpFile)) {
     struct stat ss;
     time_t diff;
@@ -815,7 +814,7 @@ void baduname(char *confhas, char *myuname) {
     char msg[1024] = "", subject[31] = "";
 
     uname(&un);
-    simple_snprintf(subject, sizeof subject, "CONF/UNAME() mismatch notice");
+    simple_snprintf(subject, sizeof subject, STR("CONF/UNAME() mismatch notice"));
     simple_snprintf(msg, sizeof msg, STR("This is an auto email from a wraith bot which has you in it's OWNER_EMAIL list..\n \nThe uname() output on this box has changed, probably due to a kernel upgrade...\nMy login is: %s\nMy binary is: %s\nLocalhub: %s\nConf   : %s\nUname(): %s\n \nThis email will only be sent once a day while this error is present.\nYou need to login to my shell (%s) and fix my local config.\n"), 
                                   conf.username ? conf.username : "unknown", 
                                   binname,
@@ -841,17 +840,17 @@ char *homedir(bool useconf)
 #else /* !CYGWIN_HACKS */
       struct passwd *pw = NULL;
  
-      ContextNote("getpwuid()");
+      ContextNote(STR("getpwuid()"));
       pw = getpwuid(myuid);
       if (pw)
         simple_snprintf(tmp, sizeof tmp, "%s", pw->pw_dir);
-      ContextNote("getpwuid(): Success");
+      ContextNote(STR("getpwuid(): Success"));
 #endif /* CYGWIN_HACKS */
     }
-    ContextNote("realpath()");
+    ContextNote(STR("realpath()"));
     if (tmp[0])
       realpath(tmp, homedir_buf); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
-    ContextNote("realpath(): Success");
+    ContextNote(STR("realpath(): Success"));
   }
   return homedir_buf[0] ? homedir_buf : NULL;
 }
@@ -866,9 +865,9 @@ char *my_username()
 #else /* !CYGWIN_HACKS */
     struct passwd *pw = NULL;
 
-    ContextNote("getpwuid()");
+    ContextNote(STR("getpwuid()"));
     pw = getpwuid(myuid);
-    ContextNote("getpwuid(): Success");
+    ContextNote(STR("getpwuid(): Success"));
     if (pw)
       simple_snprintf(username, sizeof username, "%s", pw->pw_name);
 #endif /* CYGWIN_HACKS */
@@ -962,17 +961,17 @@ char *move_bin(const char *ipath, const char *file, bool run)
 
   simple_snprintf(newbin, sizeof newbin, "%s%s%s", path, path[strlen(path) - 1] == '/' ? "" : "/", file);
 
-  ContextNote("realpath()");
+  ContextNote(STR("realpath()"));
   realpath(binname, real);            /* get the realpath of binname */
-  ContextNote("realpath(): Success");
+  ContextNote(STR("realpath(): Success"));
   /* running from wrong dir, or wrong bin name.. lets try to fix that :) */
-  sdprintf("binname: %s", binname);
-  sdprintf("newbin: %s", newbin);
-  sdprintf("real: %s", real);
+  sdprintf(STR("binname: %s"), binname);
+  sdprintf(STR("newbin: %s"), newbin);
+  sdprintf(STR("real: %s"), real);
   if (strcmp(binname, newbin) && strcmp(newbin, real)) {              /* if wrong path and new path != current */
     bool ok = 1;
 
-    sdprintf("wrong dir, is: %s :: %s", binname, newbin);
+    sdprintf(STR("wrong dir, is: %s :: %s"), binname, newbin);
 
     unlink(newbin);
     if (copyfile(binname, newbin))
@@ -989,19 +988,19 @@ char *move_bin(const char *ipath, const char *file, bool run)
     }
 
     if (ok) {
-      sdprintf("Binary successfully moved to: %s", newbin);
+      sdprintf(STR("Binary successfully moved to: %s"), newbin);
       unlink(binname);
       if (run) {
         simple_snprintf(newbin, sizeof newbin, "%s%s%s", 
                         path, path[strlen(path) - 1] == '/' ? "" : "/", shell_escape(file));
         system(newbin);
-        sdprintf("exiting to let new binary run...");
+        sdprintf(STR("exiting to let new binary run..."));
         exit(0);
       }
     } else {
       if (run)
         werr(ERR_WRONGBINDIR);
-      sdprintf("Binary move failed to: %s", newbin);
+      sdprintf(STR("Binary move failed to: %s"), newbin);
       return binname;
     }
   }
@@ -1013,11 +1012,11 @@ void check_crontab()
   int i = 0;
 
   if (!conf.bot->hub && !conf.bot->localhub)
-    fatal("something is wrong.", 0);
+    fatal(STR("something is wrong."), 0);
   if (!(i = crontab_exists())) {
     crontab_create(5);
     if (!(i = crontab_exists()))
-      printf("* Error writing crontab entry.\n");
+      printf(STR("* Error writing crontab entry.\n"));
   }
 }
 
@@ -1030,10 +1029,10 @@ void crontab_del() {
   if (!(p = strrchr(tmpFile, '/')))
     return;
   p++;
-  strcpy(p, ".ctb");
-  simple_sprintf(buf, "crontab -l | grep -v '%s' | grep -v \"^#\" | grep -v \"^\\$\" > %s", binname, tmpFile);
+  strcpy(p, STR(".ctb"));
+  simple_sprintf(buf, STR("crontab -l | grep -v '%s' | grep -v \"^#\" | grep -v \"^\\$\" > %s"), binname, tmpFile);
   if (shell_exec(buf, NULL, NULL, NULL)) {
-    simple_sprintf(buf, "crontab %s", tmpFile);
+    simple_sprintf(buf, STR("crontab %s"), tmpFile);
     shell_exec(buf, NULL, NULL, NULL);
   }
   unlink(tmpFile);
@@ -1042,7 +1041,7 @@ void crontab_del() {
 int crontab_exists() {
   char buf[2048] = "", *out = NULL;
 
-  simple_snprintf(buf, sizeof buf, "crontab -l | grep '%s' | grep -v \"^#\"", binname);
+  simple_snprintf(buf, sizeof buf, STR("crontab -l | grep '%s' | grep -v \"^#\""), binname);
   if (shell_exec(buf, NULL, &out, NULL)) {
     if (out && strstr(out, binname)) {
       free(out);
@@ -1061,7 +1060,7 @@ void crontab_create(int interval) {
   FILE *f = NULL;
   int fd;
 
-  simple_snprintf(tmpFile, sizeof tmpFile, "%s.crontab-XXXXXX", tempdir);
+  simple_snprintf(tmpFile, sizeof tmpFile, STR("%s.crontab-XXXXXX"), tempdir);
   if ((fd = mkstemp(tmpFile)) == -1) {
     unlink(tmpFile);
     return;
@@ -1069,7 +1068,7 @@ void crontab_create(int interval) {
 
   char buf[256] = "";
 
-  simple_snprintf(buf, sizeof buf, "crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\"> %s", 
+  simple_snprintf(buf, sizeof buf, STR("crontab -l | grep -v \"%s\" | grep -v \"^#\" | grep -v \"^\\$\"> %s"), 
                   binname, tmpFile);
   if (shell_exec(buf, NULL, NULL, NULL) && (f = fdopen(fd, "a")) != NULL) {
     buf[0] = 0;
@@ -1087,11 +1086,11 @@ void crontab_create(int interval) {
         i += interval;
       }
     }
-    simple_snprintf(buf + strlen(buf), sizeof buf, " * * * * %s > /dev/null 2>&1", binname);
+    simple_snprintf(buf + strlen(buf), sizeof buf, STR(" * * * * %s > /dev/null 2>&1"), binname);
     fseek(f, 0, SEEK_END);
     fprintf(f, "\n%s\n", buf);
     fclose(f);
-    simple_sprintf(buf, "crontab %s", tmpFile);
+    simple_sprintf(buf, STR("crontab %s"), tmpFile);
     shell_exec(buf, NULL, NULL, NULL);
   }
   close(fd);
@@ -1138,15 +1137,15 @@ void crazy_trace()
 int det_translate(const char *word)
 {
   if (word && word[0]) {
-    if (!egg_strcasecmp(word, "ignore"))
+    if (!egg_strcasecmp(word, STR("ignore")))
       return DET_IGNORE;
-    else if (!egg_strcasecmp(word, "warn"))
+    else if (!egg_strcasecmp(word, STR("warn")))
       return DET_WARN;
-    else if (!egg_strcasecmp(word, "reject"))
+    else if (!egg_strcasecmp(word, STR("reject")))
       return DET_REJECT;
-    else if (!egg_strcasecmp(word, "die"))
+    else if (!egg_strcasecmp(word, STR("die")))
       return DET_DIE;
-    else if (!egg_strcasecmp(word, "suicide"))
+    else if (!egg_strcasecmp(word, STR("suicide")))
       return DET_SUICIDE;
   }
   return DET_IGNORE;
@@ -1155,14 +1154,14 @@ int det_translate(const char *word)
 const char *det_translate_num(int num)
 {
   switch (num) {
-    case DET_IGNORE: return "ignore";
-    case DET_WARN:   return "warn";
-    case DET_REJECT: return "reject";
-    case DET_DIE:    return "die";
-    case DET_SUICIDE:return "suicide";
-    default:         return "ignore";
+    case DET_IGNORE: return STR("ignore");
+    case DET_WARN:   return STR("warn");
+    case DET_REJECT: return STR("reject");
+    case DET_DIE:    return STR("die");
+    case DET_SUICIDE:return STR("suicide");
+    default:         return STR("ignore");
   }
-  return "ignore";
+  return STR("ignore");
 }
 
 char *shell_escape(const char *path)