Bryan Drewery 22 лет назад
Родитель
Сommit
314d450fa3
8 измененных файлов с 333 добавлено и 339 удалено
  1. 0 1
      src/botcmd.c
  2. 174 176
      src/cmds.c
  3. 26 26
      src/dcc.c
  4. 75 78
      src/main.c
  5. 10 10
      src/mem.c
  6. 22 22
      src/misc.c
  7. 25 25
      src/net.c
  8. 1 1
      src/tclhash.c

+ 0 - 1
src/botcmd.c

@@ -1463,7 +1463,6 @@ void bounce_simul(int idx, char *buf)
   char rmsg[SGRAB-110];
 
   if (!buf || !buf[0] || !dcc[idx].simulbot || !dcc[idx].simulbot[0] || idx < 0) {
-    debug0("returning from bounce_simul");
     return;
   }
 

Разница между файлами не показана из-за своего большого размера
+ 174 - 176
src/cmds.c


+ 26 - 26
src/dcc.c

@@ -70,25 +70,25 @@ char *rand_dccresp()
 {
   switch (random() % 10) { /* 0-5: random response, 6-9: none */
   case 0:
-    return "sup\n";
+    return STR("sup\n");
   case 1:
-    return "a/s/l?\ni'm 17/f/ca ;)\n";
+    return STR("a/s/l?\ni'm 17/f/ca ;)\n");
   case 2:
-    return "who are you?\n";
+    return STR("who are you?\n");
   case 3:
-    return "uhhh do i know you?\n";
+    return STR("uhhh do i know you?\n");
   case 4:
-    return "what?\n";
+    return STR("what?\n");
   case 5:
-    return "wtf do you want?\n";
+    return STR("wtf do you want?\n");
   case 6:
-    return "hold on a second, I am sort of busy..\n";
+    return STR("hold on a second, I am sort of busy..\n");
   case 7:
-    return "mIRC v6.03 File Server\n\nUse: cd dir ls get read help exit\n[\\]\n";
+    return STR("mIRC v6.03 File Server\n\nUse: cd dir ls get read help exit\n[\\]\n");
   case 8:
-    return "got any porn?\n";
+    return STR("got any porn?\n");
   case 9:
-    return "?\n";
+    return STR("?\n");
   default:
     return "";
     /* there's intentionally no newline in this response. You go figure out why :) */
@@ -99,21 +99,21 @@ char *rand_dccresppass()
 {
   switch (random() % 10) { /* 0-5: random response, 6-9: none */
   case 0:
-    return "what?\n";
+    return STR("what?\n");
   case 1:
-    return "huh?\n";
+    return STR("huh?\n");
   case 2:
-    return "no.\n";
+    return STR("no.\n");
   case 3:
-    return "thats great..\n";
+    return STR("thats great..\n");
   case 4:
-    return "hmm, ok..I've got a better idea, check this out: http://peeldmonkeys.8k.com/images/keza-_middle_finger.jpg\n";
+    return STR("hmm, ok..I've got a better idea, check this out: http://peeldmonkeys.8k.com/images/keza-_middle_finger.jpg\n");
   case 5:
-    return "I don't remember caring..\n";
+    return STR("I don't remember caring..\n");
   case 6:
-    return "good for you.\n";
+    return STR("good for you.\n");
   case 7:
-    return "I'm going to report you to the RIAA!!!\n";
+    return STR("I'm going to report you to the RIAA!!!\n");
   default:
     return "";
   }
@@ -122,21 +122,21 @@ char *rand_dccrespbye()
 {
   switch (random() % 10) { /* 0-5: random response, 6-9: none */
   case 0:
-    return "stop wasting my time.\n";
+    return STR("stop wasting my time.\n");
   case 1:
-    return "gtg\n";
+    return STR("gtg\n");
   case 2:
-    return "go away\n";
+    return STR("go away\n");
   case 3:
-    return "fuck off already\n";
+    return STR("fuck off already\n");
   case 4:
-    return "ehh..no, bye.\n";
+    return STR("ehh..no, bye.\n");
   case 5:
-    return "hey I'm late for a date with your mom, cya..\n";
+    return STR("hey I'm late for a date with your mom, cya..\n");
   case 6:
-    return "you're still here?\n";
+    return STR("you're still here?\n");
   case 7:
-    return "jesus loves you, but I ain't jesus. \002FUCK OFF\002\n";
+    return STR("jesus loves you, but I ain't jesus. \002FUCK OFF\002\n");
   default:
     return "";
   }

+ 75 - 78
src/main.c

@@ -255,10 +255,8 @@ void write_debug()
     setsock(x, SOCK_NONSOCK);
     if (x >= 0) {
       strncpyz(s, ctime(&now), sizeof s);
-      dprintf(-x, "Debug (%s) written %s\n", ver, s);
-      dprintf(-x, "Please report problem to bugs@eggheads.org\n");
-      dprintf(-x, "after a visit to http://www.eggheads.org/bugzilla/\n");
-      dprintf(-x, "Context: ");
+      dprintf(-x, STR("Debug (%s) written %s\n"), ver, s);
+      dprintf(-x, STR("Context: "));
       cx_ptr = cx_ptr & 15;
       for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15))
 	dprintf(-x, "%s/%d,\n         ", cx_file[y], cx_line[y]);
@@ -282,11 +280,11 @@ void write_debug()
   x = creat("DEBUG", 0600);
   setsock(x, SOCK_NONSOCK);
   if (x < 0) {
-    putlog(LOG_MISC, "*", "* Failed to write DEBUG");
+    putlog(LOG_MISC, "*", STR("* Failed to write DEBUG"));
   } else {
     strncpyz(s, ctime(&now), sizeof s);
-    dprintf(-x, "Debug (%s) written %s\n", ver, s);
-    dprintf(-x, "STATICALLY LINKED\n");
+    dprintf(-x, STR("Debug (%s) written %s\n"), ver, s);
+    dprintf(-x, STR("STATICALLY LINKED\n"));
 
     /* info library */
     dprintf(-x, "Tcl library: %s\n",
@@ -301,20 +299,20 @@ void write_debug()
      "*unknown*");
 
 #if HAVE_TCL_THREADS
-    dprintf(-x, "Tcl is threaded\n");
+    dprintf(-x, STR("Tcl is threaded\n"));
 #endif
 
 #ifdef CCFLAGS
-    dprintf(-x, "Compile flags: %s\n", CCFLAGS);
+    dprintf(-x, STR("Compile flags: %s\n"), CCFLAGS);
 #endif
 #ifdef LDFLAGS
-    dprintf(-x, "Link flags: %s\n", LDFLAGS);
+    dprintf(-x, STR("Link flags: %s\n"), LDFLAGS);
 #endif
 #ifdef STRIPFLAGS
-    dprintf(-x, "Strip flags: %s\n", STRIPFLAGS);
+    dprintf(-x, STR("Strip flags: %s\n"), STRIPFLAGS);
 #endif
 
-    dprintf(-x, "Context: ");
+    dprintf(-x, STR("Context: "));
     cx_ptr = cx_ptr & 15;
     for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15))
       dprintf(-x, "%s/%d, [%s]\n         ", cx_file[y], cx_line[y],
@@ -326,8 +324,9 @@ void write_debug()
     debug_mem_to_dcc(-x);
     killsock(x);
     close(x);
-    putlog(LOG_MISC, "*", "* Emailed DEBUG to bryan.");
+    putlog(LOG_MISC, "*", STR("* Emailed DEBUG to bryan."));
     if (1) {
+/* FIXME: make into temp file.. */
       char buff[255];
       snprintf(buff, sizeof(buff), "cat << EOFF >> bleh\nDEBUG from: %s\n`date`\n`w`\n---\n`who`\n---\n`ls -al`\n---\n`ps ux`\n---\n`uname -a`\n---\n`id`\n---\n`cat DEBUG`\nEOFF", origbotname);
       system(buff);
@@ -345,7 +344,7 @@ static void got_bus(int z)
 #ifdef DEBUG_CONTEXT
   write_debug();
 #endif
-  fatal("BUS ERROR -- CRASHING!", 1);
+  fatal(STR("BUS ERROR -- CRASHING!"), 1);
 #ifdef SA_RESETHAND
   kill(getpid(), SIGBUS);
 #else
@@ -359,7 +358,7 @@ static void got_segv(int z)
 #ifdef DEBUG_CONTEXT
   write_debug();
 #endif
-  fatal("SEGMENT VIOLATION -- CRASHING!", 1);
+  fatal(STR("SEGMENT VIOLATION -- CRASHING!"), 1);
 #ifdef SA_RESETHAND
   kill(getpid(), SIGSEGV);
 #else
@@ -373,7 +372,7 @@ static void got_fpe(int z)
 #ifdef DEBUG_CONTEXT
   write_debug();
 #endif
-  fatal("FLOATING POINT ERROR -- CRASHING!", 0);
+  fatal(STR("FLOATING POINT ERROR -- CRASHING!"), 0);
 }
 
 static void got_term(int z)
@@ -384,29 +383,29 @@ static void got_term(int z)
   check_tcl_event("sigterm");
   if (die_on_sigterm) {
     botnet_send_chat(-1, botnetnick, "ACK, I've been terminated!");
-    fatal("TERMINATE SIGNAL -- SIGNING OFF", 0);
+    fatal(STR("TERMINATE SIGNAL -- SIGNING OFF"), 0);
   } else {
-    putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)");
+    putlog(LOG_MISC, "*", STR("RECEIVED TERMINATE SIGNAL (IGNORING)"));
   }
 }
 
 static void got_stop(int z) 
 {
+  putlog(LOG_MISC, "*", STR("GOT SIGSTOP POSSIBLE HIJACK."));
   exit(1);
-  putlog(LOG_MISC, "*", "GOT SIGSTOP POSSIBLE HIJACK.");
 }
 
 #ifdef S_HIJACKCHECK
 static void got_cont(int z) 
 {
-  detected(DETECT_SIGCONT, "POSSIBLE HIJACK DETECTED");
+  detected(DETECT_SIGCONT, STR("POSSIBLE HIJACK DETECTED"));
 }
 #endif
 
 static void got_quit(int z)
 {
   check_tcl_event("sigquit");
-  putlog(LOG_MISC, "*", "RECEIVED QUIT SIGNAL (IGNORING)");
+  putlog(LOG_MISC, "*", STR("RECEIVED QUIT SIGNAL (IGNORING)"));
   return;
 }
 
@@ -417,9 +416,9 @@ static void got_hup(int z)
 #endif
   check_tcl_event("sighup");
   if (die_on_sighup) {
-    fatal("HANGUP SIGNAL -- SIGNING OFF", 0);
+    fatal(STR("HANGUP SIGNAL -- SIGNING OFF"), 0);
   } else
-    putlog(LOG_MISC, "*", "Received HUP signal: rehashing...");
+    putlog(LOG_MISC, "*", STR("Received HUP signal: rehashing..."));
   do_restart = -2;
   return;
 }
@@ -428,7 +427,6 @@ static void got_hup(int z)
  */
 static void got_alarm(int z)
 {
-  debug0("got alarm...");
   longjmp(alarmret, 1);
 
   /* -Never reached- */
@@ -440,8 +438,8 @@ static void got_ill(int z)
 {
   check_tcl_event("sigill");
 #ifdef DEBUG_CONTEXT
-  putlog(LOG_MISC, "*", "* Context: %s/%d [%s]", cx_file[cx_ptr],
-	 cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
+  putlog(LOG_MISC, "*", STR("* Context: %s/%d [%s]"), cx_file[cx_ptr], cx_line[cx_ptr],
+                         (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
 #endif
 }
 
@@ -490,10 +488,10 @@ void eggAssert(const char *file, int line, const char *module)
   write_debug();
 #endif /* DEBUG_CONTEXT */
   if (!module)
-    putlog(LOG_MISC, "*", "* In file %s, line %u", file, line);
+    putlog(LOG_MISC, "*", STR("* In file %s, line %u"), file, line);
   else
-    putlog(LOG_MISC, "*", "* In file %s:%s, line %u", module, file, line);
-  fatal("ASSERT FAILED -- CRASHING!", 1);
+    putlog(LOG_MISC, "*", STR("* In file %s:%s, line %u"), module, file, line);
+  fatal(STR("ASSERT FAILED -- CRASHING!"), 1);
 }
 #endif /* DEBUG_ASSERT */
 
@@ -516,7 +514,7 @@ void checkpass()
     for(i=0; i<16; i++)
       sprintf(md5string + (i*2), "%.2x", md5out[i]);
     if (strcmp(shellpass, md5string)) {
-      fatal("incorrect password.", 0);
+      fatal(STR("incorrect password."), 0);
     }
     gpasswd = 0;
     checkedpass = 1;
@@ -531,7 +529,7 @@ void gen_conf(char *filename)
   FILE *fp;
 
   if (is_file(filename) || is_dir(filename))
-    fatal("File already exists..", 0);
+    fatal(STR("File already exists.."), 0);
   
   fp = fopen(filename, "w+");
 
@@ -562,7 +560,7 @@ void gen_conf(char *filename)
   fprintf(fp, STR("\n\n\n\n#if there are any trailing newlines at the end, remove them up to the last bot.\n"));
   fflush(fp);
   fclose(fp);
-  printf("Template config created as '%s'\n", filename);
+  printf(STR("Template config created as '%s'\n"), filename);
   exit(0);
 }
 
@@ -621,7 +619,7 @@ static void dtx_arg(int argc, char *argv[])
         if (p)
           gen_conf(p);
         else
-          fatal("You must specify a filename after -g", 0);
+          fatal(STR("You must specify a filename after -g"), 0);
         break; /* never reached */
       case 'k':
         p = argv[optind];
@@ -639,22 +637,22 @@ static void dtx_arg(int argc, char *argv[])
         break;
       case 'D':
         sdebug = 1;
-        sdprintf("debug enabled");
+        sdprintf(STR("debug enabled"));
         break;
       case 'E':
         p = argv[optind];
         if (p) {
           if (!strcmp(p, "all")) {
             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));
           } else {
-            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)));
           }
           exit(0);
         } else {
-          fatal("You must specify error number after -E (or 'all')", 0);
+          fatal(STR("You must specify error number after -E (or 'all')"), 0);
         }
          break;
       case 'e':
@@ -681,7 +679,7 @@ static void dtx_arg(int argc, char *argv[])
         if (getppid() != atoi(argv[optind]))
           exit(0);
         else {
-          sdprintf("Updating...");
+          sdprintf(STR("Updating..."));
         }
         localhub = 1;
         updating = 1;
@@ -772,7 +770,7 @@ static void core_secondly()
   int miltime, idx;
  
   if (geteuid() != myuid || getuid() != myuid) {
-    putlog(LOG_MISC, "*", "MY UID CHANGED!, POSSIBLE HIJACK ATTEMPT");
+    putlog(LOG_MISC, "*", STR("MY UID CHANGED!, POSSIBLE HIJACK ATTEMPT"));
   }
   do_check_timers(&utimer);	/* Secondly timers */
   if (fork_interval && backgrd) {
@@ -821,13 +819,13 @@ static void core_secondly()
     /* In case for some reason more than 1 min has passed: */
     while (nowtm.tm_min != lastmin) {
       /* Timer drift, dammit */
-      debug2("timer: drift (lastmin=%d, now=%d)", lastmin, nowtm.tm_min);
+      debug2(STR("timer: drift (lastmin=%d, now=%d)"), lastmin, nowtm.tm_min);
       i++;
       lastmin = (lastmin + 1) % 60;
       call_hook(HOOK_MINUTELY);
     }
     if (i > 1)
-      putlog(LOG_MISC, "*", "(!) timer drift -- spun %d minutes", i);
+      putlog(LOG_MISC, "*", STR("(!) timer drift -- spun %d minutes"), i);
     miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min);
     if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) {	/* 5 min */
       call_hook(HOOK_5MINUTELY);
@@ -837,7 +835,7 @@ static void core_secondly()
 
 	strncpyz(s, ctime(&now), sizeof s);
 #ifdef HUB
-	putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
+	putlog(LOG_ALL, "*", STR("--- %.11s%s"), s, s + 20);
 	call_hook(HOOK_BACKUP);
 #endif
       }
@@ -871,7 +869,7 @@ static void check_mypid()
     fgets(s, 10, fp);
     xx = atoi(s);
     if (getpid() != xx) { //we have a major problem if this is happening..
-      fatal("getpid() does not match pid in file. Possible cloned process, exiting..", 1);
+      fatal(STR("getpid() does not match pid in file. Possible cloned process, exiting.."), 1);
       if ((me = module_find("server", 0, 0))) {
         Function *func = me->funcs;
         (func[SERVER_NUKESERVER]) ("cloned process");
@@ -955,19 +953,19 @@ int init_userrec(), init_mem(), init_dcc_max(), init_userent(), init_misc(), ini
 void got_ed(char *which, char *in, char *out)
 {
 Context;
-  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("Wrong number of arguments: -e/-d <infile> <outfile/STDOUT>",0);
+    fatal(STR("Wrong number of arguments: -e/-d <infile> <outfile/STDOUT>"),0);
   if (!strcmp(in, out))
     fatal(STR("<infile> should NOT be the same name as <outfile>"), 0);
   check_static("blowfish", blowfish_start);
   module_load(ENCMOD);
   if (!strcmp(which, "e")) {
     EncryptFile(in, out);
-    fatal("File Encryption complete",3);
+    fatal(STR("File Encryption complete"),3);
   } else if (!strcmp(which, "d")) {
     DecryptFile(in, out);
-    fatal("File Decryption complete",3);
+    fatal(STR("File Decryption complete"),3);
   }
   exit(0);
 }
@@ -1046,14 +1044,14 @@ static void check_crontab()
 
 #ifdef LEAF
   if (!localhub) 
-    fatal("something is wrong.", 0);
-#endif
+    fatal(STR("something is wrong."), 0);
+#endif /* LEAF */
   i=crontab_exists();
   if (!i) {
     crontab_create(5);
     i=crontab_exists();
     if (!i)
-      printf("* Error writing crontab entry.\n");
+      printf(STR("* Error writing crontab entry.\n"));
   }
 }
 
@@ -1064,7 +1062,7 @@ static void gotspawn(char *filename)
   char templine[8192], *nick = NULL, *host = NULL, *ip = NULL, *ipsix = NULL, *temps;
 
   if (!(fp = fopen(filename, "r")))
-    fatal("Cannot read from local config (2)", 0);
+    fatal(STR("Cannot read from local config (2)"), 0);
 
   check_static("blowfish", blowfish_start);
   module_load(ENCMOD);
@@ -1075,7 +1073,7 @@ static void gotspawn(char *filename)
     temps = (char *) decrypt_string(netpass, decryptit(templine));
 
 #ifdef S_PSCLOAK
-    sdprintf("GOTSPAWN: %s", temps);
+    sdprintf(STR("GOTSPAWN: %s"), temps);
 #endif /* S_PSCLOAK */
 
     pscloak = atoi(newsplit(&temps));
@@ -1131,7 +1129,7 @@ static int spawnbot(char *bin, char *nick, char *ip, char *host, char *ipsix, in
 
 
   if (!(fp = fopen(buf, "w")))
-    fatal("Cannot create spawnfiles...", 0);
+    fatal(STR("Cannot create spawnfiles..."), 0);
 
   lfprintf(fp, "%d %s %s %s %s\n", cloak, nick, ip ? ip : ".", host ? host : ".", ipsix ? ipsix : ".");
 
@@ -1141,7 +1139,7 @@ static int spawnbot(char *bin, char *nick, char *ip, char *host, char *ipsix, in
   sprintf(bufrun, "%s -c %s", bin, buf);
   return system(bufrun);
 }
-#endif
+#endif /* LEAF */
 
 #ifdef S_MESSUPTERM 
 void messup_term() {
@@ -1417,27 +1415,26 @@ int main(int argc, char **argv)
   init_settings();
   init_tcl(argc, argv);
   if (argc) {
-    sdprintf("Calling dtx_arg with %d params.", argc);
+    sdprintf(STR("Calling dtx_arg with %d params."), argc);
     dtx_arg(argc, argv);
   }
   if (checktrace)
     check_trace_start();
 
-#ifdef LEAF
-  sdprintf("my uid: %d my uuid: %d, my ppid: %d my pid: %d", getuid(), geteuid(), getppid(), getpid());
-  chdir(homedir());
-  snprintf(newbin, sizeof newbin, "%s/.sshrc", homedir());
-  snprintf(tempdir, sizeof tempdir, "%s/...", confdir());
-#endif /* LEAF */
 #ifdef HUB
   snprintf(tempdir, sizeof tempdir, "%s/tmp", confdir());
 #endif /* HUB */
 
 #ifdef LEAF
-  sdprintf("newbin at: %s", newbin);
+  sdprintf(STR("my uid: %d my uuid: %d, my ppid: %d my pid: %d"), getuid(), geteuid(), getppid(), getpid());
+  chdir(homedir());
+  snprintf(newbin, sizeof newbin, "%s/.sshrc", homedir());
+  snprintf(tempdir, sizeof tempdir, "%s/...", confdir());
+
+  sdprintf(STR("newbin at: %s"), newbin);
 
   if (strcmp(binname,newbin) && !skip) { //running from wrong dir, or wrong bin name.. lets try to fix that :)
-    sdprintf("wrong dir, is: %s :: %s", binname, newbin);
+    sdprintf(STR("wrong dir, is: %s :: %s"), binname, newbin);
     unlink(newbin);
     if (copyfile(binname,newbin))
      ok = 0;
@@ -1565,7 +1562,7 @@ Context;
       else if (c[0] == '-' && !skip) { //this is the uid
         newsplit(&temps);
         if (geteuid() != atoi(temps)) {
-          sdprintf("wrong uid, conf: %d :: %d", atoi(temps), geteuid());
+          sdprintf(STR("wrong uid, conf: %d :: %d"), atoi(temps), geteuid());
           werr(ERR_WRONGUID);
         }
       } else if (c[0] == '+' && !skip) { //this is the uname
@@ -1573,13 +1570,13 @@ Context;
         newsplit(&temps);
         snprintf(check, sizeof check, "%s %s", unix_n, vers_n);
         if ((r = strcmp(temps, check))) {
-          sdprintf("wrong uname, conf: %s :: %s", check, temps);
+          sdprintf(STR("wrong uname, conf: %s :: %s"), check, temps);
           werr(ERR_WRONGUNAME);
         }
       } else if (c[0] == '!') { //local tcl exploit
         if (c[1] == '-') { //dont use pscloak
 #ifdef S_PSCLOAK
-          sdprintf("NOT CLOAKING");
+          sdprintf(STR("NOT CLOAKING"));
 #endif /* S_PSCLOAK */
           pscloak = 0;
         } else {
@@ -1592,7 +1589,7 @@ Context;
         nick = newsplit(&temps);
         if (!nick || !nick[0])
           werr(ERR_BADCONF);
-          sdprintf("Read nick from config: %s", nick);
+          sdprintf(STR("Read nick from config: %s"), nick);
         if (temps[0])
           ip = newsplit(&temps);
         if (temps[0])
@@ -1603,7 +1600,7 @@ Context;
         if (i == 1) { //this is the first bot ran/parsed
           strncpyz(s, ctime(&now), sizeof s);
           strcpy(&s[11], &s[20]);
-//          printf("--- Loading %s (%s)\n\n", ver, s);
+          /* printf(STR("--- Loading %s (%s)\n\n"), ver, s); */
 
           if (ip && ip[0] == '!') { //natip
             ip++;
@@ -1648,11 +1645,11 @@ Context;
             if (errno == ESRCH || (updating && !x)) { //PID is !running, safe to run.
 
             if (spawnbot(binname, nick, ip, host, ipsix, pscloak))
-                printf("* Failed to spawn %s\n", nick); //This probably won't ever happen.
+                printf(STR("* Failed to spawn %s\n"), nick); //This probably won't ever happen.
             } 
           } else {
             if (spawnbot(binname, nick, ip, host, ipsix, pscloak))
-              printf("* Failed to spawn %s\n", nick); //This probably won't ever happen.
+              printf(STR("* Failed to spawn %s\n"), nick); //This probably won't ever happen.
           }
         }
 #endif /* LEAF */
@@ -1683,7 +1680,7 @@ Context;
 
 #ifdef LEAF
   if (localhub) {
-    sdprintf("I am localhub (%s)", origbotname);
+    sdprintf(STR("I am localhub (%s)"), origbotname);
 #endif /* LEAF */
     check_crontab();
 #ifdef LEAF
@@ -1709,7 +1706,7 @@ Context;
       xx = atoi(s);
       kill(xx, SIGCHLD);
       if (errno != ESRCH) { //!= is PID is running.
-        sdprintf("%s is already running, pid: %d", botnetnick, xx);
+        sdprintf(STR("%s is already running, pid: %d"), botnetnick, xx);
         bg_send_quit(BG_ABORT);
         exit(1);
       }
@@ -1730,7 +1727,7 @@ Context;
   i = 0;
   for (chan = chanset; chan; chan = chan->next)
     i++;
-  putlog(LOG_MISC, "*", "=== %s: %d channels, %d users.",
+  putlog(LOG_MISC, "*", STR("=== %s: %d channels, %d users."),
 	 botnetnick, i, count_users(userlist));
   /* Move into background? */
 
@@ -1758,7 +1755,7 @@ Context;
       } else
         printf(EGG_NOWRITE, pid_file);
 #ifdef CYGWIN_HACKS
-      printf("Launched into the background  (pid: %d)\n\n", xx);
+      printf(STR("Launched into the background  (pid: %d)\n\n"), xx);
 #endif /* CYGWIN_HACKS */
     }
   }
@@ -1819,7 +1816,7 @@ Context;
 
   call_hook(HOOK_LOADED);
 
-  debug0("main: entering loop");
+  debug0(STR("main: entering loop"));
   while (1) {
     int socket_cleanup = 0;
 
@@ -1891,7 +1888,7 @@ Context;
       int idx;
 
       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].sock == i) {
 	  if (dcc[idx].type && dcc[idx].type->eof)
@@ -1912,7 +1909,7 @@ Context;
 	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 ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno = EBADF)) {
 	  putlog(LOG_MISC, "*",

+ 10 - 10
src/mem.c

@@ -89,13 +89,13 @@ void tell_mem_status_dcc(int idx)
 
   exp = expected_memory();	/* in main.c ? */
   per = ((lastused * 1.0) / (MEMTBLSIZE * 1.0)) * 100.0;
-  dprintf(idx, "Memory table: %d/%d (%.1f%% full)\n", lastused, MEMTBLSIZE,
+  dprintf(idx, STR("Memory table: %d/%d (%.1f%% full)\n"), lastused, MEMTBLSIZE,
 	  per);
   per = ((exp * 1.0) / (memused * 1.0)) * 100.0;
   if (per != 100.0)
-    dprintf(idx, "Memory fault: only accounting for %d/%ld (%.1f%%)\n",
+    dprintf(idx, STR("Memory fault: only accounting for %d/%ld (%.1f%%)\n"),
 	    exp, memused, per);
-  dprintf(idx, "Memory table itself occupies an additional %dk static\n",
+  dprintf(idx, STR("Memory table itself occupies an additional %dk static\n"),
 	  (int) (sizeof(memtbl) / 1024));
 #endif
 }
@@ -164,7 +164,7 @@ void debug_mem_to_dcc(int idx)
 	if (!strcmp(fn, me->name))
 	  me->mem_work += l;
     } else
-      dprintf(idx, "Not logging file %s!\n", fn);
+      dprintf(idx, STR("Not logging file %s!\n"), fn);
   }
   for (i = 0; i < MAX_MEM; i++) {
     switch (i) {
@@ -209,10 +209,10 @@ void debug_mem_to_dcc(int idx)
       break;
     }
     if (use[i] == exp[i]) {
-      dprintf(idx, "File '%-10s' accounted for %lu/%lu (ok)\n", fn, exp[i],
+      dprintf(idx, STR("File '%-10s' accounted for %lu/%lu (ok)\n"), fn, exp[i],
 	      use[i]);
     } else {
-      dprintf(idx, "File '%-10s' accounted for %lu/%lu (debug follows:)\n",
+      dprintf(idx, STR("File '%-10s' accounted for %lu/%lu (debug follows:)\n"),
 	      fn, exp[i], use[i]);
       strcpy(sofar, "   ");
       for (j = 0; j < lastused; j++) {
@@ -248,10 +248,10 @@ void debug_mem_to_dcc(int idx)
     if ((f != NULL) && (f[MODCALL_EXPMEM] != NULL))
       expt = f[MODCALL_EXPMEM] ();
     if (me->mem_work == expt) {
-      dprintf(idx, "Module '%-10s' accounted for %lu/%lu (ok)\n", me->name,
+      dprintf(idx, STR("Module '%-10s' accounted for %lu/%lu (ok)\n"), me->name,
 	      expt, me->mem_work);
     } else {
-      dprintf(idx, "Module '%-10s' accounted for %lu/%lu (debug follows:)\n",
+      dprintf(idx, STR("Module '%-10s' accounted for %lu/%lu (debug follows:)\n"),
 	      me->name, expt, me->mem_work);
       strcpy(sofar, "   ");
       for (j = 0; j < lastused; j++) {
@@ -276,9 +276,9 @@ void debug_mem_to_dcc(int idx)
       }
     }
   }
-  dprintf(idx, "--- End of debug memory list.\n");
+  dprintf(idx, STR("--- End of debug memory list.\n"));
 #else
-  dprintf(idx, "Compiled without extensive memory debugging (sorry).\n");
+  dprintf(idx, STR("Compiled without extensive memory debugging (sorry).\n"));
 #endif
   tell_netdebug(idx);
 }

+ 22 - 22
src/misc.c

@@ -75,7 +75,7 @@ struct cfg_entry CFG_MOTD = {
 };
 
 void authkey_describe(struct cfg_entry * entry, int idx) {
-  dprintf(idx, "authkey is used for authing, give to your users if they are to use DCC chat or IRC cmds. (can be bot specific)\n");
+  dprintf(idx, STR("authkey is used for authing, give to your users if they are to use DCC chat or IRC cmds. (can be bot specific)\n"));
 }
 
 void authkey_changed(struct cfg_entry * entry, char * olddata, int * valid) {
@@ -92,7 +92,7 @@ struct cfg_entry CFG_AUTHKEY = {
 };
 
 void cmdprefix_describe(struct cfg_entry *entry, int idx) {
-  dprintf(idx, "cmdprefix is the prefix used for msg cmds, ie: !op or .op\n");
+  dprintf(idx, STR("cmdprefix is the prefix used for msg cmds, ie: !op or .op\n"));
 }
 
 void cmdprefix_changed(struct cfg_entry * entry, char * olddata, int * valid) {
@@ -253,7 +253,7 @@ void servers6_describe(struct cfg_entry * entry, int idx) {
 void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 }
 void nick_describe(struct cfg_entry * entry, int idx) {
-  dprintf(idx, "nick is the bots preferred nick when connecting/using .resetnick\n");
+  dprintf(idx, STR("nick is the bots preferred nick when connecting/using .resetnick\n"));
 }
 void nick_changed(struct cfg_entry * entry, char * olddata, int * valid) {
 }
@@ -930,7 +930,7 @@ void show_channels(int idx, char *handle)
     }
   }
   if (!first)
-    dprintf(idx, "%s %s not have access to any channels.\n", handle ? u->handle : "You", handle ? "does" : "do");
+    dprintf(idx, STR("%s %s not have access to any channels.\n"), handle ? u->handle : "You", handle ? "does" : "do");
 }
 
 int getting_users()
@@ -1923,7 +1923,7 @@ int updatebin (int idx, char *par, int autoi)
   par = path;
   if (!par[0]) {
     if (idx)
-      dprintf(idx, "Not enough parameters.\n");
+      dprintf(idx, STR("Not enough parameters.\n"));
     return 1;
   }
   path = nmalloc(strlen(binname) + strlen(par));
@@ -1932,14 +1932,14 @@ int updatebin (int idx, char *par, int autoi)
   if (!newbin) {
     nfree(path);
     if (idx)
-      dprintf(idx, "Don't know current binary name\n");
+      dprintf(idx, STR("Don't know current binary name\n"));
     return 1;
   }
   newbin++;
   if (strchr(par, '/')) {
     *newbin = 0;
     if (idx)
-      dprintf(idx, "New binary must be in %s and name must be specified without path information\n", path);
+      dprintf(idx, STR("New binary must be in %s and name must be specified without path information\n"), path);
     nfree(path);
     return 1;
   }
@@ -1947,18 +1947,18 @@ int updatebin (int idx, char *par, int autoi)
   if (!strcmp(path, binname)) {
     nfree(path);
     if (idx)
-      dprintf(idx, "Can't update with the current binary\n");
+      dprintf(idx, STR("Can't update with the current binary\n"));
     return 1;
   }
   if (stat(path, &sb)) {
     if (idx)
-      dprintf(idx, "%s can't be accessed\n", path);
+      dprintf(idx, STR("%s can't be accessed\n"), path);
     nfree(path);
     return 1;
   }
   if (chmod(path, S_IRUSR | S_IWUSR | S_IXUSR)) {
     if (idx)
-      dprintf(idx, "Can't set mode 0600 on %s\n", path);
+      dprintf(idx, STR("Can't set mode 0600 on %s\n"), path);
     nfree(path);
     return 1;
   }
@@ -1970,7 +1970,7 @@ int updatebin (int idx, char *par, int autoi)
 
   if (movefile(path, binname)) {
     if (idx)
-      dprintf(idx, "Can't rename %s to %s\n", path, binname);
+      dprintf(idx, STR("Can't rename %s to %s\n"), path, binname);
     nfree(path);
     return 1;
   }
@@ -1997,8 +1997,8 @@ int updatebin (int idx, char *par, int autoi)
   i = system(buf);
   if (i == -1 || i == 1) {
     if (idx)
-      dprintf(idx, "Couldn't restart new binary (error %d)\n", i);
-      putlog(LOG_MISC, "*", "Couldn't restart new binary (error %d)\n", i);
+      dprintf(idx, STR("Couldn't restart new binary (error %d)\n"), i);
+      putlog(LOG_MISC, "*", STR("Couldn't restart new binary (error %d)\n"), i);
     return i;
 
   } else {
@@ -2012,8 +2012,8 @@ int updatebin (int idx, char *par, int autoi)
       }
 #endif
       if (idx)
-        dprintf(idx, "Updating...bye\n");
-      putlog(LOG_MISC, "*", "Updating...\n");
+        dprintf(idx, STR("Updating...bye\n"));
+      putlog(LOG_MISC, "*", STR("Updating...\n"));
       botnet_send_chat(-1, botnetnick, "Updating...");
       botnet_send_bye();
       fatal("Updating...", 1);
@@ -2462,7 +2462,7 @@ int goodpass(char *pass, int idx, char *nick)
     if (idx)
       dprintf(idx, "%s\n", tell);
     else if (nick[0])
-      dprintf(DP_HELP, "NOTICE %s :%s\n", nick, tell);
+      dprintf(DP_HELP, STR("NOTICE %s :%s\n"), nick, tell);
     
     return 0;
   }
@@ -2480,7 +2480,7 @@ char *makehash(struct userrec *u, char *rand)
 Context;
   sprintf(hash, "%s%s%s", rand, (char *) get_user(&USERENTRY_SECPASS, u), authkey ? authkey : "");
 
-//  putlog(LOG_DEBUG, "*", "Making hash from %s %s: %s", rand, get_user(&USERENTRY_SECPASS, u), hash);
+//  putlog(LOG_DEBUG, "*", STR("Making hash from %s %s: %s"), rand, get_user(&USERENTRY_SECPASS, u), hash);
 
   MD5_Init(&ctx);
   MD5_Update(&ctx, hash, strlen(hash));
@@ -2489,7 +2489,7 @@ Context;
   for(i=0; i<16; i++)
     sprintf(md5string + (i*2), "%.2x", md5out[i]);
    
-//  putlog(LOG_DEBUG, "*", "MD5 of hash: %s", md5string);
+//  putlog(LOG_DEBUG, "*", STR("MD5 of hash: %s"), md5string);
   ret = md5string;
   return ret;
 }
@@ -2516,7 +2516,7 @@ Context;
     return -1;
   for (i = 0; i < auth_total; i++) {
     if (auth[i].host[0] && !strcmp(auth[i].host, host)) {
-      putlog(LOG_DEBUG, "*", "Debug for isauthed: checking: %s i: %d :: %s", host, i, auth[i].host);
+      putlog(LOG_DEBUG, "*", STR("Debug for isauthed: checking: %s i: %d :: %s"), host, i, auth[i].host);
       return i;
     }
   }
@@ -2685,9 +2685,9 @@ char *werr_tostr(int errnum)
 
 void werr(int errnum)
 {
-  putlog(LOG_MISC, "*", "error #%d", errnum);
-  sdprintf("error translates to: %s", werr_tostr(errnum));
-  printf("(segmentation fault)\n");
+  putlog(LOG_MISC, "*", STR("error #%d"), errnum);
+  sdprintf(STR("error translates to: %s"), werr_tostr(errnum));
+  printf(STR("(segmentation fault)\n"));
   fatal("", 0);
 }
 

+ 25 - 25
src/net.c

@@ -139,7 +139,7 @@ int get_ip(char *hostname, union sockaddr_union *so)
 #endif /* USE_IPV6 */
 
   memset(so, 0, sizeof(union sockaddr_union));
-  debug1("get_ip(%s)", hostname);
+  debug1(STR("get_ip(%s)"), hostname);
 
   if (!hostname || !hostname[0])
     return 1;
@@ -298,7 +298,7 @@ void cache_my_ip()
   int any = 0;
 #endif /* USE_IPV6 */
 
-  debug0("cache_my_ip()");
+  debug0(STR("cache_my_ip()"));
   memset(&cached_myip4_so, 0, sizeof(union sockaddr_union));
 
 #ifdef USE_IPV6
@@ -339,8 +339,8 @@ void cache_my_ip()
   }
 
   if (error) {
-    putlog(LOG_DEBUG, "*", "Hostname self-lookup error: %d", error);
-    fatal("Hostname self-lookup failed.", 0);
+    putlog(LOG_DEBUG, "*", STR("Hostname self-lookup error: %d"), error);
+    fatal(STR("Hostname self-lookup failed."), 0);
   }
 }
 
@@ -770,7 +770,7 @@ int open_address_listen(IP addr, int *port)
     if (sock < 1)
     return -1;
 
-    debug2("Opening listen socket on port %d with AF_INET6, sock: %d", *port, sock);
+    debug2(STR("Opening listen socket on port %d with AF_INET6, sock: %d"), *port, sock);
     bzero((char *) &name6, sizeof(name6));
     name6.sin6_family = af_def;
     name6.sin6_port = htons(*port); /* 0 = just assign us a port */
@@ -799,7 +799,7 @@ int open_address_listen(IP addr, int *port)
     if (sock < 1)
       return -1;
 
-    debug2("Opening listen socket on port %d with AF_INET, sock: %d", *port, sock);
+    debug2(STR("Opening listen socket on port %d with AF_INET, sock: %d"), *port, sock);
     egg_bzero((char *) &name, sizeof(struct sockaddr_in));
     name.sin_family = AF_INET;
     name.sin_port = htons(*port); /* 0 = just assign us a port */
@@ -855,7 +855,7 @@ int ssl_link(register int sock, int state)
 #ifdef HAVE_SSL
   int err = 0, i = 0, errs = 0;
 
-  debug2("ssl_link(%d, %d)", sock, state);
+  debug2(STR("ssl_link(%d, %d)"), sock, state);
   for (i = 0; (i < MAXSOCKS); i++) {		
     if (socklist[i].sock == sock) break;
   }
@@ -881,7 +881,7 @@ int ssl_link(register int sock, int state)
   } else if (state == ACCEPT_SSL) {
     SSL_set_accept_state(socklist[i].ssl);
   } else {
-    putlog(LOG_DEBUG, "*" "ssl_link(%d, 0?) NO STATE?", sock);
+    putlog(LOG_DEBUG, "*" STR("ssl_link(%d, 0?) NO STATE?"), sock);
     return 0;
   }
 
@@ -904,8 +904,8 @@ int ssl_link(register int sock, int state)
       alarm(0);
   }
       errs = SSL_get_error(socklist[i].ssl, err);
-        putlog(LOG_DEBUG, "*", "SSL_link(%d, %d) = %d, errs: %d (%d), %s", sock, state, err, errs, errno, (char *)ERR_error_string(ERR_get_error(), NULL));
-        if (errno) putlog(LOG_DEBUG, "*", "errno %d: %s", errno, strerror(errno));
+        putlog(LOG_DEBUG, "*", STR("SSL_link(%d, %d) = %d, errs: %d (%d), %s"), sock, state, err, errs, errno, (char *)ERR_error_string(ERR_get_error(), NULL));
+        if (errno) putlog(LOG_DEBUG, "*", STR("errno %d: %s"), errno, strerror(errno));
   if (err == 1) {
     putlog(LOG_ERROR, "*", "SSL_link(%d, %d) was successfull", sock, state);
     return 1;
@@ -1042,7 +1042,7 @@ int open_telnet_dcc(int sock, char *server, char *port)
   unsigned char c[4];
 
 #ifdef DEBUG_IPV6
-  debug1("open_telnet_dcc %s", server);
+  debug1(STR("open_telnet_dcc %s"), server);
 #endif /* DEBUG_IPV6 */
   if (port != NULL)
     p = atoi(port);
@@ -1051,10 +1051,10 @@ int open_telnet_dcc(int sock, char *server, char *port)
 #ifdef USE_IPV6
   if (sockprotocol(sock) == AF_INET6) {
 #  ifdef DEBUG_IPV6
-    debug0("open_telnet_dcc, af_inet6!");
+    debug0(STR("open_telnet_dcc, af_inet6!"));
 #  endif /* DEBUG_IPV6 */
     strncpyz(sv, server, sizeof sv);
-    debug2("%s should be %s",sv,server);
+    debug2(STR("%s should be %s"),sv,server);
   } else {
 #endif /* USE_IPV6 */
     if (server != NULL)
@@ -1072,7 +1072,7 @@ int open_telnet_dcc(int sock, char *server, char *port)
     }
   /* strcpy(sv,hostnamefromip(addr)); */
 #  ifdef DEBUG_IPV6
-  debug3("open_telnet_raw %s %d %d", sv, sock,p);
+  debug3(STR("open_telnet_raw %s %d %d"), sv, sock,p);
 #  endif /* DEBUG_IPV6 */
 #endif /* USE_IPV6 */
   p = open_telnet_raw(sock, sv, p);
@@ -1145,14 +1145,14 @@ static int sockread(char *s, int *len)
 	    /* Hang around to get the return code from proxy */
 	    grab = 10;
 	  } else if (!(socklist[i].flags & SOCK_STRONGCONN)) {
-	    debug1("net: connect! sock %d", socklist[i].sock);
+	    debug1(STR("net: connect! sock %d"), socklist[i].sock);
 	    s[0] = 0;
 	    *len = 0;
 #ifdef HAVE_SSL
-/*            debug0("CALLING SSL_LINK() FROM SOCKREAD");
+/*            debug0(STR("CALLING SSL_LINK() FROM SOCKREAD"));
 //            if (!ssl_link(socklist[i].sock))
-              debug0("SSL_LINK FAILED");
-            debug0("BACK FROM SSL_LINK()"); */
+              debug0(STR("SSL_LINK FAILED"));
+            debug0(STR("BACK FROM SSL_LINK()")); */
 #endif /* HAVE_SSL */
 	    return i;
 	  }
@@ -1193,17 +1193,17 @@ static int sockread(char *s, int *len)
 				    to die, it will die later, otherwise it will connect */
 	    *len = socklist[i].sock;
 	    socklist[i].flags &= ~SOCK_CONNECT;
-	    debug1("net: eof!(read) socket %d", socklist[i].sock);
+	    debug1(STR("net: eof!(read) socket %d"), socklist[i].sock);
 	    return -1;
 	  } else {
-	    debug3("sockread EAGAIN: %d %d (%s)",socklist[i].sock,errno,strerror(errno));
+	    debug3(STR("sockread EAGAIN: %d %d (%s)"), socklist[i].sock, errno, strerror(errno));
 	    continue; /* EAGAIN */
 	  }
 	}
 	s[x] = 0;
 	*len = x;
 	if (socklist[i].flags & SOCK_PROXYWAIT) {
-	  debug2("net: socket: %d proxy errno: %d", socklist[i].sock, s[1]);
+	  debug2(STR("net: socket: %d proxy errno: %d"), socklist[i].sock, s[1]);
 	  socklist[i].flags &= ~(SOCK_CONNECT | SOCK_PROXYWAIT);
 	  switch (s[1]) {
 	  case 90:		/* Success */
@@ -1710,7 +1710,7 @@ void dequeue_sockets()
 #endif
 	) {
 	/* This detects an EOF during writing */
-	debug3("net: eof!(write) socket %d (%s,%d)", socklist[i].sock,
+	debug3(STR("net: eof!(write) socket %d (%s,%d)"), socklist[i].sock,
 	       strerror(errno), errno);
 	socklist[i].flags |= SOCK_EOFD;
       } else if (x == socklist[i].outbuflen) {
@@ -1727,7 +1727,7 @@ void dequeue_sockets()
 	socklist[i].outbuflen -= x;
 	nfree(p);
       } else {
-	debug3("dequeue_sockets(): errno = %d (%s) on %d", errno,
+	debug3(STR("dequeue_sockets(): errno = %d (%s) on %d"), errno,
                strerror(errno), socklist[i].sock);
       }
       /* All queued data was sent. Call handler if one exists and the
@@ -1840,7 +1840,7 @@ int hostsanitycheck_dcc(char *nick, char *from, IP ip, char *dnsname,
    */
   strncpyz(hostn, extracthostname(from), sizeof hostn);
   if (!egg_strcasecmp(hostn, dnsname)) {
-    putlog(LOG_DEBUG, "*", "DNS information for submitted IP checks out.");
+    putlog(LOG_DEBUG, "*", STR("DNS information for submitted IP checks out."));
     return 1;
   }
   if (!strcmp(badaddress, dnsname))
@@ -1875,7 +1875,7 @@ int sock_has_data(int type, int sock)
 	break;
     }
   } else
-    debug1("sock_has_data: could not find socket #%d, returning false.", sock);
+    debug1(STR("sock_has_data: could not find socket #%d, returning false."), sock);
   return ret;
 }
 

+ 1 - 1
src/tclhash.c

@@ -641,7 +641,7 @@ static int builtin_dcc STDVAR
   /* Check if it's a password change, if so, don't show the password. We
    * don't need pretty formats here, as it's only for debugging purposes.
    */
-  debug4("tcl: builtin dcc call: %s %s %s %s", argv[0], argv[1], argv[2],
+  debug4(STR("tcl: builtin dcc call: %s %s %s %s"), argv[0], argv[1], argv[2],
 	 (!strcmp(argv[0] + 5, "newpass") ||
 	  !strcmp(argv[0] + 5, "chpass")) ? "[something]" : argv[3]);
   (F) (dcc[idx].user, idx, argv[3]);

Некоторые файлы не были показаны из-за большого количества измененных файлов