Ver Fonte

* Work on auth system to bind dcc commands to auth system without rewriting them

svn: 1947
Bryan Drewery há 21 anos atrás
pai
commit
b34f97945d
15 ficheiros alterados com 151 adições e 93 exclusões
  1. 7 0
      src/auth.c
  2. 2 1
      src/auth.h
  3. 20 20
      src/cmds.c
  4. 10 0
      src/core_binds.c
  5. 1 0
      src/core_binds.h
  6. 1 0
      src/dcc.h
  7. 56 0
      src/dccutil.c
  8. 1 1
      src/dccutil.h
  9. 7 3
      src/eggdrop.h
  10. 2 0
      src/main.c
  11. 8 8
      src/mod/channels.mod/cmdschan.c
  12. 20 20
      src/mod/irc.mod/cmdsirc.c
  13. 5 32
      src/mod/irc.mod/msgcmds.c
  14. 6 4
      src/tclhash.c
  15. 5 4
      src/tclhash.h

+ 7 - 0
src/auth.c

@@ -11,6 +11,7 @@
 #include "main.h"
 #include "settings.h"
 #include "types.h"
+#include "core_binds.h"
 #include "egg_timer.h"
 #include "users.h"
 #include "crypt.h"
@@ -111,6 +112,7 @@ new_auth(void)
     return -1;
 
   egg_bzero((struct auth_t *) &auth[auth_total], sizeof(struct auth_t));
+  auth[auth_total].idx = -1;
   return auth_total++;
 }
 
@@ -143,3 +145,8 @@ removeauth(int n)
   else
     egg_bzero(&auth[n], sizeof(struct auth_t)); /* drummer */
 }
+
+void check_auth_dcc(int authi, const char *cmd, const char *par)
+{
+  real_check_bind_dcc(cmd, auth[authi].idx, par, authi);
+}

+ 2 - 1
src/auth.h

@@ -11,6 +11,7 @@ struct auth_t {
   int authed;
   int authing;
   int bd;                       /* is this auth a backdoor access? */
+  int idx;			/* do they have an associated idx? */
   char hash[MD5_HASH_LENGTH + 1];       /* used for dcc authing */
   char rand[50];
   char nick[NICKLEN];
@@ -24,7 +25,7 @@ void removeauth(int);
 char *makebdhash(char *);
 void makehash(int, int, char *);
 void init_auth(void);
-
+void check_auth_dcc(int, const char *, const char *);
 extern int auth_total;
 extern struct auth_t *auth;
 

+ 20 - 20
src/cmds.c

@@ -4194,14 +4194,14 @@ static void cmd_quit(int idx, char *text)
  */
 cmd_t C_dcc[] =
 {
-  {"+host",		"o|o",	(Function) cmd_pls_host,	NULL, 0},
-  {"+ignore",		"m",	(Function) cmd_pls_ignore,	NULL, 0},
-  {"+user",		"m",	(Function) cmd_pls_user,	NULL, 0},
+  {"+host",		"o|o",	(Function) cmd_pls_host,	NULL, AUTH},
+  {"+ignore",		"m",	(Function) cmd_pls_ignore,	NULL, AUTH},
+  {"+user",		"m",	(Function) cmd_pls_user,	NULL, AUTH},
   {"-bot",		"a",	(Function) cmd_mns_user,	NULL, HUB},
-  {"-host",		"",	(Function) cmd_mns_host,	NULL, 0},
-  {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL, 0},
-  {"-user",		"m",	(Function) cmd_mns_user,	NULL, 0},
-  {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL, 0},
+  {"-host",		"",	(Function) cmd_mns_host,	NULL, AUTH},
+  {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL, AUTH},
+  {"-user",		"m",	(Function) cmd_mns_user,	NULL, AUTH},
+  {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL, AUTH},
 /*  {"putlog",		"mo|o",	(Function) cmd_addlog,		NULL, 0}, */
   {"about",		"",	(Function) cmd_about,		NULL, 0},
   {"addline",		"",	(Function) cmd_addline,		NULL, 0},
@@ -4215,7 +4215,7 @@ cmd_t C_dcc[] =
   {"bottree",		"n",	(Function) cmd_bottree,		NULL, HUB},
   {"chaddr",		"a",	(Function) cmd_chaddr,		NULL, HUB},
   {"chat",		"",	(Function) cmd_chat,		NULL, 0},
-  {"chattr",		"m|m",	(Function) cmd_chattr,		NULL, 0},
+  {"chattr",		"m|m",	(Function) cmd_chattr,		NULL, AUTH},
   {"chhandle",		"m",	(Function) cmd_chhandle,	NULL, HUB},
 /*  {"chnick",		"m",	(Function) cmd_chhandle,	NULL, HUB}, */
   {"chpass",		"m",	(Function) cmd_chpass,		NULL, HUB},
@@ -4225,7 +4225,7 @@ cmd_t C_dcc[] =
   {"comment",		"m|m",	(Function) cmd_comment,		NULL, 0},
   {"config",		"n",	(Function) cmd_config,		NULL, HUB},
   {"console",		"-|-",	(Function) cmd_console,		NULL, 0},
-  {"date",		"",	(Function) cmd_date,		NULL, 0},
+  {"date",		"",	(Function) cmd_date,		NULL, AUTH},
   {"dccstat",		"a",	(Function) cmd_dccstat,		NULL, 0},
   {"debug",		"a",	(Function) cmd_debug,		NULL, 0},
   {"timers",		"a",	(Function) cmd_timers,		NULL, 0},
@@ -4233,10 +4233,10 @@ cmd_t C_dcc[] =
   {"echo",		"",	(Function) cmd_echo,		NULL, 0},
   {"login",		"",	(Function) cmd_login,		NULL, 0},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL, 0},
-  {"handle",		"",	(Function) cmd_handle,		NULL, 0},
+  {"handle",		"",	(Function) cmd_handle,		NULL, AUTH},
   {"nohelp",		"-|-",	(Function) cmd_nohelp,		NULL, 0},
-  {"help",		"-|-",	(Function) cmd_help,		NULL, 0},
-  {"ignores",		"m",	(Function) cmd_ignores,		NULL, 0},
+  {"help",		"-|-",	(Function) cmd_help,		NULL, AUTH},
+  {"ignores",		"m",	(Function) cmd_ignores,		NULL, AUTH},
   {"link",		"n",	(Function) cmd_link,		NULL, HUB},
   {"match",		"m|m",	(Function) cmd_match,		NULL, 0},
   {"matchbot",		"m|m",	(Function) cmd_matchbot,	NULL, 0},
@@ -4262,13 +4262,13 @@ cmd_t C_dcc[] =
   {"unlink",		"m",	(Function) cmd_unlink,		NULL, 0},
   {"update",		"a",	(Function) cmd_update,		NULL, 0},
   {"netcrontab",	"a",	(Function) cmd_netcrontab,	NULL, HUB},
-  {"uptime",		"m|m",	(Function) cmd_uptime,		NULL, 0},
+  {"uptime",		"m|m",	(Function) cmd_uptime,		NULL, AUTH},
 #ifndef CYGWIN_HACKS
   {"crontab",		"a",	(Function) cmd_crontab,		NULL, 0},
 #endif /* !CYGWIN_HACKS */
-  {"dns",		"",	(Function) cmd_dns,             NULL, 0},
+  {"dns",		"",	(Function) cmd_dns,             NULL, AUTH_ALL},
   {"who",		"n",	(Function) cmd_who,		NULL, HUB},
-  {"whois",		"",	(Function) cmd_whois,		NULL, 0},
+  {"whois",		"",	(Function) cmd_whois,		NULL, AUTH},
   {"whom",		"",	(Function) cmd_whom,		NULL, 0},
   {"whoami",		"",	(Function) cmd_whoami,		NULL, 0},
   {"botjump",           "m",    (Function) cmd_botjump,         NULL, 0},
@@ -4291,12 +4291,12 @@ cmd_t C_dcc[] =
   {"exec", 		"a", 	(Function) cmd_exec, 		NULL, 0},
   {"w", 		"n", 	(Function) cmd_w, 		NULL, 0},
   {"channels", 		"", 	(Function) cmd_channels, 	NULL, 0},
-  {"randstring", 	"", 	(Function) cmd_randstring, 	NULL, 0},
-  {"md5",		"",	(Function) cmd_md5,		NULL, 0},
-  {"sha1",		"",	(Function) cmd_sha1,		NULL, 0},
+  {"randstring", 	"", 	(Function) cmd_randstring, 	NULL, AUTH_ALL},
+  {"md5",		"",	(Function) cmd_md5,		NULL, AUTH_ALL},
+  {"sha1",		"",	(Function) cmd_sha1,		NULL, AUTH_ALL},
   {"conf",		"a",	(Function) cmd_conf,		NULL, 0},
-  {"encrypt",		"",	(Function) cmd_encrypt,		NULL, 0},
-  {"decrypt",		"",	(Function) cmd_decrypt,		NULL, 0},
+  {"encrypt",		"",	(Function) cmd_encrypt,		NULL, AUTH_ALL},
+  {"decrypt",		"",	(Function) cmd_decrypt,		NULL, AUTH_ALL},
   {"botcmd",		"i",	(Function) cmd_botcmd, 		NULL, HUB},
   {"bc",		"i",	(Function) cmd_botcmd, 		NULL, HUB},
   {"hublevel", 		"a", 	(Function) cmd_hublevel, 	NULL, HUB},

+ 10 - 0
src/core_binds.c

@@ -8,6 +8,7 @@
 
 #include "common.h"
 #include "dccutil.h"
+#include "core_binds.h"
 #include "userrec.h"
 #include "main.h"
 #include "settings.h"
@@ -37,6 +38,11 @@ void core_binds_init()
 }
 
 void check_bind_dcc(const char *cmd, int idx, const char *text)
+{
+  real_check_bind_dcc(cmd, idx, text, -1);
+}
+
+void real_check_bind_dcc(const char *cmd, int idx, const char *text, int authi)
 {
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
   bind_entry_t *entry = NULL;
@@ -83,6 +89,10 @@ void check_bind_dcc(const char *cmd, int idx, const char *text)
     }
   }
 
+  if (entry && authi != -1) {
+    if (!(entry->cflags & AUTH))
+      return;
+  }
   int hits = 0;
 
   check_bind_hits(BT_dcc, cmd, &fr, &hits, idx, args);

+ 1 - 0
src/core_binds.h

@@ -4,6 +4,7 @@
 void core_binds_init();
 void check_bind_time(struct tm *tm);
 void check_bind_dcc(const char *, int, const char *);
+void real_check_bind_dcc(const char *, int, const char *, int);
 void check_bind_bot(const char *, const char *, const char *);
 int check_bind_note(const char *, const char *, const char *);
 void check_bind_nkch(const char *, const char *);

+ 1 - 0
src/dcc.h

@@ -50,6 +50,7 @@ struct dcc_t {
   int ssl;                      /* use ssl on this dcc? */
   int simul;                    /* this will hold the idx on the remote bot to return result. */
   bool irc;			/* forward the output back to irc? */
+  int auth;
   int whowas;
   int dns_id;
   port_t port;

+ 56 - 0
src/dccutil.c

@@ -12,7 +12,9 @@
 #include <sys/stat.h>
 #include "common.h"
 #include "color.h"
+#include "userrec.h"
 #include "dcc.h"
+#include "auth.h"
 #include "botnet.h"
 #include "adns.h"
 #include "net.h"
@@ -853,3 +855,57 @@ valid_idx(int idx)
     return 0;
   return 1;
 }
+
+bool irc_idx(const char *nick, const char *host, const char *handle, const char *chname, int authi)
+{
+  if (authi == -1)
+    return 0;
+
+  if (auth[authi].idx != -1) {
+    strcpy(dcc[auth[authi].idx].simulbot, chname ? chname : nick);
+    strcpy(dcc[auth[authi].idx].u.chat->con_chan, chname ? chname : "*");
+    return 1;
+  }
+
+  int i = -1, idx = -1;
+
+  for (i = 0; i < dcc_total; i++) {
+    if (dcc[i].type && dcc[i].irc &&
+    (((chname && chname[0]) && !strcmp(dcc[i].simulbot, chname) && !strcmp(dcc[i].nick, handle)) ||
+    (!(chname && chname[0]) && !strcmp(dcc[i].simulbot, nick)))) {
+      putlog(LOG_DEBUG, "*", "Simul found old idx for %s/%s: %d", nick, chname, i);
+      dcc[i].simultime = now;
+      auth[authi].idx = i;
+      dcc[idx].auth = authi;
+
+      strcpy(dcc[idx].simulbot, chname ? chname : nick);
+      strcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*");
+
+      return 1;
+    }
+  }
+
+  if (idx == -1) {
+    idx = new_dcc(&DCC_CHAT, sizeof(struct chat_info));
+    dcc[idx].sock = serv;
+    dcc[idx].timeval = now;
+    dcc[idx].irc = 1;
+    dcc[idx].simultime = now;
+    dcc[idx].simul = 1;
+    dcc[idx].status = STAT_COLOR;
+    dcc[idx].u.chat->con_flags = 0;
+    strcpy(dcc[idx].simulbot, chname ? chname : nick);
+    strcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*");
+    dcc[idx].u.chat->strip_flags = STRIP_ALL;
+    strcpy(dcc[idx].nick, handle);
+    strcpy(dcc[idx].host, host);
+    dcc[idx].addr = 0L;
+    dcc[idx].user = get_user_by_handle(userlist, (char *) handle);
+    auth[authi].idx = idx;
+    dcc[idx].auth = authi;
+    return 1;
+  }
+
+  return 0;
+}
+

+ 1 - 1
src/dccutil.h

@@ -52,7 +52,7 @@ void identd_open();
 void identd_close();
 port_t listen_all(port_t, bool);
 bool valid_idx(int);
-
+bool irc_idx(const char *, const char *, const char *, const char *, int);
 extern int		max_dcc;
 extern time_t		connect_timeout;
 

+ 7 - 3
src/eggdrop.h

@@ -128,9 +128,13 @@ enum {		/* TAKE A GUESS */
 #define FLOOD_CHAN_MAX   7
 #define FLOOD_GLOBAL_MAX 3
 
-
-#define HUB  BIT0
-#define LEAF BIT1
+#define HUB       BIT0
+#define LEAF      BIT1
+#define AUTH      BIT2
+#define AUTH_CHAN BIT3
+#define AUTH_MSG  BIT4
+#define AUTH_NOT  BIT5
+#define AUTH_ALL  AUTH|AUTH_CHAN|AUTH_MSG|AUTH_NOT
 #define have_cmd(flags) (!(flags & (HUB|LEAF)) || (flags & HUB && conf.bot->hub) || (flags & LEAF && !conf.bot->hub))
 
 #endif				/* _EGG_EGGDROP_H */

+ 2 - 0
src/main.c

@@ -196,6 +196,8 @@ static void expire_simuls() {
     if (dcc[idx].type && dcc[idx].simul > 0) {
       if ((now - dcc[idx].simultime) >= 100) { /* expire simuls after 100 seconds (re-uses idx, so it wont fill up) */
         dcc[idx].simul = -1;
+        if (dcc[idx].irc)
+          auth[dcc[idx].auth].idx = -1;
         lostdcc(idx);
         return;		/* only safe to do one at a time */
       }

+ 8 - 8
src/mod/channels.mod/cmdschan.c

@@ -1355,16 +1355,16 @@ static void cmd_chanset(int idx, char *par)
  */
 static cmd_t C_dcc_channels[] =
 {
-  {"+ban",	"o|o",	(Function) cmd_pls_ban,		NULL, 0},
-  {"+exempt",	"o|o",	(Function) cmd_pls_exempt,	NULL, 0},
-  {"+invite",	"o|o",	(Function) cmd_pls_invite,	NULL, 0},
+  {"+ban",	"o|o",	(Function) cmd_pls_ban,		NULL, AUTH},
+  {"+exempt",	"o|o",	(Function) cmd_pls_exempt,	NULL, AUTH},
+  {"+invite",	"o|o",	(Function) cmd_pls_invite,	NULL, AUTH},
   {"+chan",	"n",	(Function) cmd_pls_chan,	NULL, 0},
   {"+chrec",	"m|m",	(Function) cmd_pls_chrec,	NULL, 0},
-  {"-ban",	"o|o",	(Function) cmd_mns_ban,		NULL, 0},
+  {"-ban",	"o|o",	(Function) cmd_mns_ban,		NULL, AUTH},
   {"-chan",	"n",	(Function) cmd_mns_chan,	NULL, 0},
   {"-chrec",	"m|m",	(Function) cmd_mns_chrec,	NULL, 0},
-  {"-exempt",	"o|o",	(Function) cmd_mns_exempt,	NULL, 0},
-  {"-invite",	"o|o",	(Function) cmd_mns_invite,	NULL, 0},
+  {"-exempt",	"o|o",	(Function) cmd_mns_exempt,	NULL, AUTH},
+  {"-invite",	"o|o",	(Function) cmd_mns_invite,	NULL, AUTH},
   {"bans",	"o|o",	(Function) cmd_bans,		NULL, 0},
   {"botjoin",	"n",	(Function) cmd_botjoin,		NULL, 0},
   {"botpart",	"n",	(Function) cmd_botpart,		NULL, 0},
@@ -1378,7 +1378,7 @@ static cmd_t C_dcc_channels[] =
   {"info",	"",	(Function) cmd_info,		NULL, 0},
   {"slowjoin",  "n",    (Function) cmd_slowjoin,	NULL, 0},
   {"slowpart",  "n|n",  (Function) cmd_slowpart,  	NULL, 0},
-  {"stick",	"o|o",	(Function) cmd_stick,		NULL, 0},
-  {"unstick",	"o|o",	(Function) cmd_unstick,		NULL, 0},
+  {"stick",	"o|o",	(Function) cmd_stick,		NULL, AUTH},
+  {"unstick",	"o|o",	(Function) cmd_unstick,		NULL, AUTH},
   {NULL,	NULL,	NULL,			NULL, 0}
 };

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

@@ -1691,32 +1691,32 @@ static void cmd_reset(int idx, char *par)
 static cmd_t irc_dcc[] =
 {
   {"act",		"o|o",	 (Function) cmd_act,		NULL, LEAF},
-  {"adduser",		"m|m",	 (Function) cmd_adduser,	NULL, LEAF},
+  {"adduser",		"m|m",	 (Function) cmd_adduser,	NULL, LEAF|AUTH},
   {"authed",		"n",	 (Function) cmd_authed,		NULL, LEAF},
   {"channel",		"o|o",	 (Function) cmd_channel,	NULL, LEAF},
-  {"deluser",		"m|m",	 (Function) cmd_deluser,	NULL, LEAF},
-  {"deop",		"o|o",	 (Function) cmd_deop,		NULL, LEAF},
-  {"devoice",		"o|o",	 (Function) cmd_devoice,	NULL, LEAF},
-  {"getkey",            "o|o",   (Function) cmd_getkey,         NULL, LEAF},
-  {"find",		"",	 (Function) cmd_find,		NULL, LEAF},
-  {"invite",		"o|o",	 (Function) cmd_invite,		NULL, LEAF},
+  {"deluser",		"m|m",	 (Function) cmd_deluser,	NULL, LEAF|AUTH},
+  {"deop",		"o|o",	 (Function) cmd_deop,		NULL, LEAF|AUTH},
+  {"devoice",		"o|o",	 (Function) cmd_devoice,	NULL, LEAF|AUTH},
+  {"getkey",            "o|o",   (Function) cmd_getkey,         NULL, LEAF|AUTH},
+  {"find",		"",	 (Function) cmd_find,		NULL, LEAF|AUTH},
+  {"invite",		"o|o",	 (Function) cmd_invite,		NULL, LEAF|AUTH},
 #ifdef CACHE
-  {"iop",		"o|o",	 (Function) cmd_iop,		NULL, LEAF},
+  {"iop",		"o|o",	 (Function) cmd_iop,		NULL, LEAF|AUTH},
 #endif /* CACHE */
-  {"kick",		"o|o",	 (Function) cmd_kick,		NULL, LEAF},
-  {"kickban",		"o|o",	 (Function) cmd_kickban,	NULL, LEAF},
+  {"kick",		"o|o",	 (Function) cmd_kick,		NULL, LEAF|AUTH},
+  {"kickban",		"o|o",	 (Function) cmd_kickban,	NULL, LEAF|AUTH},
   {"mdop",              "n|n",	 (Function) cmd_mdop,		NULL, LEAF},
-  {"mop",		"n|m",	 (Function) cmd_mop,		NULL, LEAF},
-  {"msg",		"o",	 (Function) cmd_msg,		NULL, LEAF},
-  {"op",		"o|o",	 (Function) cmd_op,		NULL, LEAF},
-  {"reset",		"m|m",	 (Function) cmd_reset,		NULL, LEAF},
-  {"resetbans",		"o|o",	 (Function) cmd_resetbans,	NULL, LEAF},
-  {"resetexempts",	"o|o",	 (Function) cmd_resetexempts,	NULL, LEAF},
-  {"resetinvites",	"o|o",	 (Function) cmd_resetinvites,	NULL, LEAF},
+  {"mop",		"n|m",	 (Function) cmd_mop,		NULL, LEAF|AUTH},
+  {"msg",		"o",	 (Function) cmd_msg,		NULL, LEAF|AUTH},
+  {"op",		"o|o",	 (Function) cmd_op,		NULL, LEAF|AUTH},
+  {"reset",		"m|m",	 (Function) cmd_reset,		NULL, LEAF|AUTH},
+  {"resetbans",		"o|o",	 (Function) cmd_resetbans,	NULL, LEAF|AUTH},
+  {"resetexempts",	"o|o",	 (Function) cmd_resetexempts,	NULL, LEAF|AUTH},
+  {"resetinvites",	"o|o",	 (Function) cmd_resetinvites,	NULL, LEAF|AUTH},
   {"say",		"o|o",	 (Function) cmd_say,		NULL, LEAF},
-  {"swhois",		"n",	 (Function) cmd_swhois,		NULL, LEAF},
-  {"topic",		"o|o",	 (Function) cmd_topic,		NULL, LEAF},
-  {"voice",		"o|o",	 (Function) cmd_voice,		NULL, LEAF},
+  {"swhois",		"n",	 (Function) cmd_swhois,		NULL, LEAF|AUTH},
+  {"topic",		"o|o",	 (Function) cmd_topic,		NULL, LEAF|AUTH},
+  {"voice",		"o|o",	 (Function) cmd_voice,		NULL, LEAF|AUTH},
   {NULL,		NULL,	 NULL,				NULL, 0}
 };
 

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

@@ -467,44 +467,17 @@ static cmd_t C_msg[] =
 static int msgc_test(char *nick, char *host, struct userrec *u, char *chname, char *par)
 {
   char *cmd = NULL;
-  int idx = -1, i = 0, chan = 0;
+  int i = 0;
 
   LOGC("TEST");
 
   cmd = newsplit(&par);
-  if (chname)
-    chan++;
-
-  for (i = 0; i < dcc_total; i++) {
-   if (dcc[i].type && dcc[i].irc && ((chan && !strcmp(dcc[i].simulbot, chname) && !strcmp(dcc[i].nick, u->handle)) || 
-      (!chan && !strcmp(dcc[i].simulbot, nick)))) {
-     putlog(LOG_DEBUG, "*", "Simul found old idx for %s/%s: %d", nick, chname, i);
-     dcc[i].simultime = now;
-     idx = i;
-     break;
-   }
-  }
 
-  if (idx < 0) {
-    idx = new_dcc(&DCC_CHAT, sizeof(struct chat_info));
-    dcc[idx].sock = serv;
-    dcc[idx].timeval = now;
-    dcc[idx].irc = 1;
-    dcc[idx].simultime = now;
-    dcc[idx].simul = 1;
-    dcc[idx].status = STAT_COLOR;
-    strcpy(dcc[idx].simulbot, chname ? chname : nick);
-    dcc[idx].u.chat->con_flags = 0;
-    strcpy(dcc[idx].u.chat->con_chan, chname ? chname : "*");
-    dcc[idx].u.chat->strip_flags = STRIP_ALL;
-    strcpy(dcc[idx].nick, u->handle);
-    strcpy(dcc[idx].host, host);
-    dcc[idx].addr = 0L;
-    dcc[idx].user = u;
-  }
-  /* rmspace(par); */
+  i = findauth(host);
 
-  check_bind_dcc(cmd, idx, par);
+  if (irc_idx(nick, host, u->handle, chname, i)) {
+    check_auth_dcc(i, cmd, par);
+  }
 
   return BIND_RET_BREAK;
 }

+ 6 - 4
src/tclhash.c

@@ -178,7 +178,7 @@ static bind_entry_t *bind_entry_lookup(bind_table_t *table, int id, const char *
 	return(entry);
 }
 
-int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback)
+static int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback)
 {
 	bind_entry_t *entry = NULL;
 
@@ -206,6 +206,7 @@ static void bind_entry_really_del(bind_table_t *table, bind_entry_t *entry)
 	free(entry);
 }
 
+#ifdef NO
 /* Modify a bind entry's flags and mask. */
 int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask)
 {
@@ -224,7 +225,6 @@ int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char
 
 	return(0);
 }
-
 /* void blah()
 {
   bind_entry_t *entry = NULL;
@@ -250,8 +250,9 @@ int bind_entry_overwrite(bind_table_t *table, int id, const char *mask, const ch
 	entry->client_data = client_data;
 	return(0);
 }
+#endif
 
-int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data)
+int bind_entry_add(bind_table_t *table, const char *flags, int cflags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data)
 {
 	bind_entry_t *entry = NULL, *old_entry = bind_entry_lookup(table, -1, mask, function_name, NULL);
 
@@ -284,6 +285,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 		entry->user_flags.match = FR_GLOBAL | FR_CHAN;
 		break_down_flags(flags, &entry->user_flags, NULL);
 	}
+        entry->cflags = cflags;
 	if (mask) entry->mask = strdup(mask);
 	if (function_name) entry->function_name = strdup(function_name);
 	entry->callback = (HashFunc) callback;
@@ -459,7 +461,7 @@ void add_builtins(const char *table_name, cmd_t *cmds)
                   cmdi++;
                 } 
 		egg_snprintf(name, sizeof name, "*%s:%s", table->name, cmds->funcname ? cmds->funcname : cmds->name);
-		bind_entry_add(table, cmds->flags, cmds->name, name, 0, cmds->func, NULL);
+		bind_entry_add(table, cmds->flags, cmds->type, cmds->name, name, 0, cmds->func, NULL);
           }
 	}
 }

+ 5 - 4
src/tclhash.h

@@ -48,6 +48,7 @@ typedef struct bind_entry_b {
 	int nhits;
         int flags;
 	int id;
+        int cflags;
 } bind_entry_t;
 
 /* This is the highest-level structure. It's like the "msg" table
@@ -72,10 +73,10 @@ bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, in
 void bind_table_del(bind_table_t *table);
 bind_table_t *bind_table_lookup(const char *name);
 bind_table_t *bind_table_lookup_or_fake(const char *name);
-int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data);
-int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback);
-int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask);
-int bind_entry_overwrite(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback, void *client_data);
+//int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, const char *function_name, int bind_flags, Function callback, void *client_data);
+//int bind_entry_del(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback);
+//int bind_entry_modify(bind_table_t *table, int id, const char *mask, const char *function_name, const char *newflags, const char *newmask);
+//int bind_entry_overwrite(bind_table_t *table, int id, const char *mask, const char *function_name, Function callback, void *client_data);
 void add_builtins(const char *table_name, cmd_t *cmds);
 void rem_builtins(const char *table_name, cmd_t *cmds);