Răsfoiți Sursa

* Added compile time option S_AUTH
* Moved all config related items to src/config.c
* Moved all auth functions to src/auth.c
* Added both config.c and auth.c to mem.c
* Fixed a bug in build with -d


svn: 191

Bryan Drewery 22 ani în urmă
părinte
comite
6a9b50bc7a

+ 1 - 1
build

@@ -161,7 +161,7 @@ do
   mv -f $bin $bin.$os.$numver${d}
 done
 
-tar -zcf $packname.$os.$numver${d}.tgz *.$os.$numver
+tar -zcf $packname.$os.$numver${d}.tgz *.$os.$numver${d}
 rm -f *.$os.$numver
 echo "Binaries are now in '$packname.$os.$numver${d}.tgz'."
 exit 0

+ 1 - 0
pack/conf.h

@@ -14,6 +14,7 @@
 
 /*      S_FEATURE	  RECOMMENDED	DESCRIPTION 					*/
 #define S_ANTITRACE	/*  yes		ptrace detection 				*/
+#define S_AUTH		/*  yes		authorization system (HIGHLY RECOMMENDED)	*/
 #define S_AUTOAWAY	/*  yes		random autoaway/return on IRC 			*/
 #define S_DCCPASS	/*  yes		DCC command passwords 				*/
 #define S_GARBLESTRINGS	/*  yes		encrypt strings in binary			*/

+ 18 - 8
src/Makefile.in

@@ -13,11 +13,11 @@ STRIP = @STRIP@
 CFLAGS = @CFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/pack @DEFS@ $(CFLGS)
 CPPFLAGS = @CPPFLAGS@
 
-eggdrop_objs = pcrypt.o settings.o \
-bg.o botcmd.o botmsg.o botnet.o chanprog.o cmds.o \
-dcc.o dccutil.o dns.o flags.o main.o mem.o misc.o \
-misc_file.o modules.o net.o rfc1459.o tcl.o tcldcc.o tclhash.o \
-tclmisc.o tcluser.o userent.o userrec.o users.o
+eggdrop_objs = auth.o bg.o botcmd.o botmsg.o botnet.o \
+chanprog.o cmds.o config.o crypt.o dcc.o dccutil.o dns.o flags.o \
+main.o mem.o misc.o misc_file.o modules.o net.o \
+rfc1459.o settings.o tcl.o tcldcc.o tclhash.o tclmisc.o \
+tcluser.o userent.o userrec.o users.o
 
 MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)'
@@ -94,6 +94,10 @@ eggdrop.h:
 
 #safety hash
 ../stringfix: stringfix.c
+auth.o: auth.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \
+ ../lush.h misc_file.h cmdt.h chan.h users.h compat/compat.h compat/inet_aton.h \
+ compat/inet_ntop.h ../src/main.h compat/snprintf.h  compat/memset.h \
+ compat/memcpy.h compat/strcasecmp.h compat/strftime.h
 bg.o: bg.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
@@ -124,6 +128,14 @@ cmds.o: cmds.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
  tandem.h modules.h mod/modvals.h
+config.o: config.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \
+ ../lush.h misc_file.h cmdt.h chan.h users.h compat/compat.h compat/inet_aton.h \
+ compat/inet_ntop.h ../src/main.h compat/snprintf.h  compat/memset.h \
+ compat/memcpy.h compat/strcasecmp.h compat/strftime.h
+crypt.o: crypt.c main.h ../config.h ../pack/salt.h eggdrop.h proto.h \
+ ../lush.h misc_file.h compat/compat.h compat/inet_aton.h \
+ compat/inet_ntop.h ../src/main.h compat/snprintf.h  compat/memset.h \
+ compat/memcpy.h compat/strcasecmp.h compat/strftime.h
 dcc.o: dcc.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
@@ -178,6 +190,7 @@ rfc1459.o: rfc1459.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h
  users.h compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h \
  compat/snprintf.h compat/memset.h compat/memcpy.h compat/strcasecmp.h \
  compat/strftime.h
+settings.o: settings.c eggdrop.h ../src/main.h ../pack/conf.h
 stringfix.o: stringfix.c
 tcl.o: tcl.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h proto.h \
  ../lush.h misc_file.h cmdt.h tclegg.h tclhash.h chan.h users.h \
@@ -218,6 +231,3 @@ users.o: users.c main.h ../config.h ../pack/conf.h lang.h eggdrop.h flags.h prot
  compat/compat.h compat/inet_aton.h compat/inet_ntop.h ../src/main.h compat/snprintf.h \
  compat/memset.h compat/memcpy.h compat/strcasecmp.h compat/strftime.h \
  modules.h mod/modvals.h tandem.h
-settings.o: settings.c eggdrop.h ../src/main.h
-pcrypt.o: pcrypt.c ../pack/salt.h
-

+ 147 - 0
src/auth.c

@@ -0,0 +1,147 @@
+/*
+ * auth.c -- handles:
+ *   auth system functions
+ *   auth system hooks
+ */
+
+#include "main.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "chan.h"
+#include "tandem.h"
+#include "modules.h"
+#include <pwd.h>
+#include <errno.h>
+
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <signal.h>
+
+
+#include "stat.h"
+#include "bg.h"
+
+extern struct userrec *userlist;
+extern struct dcc_t	*dcc;
+extern struct chanset_t	*chanset;
+extern time_t		 now;
+
+#ifdef S_AUTH
+int auth_total = 0;
+int max_auth = 100;
+struct auth_t *auth = 0;
+#endif /* S_AUTH */
+
+/* Expected memory usage
+ */
+int expmem_auth()
+{
+  int tot = 0;
+
+#ifdef S_AUTH
+  tot += sizeof(struct auth_t) * max_auth;
+#endif /* S_AUTH */
+
+  return tot;
+}
+
+#ifdef S_AUTH
+void init_auth_max()
+{
+  if (max_auth < 1)
+    max_auth = 1;
+  if (auth)
+    auth = nrealloc(auth, sizeof(struct auth_t) * max_auth);
+  else
+    auth = nmalloc(sizeof(struct auth_t) * max_auth);
+}
+
+static void expire_auths()
+{
+  int i = 0, idle = 0;
+  if (!ischanhub()) return;
+  for (i = 0; i < auth_total;i++) {
+    if (auth[i].authed) {
+      idle = now - auth[i].atime;
+      if (idle >= 60*60) {
+        removeauth(i);
+      }
+    }
+  }
+}
+#endif /* S_AUTH */
+
+void init_auth()
+{
+#ifdef S_AUTH
+  init_auth_max();
+  add_hook(HOOK_MINUTELY, (Function) expire_auths);
+#endif /* S_AUTH */
+}
+
+#ifdef S_AUTH
+char *makehash(struct userrec *u, char *rand)
+{
+  int i = 0;
+  MD5_CTX ctx;
+  unsigned char md5out[33];
+  char md5string[33], hash[500], *ret = NULL;
+Context;
+  sprintf(hash, "%s%s%s", rand, (char *) get_user(&USERENTRY_SECPASS, u), authkey ? authkey : "");
+
+//  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));
+  MD5_Final(md5out, &ctx);
+
+  for(i=0; i<16; i++)
+    sprintf(md5string + (i*2), "%.2x", md5out[i]);
+   
+//  putlog(LOG_DEBUG, "*", STR("MD5 of hash: %s"), md5string);
+  ret = md5string;
+  return ret;
+}
+
+int new_auth(void)
+{
+  int i = auth_total;
+
+Context;
+  if (auth_total == max_auth)
+    return -1;
+
+  auth_total++;
+  egg_bzero((char *) &auth[i], sizeof(struct auth_t));
+  return i;
+}
+
+int isauthed(char *host)
+{
+  int i = 0;
+Context;
+  if (!host || !host[0])
+    return -1;
+  for (i = 0; i < auth_total; i++) {
+    if (auth[i].host[0] && !strcmp(auth[i].host, host)) {
+      putlog(LOG_DEBUG, "*", STR("Debug for isauthed: checking: %s i: %d :: %s"), host, i, auth[i].host);
+      return i;
+    }
+  }
+  return -1;
+}
+  
+void removeauth(int n)
+{
+Context;
+  auth_total--;
+  if (n < auth_total)
+    egg_memcpy(&auth[n], &auth[auth_total], sizeof(struct auth_t));
+  else
+    egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
+}
+#endif /* S_AUTH */

+ 29 - 29
src/cmds.c

@@ -457,36 +457,36 @@ static void cmd_cmdpass(struct userrec *u, int idx, char *par)
   for (i = 0; cmd[i]; i++)
     cmd[i] = tolower(cmd[i]);
 
-  if (!strcasecmp(cmd, "op")) l++;
-  else if (!strcasecmp(cmd, "act")) l++;
-  else if (!strcasecmp(cmd, "adduser")) l++;
-  else if (!strcasecmp(cmd, "channel")) l++;
-  else if (!strcasecmp(cmd, "deluser")) l++;
-  else if (!strcasecmp(cmd, "deop")) l++;
-  else if (!strcasecmp(cmd, "devoice")) l++;
-  else if (!strcasecmp(cmd, "getkey")) l++;
-  else if (!strcasecmp(cmd, "find")) l++;
-  else if (!strcasecmp(cmd, "invite")) l++;
-  else if (!strcasecmp(cmd, "kick")) l++;
-  else if (!strcasecmp(cmd, "kickban")) l++;
-  else if (!strcasecmp(cmd, "mdop")) l++;
-  else if (!strcasecmp(cmd, "msg")) l++;
-  else if (!strcasecmp(cmd, "reset")) l++;
-  else if (!strcasecmp(cmd, "resetbans")) l++;
-  else if (!strcasecmp(cmd, "resetexempts")) l++;
-  else if (!strcasecmp(cmd, "resetinvites")) l++;
-  else if (!strcasecmp(cmd, "say")) l++;
-  else if (!strcasecmp(cmd, "topic")) l++;
-  else if (!strcasecmp(cmd, "voice")) l++;
-  else if (!strcasecmp(cmd, "clearqueue")) l++;
-  else if (!strcasecmp(cmd, "dump")) l++;
-  else if (!strcasecmp(cmd, "jump")) l++;
-  else if (!strcasecmp(cmd, "servers")) l++;
-  else if (!strcasecmp(cmd, "authed")) l++;
+  if (!egg_strcasecmp(cmd, "op")) l++;
+  else if (!egg_strcasecmp(cmd, "act")) l++;
+  else if (!egg_strcasecmp(cmd, "adduser")) l++;
+  else if (!egg_strcasecmp(cmd, "channel")) l++;
+  else if (!egg_strcasecmp(cmd, "deluser")) l++;
+  else if (!egg_strcasecmp(cmd, "deop")) l++;
+  else if (!egg_strcasecmp(cmd, "devoice")) l++;
+  else if (!egg_strcasecmp(cmd, "getkey")) l++;
+  else if (!egg_strcasecmp(cmd, "find")) l++;
+  else if (!egg_strcasecmp(cmd, "invite")) l++;
+  else if (!egg_strcasecmp(cmd, "kick")) l++;
+  else if (!egg_strcasecmp(cmd, "kickban")) l++;
+  else if (!egg_strcasecmp(cmd, "mdop")) l++;
+  else if (!egg_strcasecmp(cmd, "msg")) l++;
+  else if (!egg_strcasecmp(cmd, "reset")) l++;
+  else if (!egg_strcasecmp(cmd, "resetbans")) l++;
+  else if (!egg_strcasecmp(cmd, "resetexempts")) l++;
+  else if (!egg_strcasecmp(cmd, "resetinvites")) l++;
+  else if (!egg_strcasecmp(cmd, "say")) l++;
+  else if (!egg_strcasecmp(cmd, "topic")) l++;
+  else if (!egg_strcasecmp(cmd, "voice")) l++;
+  else if (!egg_strcasecmp(cmd, "clearqueue")) l++;
+  else if (!egg_strcasecmp(cmd, "dump")) l++;
+  else if (!egg_strcasecmp(cmd, "jump")) l++;
+  else if (!egg_strcasecmp(cmd, "servers")) l++;
+  else if (!egg_strcasecmp(cmd, "authed")) l++;
 
   if (!l) {
     for (hm = H_dcc->first; hm; hm = hm->next)
-      if (!strcasecmp2(cmd, hm->mask))
+      if (!egg_strcasecmp(cmd, hm->mask))
         break;
     if (!hm) {
       dprintf(idx, STR("No such DCC command\n"));
@@ -684,7 +684,7 @@ static void cmd_downbots(struct userrec *u, int idx, char *par)
   putlog(LOG_CMDS, "*", STR("#%s# downbots"), dcc[idx].nick);
   for (u2 = userlist; u2; u2 = u2->next) {
     if (u2->flags & USER_BOT) {
-      if (strcasecmp(u2->handle, botnetnick)) {
+      if (egg_strcasecmp(u2->handle, botnetnick)) {
         if (nextbot(u2->handle) == -1) {
           strcat(work, u2->handle);
           cnt++;
@@ -753,7 +753,7 @@ Context;
   for (o = 0; o < cmdi; o++) {
     if (!flagrec_ok(&cmds[o].flags, &fr))
       continue;
-    if (!showall && !strcasecmp(par, cmds[o].name)) {
+    if (!showall && !egg_strcasecmp(par, cmds[o].name)) {
       fnd = 1;
       build_flags(flg, &(cmds[o].flags), NULL);
       dprintf(idx, STR("### %s (required flags: %s)\n"), cmds[o].name, flg);

+ 681 - 0
src/config.c

@@ -0,0 +1,681 @@
+/*
+ * config.c -- handles:
+ *   botnet config
+ *   cmdpass functions
+ */
+
+#include "main.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "chan.h"
+#include "tandem.h"
+#include "modules.h"
+#include <net/if.h>
+/* not needed?
+#include <sys/ioctl.h> 
+#include <signal.h>
+*/
+
+#include "stat.h"
+#include "bg.h"
+
+extern char			botnetnick[];
+extern struct userrec *userlist;
+extern time_t		 now;
+
+#ifdef S_AUTH
+char authkey[121];		/* This is one of the keys used in the auth hash */
+#endif /* S_AUTH */
+
+char cmdprefix[1] = "+";	/* This is the prefix for msg/channel cmds */
+
+struct cfg_entry CFG_MOTD = {
+  "motd", CFGF_GLOBAL, NULL, NULL,
+  NULL, NULL, NULL
+};
+
+#ifdef S_AUTH
+void authkey_describe(struct cfg_entry * entry, int idx) {
+  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) {
+  if (entry->ldata) {
+    strncpy0(authkey, (char *) entry->ldata, sizeof authkey);
+  } else if (entry->gdata) {
+    strncpy0(authkey, (char *) entry->gdata, sizeof authkey);
+  }
+}
+
+struct cfg_entry CFG_AUTHKEY = {
+  "authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  authkey_changed, authkey_changed, authkey_describe
+};
+#endif /* S_AUTH */
+
+void cmdprefix_describe(struct cfg_entry *entry, int idx) {
+  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) {
+  if (entry->ldata) {
+    strncpy0(cmdprefix, (char *) entry->ldata, sizeof cmdprefix);
+  } else if (entry->gdata) {
+    strncpy0(cmdprefix, (char *) entry->gdata, sizeof cmdprefix);
+  }
+}
+
+struct cfg_entry CFG_CMDPREFIX = {
+  "cmdprefix", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  cmdprefix_changed, cmdprefix_changed, cmdprefix_describe
+};
+
+void misc_describe(struct cfg_entry *cfgent, int idx)
+{
+  int i = 0;
+
+  if (!strcmp(cfgent->name, STR("fork-interval"))) {
+    dprintf(idx, STR("fork-interval is number of seconds in between each fork() call made by the bot, to change process ID and reset cpu usage counters.\n"));
+    i = 1;
+#ifdef S_LASTCHECK
+  } else if (!strcmp(cfgent->name, STR("login"))) {
+    dprintf(idx, STR("login sets how to handle someone logging in to the shell\n"));
+#endif /* S_LASTCHECK */
+#ifdef S_ANTITRACE
+  } else if (!strcmp(cfgent->name, STR("trace"))) {
+    dprintf(idx, STR("trace sets how to handle someone tracing/debugging the bot\n"));
+#endif /* S_ANTITRACE */
+#ifdef S_PROMISC
+  } else if (!strcmp(cfgent->name, STR("promisc"))) {
+    dprintf(idx, STR("promisc sets how to handle when a interface is set to promiscuous mode\n"));
+#endif /* S_PROMISC */
+#ifdef S_PROCESSCHECK
+  } else if (!strcmp(cfgent->name, STR("bad-process"))) {
+    dprintf(idx, STR("bad-process sets how to handle when a running process not listed in process-list is detected\n"));
+  } else if (!strcmp(cfgent->name, STR("process-list"))) {
+    dprintf(idx, STR("process-list is a comma-separated list of \"expected processes\" running on the bots uid\n"));
+    i = 1;
+#endif /* S_PROCESSCHECK */
+#ifdef S_HIJACKCHECK
+  } else if (!strcmp(cfgent->name, STR("hijack"))) {
+    dprintf(idx, STR("hijack sets how to handle when a commonly used hijack method attempt is detected. (recommended: die)\n"));
+#endif /* S_HIJACKCHECK */
+  }
+  if (!i)
+    dprintf(idx, STR("Valid settings are: nocheck, ignore, warn, die, reject, suicide\n"));
+}
+
+void fork_lchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
+  if (!cfgent->ldata)
+    return;
+  if (atoi(cfgent->ldata)<=0)
+    *valid=0;
+}
+
+void fork_gchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
+  if (!cfgent->gdata)
+    return;
+  if (atoi(cfgent->gdata)<=0)
+    *valid=0;
+}
+
+void fork_describe(struct cfg_entry * cfgent, int idx) {
+  dprintf(idx, STR("fork-interval is number of seconds in between each fork() call made by the bot, to change process ID and reset cpu usage counters.\n"));
+}
+
+struct cfg_entry CFG_FORKINTERVAL = {
+  "fork-interval", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  fork_gchanged, fork_lchanged, fork_describe
+};
+
+void detect_lchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
+  char * p = cfgent->ldata;
+  if (!p)
+    *valid=1;
+  else if (strcmp(p, STR("ignore")) && strcmp(p, STR("die")) && strcmp(p, STR("reject"))
+           && strcmp(p, STR("suicide")) && strcmp(p, STR("nocheck")) && strcmp(p, STR("warn")))
+    *valid=0;
+}
+
+void detect_gchanged(struct cfg_entry * cfgent, char * oldval, int * valid) {
+  char * p = (char *) cfgent->ldata;
+  if (!p)
+    *valid=1;
+  else if (strcmp(p, STR("ignore")) && strcmp(p, STR("die")) && strcmp(p, STR("reject"))
+           && strcmp(p, STR("suicide")) && strcmp(p, STR("nocheck")) && strcmp(p, STR("warn")))
+    *valid=0;
+}
+
+#ifdef S_LASTCHECK
+struct cfg_entry CFG_LOGIN = {
+  "login", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  detect_gchanged, detect_lchanged, misc_describe
+};
+#endif /* S_LASTCHECK */
+#ifdef S_HIJACKCHECK
+struct cfg_entry CFG_HIJACK = {
+  "hijack", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  detect_gchanged, detect_lchanged, misc_describe
+};
+#endif /* S_HIJACKCHECK */
+#ifdef S_ANTITRACE
+struct cfg_entry CFG_TRACE = {
+  "trace", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  detect_gchanged, detect_lchanged, misc_describe
+};
+#endif /* S_ANTITRACE */
+#ifdef S_PROMISC
+struct cfg_entry CFG_PROMISC = {
+  "promisc", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  detect_gchanged, detect_lchanged, misc_describe
+};
+#endif /* S_PROMISC */
+#ifdef S_PROCESSCHECK
+struct cfg_entry CFG_BADPROCESS = {
+  "bad-process", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  detect_gchanged, detect_lchanged, misc_describe
+};
+
+struct cfg_entry CFG_PROCESSLIST = {
+  "process-list", CFGF_GLOBAL | CFGF_LOCAL, NULL, NULL,
+  NULL, NULL, misc_describe
+};
+#endif /* S_PROCESSCHECK */
+
+#ifdef S_DCCPASS
+struct cmd_pass *cmdpass = NULL;
+#endif
+
+/* this is cfg shit from servers/irc/ctcp because hub doesnt load
+ * these mods */
+#ifdef HUB
+void servers_describe(struct cfg_entry * entry, int idx) {
+  dprintf(idx, STR("servers is a comma-separated list of servers the bot will use\n"));
+}
+void servers_changed(struct cfg_entry * entry, char * olddata, int * valid) {
+}
+void servers6_describe(struct cfg_entry * entry, int idx) {
+  dprintf(idx, STR("servers6 is a comma-separated list of servers the bot will use (FOR IPv6)\n"));
+}
+void servers6_changed(struct cfg_entry * entry, char * olddata, int * valid) {
+}
+void nick_describe(struct cfg_entry * entry, int idx) {
+  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) {
+}
+void realname_describe(struct cfg_entry * entry, int idx) {
+  dprintf(idx, STR("realname is the bots \"real name\" when connecting\n"));
+}
+
+void realname_changed(struct cfg_entry * entry, char * olddata, int * valid) {
+}
+struct cfg_entry CFG_SERVERS = {
+  "servers", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  servers_changed, servers_changed, servers_describe
+};
+struct cfg_entry CFG_SERVERS6 = {
+  "servers6", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  servers6_changed, servers6_changed, servers6_describe
+};
+
+struct cfg_entry CFG_NICK = {
+  "nick", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  nick_changed, nick_changed, nick_describe
+};
+
+struct cfg_entry CFG_REALNAME = {
+  "realname", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
+  realname_changed, realname_changed, realname_describe
+};
+
+void getin_describe(struct cfg_entry *cfgent, int idx)
+{
+  if (!strcmp(cfgent->name, STR("op-bots")))
+    dprintf(idx, STR("op-bots is number of bots to ask every time a oprequest is to be made\n"));
+  else if (!strcmp(cfgent->name, STR("in-bots")))
+    dprintf(idx, STR("in-bots is number of bots to ask every time a inrequest is to be made\n"));
+  else if (!strcmp(cfgent->name, STR("op-requests")))
+    dprintf(idx, STR("op-requests (requests:seconds) limits how often the bot will ask for ops\n"));
+  else if (!strcmp(cfgent->name, STR("lag-threshold")))
+    dprintf(idx, STR("lag-threshold is maximum acceptable server lag for the bot to send/honor requests\n"));
+  else if (!strcmp(cfgent->name, STR("op-time-slack")))
+    dprintf(idx, STR("op-time-slack is number of seconds a opcookies encoded time value can be off from the bots current time\n"));
+  else if (!strcmp(cfgent->name, STR("lock-threshold")))
+    dprintf(idx, STR("Format H:L. When at least H hubs but L or less leafs are linked, lock all channels\n"));
+  else if (!strcmp(cfgent->name, STR("kill-threshold")))
+    dprintf(idx, STR("When more than kill-threshold bots have been killed/k-lined the last minute, channels are locked\n"));
+  else if (!strcmp(cfgent->name, STR("fight-threshold")))
+    dprintf(idx, STR("When more than fight-threshold ops/deops/kicks/bans/unbans altogether have happened on a channel in one minute, the channel is locked\n"));
+  else {
+    dprintf(idx, STR("No description for %s ???\n"), cfgent->name);
+    putlog(LOG_ERRORS, "*", STR("getin_describe() called with unknown config entry %s"), cfgent->name);
+  }
+}
+
+void getin_changed(struct cfg_entry *cfgent, char *oldval, int *valid)
+{
+  int i;
+
+  if (!cfgent->gdata)
+    return;
+  *valid = 0;
+  if (!strcmp(cfgent->name, STR("op-requests"))) {
+    int L,
+      R;
+    char *value = cfgent->gdata;
+
+    L = atoi(value);
+    value = strchr(value, ':');
+    if (!value)
+      return;
+    value++;
+    R = atoi(value);
+    if ((R >= 60) || (R <= 3) || (L < 1) || (L > R))
+      return;
+    *valid = 1;
+    return;
+  }
+  if (!strcmp(cfgent->name, STR("lock-threshold"))) {
+    int L,
+      R;
+    char *value = cfgent->gdata;
+
+    L = atoi(value);
+    value = strchr(value, ':');
+    if (!value)
+      return;
+    value++;
+    R = atoi(value);
+    if ((R >= 1000) || (R < 0) || (L < 0) || (L > 100))
+      return;
+    *valid = 1;
+    return;
+  }
+  i = atoi(cfgent->gdata);
+  if (!strcmp(cfgent->name, STR("op-bots"))) {
+    if ((i < 1) || (i > 10))
+      return;
+  } else if (!strcmp(cfgent->name, STR("invite-bots"))) {
+    if ((i < 1) || (i > 10))
+      return;
+  } else if (!strcmp(cfgent->name, STR("key-bots"))) {
+    if ((i < 1) || (i > 10))
+      return;
+  } else if (!strcmp(cfgent->name, STR("limit-bots"))) {
+    if ((i < 1) || (i > 10))
+      return;
+  } else if (!strcmp(cfgent->name, STR("unban-bots"))) {
+    if ((i < 1) || (i > 10))
+      return;
+  } else if (!strcmp(cfgent->name, STR("lag-threshold"))) {
+    if ((i < 3) || (i > 60))
+      return;
+  } else if (!strcmp(cfgent->name, STR("fight-threshold"))) {
+    if (i && ((i < 50) || (i > 1000)))
+      return;
+  } else if (!strcmp(cfgent->name, STR("kill-threshold"))) {
+    if ((i < 0) || (i >= 200))
+      return;
+  } else if (!strcmp(cfgent->name, STR("op-time-slack"))) {
+    if ((i < 30) || (i > 1200))
+      return;
+  }
+  *valid = 1;
+  return;
+}
+
+struct cfg_entry CFG_OPBOTS = {
+  "op-bots", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_INBOTS = {
+  "in-bots", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_LAGTHRESHOLD = {
+  "lag-threshold", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_OPREQUESTS = {
+  "op-requests", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_OPTIMESLACK = {
+  "op-time-slack", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+#ifdef G_AUTOLOCK
+struct cfg_entry CFG_LOCKTHRESHOLD = {
+  "lock-threshold", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_KILLTHRESHOLD = {
+  "kill-threshold", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+
+struct cfg_entry CFG_FIGHTTHRESHOLD = {
+  "fight-threshold", CFGF_GLOBAL, NULL, NULL,
+  getin_changed, NULL, getin_describe
+};
+#endif /* G_AUTOLOCK */
+#endif /* HUB */
+
+int cfg_count=0;
+struct cfg_entry ** cfg = NULL;
+int cfg_noshare=0;
+
+/* Expected memory usage
+ */
+int expmem_config()
+{
+#ifdef S_DCCPASS
+  struct cmd_pass *cp = NULL;
+#endif /* S_DCCPASS */
+
+  int tot = 0, i;
+
+  for (i=0;i<cfg_count;i++) {
+    tot += sizeof(void *);
+    if (cfg[i]->gdata)
+      tot += strlen(cfg[i]->gdata) + 1;
+    if (cfg[i]->ldata)
+      tot += strlen(cfg[i]->ldata) + 1;
+  }
+#ifdef S_DCCPASS
+  for (cp=cmdpass;cp;cp=cp->next) {
+    tot += sizeof(struct cmd_pass) + strlen(cp->name)+1;
+  }
+#endif /* S_DCCPASS */
+  return tot;
+}
+
+void init_config()
+{
+#ifdef S_AUTH
+  add_cfg(&CFG_AUTHKEY);
+#endif /* S_AUTH */
+  add_cfg(&CFG_MOTD);
+  add_cfg(&CFG_FORKINTERVAL);
+#ifdef S_LASTCHECK
+  add_cfg(&CFG_LOGIN);
+#endif /* S_LASTCHECK */
+#ifdef S_HIJACKCHECK
+  add_cfg(&CFG_HIJACK);
+#endif /* S_HIJACKCHECK */
+#ifdef S_ANTITRACE
+  add_cfg(&CFG_TRACE);
+#endif /* S_ANTITRACE */
+#ifdef S_PROMISC
+  add_cfg(&CFG_PROMISC);
+#endif /* S_PROMISC */
+#ifdef S_PROCESSCHECK
+  add_cfg(&CFG_BADPROCESS);
+  add_cfg(&CFG_PROCESSLIST);
+#endif /* S_PROCESSCHECK */
+#ifdef HUB
+  add_cfg(&CFG_NICK);
+  add_cfg(&CFG_SERVERS);
+  add_cfg(&CFG_SERVERS6);
+  add_cfg(&CFG_REALNAME);
+  set_cfg_str(NULL, STR("realname"), "A deranged product of evil coders");
+  add_cfg(&CFG_OPBOTS);
+  add_cfg(&CFG_INBOTS);
+  add_cfg(&CFG_LAGTHRESHOLD);
+  add_cfg(&CFG_OPREQUESTS);
+  add_cfg(&CFG_OPTIMESLACK);
+#ifdef G_AUTOLOCK
+  add_cfg(&CFG_LOCKTHRESHOLD);
+  add_cfg(&CFG_KILLTHRESHOLD);
+  add_cfg(&CFG_FIGHTTHRESHOLD);
+#endif /* G_AUTOLOCK */
+#endif /* HUB */
+}
+
+#ifdef S_DCCPASS
+int check_cmd_pass(char *cmd, char *pass)
+{
+  struct cmd_pass *cp;
+
+  for (cp = cmdpass; cp; cp = cp->next)
+    if (!egg_strcasecmp(cmd, cp->name)) {
+      char tmp[32];
+
+      encrypt_pass(pass, tmp);
+      if (!strcmp(tmp, cp->pass))
+        return 1;
+      return 0;
+    }
+  return 0;
+}
+
+int has_cmd_pass(char *cmd) 
+{
+  struct cmd_pass *cp;
+
+  for (cp = cmdpass; cp; cp = cp->next)
+    if (!egg_strcasecmp(cmd, cp->name))
+      return 1;
+  return 0;
+}
+
+void set_cmd_pass(char *ln, int shareit) {
+  struct cmd_pass *cp;
+  char *cmd;
+
+  cmd = newsplit(&ln);
+  for (cp = cmdpass; cp; cp = cp->next)
+    if (!strcmp(cmd, cp->name))
+      break;
+  if (cp)
+    if (ln[0]) {
+      /* change */
+      strcpy(cp->pass, ln);
+      if (shareit)
+        botnet_send_cmdpass(-1, cp->name, cp->pass);
+    } else {
+      if (cp == cmdpass)
+        cmdpass = cp->next;
+      else {
+        struct cmd_pass *cp2;
+
+        cp2 = cmdpass;
+        while (cp2->next != cp)
+          cp2 = cp2->next;
+        cp2->next = cp->next;
+      }
+      if (shareit)
+        botnet_send_cmdpass(-1, cp->name, "");
+      nfree(cp->name);
+      nfree(cp);
+  } else if (ln[0]) {
+    /* create */
+    cp = nmalloc(sizeof(struct cmd_pass));
+    cp->next = cmdpass;
+    cmdpass = cp;
+    cp->name = nmalloc(strlen(cmd) + 1);
+    strcpy(cp->name, cmd);
+    strcpy(cp->pass, ln);
+    if (shareit)
+      botnet_send_cmdpass(-1, cp->name, cp->pass);
+  }
+}
+#endif /* S_DCCPAS */
+
+struct cfg_entry *check_can_set_cfg(char *target, char *entryname)
+{
+  int i;
+  struct userrec *u;
+  struct cfg_entry *entry = NULL;
+
+  for (i = 0; i < cfg_count; i++)
+    if (!strcmp(cfg[i]->name, entryname)) {
+      entry = cfg[i];
+      break;
+    }
+  if (!entry)
+    return 0;
+  if (target) {
+    if (!(entry->flags & CFGF_LOCAL))
+      return 0;
+    if (!(u = get_user_by_handle(userlist, target)))
+      return 0;
+    if (!(u->flags & USER_BOT))
+      return 0;
+  } else {
+    if (!(entry->flags & CFGF_GLOBAL))
+      return 0;
+  }
+  return entry;
+}
+
+void set_cfg_str(char *target, char *entryname, char *data)
+{
+  struct cfg_entry *entry;
+  int free = 0;
+
+  if (!(entry = check_can_set_cfg(target, entryname)))
+    return;
+  if (data && !strcmp(data, "-"))
+    data = NULL;
+  if (data && (strlen(data) >= 1024))
+    data[1023] = 0;
+  if (target) {
+    struct userrec *u = get_user_by_handle(userlist, target);
+    struct xtra_key *xk;
+    char *olddata = entry->ldata;
+
+    if (u && !strcmp(botnetnick, u->handle)) {
+      if (data) {
+	entry->ldata = nmalloc(strlen(data) + 1);
+	strcpy(entry->ldata, data);
+      } else
+	entry->ldata = NULL;
+      if (entry->localchanged) {
+	int valid = 1;
+
+	entry->localchanged(entry, olddata, &valid);
+	if (!valid) {
+	  if (entry->ldata)
+	    nfree(entry->ldata);
+	  entry->ldata = olddata;
+	  data = olddata;
+	  olddata = NULL;
+	}
+      }
+    }
+    xk = nmalloc(sizeof(struct xtra_key));
+    egg_bzero(xk, sizeof(struct xtra_key));
+    xk->key = nmalloc(strlen(entry->name) + 1);
+    strcpy(xk->key, entry->name);
+    if (data) {
+      xk->data = nmalloc(strlen(data) + 1);
+      strcpy(xk->data, data);
+    }
+    set_user(&USERENTRY_CONFIG, u, xk);
+    if (olddata)
+      nfree(olddata);
+  } else {
+    char *olddata = entry->gdata;
+
+    if (data) {
+      free = 1;
+      entry->gdata = nmalloc(strlen(data) + 1);
+      strcpy(entry->gdata, data);
+    } else
+      entry->gdata = NULL;
+    if (entry->globalchanged) {
+      int valid = 1;
+
+      entry->globalchanged(entry, olddata, &valid);
+      if (!valid) {
+	if (entry->gdata)
+	  nfree(entry->gdata);
+	entry->gdata = olddata;
+	olddata = NULL;
+      }
+    }
+    if (!cfg_noshare)
+      botnet_send_cfg_broad(-1, entry);
+    if (olddata)
+      nfree(olddata);
+  }
+}
+
+void userfile_cfg_line(char *ln)
+{
+  char *name;
+  int i;
+  struct cfg_entry *cfgent = NULL;
+
+  name = newsplit(&ln);
+  for (i = 0; !cfgent && (i < cfg_count); i++)
+    if (!strcmp(cfg[i]->name, name))
+      cfgent = cfg[i];
+  if (cfgent) {
+    set_cfg_str(NULL, cfgent->name, ln[0] ? ln : NULL);
+  } else
+    putlog(LOG_ERRORS, "*", STR("Unrecognized config entry %s in userfile"), name);
+
+}
+
+void got_config_share(int idx, char *ln)
+{
+  char *name;
+  int i;
+  struct cfg_entry *cfgent = NULL;
+
+  cfg_noshare++;
+  name = newsplit(&ln);
+  for (i = 0; !cfgent && (i < cfg_count); i++)
+    if (!strcmp(cfg[i]->name, name))
+      cfgent = cfg[i];
+  if (cfgent) {
+    set_cfg_str(NULL, cfgent->name, ln[0] ? ln : NULL);
+    botnet_send_cfg_broad(idx, cfgent);
+  } else
+    putlog(LOG_ERRORS, "*", STR("Unrecognized config entry %s in userfile"), name);
+  cfg_noshare--;
+}
+
+void add_cfg(struct cfg_entry *entry)
+{
+  cfg = (void *) user_realloc(cfg, sizeof(void *) * (cfg_count + 1));
+  cfg[cfg_count] = entry;
+  cfg_count++;
+  entry->ldata = NULL;
+  entry->gdata = NULL;
+}
+
+void trigger_cfg_changed()
+{
+  int i;
+  struct userrec *u;
+  struct xtra_key *xk;
+
+  u = get_user_by_handle(userlist, botnetnick);
+
+  for (i = 0; i < cfg_count; i++) {
+    if (cfg[i]->flags & CFGF_LOCAL) {
+      xk = get_user(&USERENTRY_CONFIG, u);
+      while (xk && strcmp(xk->key, cfg[i]->name))
+	xk = xk->next;
+      if (xk) {
+	putlog(LOG_DEBUG, "*", STR("trigger_cfg_changed for %s"), cfg[i]->name ? cfg[i]->name : "(null)");
+	if (!strcmp(cfg[i]->name, xk->key ? xk->key : "")) {
+	  set_cfg_str(botnetnick, cfg[i]->name, xk->data);
+	}
+      }
+    }
+  }
+}
+

+ 70 - 2
src/pcrypt.c → src/crypt.c

@@ -1,6 +1,7 @@
 /*
- * pcrypt.c -- handles:
- * psybnc crypt and lfprintf functions.
+ * crypt.c -- handles:
+ * psybnc crypt() 
+ * File encryption
  *
  */
 
@@ -183,3 +184,70 @@ Context;
   return 0;
 }
 
+void EncryptFile(char *infile, char *outfile)
+{
+  char  buf[8192];
+  FILE *f, *f2 = NULL;
+  int std = 0;
+  if (!strcmp(outfile, "STDOUT"))
+    std = 1;
+  f  = fopen(infile, "r");
+  if(!f)
+    return;
+  if (!std) {
+    f2 = fopen(outfile, "w");
+    if (!f2)
+      return;
+  } else {
+    printf("----------------------------------START----------------------------------\n");
+  }
+
+  while (fscanf(f,"%[^\n]\n",buf) != EOF) {
+    if (std)
+      printf("%s\n", cryptit(encrypt_string(netpass, buf)));
+    else
+      lfprintf(f2, "%s\n", buf);
+  }
+  if (std)
+    printf("-----------------------------------ENF-----------------------------------\n");
+
+  fclose(f);
+  if (f2)
+    fclose(f2);
+}
+
+void DecryptFile(char *infile, char *outfile)
+{
+  char  buf[8192], *temps;
+  FILE *f, *f2 = NULL;
+  int std = 0;
+
+  if (!strcmp(outfile, "STDOUT"))
+    std = 1;
+  f  = fopen(infile, "r");
+  if (!f)
+    return;
+  if (!std) {
+    f2 = fopen(outfile, "w");
+    if (!f2)
+      return;
+  } else {
+    printf("----------------------------------START----------------------------------\n");
+  }
+
+  while (fscanf(f,"%[^\n]\n",buf) != EOF) {
+    temps = (char *) decrypt_string(netpass, decryptit(buf));
+    if (!std)
+      fprintf(f2, "%s\n",temps);
+    else
+      printf("%s\n", temps);
+    nfree(temps);
+  }
+  if (std)
+    printf("-----------------------------------END-----------------------------------\n");
+
+  fclose(f);
+  if (f2)
+    fclose(f2);
+}
+

+ 12 - 6
src/dcc.c

@@ -397,7 +397,7 @@ static void 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 (!strcasecmp(code, "elink")) {
+  } else if (!egg_strcasecmp(code, "elink")) {
     int snum = -1;
     putlog(LOG_DEBUG, "*", "Got elink: %s %s", code, buf);
     /* Set the socket key and we're linked */
@@ -422,7 +422,7 @@ static void dcc_bot_new(int idx, char *buf, int x)
       dprintf(idx, "elinkdone\n");
       putlog(LOG_BOTS, "*", "Handshake with %s succeeded, we're linked.", dcc[idx].nick);
     }
-  } else if (!strcasecmp(code, "error")) {
+  } else if (!egg_strcasecmp(code, "error")) {
     putlog(LOG_MISC, "*", "ERROR linking %s: %s", dcc[idx].nick, buf);
     killsock(dcc[idx].sock);
     lostdcc(idx);
@@ -599,6 +599,7 @@ struct dcc_table DCC_FORK_BOT =
 
 static void dcc_chat_secpass(int idx, char *buf, int atr)
 {
+#ifdef S_AUTH
   char check[50];
 
   if (!atr)
@@ -610,6 +611,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
 
   if (!strcmp(check, buf)) {
 //+secpass
+#endif /* S_AUTH */
       putlog(LOG_MISC, "*", DCC_LOGGEDIN, dcc[idx].nick,
 	     dcc[idx].host, dcc[idx].port);
       if (dcc[idx].u.chat->away) {
@@ -624,9 +626,8 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
 	dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
       stats_add(dcc[idx].user, 1, 0);
       dcc_chatter(idx);
-  } else {
-//bad auth!
-
+#ifdef S_AUTH
+  } else {		/* bad auth */
     dprintf(idx, "%s", rand_dccrespbye());
     putlog(LOG_MISC, "*", DCC_BADAUTH, dcc[idx].nick,
 	   dcc[idx].host, dcc[idx].port);
@@ -649,6 +650,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
       lostdcc(idx);
     }
   }
+#endif /* S_AUTH */
 }
 struct dcc_table DCC_CHAT_SECPASS;
 
@@ -661,7 +663,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
 
   /* Check for MD5 digest from remote _bot_. <cybah> */
   if (atr & USER_BOT) {
-    if (!strcasecmp(buf, "elinkdone")) {
+    if (!egg_strcasecmp(buf, "elinkdone")) {
       nfree(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
       dcc[idx].u.bot = get_data_ptr(sizeof(struct bot_info));
@@ -678,6 +680,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     return;
   }
   if (u_pass_match(dcc[idx].user, buf)) {
+#ifdef S_AUTH
     char rand[50];
 
     make_rand_str(rand, 50);
@@ -686,6 +689,9 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     dcc[idx].type = &DCC_CHAT_SECPASS;
     dcc[idx].timeval = now;
     dprintf(idx, "-Auth %s %s\n", rand, botnetnick);
+#else
+    dcc_chat_secpass(idx, buf, atr);
+#endif /* S_AUTH */
   } else {
     dprintf(idx, "%s", rand_dccrespbye());
     putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick,

+ 7 - 5
src/main.c

@@ -198,8 +198,8 @@ void fatal(const char *s, int recoverable)
   }
 }
 
-int expmem_chanprog(), expmem_users(), expmem_misc(), expmem_dccutil(),
- expmem_botnet(), expmem_tcl(), expmem_tclhash(), expmem_net(),
+int expmem_chanprog(), expmem_users(), expmem_config(), expmem_misc(), expmem_dccutil(),
+ expmem_botnet(), expmem_tcl(), expmem_tclhash(), expmem_net(), expmem_auth(),
  expmem_modules(int), expmem_tcldcc(),
  expmem_tclmisc();
 
@@ -210,9 +210,9 @@ int expected_memory(void)
 {
   int tot;
 
-  tot = expmem_chanprog() + expmem_users() + expmem_misc() +
+  tot = expmem_chanprog() + expmem_users() + expmem_config() + expmem_misc() +
     expmem_dccutil() + expmem_botnet() + expmem_tcl() + expmem_tclhash() +
-    expmem_net() + expmem_modules(0) + expmem_tcldcc() +
+    expmem_net() + expmem_modules(0) + expmem_tcldcc() + expmem_auth() +
     expmem_tclmisc();
   return tot;
 }
@@ -947,7 +947,7 @@ void restart_chons();
 void check_static(char *, char *(*)());
 
 #include "mod/static.h"
-int init_userrec(), init_mem(), init_dcc_max(), init_userent(), init_misc(), init_bots(),
+int init_userrec(), init_mem(), init_dcc_max(), init_userent(), init_misc(), init_auth(), init_config(), init_bots(),
  init_net(), init_modules(), init_tcl(int, char **), init_botcmd();
 
 void got_ed(char *which, char *in, char *out)
@@ -1510,6 +1510,8 @@ int main(int argc, char **argv)
   init_dcc_max();
   init_userent();
   init_misc();
+  init_auth();
+  init_config();
   init_bots();
   init_net();
   init_modules();

+ 15 - 1
src/mem.c

@@ -46,6 +46,8 @@ int expmem_tclhash();
 int expmem_tclmisc();
 int expmem_net();
 int expmem_modules();
+int expmem_config();
+int expmem_auth();
 int expmem_language() 
 {
   return 0;
@@ -103,7 +105,7 @@ void tell_mem_status_dcc(int idx)
 void debug_mem_to_dcc(int idx)
 {
 #ifdef DEBUG_MEM
-#define MAX_MEM 13
+#define MAX_MEM 15
   unsigned long exp[MAX_MEM], use[MAX_MEM], l;
   int i, j;
   char fn[20], sofar[81];
@@ -123,6 +125,8 @@ void debug_mem_to_dcc(int idx)
   exp[10] = expmem_modules(1);
   exp[11] = expmem_tcldcc();
   exp[12] = expmem_dns();
+  exp[13] = expmem_config();
+  exp[14] = expmem_auth();
   for (me = module_list; me; me = me->next)
     me->mem_work = 0;
   for (i = 0; i < MAX_MEM; i++)
@@ -159,6 +163,10 @@ void debug_mem_to_dcc(int idx)
       use[11] += l;
     else if (!strcmp(fn, "xdns.c"))
       use[12] += l;
+    else if (!strcmp(fn, "xconfig.c"))
+      use[13] += l;
+    else if (!strcmp(fn, "xauth.c"))
+      use[14] += l;
     else if (p) {
       for (me = module_list; me; me = me->next)
 	if (!strcmp(fn, me->name))
@@ -207,6 +215,12 @@ void debug_mem_to_dcc(int idx)
     case 12:
       strcpy(fn, "xdns.c");
       break;
+    case 13:
+      strcpy(fn, "xconfig.c");
+      break;
+    case 14:
+      strcpy(fn, "xauth.c");
+      break;
     }
     if (use[i] == exp[i]) {
       dprintf(idx, STR("File '%-10s' accounted for %lu/%lu (ok)\n"), fn, exp[i],

Fișier diff suprimat deoarece este prea mare
+ 30 - 829
src/misc.c


+ 24 - 24
src/mod/ctcp.mod/ctcp.c

@@ -577,7 +577,7 @@ static int ctcp_INVITE_UNBAN(char *nick, char *uhost, char *handle, char *object
       *p = 0;
     while (chan) {
       if (chan->status & CHAN_ACTIVE) {
-        if (!strcasecmp(chan->name, chname)) {
+        if (!egg_strcasecmp(chan->name, chname)) {
           dprintf(DP_HELP, STR("NOTICE %s :\002BitchX\002: Access Denied\n"), nick);
           return 0;
         }
@@ -608,51 +608,51 @@ static int ctcp_CLIENTINFO(char *nick, char *uhost, char *handle, char *object,
 
   if (!msg[0]) {
     strcpy(text, STR("SED UTC ACTION DCC CDCC BDCC XDCC VERSION CLIENTINFO USERINFO ERRMSG FINGER TIME PING ECHO INVITE WHOAMI OP OPS UNBAN IDENT XLINK UPTIME :Use CLIENTINFO <COMMAND> to get more specific information"));
-  } else if (!strcasecmp(msg, STR("UNBAN")))
+  } else if (!egg_strcasecmp(msg, STR("UNBAN")))
     strcpy(text, STR("UNBAN unbans the person from channel"));
-  else if (!strcasecmp(msg, STR("OPS")))
+  else if (!egg_strcasecmp(msg, STR("OPS")))
     strcpy(text, STR("OPS ops the person if on userlist"));
-  else if (!strcasecmp(msg, STR("ECHO")))
+  else if (!egg_strcasecmp(msg, STR("ECHO")))
     strcpy(text, STR("ECHO returns the arguments it receives"));
-  else if (!strcasecmp(msg, STR("WHOAMI")))
+  else if (!egg_strcasecmp(msg, STR("WHOAMI")))
     strcpy(text, STR("WHOAMI user list information"));
-  else if (!strcasecmp(msg, STR("INVITE")))
+  else if (!egg_strcasecmp(msg, STR("INVITE")))
     strcpy(text, STR("INVITE invite to channel specified"));
-  else if (!strcasecmp(msg, STR("PING")))
+  else if (!egg_strcasecmp(msg, STR("PING")))
     strcpy(text, STR("PING returns the arguments it receives"));
-  else if (!strcasecmp(msg, STR("UTC")))
+  else if (!egg_strcasecmp(msg, STR("UTC")))
     strcpy(text, STR("UTC substitutes the local timezone"));
-  else if (!strcasecmp(msg, STR("XDCC")))
+  else if (!egg_strcasecmp(msg, STR("XDCC")))
     strcpy(text, STR("XDCC checks cdcc info for you"));
-  else if (!strcasecmp(msg, STR("BDCC")))
+  else if (!egg_strcasecmp(msg, STR("BDCC")))
     strcpy(text, STR("BDCC checks cdcc info for you"));
-  else if (!strcasecmp(msg, STR("CDCC")))
+  else if (!egg_strcasecmp(msg, STR("CDCC")))
     strcpy(text, STR("CDCC checks cdcc info for you"));
-  else if (!strcasecmp(msg, STR("DCC")))
+  else if (!egg_strcasecmp(msg, STR("DCC")))
     strcpy(text, STR("DCC requests a direct_client_connection"));
-  else if (!strcasecmp(msg, STR("ACTION")))
+  else if (!egg_strcasecmp(msg, STR("ACTION")))
     strcpy(text, STR("ACTION contains action descriptions for atmosphere"));
-  else if (!strcasecmp(msg, STR("FINGER")))
+  else if (!egg_strcasecmp(msg, STR("FINGER")))
     strcpy(text, STR("FINGER shows real name, login name and idle time of user"));
-  else if (!strcasecmp(msg, STR("ERRMSG")))
+  else if (!egg_strcasecmp(msg, STR("ERRMSG")))
     strcpy(text, STR("ERRMSG returns error messages"));
-  else if (!strcasecmp(msg, STR("USERINFO")))
+  else if (!egg_strcasecmp(msg, STR("USERINFO")))
     strcpy(text, STR("USERINFO returns user settable information"));
-  else if (!strcasecmp(msg, STR("CLIENTINFO")))
+  else if (!egg_strcasecmp(msg, STR("CLIENTINFO")))
     strcpy(text, STR("CLIENTINFO gives information about available CTCP commands"));
-  else if (!strcasecmp(msg, STR("SED")))
+  else if (!egg_strcasecmp(msg, STR("SED")))
     strcpy(text, STR("SED contains simple_encrypted_data"));
-  else if (!strcasecmp(msg, "OP"))
+  else if (!egg_strcasecmp(msg, "OP"))
     strcpy(text, STR("OP ops the person if on userlist"));
-  else if (!strcasecmp(msg, STR("VERSION")))
+  else if (!egg_strcasecmp(msg, STR("VERSION")))
     strcpy(text, STR("VERSION shows client type, version and environment"));
-  else if (!strcasecmp(msg, STR("XLINK")))
+  else if (!egg_strcasecmp(msg, STR("XLINK")))
     strcpy(text, STR("XLINK x-filez rule"));
-  else if (!strcasecmp(msg, STR("IDENT")))
+  else if (!egg_strcasecmp(msg, STR("IDENT")))
     strcpy(text, STR("IDENT change userhost of userlist"));
-  else if (!strcasecmp(msg, STR("TIME")))
+  else if (!egg_strcasecmp(msg, STR("TIME")))
     strcpy(text, STR("TIME tells you the time on the user's host"));
-  else if (!strcasecmp(msg, STR("UPTIME")))
+  else if (!egg_strcasecmp(msg, STR("UPTIME")))
     strcpy(text, STR("UPTIME my uptime"));
   else {
     dprintf(DP_HELP, STR("NOTICE %s :\001ERRMSG %s is not a valid function\001\n"), nick, msg);

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

@@ -1090,6 +1090,7 @@ static void cmd_invite(struct userrec *u, int idx, char *par)
 
 }
 
+#ifdef S_AUTH
 static void cmd_authed(struct userrec *u, int idx, char *par)
 {
   int i = 0;
@@ -1100,8 +1101,8 @@ static void cmd_authed(struct userrec *u, int idx, char *par)
   for (i = 0; i < auth_total; i++) {
    dprintf(idx, " %d. %s!%s at %li\n", i, auth[i].nick, auth[i].host, auth[i].authtime);
   }
-
 }
+#endif /* S_AUTH */
 
 static void cmd_channel(struct userrec *u, int idx, char *par)
 {
@@ -1567,7 +1568,9 @@ static dcc_cmd_t irc_dcc[] =
 {
   {"act",		"o|o",	 (Function) cmd_act,		NULL,         NULL},
   {"adduser",		"m|m",	 (Function) cmd_adduser,		NULL,         NULL},
+#ifdef S_AUTH
   {"authed",		"n",	 (Function) cmd_authed,			NULL,         NULL},
+#endif /* S_AUTH */
   {"channel",		"o|o",	 (Function) cmd_channel,		NULL,         NULL},
   {"deluser",		"m|m",	 (Function) cmd_deluser,		NULL,         NULL},
   {"deop",		"o|o",	 (Function) cmd_deop,		NULL,         NULL},

+ 6 - 18
src/mod/irc.mod/irc.c

@@ -88,21 +88,6 @@ static int include_lk = 1;		/* For correct calculation
 #include "msgcmds.c"
 #include "tclirc.c"
 
-
-void expire_auths()
-{
-  int i = 0, idle = 0;
-  if (!ischanhub()) return;
-  for (i = 0; i < auth_total;i++) {
-    if (auth[i].authed) {
-      idle = now - auth[i].atime;
-      if (idle >= 60*60) {
-        removeauth(i);
-      }
-    }
-  }
-}
-
 void makeopline(struct chanset_t *chan, char *nick, char *buf)
 {
   char plaincookie[20],
@@ -1392,6 +1377,7 @@ static int check_tcl_pub(char *nick, char *from, char *chname, char *msg)
   return 1;
 }
 
+#ifdef S_AUTH
 static int check_tcl_pubc(char *cmd, char *nick, char *uhost,
                          struct userrec *u, char *args, char *chan)
 {
@@ -1413,6 +1399,7 @@ static int check_tcl_pubc(char *cmd, char *nick, char *uhost,
   return ((x == BIND_MATCHED) || (x == BIND_EXECUTED) || (x == BIND_EXEC_LOG));
 
 }
+#endif /* S_AUTH */
 
 static void check_tcl_pubm(char *nick, char *from, char *chname, char *msg)
 {
@@ -1705,12 +1692,12 @@ static char *irc_close()
   rem_builtins(H_bot, irc_bot);
   rem_builtins_dcc(H_dcc, irc_dcc);
   rem_builtins(H_msg, C_msg);
+#ifdef S_AUTH
   rem_builtins(H_msgc, C_msgc);
+#endif /* S_AUTH */
   rem_builtins(H_raw, irc_raw);
   rem_tcl_commands(tclchan_cmds);
   del_hook(HOOK_MINUTELY, (Function) check_expired_chanstuff);
-  del_hook(HOOK_MINUTELY, (Function) expire_auths);
-
   del_hook(HOOK_MINUTELY, (Function) check_servers);
   del_hook(HOOK_ADD_MODE, (Function) real_add_mode);
   del_hook(HOOK_IDLE, (Function) flush_modes);
@@ -1920,7 +1907,6 @@ char *irc_start(Function * global_funcs)
     chan->ircnet_status &= ~(CHAN_ASKED_INVITED | CHAN_ASKED_EXEMPTS);
 #endif
   }
-  add_hook(HOOK_MINUTELY, (Function) expire_auths);
   add_hook(HOOK_MINUTELY, (Function) check_expired_chanstuff);
   add_hook(HOOK_MINUTELY, (Function) check_servers);
   add_hook(HOOK_ADD_MODE, (Function) real_add_mode);
@@ -1940,7 +1926,9 @@ char *irc_start(Function * global_funcs)
   add_builtins(H_bot, irc_bot);
   add_builtins_dcc(H_dcc, irc_dcc);
   add_builtins(H_msg, C_msg);
+#ifdef S_AUTH
   add_builtins(H_msgc, C_msgc);
+#endif /* S_AUTH */
   add_builtins(H_raw, irc_raw);
   add_tcl_commands(tclchan_cmds);
   H_topc = add_bind_table("topc", HT_STACKABLE, channels_5char);

+ 2 - 0
src/mod/irc.mod/irc.h

@@ -29,7 +29,9 @@ static void check_tcl_signtopcnick(char *, char *, struct userrec *u, char *,
 				   char *, p_tcl_bind_list);
 static void check_tcl_pubm(char *, char *, char *, char *);
 static int check_tcl_pub(char *, char *, char *, char *);
+#ifdef S_AUTH
 static int check_tcl_pubc(char *, char *, char *, struct userrec *, char *, char *);
+#endif /* S_AUTH */
 static void makeopline(struct chanset_t *, char *, char *);
 static int me_op(struct chanset_t *);
 static int me_voice(struct chanset_t *);

+ 7 - 5
src/mod/irc.mod/msgcmds.c

@@ -108,7 +108,7 @@ static int msg_ident(char *nick, char *host, struct userrec *u, char *par)
   return 1;
 }
 
-//move all the above shit to misc.c with proto.h additions.
+#ifdef S_AUTH
 static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 {
   int i = 0;
@@ -242,6 +242,7 @@ static int msg_unauth(char *nick, char *host, struct userrec *u, char *par)
 
   return 1;
 }
+#endif /* S_AUTH */
 
 static int msg_op(char *nick, char *host, struct userrec *u, char *par)
 {
@@ -457,10 +458,12 @@ static int msg_invite(char *nick, char *host, struct userrec *u, char *par)
 
 static cmd_t C_msg[] =
 {
+#ifdef S_AUTH
   {"auth?",		"",	(Function) msg_authstart,	NULL},
   {"auth",		"",	(Function) msg_auth,		NULL},
   {"+auth",		"",	(Function) msg_pls_auth,	NULL},
   {"unauth",		"",	(Function) msg_unauth,		NULL},
+#endif /* S_AUTH */
   {"word",		"",	(Function) msg_word,		NULL},
   {"ident",		"",	(Function) msg_ident,		NULL},
   {"invite",		"o|o",	(Function) msg_invite,		NULL},
@@ -471,6 +474,7 @@ static cmd_t C_msg[] =
   {NULL,		NULL,	NULL,				NULL}
 };
 
+#ifdef S_AUTH
 static int msgc_test(char *nick, char *host, struct userrec *u, char *par, char *chname)
 {
   dprintf(DP_HELP, "NOTICE %s :Works :)\n", nick);
@@ -614,8 +618,6 @@ static int msgc_channels(char *nick, char *host, struct userrec *u, char *par, c
   return 1;
 }
 
-
-
 static int msgc_getkey(char *nick, char *host, struct userrec *u, char *par, char *chname)
 {
   struct chanset_t *chan = NULL;
@@ -727,5 +729,5 @@ static cmd_t C_msgc[] =
   {"help",		"",	(Function) msgc_help,		NULL},
   {NULL,		NULL,	NULL,				NULL}
 };
-
-#endif
+#endif /* S_AUTH */
+#endif /* LEAF */

+ 4 - 0
src/mod/module.h

@@ -515,6 +515,7 @@
 /* 313 - 316 */
 #define dcc_prefix ((char *)(global[313]))
 #define goodpass ((int (*)(char *, int, char *))global[314])
+#ifdef S_AUTH
 #define auth (*(struct auth_t **)global[315])
 #define auth_total (*(int*)global[316])
 /* 317 - 320 */
@@ -523,8 +524,11 @@
 #define removeauth ((void (*)(int))global[319])
 #define makehash ((char *(*)(struct userrec *, char *))global[320])
 /* 321 - 324 */
+#endif /* S_AUTH */
 #define USERENTRY_SECPASS (*(struct user_entry_type *)(global[321]))
+#ifdef S_AUTH
 #define authkey ((char *)(global[322]))
+#endif /* S_AUTH */
 #define myip ((char *)(global[323]))
 #define myip6 ((char *)(global[324]))
 /* 325 - 328 */

+ 10 - 1
src/mod/server.mod/server.c

@@ -80,8 +80,11 @@ static int kick_method;
 static int optimize_kicks;
 
 
-static p_tcl_bind_list H_wall, H_raw, H_notc, H_msgc, H_msgm, H_msg, H_flud,
+static p_tcl_bind_list H_wall, H_raw, H_notc, H_msgm, H_msg, H_flud,
 		       H_ctcr, H_ctcp;
+#ifdef S_AUTH
+static p_tcl_bind_list H_msgc;
+#endif /* S_AUTH */
 
 static void empty_msgq(void);
 static void next_server(int *, char *, unsigned int *, char *);
@@ -1291,6 +1294,7 @@ static int server_msg STDVAR
   return TCL_OK;
 }
 
+#ifdef S_AUTH
 static int server_msgc STDVAR
 {
   Function F = (Function) cd;
@@ -1300,6 +1304,7 @@ static int server_msgc STDVAR
   F(argv[1], argv[2], get_user_by_handle(userlist, argv[3]), argv[4], argv[5]);
   return TCL_OK;
 }
+#endif /* S_AUTH */
 
 static int server_raw STDVAR
 {
@@ -2002,7 +2007,9 @@ static Function server_table[] =
   (Function) & curserv,
   (Function) cursrvname,
   (Function) botrealname,
+#ifdef S_AUTH
   (Function) & H_msgc,          /* p_tcl_bind_list */
+#endif /* S_AUTH */
 
 };
 
@@ -2108,7 +2115,9 @@ char *server_start(Function *global_funcs)
   H_raw = add_bind_table("raw", HT_STACKABLE, server_raw);
   H_notc = add_bind_table("notc", HT_STACKABLE, server_5char);
   H_msgm = add_bind_table("msgm", HT_STACKABLE, server_msg);
+#ifdef S_AUTH
   H_msgc = add_bind_table("msgc", 0, server_msgc);
+#endif /* S_AUTH */
   H_msg = add_bind_table("msg", 0, server_msg);
   H_flud = add_bind_table("flud", HT_STACKABLE, server_5char);
   H_ctcr = add_bind_table("ctcr", HT_STACKABLE, server_6char);

+ 2 - 0
src/mod/server.mod/server.h

@@ -59,7 +59,9 @@
 #define curserv (*(int *)(server_funcs[40))
 #define cursrvname ((char *)(server_funcs[41]))
 #define botrealname ((char *)(server_funcs[42]))
+#ifdef S_AUTH
 #define H_msgc (*(p_tcl_bind_list *)(server_funcs[43]))
+#endif /* S_AUTH */
 
 #else		/* MAKING_SERVER */
 

+ 40 - 4
src/mod/server.mod/servmsg.c

@@ -94,6 +94,7 @@ static int check_tcl_msg(char *cmd, char *nick, char *uhost,
   return ((x == BIND_MATCHED) || (x == BIND_EXECUTED) || (x == BIND_EXEC_LOG));
 }
 
+#ifdef S_AUTH
 static int check_tcl_msgc(char *cmd, char *nick, char *uhost,
                          struct userrec *u, char *args)
 {
@@ -114,7 +115,7 @@ static int check_tcl_msgc(char *cmd, char *nick, char *uhost,
            cmd, args);
   return ((x == BIND_MATCHED) || (x == BIND_EXECUTED) || (x == BIND_EXEC_LOG));
 }
-
+#endif /* S_AUTH */
 
 static void check_tcl_notc(char *nick, char *uhost, struct userrec *u,
 	       		   char *dest, char *arg)
@@ -346,8 +347,10 @@ static int detect_flood(char *floodnick, char *floodhost, char *from, int which)
   if (atr & (USER_BOT))
     return 0;
 
+#ifdef S_AUTH
   if (isauthed(floodhost) > -1) 
     return 0;
+#endif /* S_AUTH */
 
   /* Determine how many are necessary to make a flood */
   switch (which) {
@@ -430,7 +433,10 @@ static int gotmsg(char *from, char *msg)
   char *to, buf[UHOSTLEN], *nick, ctcpbuf[512], *uhost = buf, *ctcp;
   char *p, *p1, *code;
   struct userrec *u;
-  int ctcp_count = 0, i;
+  int ctcp_count = 0;
+#ifdef S_AUTH
+  int i = 0;
+#endif /* S_AUTH */
   int ignoring = 0;
 
 
@@ -540,7 +546,7 @@ static int gotmsg(char *from, char *msg)
         last_ctcp = now;
       }
     }
-
+#ifdef S_AUTH
   if (msg[0]) {
     if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
       /* Msg from oper */
@@ -579,6 +585,32 @@ Context;
       }
     }
   }
+#else /* easier to just put an entirely different block of code here */
+  if (msg[0]) {
+    if ((to[0] == '$') || (strchr(to, '.') != NULL)) {
+      /* Msg from oper */
+      if (!ignoring) {
+        detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
+        /* Do not interpret as command */
+        putlog(LOG_MSGS | LOG_SERV, "*", "[%s!%s to %s] %s",
+               nick, uhost, to, msg);
+      }
+    } else {
+      char *code;
+      struct userrec *u;
+
+      detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
+      u = get_user_by_host(from);
+      code = newsplit(&msg);
+      rmspace(msg);
+      if (!ignoring || trigger_on_ignore)
+        check_tcl_msgm(code, nick, uhost, u, msg);
+      if (!ignoring)
+        if (!check_tcl_msg(code, nick, uhost, u, msg))
+          putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
+    }
+  }
+#endif /* S_AUTH */
   return 0;
 }
 
@@ -1014,13 +1046,17 @@ static void disconnect_server(int idx)
 
 static void eof_server(int idx)
 {
-  int i = 0;
   putlog(LOG_SERV, "*", "%s %s", IRC_DISCONNECTED, dcc[idx].host);
+#ifdef S_AUTH
+{
+  int i = 0;
   if (ischanhub() && auth_total > 0) {
     putlog(LOG_DEBUG, "*", "Removing %d auth entries.", auth_total);
     for (i = 0; i < auth_total; i++)
       removeauth(i);  
   }
+}
+#endif /* S_AUTH */
   disconnect_server(idx);
   lostdcc(idx);
 }

+ 22 - 2
src/modules.c

@@ -12,7 +12,9 @@
 #include <ctype.h>
 
 extern struct dcc_t	*dcc;
+#ifdef S_AUTH
 extern struct auth_t    *auth;
+#endif /* S_AUTH */
 
 #include "users.h"
 
@@ -22,8 +24,15 @@ extern char		 tempdir[], botnetnick[], botname[], natip[], cmdprefix[],
 			 hostname[], origbotname[], botuser[], admin[],
 			 userfile[], ver[], notify_new[], kickprefix[], bankickprefix[],
 			 version[], quit_msg[], hostname6[], netpass[], thepass[], dcc_prefix[],
-                         authkey[], myip[], myip6[];
-extern int	 noshare, loading, role, auth_total, dcc_total, egg_numver, userfile_perm,
+#ifdef S_AUTH
+                         authkey[], 
+#endif /* S_AUTH */
+			 myip[], myip6[];
+extern int	 noshare, loading, role, 
+#ifdef S_AUTH
+			 auth_total, 
+#endif /* S_AUTH */
+ 			 dcc_total, egg_numver, userfile_perm,
 			 use_console_r, ignore_time, must_be_owner,
 			 debug_output, default_flags, norestruct, 
 			 max_dcc, share_greet, password_timeout, localhub,
@@ -562,6 +571,7 @@ Function global_table[] =
   (Function) deflag_user,
   (Function) dcc_prefix,
   (Function) goodpass,
+#ifdef S_AUTH
   (Function) & auth, /* struct auth_t *auth */
   (Function) & auth_total,
   (Function) new_auth,
@@ -570,6 +580,16 @@ Function global_table[] =
   (Function) makehash,
   (Function) & USERENTRY_SECPASS,
   (Function) authkey,
+#else
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
+  (Function) 0,
+  (Function) & USERENTRY_SECPASS,
+  (Function) 0,
+#endif /* S_AUTH */
   (Function) myip,
   (Function) myip6,
   (Function) cmdprefix,

+ 23 - 21
src/proto.h

@@ -55,6 +55,8 @@ int base64_to_int(char *);
 char *cryptit (char *);
 char *decryptit (char *);
 int lfprintf(FILE *, char *, ...);
+void EncryptFile(char *, char *);
+void DecryptFile(char *, char *);
 
 /* botnet.c */
 void lower_bot_linked(int idx);
@@ -212,6 +214,26 @@ void debug_mem_to_dcc(int);
 char *progname();
 void init_settings();
 
+/* auth.c */
+int new_auth();
+int isauthed(char *);
+void removeauth(int);
+char *makehash(struct userrec *, char *);
+
+/* config.c */
+void set_cfg_int(char *target, char *entryname, int data);
+void set_cfg_str(char *target, char *entryname, char *data);
+void add_cfg(struct cfg_entry *entry);
+void got_config_share(int idx, char *ln);
+void userfile_cfg_line(char *ln);
+void trigger_cfg_changed();
+void got_config_share (int idx, char * ln);
+#ifdef S_DCCPASS
+int check_cmd_pass(char *,char *);
+int has_cmd_pass(char *);
+void set_cmd_pass(char *, int);
+#endif /* S_DCCPASS */
+
 /* misc.c */
 void werr(int);
 char *werr_tostr(int);
@@ -221,12 +243,8 @@ char *getfullbinname(char *);
 char *replace(char *, char *, char *);
 #ifdef S_GARBLESTRINGS
 char *degarble(int, char *);
-#endif
+#endif /* S_GARBLESTRINGS */
 void detected(int, char *);
-int new_auth();
-int isauthed(char *);
-void removeauth(int);
-char *makehash(struct userrec *, char *);
 int goodpass(char *, int, char *);
 void check_last();
 void check_promisc();
@@ -237,16 +255,7 @@ int isupdatehub();
 int getting_users();
 char *kickreason(int);
 int bot_aggressive_to(struct userrec *);
-void set_cfg_int(char *target, char *entryname, int data);
-void set_cfg_str(char *target, char *entryname, char *data);
-void add_cfg(struct cfg_entry *entry);
-void got_config_share(int idx, char *ln);
-void userfile_cfg_line(char *ln);
-void trigger_cfg_changed();
-void EncryptFile(char *, char *);
-void DecryptFile(char *, char *);
 int updatebin(int, char *, int);
-void got_config_share (int idx, char * ln);
 int shell_exec(char * cmdline, char * input, char ** output, char ** erroutput);
 int prand(int *seed, int range);
 int egg_strcatn(char *dst, const char *src, size_t max);
@@ -274,13 +283,6 @@ char *str_escape(const char *str, const char div, const char mask);
 char *strchr_unescape(char *str, const char div, register const char esc_char);
 void str_unescape(char *str, register const char esc_char);
 void kill_bot(char *, char *);
-int strcasecmp2(char *, char *);
-#ifdef S_DCCPASS
-int check_cmd_pass(char *,char *);
-int has_cmd_pass(char *);
-void set_cmd_pass(char *, int);
-#endif
-
 
 /* net.c */
 #ifdef HAVE_SSL

+ 1 - 1
src/tclhash.c

@@ -835,7 +835,7 @@ int check_tcl_dcc(char *cmd, int idx, char *args)
 #ifdef S_DCCPASS
 
   for (hm = H_dcc->first; hm; hm = hm->next) {
-    if (!strcasecmp(cmd, hm->mask)) {
+    if (!egg_strcasecmp(cmd, hm->mask)) {
       found = 1;
       break;
     }

+ 1 - 1
src/userent.c

@@ -273,7 +273,7 @@ int config_set(struct userrec *u, struct user_entry *e, void *buf)
    *new = buf;
 
   for (curr = e->u.extra; curr; curr = curr->next) {
-    if (curr->key && !strcasecmp(curr->key, new->key)) {
+    if (curr->key && !egg_strcasecmp(curr->key, new->key)) {
       old = curr;
       break;
     }

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff