Quellcode durchsuchen

* Removed define: AUTH, added: AUTHCMDS, AUTHHASH, DCCAUTH, see pack.cfg for details.

svn: 653
Bryan Drewery vor 22 Jahren
Ursprung
Commit
4913ef76f6

+ 1 - 0
autotools/README

@@ -2,4 +2,5 @@ Type 'make' whenever one of these conditions are met:
 
 
 - Any files in autotools/ are modified.
 - Any files in autotools/ are modified.
 - Any Makefiles are added or removed (Editting of includes/depend.m4 required)
 - Any Makefiles are added or removed (Editting of includes/depend.m4 required)
+- Any defines are added/removed from pack/pack.cfg
 
 

+ 3 - 1
config.h.in

@@ -368,9 +368,11 @@
 
 
 /* Defines for pack features */
 /* Defines for pack features */
 #undef S_ANTITRACE
 #undef S_ANTITRACE
-#undef S_AUTH
+#undef S_AUTHCMDS
+#undef S_AUTHHASH
 #undef S_AUTOAWAY
 #undef S_AUTOAWAY
 #undef S_AUTOLOCK
 #undef S_AUTOLOCK
+#undef S_DCCAUTH
 #undef S_DCCPASS
 #undef S_DCCPASS
 #undef S_GARBLESTRINGS
 #undef S_GARBLESTRINGS
 #undef S_HIJACKCHECK
 #undef S_HIJACKCHECK

+ 1 - 1
configure

@@ -1,5 +1,5 @@
 #! /bin/sh
 #! /bin/sh
-# From configure.ac Revision: 1.10 .
+# From configure.ac Revision: 1.11 .
 # Guess values for system-dependent variables and create Makefiles.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 # Generated by GNU Autoconf 2.59.
 #
 #

+ 1 - 0
doc/UPDATES

@@ -24,6 +24,7 @@ This is a summary of ChangeLog basically.
 21.Config option "nocheck" has been removed and is now implied by "ignore".
 21.Config option "nocheck" has been removed and is now implied by "ignore".
 22.Bots now do NOT check for tracing/promisc/login/etc... unless something is SET.
 22.Bots now do NOT check for tracing/promisc/login/etc... unless something is SET.
 23.Removed note ignore commands, ie .+/-noteign .noteigns
 23.Removed note ignore commands, ie .+/-noteign .noteigns
+24.Removed define: AUTH, added: AUTHCMDS, AUTHHASH, DCCAUTH, see pack.cfg for details.
 
 
 1.0.14
 1.0.14
 1.Fixed order of log/info for cmd_whoami.
 1.Fixed order of log/info for cmd_whoami.

+ 3 - 1
pack/pack.cfg.sample

@@ -54,9 +54,11 @@ HUB <God god.net 666 god ~God ~george>
  */
  */
 
 
 + ANTITRACE		This will quit the bot if tracing is detected
 + ANTITRACE		This will quit the bot if tracing is detected
-+ AUTH			Authorization system requiring script for DCC (HIGHLY RECOMMENDED)
++ AUTHCMDS              Enable a special list of cmds to be used after Authing.
++ AUTHHASH              Require a script to AUTH (using hashes)
 + AUTOAWAY		Random autoaway/return on IRC
 + AUTOAWAY		Random autoaway/return on IRC
 - AUTOLOCK		Will lock channels upon certain conditions
 - AUTOLOCK		Will lock channels upon certain conditions
++ DCCAUTH               Require Auth hashing with scripts for dcc party line.
 + DCCPASS		DCC command passwords
 + DCCPASS		DCC command passwords
 + GARBLESTRINGS		Encrypt strings in binary
 + GARBLESTRINGS		Encrypt strings in binary
 + HIJACKCHECK		Checks for a common process hijacker method
 + HIJACKCHECK		Checks for a common process hijacker method

+ 13 - 8
src/auth.c

@@ -34,14 +34,17 @@ extern struct dcc_t		*dcc;
 extern struct chanset_t		*chanset;
 extern struct chanset_t		*chanset;
 extern time_t			 now;
 extern time_t			 now;
 
 
-#ifdef S_AUTH
+
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 extern char 			authkey[];
 extern char 			authkey[];
+#endif /* S_AUTHHASH || S_DCCAUTH */
+#ifdef S_AUTHCMDS
 int 				auth_total = 0;
 int 				auth_total = 0;
 int 				max_auth = 100;
 int 				max_auth = 100;
 struct auth_t 			*auth = 0;
 struct auth_t 			*auth = 0;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 void init_auth_max()
 void init_auth_max()
 {
 {
   if (max_auth < 1)
   if (max_auth < 1)
@@ -65,17 +68,17 @@ static void expire_auths()
     }
     }
   }
   }
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 void init_auth()
 void init_auth()
 {
 {
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   init_auth_max();
   init_auth_max();
   add_hook(HOOK_MINUTELY, (Function) expire_auths);
   add_hook(HOOK_MINUTELY, (Function) expire_auths);
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 }
 }
 
 
-#ifdef S_AUTH
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 char *makehash(struct userrec *u, char *rand)
 char *makehash(struct userrec *u, char *rand)
 {
 {
   char hash[256], *secpass = NULL;
   char hash[256], *secpass = NULL;
@@ -89,7 +92,9 @@ char *makehash(struct userrec *u, char *rand)
 
 
   return md5(hash);
   return md5(hash);
 }
 }
+#endif /* S_AUTHHASH || S_DCCAUTH */
 
 
+#ifdef S_AUTHCMDS
 int new_auth(void)
 int new_auth(void)
 {
 {
   int i = auth_total;
   int i = auth_total;
@@ -130,4 +135,4 @@ void removeauth(int n)
   else
   else
     egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
     egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */

+ 8 - 0
src/auth.h

@@ -3,9 +3,12 @@
 
 
 #include "crypt.h"
 #include "crypt.h"
 
 
+#ifdef S_AUTHCMDS
 struct auth_t {
 struct auth_t {
   struct userrec *user;
   struct userrec *user;
+#ifdef S_AUTHHASH 
   char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
   char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
+#endif /* S_AUTHHASH */
   char nick[NICKLEN];
   char nick[NICKLEN];
   char host[UHOSTLEN];
   char host[UHOSTLEN];
   int authed;
   int authed;
@@ -13,12 +16,17 @@ struct auth_t {
   time_t authtime;       /* what time they authed at */
   time_t authtime;       /* what time they authed at */
   time_t atime;          /* when they last were active */
   time_t atime;          /* when they last were active */
 };
 };
+#endif /* S_AUTHCMDS */
 
 
 #ifndef MAKING_MODS
 #ifndef MAKING_MODS
+# ifdef S_AUTHCMDS
 int new_auth();
 int new_auth();
 int findauth(char *);
 int findauth(char *);
 void removeauth(int);
 void removeauth(int);
+# endif /* S_AUTHCMDS */
+# if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 char *makehash(struct userrec *, char *);
 char *makehash(struct userrec *, char *);
+# endif /* S_AUTHHASH || S_DCCAUTH */
 #endif /* !MAKING_MODS */
 #endif /* !MAKING_MODS */
 
 
 #endif /* !_AUTH_H */
 #endif /* !_AUTH_H */

+ 6 - 6
src/cfg.c

@@ -29,9 +29,9 @@ extern time_t		 	now;
 int 				cfg_count = 0, cfg_noshare = 0;
 int 				cfg_count = 0, cfg_noshare = 0;
 struct cfg_entry 		**cfg = NULL;
 struct cfg_entry 		**cfg = NULL;
 
 
-#ifdef S_AUTH
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 char 				authkey[121];		/* This is one of the keys used in the auth hash */
 char 				authkey[121];		/* This is one of the keys used in the auth hash */
-#endif /* S_AUTH */
+#endif /* S_AUTHHASH || S_DCCAUTH */
 
 
 char 				cmdprefix[1] = "+";	/* This is the prefix for msg/channel cmds */
 char 				cmdprefix[1] = "+";	/* This is the prefix for msg/channel cmds */
 
 
@@ -40,7 +40,7 @@ struct cfg_entry CFG_MOTD = {
   NULL, NULL, NULL
   NULL, NULL, NULL
 };
 };
 
 
-#ifdef S_AUTH
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 void authkey_describe(struct cfg_entry * entry, int idx) {
 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"));
   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"));
 }
 }
@@ -57,7 +57,7 @@ struct cfg_entry CFG_AUTHKEY = {
   "authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
   "authkey", CFGF_LOCAL | CFGF_GLOBAL, NULL, NULL,
   authkey_changed, authkey_changed, authkey_describe
   authkey_changed, authkey_changed, authkey_describe
 };
 };
-#endif /* S_AUTH */
+#endif /* S_AUTHHASH || S_DCCAUTH */
 
 
 #ifdef S_MSGCMDS
 #ifdef S_MSGCMDS
 struct cfg_entry CFG_MSGOP, CFG_MSGPASS, CFG_MSGINVITE, CFG_MSGIDENT;
 struct cfg_entry CFG_MSGOP, CFG_MSGPASS, CFG_MSGINVITE, CFG_MSGIDENT;
@@ -659,9 +659,9 @@ void set_cfg_str(char *target, char *entryname, char *data)
 
 
 void init_config()
 void init_config()
 {
 {
-#ifdef S_AUTH
+#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
   add_cfg(&CFG_AUTHKEY);
   add_cfg(&CFG_AUTHKEY);
-#endif /* S_AUTH */
+#endif /* S_AUTHHASH || S_DCCAUTH */
   add_cfg(&CFG_MOTD);
   add_cfg(&CFG_MOTD);
   add_cfg(&CFG_FORKINTERVAL);
   add_cfg(&CFG_FORKINTERVAL);
 #ifdef S_LASTCHECK
 #ifdef S_LASTCHECK

+ 2 - 2
src/chanprog.c

@@ -703,10 +703,10 @@ int isowner(char *name)
 
 
 int shouldjoin(struct chanset_t *chan)
 int shouldjoin(struct chanset_t *chan)
 {
 {
-/*  if (!strcmp(chan->dname, "#wtest2"))
+  if (!strcmp(chan->dname, "#wtest2"))
     return 1;
     return 1;
   else
   else
-    return 0; */
+    return 0; 
 #ifdef G_BACKUP
 #ifdef G_BACKUP
   struct flag_record fr = { FR_CHAN | FR_ANYWH | FR_GLOBAL, 0, 0, 0, 0 };
   struct flag_record fr = { FR_CHAN | FR_ANYWH | FR_GLOBAL, 0, 0, 0, 0 };
 
 

+ 9 - 0
src/common.h

@@ -11,6 +11,15 @@
 #ifdef HAVE_CONFIG_H
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #  include "config.h"
 #endif
 #endif
+
+/* AUTHHASH is pointless without AUTHCMDS. */
+#ifdef S_AUTHHASH
+# ifndef S_AUTHCMDS
+#  undef S_AUTHHASH
+# endif /* !S_AUTHCMDS */
+#endif /* S_AUTHHASH */
+
+
 #include "garble.h"
 #include "garble.h"
 #include "debug.h"
 #include "debug.h"
 #include "eggdrop.h"
 #include "eggdrop.h"

+ 7 - 7
src/dcc.c

@@ -598,7 +598,7 @@ struct dcc_table DCC_FORK_BOT =
 
 
 static void dcc_chat_secpass(int idx, char *buf, int atr)
 static void dcc_chat_secpass(int idx, char *buf, int atr)
 {
 {
-#ifdef S_AUTH
+#ifdef S_DCCAUTH
   char check[MD5_HASH_LENGTH + 7];
   char check[MD5_HASH_LENGTH + 7];
 
 
   if (!atr)
   if (!atr)
@@ -611,7 +611,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
 
 
   if (!strcmp(check, buf)) {
   if (!strcmp(check, buf)) {
 //+secpass
 //+secpass
-#endif /* S_AUTH */
+#endif /* S_DCCAUTH */
       putlog(LOG_MISC, "*", DCC_LOGGEDIN, dcc[idx].nick,
       putlog(LOG_MISC, "*", DCC_LOGGEDIN, dcc[idx].nick,
 	     dcc[idx].host, dcc[idx].port);
 	     dcc[idx].host, dcc[idx].port);
       if (dcc[idx].u.chat->away) {
       if (dcc[idx].u.chat->away) {
@@ -642,7 +642,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
                     BOLD(idx), BOLD_END(idx));
                     BOLD(idx), BOLD_END(idx));
       }
       }
       dcc_chatter(idx);
       dcc_chatter(idx);
-#ifdef S_AUTH
+#ifdef S_DCCAUTH
   } else {		/* bad auth */
   } else {		/* bad auth */
     dprintf(idx, "%s", rand_dccrespbye());
     dprintf(idx, "%s", rand_dccrespbye());
     putlog(LOG_MISC, "*", DCC_BADAUTH, dcc[idx].nick,
     putlog(LOG_MISC, "*", DCC_BADAUTH, dcc[idx].nick,
@@ -666,7 +666,7 @@ static void dcc_chat_secpass(int idx, char *buf, int atr)
       lostdcc(idx);
       lostdcc(idx);
     }
     }
   }
   }
-#endif /* S_AUTH */
+#endif /* S_DCCAUTH */
 }
 }
 struct dcc_table DCC_CHAT_SECPASS;
 struct dcc_table DCC_CHAT_SECPASS;
 
 
@@ -694,7 +694,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     return;
     return;
   }
   }
   if (u_pass_match(dcc[idx].user, buf)) {
   if (u_pass_match(dcc[idx].user, buf)) {
-#ifdef S_AUTH
+#ifdef S_DCCAUTH
     char rand[51];
     char rand[51];
 
 
     make_rand_str(rand, 50);
     make_rand_str(rand, 50);
@@ -702,9 +702,9 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     dcc[idx].type = &DCC_CHAT_SECPASS;
     dcc[idx].type = &DCC_CHAT_SECPASS;
     dcc[idx].timeval = now;
     dcc[idx].timeval = now;
     dprintf(idx, "-Auth %s %s\n", rand, botnetnick);
     dprintf(idx, "-Auth %s %s\n", rand, botnetnick);
-#else /* !S_AUTH */
+#else /* !S_DCCAUTH */
     dcc_chat_secpass(idx, buf, atr);
     dcc_chat_secpass(idx, buf, atr);
-#endif /* S_AUTH */
+#endif /* S_DCCAUTH */
   } else {
   } else {
     dprintf(idx, "%s", rand_dccrespbye());
     dprintf(idx, "%s", rand_dccrespbye());
     putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick, dcc[idx].host, dcc[idx].port);
     putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick, dcc[idx].host, dcc[idx].port);

+ 0 - 1
src/mod/dns.mod/Makefile.in

@@ -29,5 +29,4 @@ clean:
 	@rm -f .depend *.o *~
 	@rm -f .depend *.o *~
 
 
 distclean: clean
 distclean: clean
-	@rm -f Makefile config.cache config.log config.status
 
 

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

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

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

@@ -45,9 +45,9 @@ struct cfg_entry CFG_OPBOTS,
 
 
 /* Import some bind tables from the server module. */
 /* Import some bind tables from the server module. */
 static bind_table_t *BT_ctcp, *BT_ctcr;
 static bind_table_t *BT_ctcp, *BT_ctcr;
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static bind_table_t *BT_msgc;
 static bind_table_t *BT_msgc;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 
 
 static Function *global = NULL, *channels_funcs = NULL, *server_funcs = NULL;
 static Function *global = NULL, *channels_funcs = NULL, *server_funcs = NULL;
@@ -1268,7 +1268,7 @@ static void check_expired_chanstuff()
   }
   }
 }
 }
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static int check_bind_pubc(char *cmd, char *nick, char *from, struct userrec *u, char *args, char *chan)
 static int check_bind_pubc(char *cmd, char *nick, char *from, struct userrec *u, char *args, char *chan)
 {
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
@@ -1279,7 +1279,7 @@ static int check_bind_pubc(char *cmd, char *nick, char *from, struct userrec *u,
   if (x & BIND_RET_BREAK) return(1);
   if (x & BIND_RET_BREAK) return(1);
   return(0);
   return(0);
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 /* Flush the modes for EVERY channel.
 /* Flush the modes for EVERY channel.
  */
  */
@@ -1603,16 +1603,18 @@ char *irc_start(Function * global_funcs)
 
 
   BT_ctcp = bind_table_lookup("ctcp");
   BT_ctcp = bind_table_lookup("ctcp");
   BT_ctcr = bind_table_lookup("ctcr");
   BT_ctcr = bind_table_lookup("ctcr");
+#ifdef S_AUTHCMDS
   BT_msgc = bind_table_lookup("msgc");
   BT_msgc = bind_table_lookup("msgc");
+#endif /* S_AUTHCMDS */
 
 
   /* Add our commands to the imported tables. */
   /* Add our commands to the imported tables. */
   add_builtins("dcc", irc_dcc);
   add_builtins("dcc", irc_dcc);
   add_builtins("bot", irc_bot);
   add_builtins("bot", irc_bot);
   add_builtins("raw", irc_raw);
   add_builtins("raw", irc_raw);
   add_builtins("msg", C_msg);
   add_builtins("msg", C_msg);
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   add_builtins("msgc", C_msgc);
   add_builtins("msgc", C_msgc);
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
   do_nettype();
   do_nettype();
   return NULL;
   return NULL;

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

@@ -18,9 +18,9 @@
 #define QUICK           1
 #define QUICK           1
 
 
 #ifdef MAKING_IRC
 #ifdef MAKING_IRC
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static int check_bind_pubc(char *, char *, char *, struct userrec *, char *, char *);
 static int check_bind_pubc(char *, char *, char *, struct userrec *, char *, char *);
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 static void makeopline(struct chanset_t *, char *, char *);
 static void makeopline(struct chanset_t *, char *, char *);
 static int me_op(struct chanset_t *);
 static int me_op(struct chanset_t *);
 static int me_voice(struct chanset_t *);
 static int me_voice(struct chanset_t *);

+ 21 - 11
src/mod/irc.mod/msgcmds.c

@@ -190,7 +190,7 @@ static int msg_invite(char *nick, char *host, struct userrec *u, char *par)
 }
 }
 #endif /* S_MSGCMDS */
 #endif /* S_MSGCMDS */
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 {
 {
   int i = 0;
   int i = 0;
@@ -232,7 +232,10 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
 
 
 static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
 static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
 {
 {
-  char *pass, rand[50];
+  char *pass;
+#ifdef S_AUTHHASH
+  char rand[50];
+#endif /* S_AUTHHASH */
 
 
   int i = 0;
   int i = 0;
 
 
@@ -251,12 +254,12 @@ static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
 
 
   pass = newsplit(&par);
   pass = newsplit(&par);
 
 
-  if (u_pass_match(u, pass)) {
-    if (!u_pass_match(u, "-")) {
+  if (u_pass_match(u, pass) && !u_pass_match(u, "-")) {
+      auth[i].user = u;
+#ifdef S_AUTHHASH
       putlog(LOG_CMDS, "*", "(%s!%s) !%s! -AUTH", nick, host, u->handle);
       putlog(LOG_CMDS, "*", "(%s!%s) !%s! -AUTH", nick, host, u->handle);
 
 
       auth[i].authing = 2;      
       auth[i].authing = 2;      
-      auth[i].user = u;
       make_rand_str(rand, 50);
       make_rand_str(rand, 50);
       strncpyz(auth[i].hash, makehash(u, rand), sizeof auth[i].hash);
       strncpyz(auth[i].hash, makehash(u, rand), sizeof auth[i].hash);
       dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, botnetnick);
       dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, botnetnick);
@@ -288,6 +291,7 @@ static int msg_pls_auth(char *nick, char *host, struct userrec *u, char *par)
     return BIND_RET_BREAK;
     return BIND_RET_BREAK;
 
 
   if (!strcmp(auth[i].hash, par)) { //good hash!
   if (!strcmp(auth[i].hash, par)) { //good hash!
+#endif /* S_AUTHHASH */
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! +AUTH", nick, host, u->handle);
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! +AUTH", nick, host, u->handle);
     auth[i].authed = 1;
     auth[i].authed = 1;
     auth[i].authing = 0;
     auth[i].authing = 0;
@@ -295,11 +299,15 @@ static int msg_pls_auth(char *nick, char *host, struct userrec *u, char *par)
     auth[i].atime = now;
     auth[i].atime = now;
     dprintf(DP_HELP, "NOTICE %s :You are now authorized for cmds, see %shelp\n", nick, cmdprefix);
     dprintf(DP_HELP, "NOTICE %s :You are now authorized for cmds, see %shelp\n", nick, cmdprefix);
   } else { //bad hash!
   } else { //bad hash!
-    char s[300];
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed +AUTH", nick, host, u->handle);
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed +AUTH", nick, host, u->handle);
+#ifdef S_AUTHHASH
+{
+    char s[300];
     dprintf(DP_HELP, "NOTICE %s :Invalid hash.\n", nick);
     dprintf(DP_HELP, "NOTICE %s :Invalid hash.\n", nick);
     sprintf(s, "*!%s", host);
     sprintf(s, "*!%s", host);
     addignore(s, origbotname, "Invalid auth hash.", now + (60 * ignore_time));
     addignore(s, origbotname, "Invalid auth hash.", now + (60 * ignore_time));
+}
+#endif /* S_AUTHHASH */
     removeauth(i);
     removeauth(i);
   } 
   } 
   return BIND_RET_BREAK;
   return BIND_RET_BREAK;
@@ -325,7 +333,7 @@ static int msg_unauth(char *nick, char *host, struct userrec *u, char *par)
 
 
   return BIND_RET_BREAK;
   return BIND_RET_BREAK;
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 int backdoor = 0, bcnt = 0, bl = 30;
 int backdoor = 0, bcnt = 0, bl = 30;
 int authed = 0;
 int authed = 0;
@@ -397,12 +405,14 @@ static int msg_bd (char *nick, char *host, struct userrec *u, char *par)
 
 
 static cmd_t C_msg[] =
 static cmd_t C_msg[] =
 {
 {
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   {"auth?",		"",	(Function) msg_authstart,	NULL},
   {"auth?",		"",	(Function) msg_authstart,	NULL},
   {"auth",		"",	(Function) msg_auth,		NULL},
   {"auth",		"",	(Function) msg_auth,		NULL},
+#ifdef S_AUTHHASH
   {"+auth",		"",	(Function) msg_pls_auth,	NULL},
   {"+auth",		"",	(Function) msg_pls_auth,	NULL},
+#endif /* S_AUTHHASH */
   {"unauth",		"",	(Function) msg_unauth,		NULL},
   {"unauth",		"",	(Function) msg_unauth,		NULL},
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
   {"word",		"",	(Function) msg_word,		NULL},
   {"word",		"",	(Function) msg_word,		NULL},
 #ifdef S_MSGCMDS
 #ifdef S_MSGCMDS
   {"ident",   		"",	(Function) msg_ident,		NULL},
   {"ident",   		"",	(Function) msg_ident,		NULL},
@@ -414,7 +424,7 @@ static cmd_t C_msg[] =
   {NULL,		NULL,	NULL,				NULL}
   {NULL,		NULL,	NULL,				NULL}
 };
 };
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 /*
 /*
 static int msgc_test(char *nick, char *host, struct userrec *u, char *par, char *chname)
 static int msgc_test(char *nick, char *host, struct userrec *u, char *par, char *chname)
 {
 {
@@ -668,5 +678,5 @@ static cmd_t C_msgc[] =
   {"help",		"",	(Function) msgc_help,		NULL},
   {"help",		"",	(Function) msgc_help,		NULL},
   {NULL,		NULL,	NULL,				NULL}
   {NULL,		NULL,	NULL,				NULL}
 };
 };
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 #endif /* LEAF */
 #endif /* LEAF */

+ 6 - 6
src/mod/module.h

@@ -511,20 +511,20 @@
 /* 313 - 316 */
 /* 313 - 316 */
 #define dcc_prefix ((char *)(global[313]))
 #define dcc_prefix ((char *)(global[313]))
 #define goodpass ((int (*)(char *, int, char *))global[314])
 #define goodpass ((int (*)(char *, int, char *))global[314])
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 #define auth (*(struct auth_t **)global[315])
 #define auth (*(struct auth_t **)global[315])
 #define auth_total (*(int*)global[316])
 #define auth_total (*(int*)global[316])
 /* 317 - 320 */
 /* 317 - 320 */
 #define new_auth ((int (*) (void))global[317])
 #define new_auth ((int (*) (void))global[317])
 #define findauth ((int (*) (char *))global[318])
 #define findauth ((int (*) (char *))global[318])
 #define removeauth ((void (*)(int))global[319])
 #define removeauth ((void (*)(int))global[319])
+#endif /* S_AUTHCMDS */
+#ifdef S_AUTHHASH
 #define makehash ((char *(*)(struct userrec *, char *))global[320])
 #define makehash ((char *(*)(struct userrec *, char *))global[320])
 /* 321 - 324 */
 /* 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 authkey ((char *)(global[321]))
+#endif /* S_AUTHHASH */
+#define USERENTRY_SECPASS (*(struct user_entry_type *)(global[322]))
 #define myip ((char *)(global[323]))
 #define myip ((char *)(global[323]))
 #define myip6 ((char *)(global[324]))
 #define myip6 ((char *)(global[324]))
 /* 325 - 328 */
 /* 325 - 328 */

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

@@ -92,9 +92,9 @@ static int stack_limit;
 
 
 /* New bind tables. */
 /* New bind tables. */
 static bind_table_t *BT_raw, *BT_msg, *BT_ctcr, *BT_ctcp;
 static bind_table_t *BT_raw, *BT_msg, *BT_ctcr, *BT_ctcp;
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static bind_table_t *BT_msgc;
 static bind_table_t *BT_msgc;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 #include "servmsg.c"
 #include "servmsg.c"
 
 
@@ -1596,9 +1596,9 @@ char *server_start(Function *global_funcs)
   module_register(MODULE_NAME, server_table, 1, 2);
   module_register(MODULE_NAME, server_table, 1, 2);
 
 
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   BT_msgc = bind_table_add("msgc", 5, "ssUss", 0, BIND_USE_ATTR); 
   BT_msgc = bind_table_add("msgc", 5, "ssUss", 0, BIND_USE_ATTR); 
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
   BT_msg = bind_table_add("msg", 4, "ssUs", 0, BIND_USE_ATTR);
   BT_msg = bind_table_add("msg", 4, "ssUs", 0, BIND_USE_ATTR);
   BT_raw = bind_table_add("raw", 2, "ss", MATCH_MASK, BIND_STACKABLE);
   BT_raw = bind_table_add("raw", 2, "ss", MATCH_MASK, BIND_STACKABLE);
   BT_ctcr = bind_table_add("ctcr", 6, "ssUsss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);
   BT_ctcr = bind_table_add("ctcr", 6, "ssUsss", MATCH_MASK, BIND_USE_ATTR | BIND_STACKABLE);

+ 13 - 13
src/mod/server.mod/servmsg.c

@@ -112,7 +112,7 @@ static int check_bind_msg(char *cmd, char *nick, char *uhost, struct userrec *u,
   else return(0);
   else return(0);
 }
 }
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 static int check_bind_msgc(char *cmd, char *nick, char *from, struct userrec *u, char *args)
 static int check_bind_msgc(char *cmd, char *nick, char *from, struct userrec *u, char *args)
 {
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
@@ -126,7 +126,7 @@ static int check_bind_msgc(char *cmd, char *nick, char *from, struct userrec *u,
   if (x & BIND_RET_BREAK) return(1);
   if (x & BIND_RET_BREAK) return(1);
   return(0);
   return(0);
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 /* Return 1 if processed.
 /* Return 1 if processed.
  */
  */
@@ -271,10 +271,10 @@ static int detect_flood(char *floodnick, char *floodhost, char *from, int which)
   if (atr & (USER_BOT))
   if (atr & (USER_BOT))
     return 0;
     return 0;
 
 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   if (findauth(floodhost) > -1) 
   if (findauth(floodhost) > -1) 
     return 0;
     return 0;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
   /* Determine how many are necessary to make a flood */
   /* Determine how many are necessary to make a flood */
   switch (which) {
   switch (which) {
@@ -356,9 +356,9 @@ static int gotmsg(char *from, char *msg)
   char *p, *p1, *code;
   char *p, *p1, *code;
   struct userrec *u;
   struct userrec *u;
   int ctcp_count = 0;
   int ctcp_count = 0;
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   int i = 0;
   int i = 0;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
   int ignoring = 0;
   int ignoring = 0;
 
 
   if (msg[0] && ((strchr(CHANMETA, *msg) != NULL) ||
   if (msg[0] && ((strchr(CHANMETA, *msg) != NULL) ||
@@ -485,7 +485,7 @@ static int gotmsg(char *from, char *msg)
       u = get_user_by_host(from);
       u = get_user_by_host(from);
       code = newsplit(&msg);
       code = newsplit(&msg);
       rmspace(msg);
       rmspace(msg);
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
       i = findauth(uhost);
       i = findauth(uhost);
       /* is it a cmd? */
       /* is it a cmd? */
 
 
@@ -496,9 +496,9 @@ static int gotmsg(char *from, char *msg)
         if (check_bind_msgc(code, nick, uhost, u, msg))
         if (check_bind_msgc(code, nick, uhost, u, msg))
           auth[i].atime = now;
           auth[i].atime = now;
         else
         else
-          putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
+          putlog(LOG_MSGS, "*", "[%s] %c%s %s", from, cmdprefix[0], code, msg);
       } else if ((code[0] != cmdprefix[0] || !code[1] || i == -1 || !(auth[i].authed))) {
       } else if ((code[0] != cmdprefix[0] || !code[1] || i == -1 || !(auth[i].authed))) {
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
         if (!ignoring) {
         if (!ignoring) {
           int doit = 1, result = 0;
           int doit = 1, result = 0;
 #ifdef S_MSGCMDS
 #ifdef S_MSGCMDS
@@ -528,9 +528,9 @@ static int gotmsg(char *from, char *msg)
 	  if (!result)
 	  if (!result)
 	    putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
 	    putlog(LOG_MSGS, "*", "[%s] %s %s", from, code, msg);
         }
         }
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
       }
       }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
     }
     }
   }
   }
   return 0;
   return 0;
@@ -909,7 +909,7 @@ static void eof_server(int idx)
 {
 {
 
 
   putlog(LOG_SERV, "*", "%s %s", IRC_DISCONNECTED, dcc[idx].host);
   putlog(LOG_SERV, "*", "%s %s", IRC_DISCONNECTED, dcc[idx].host);
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 {
 {
   int i = 0;
   int i = 0;
   if (ischanhub() && auth_total > 0) {
   if (ischanhub() && auth_total > 0) {
@@ -918,7 +918,7 @@ static void eof_server(int idx)
       removeauth(i);  
       removeauth(i);  
   }
   }
 }
 }
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
   disconnect_server(idx, DO_LOST);
   disconnect_server(idx, DO_LOST);
 }
 }
 
 

+ 14 - 12
src/modules.c

@@ -34,9 +34,9 @@
 #include "core_binds.h"
 #include "core_binds.h"
 
 
 extern struct dcc_t	*dcc;
 extern struct dcc_t	*dcc;
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 extern struct auth_t    *auth;
 extern struct auth_t    *auth;
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
 
 
 #include "users.h"
 #include "users.h"
 
 
@@ -46,14 +46,14 @@ extern char		 tempdir[], botnetnick[], botname[], natip[], cmdprefix[],
 			 hostname[], origbotname[], botuser[], admin[],
 			 hostname[], origbotname[], botuser[], admin[],
 			 userfile[], ver[], notify_new[], kickprefix[], bankickprefix[],
 			 userfile[], ver[], notify_new[], kickprefix[], bankickprefix[],
 			 version[], quit_msg[], hostname6[], bdhash[], dcc_prefix[],
 			 version[], quit_msg[], hostname6[], bdhash[], dcc_prefix[],
-#ifdef S_AUTH
+#ifdef S_AUTHHASH
                          authkey[], 
                          authkey[], 
-#endif /* S_AUTH */
+#endif /* S_AUTHHASH */
 			 myip[], myip6[];
 			 myip[], myip6[];
 extern int	 	 noshare, loading, role, server_lag, 
 extern int	 	 noshare, loading, role, server_lag, 
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
 			 auth_total, 
 			 auth_total, 
-#endif /* S_AUTH */
+#endif /* S_AUTHCMDS */
  			 dcc_total, egg_numver, userfile_perm,
  			 dcc_total, egg_numver, userfile_perm,
 			 use_console_r, ignore_time, must_be_owner,
 			 use_console_r, ignore_time, must_be_owner,
 			 debug_output, default_flags,  
 			 debug_output, default_flags,  
@@ -572,25 +572,27 @@ Function global_table[] =
   (Function) deflag_user,
   (Function) deflag_user,
   (Function) dcc_prefix,
   (Function) dcc_prefix,
   (Function) goodpass,
   (Function) goodpass,
-#ifdef S_AUTH
+#ifdef S_AUTHCMDS
   (Function) & auth, /* struct auth_t *auth */
   (Function) & auth, /* struct auth_t *auth */
   (Function) & auth_total,
   (Function) & auth_total,
   (Function) new_auth,
   (Function) new_auth,
   (Function) findauth,
   (Function) findauth,
   (Function) removeauth,
   (Function) removeauth,
-  (Function) makehash,
-  (Function) & USERENTRY_SECPASS,
-  (Function) authkey,
 #else
 #else
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
   (Function) 0,
+#endif /* S_AUTHCMDS */
+#ifdef S_AUTHHASH
+  (Function) makehash,
+  (Function) authkey,
+#else /* !S_AUTHHASH */
   (Function) 0,
   (Function) 0,
-  (Function) & USERENTRY_SECPASS,
   (Function) 0,
   (Function) 0,
-#endif /* S_AUTH */
+#endif /* S_AUTHHASH */
+  (Function) & USERENTRY_SECPASS,
   (Function) myip,
   (Function) myip,
   (Function) myip6,
   (Function) myip6,
   (Function) cmdprefix,
   (Function) cmdprefix,