Просмотр исходного кода

* Port [3508] [3509] to 1.2.14
* Made 'ident-botnick' variable to decide to send username vs botnick for non-ident.



svn: 3510

Bryan Drewery 19 лет назад
Родитель
Сommit
732d17cd6b
6 измененных файлов с 13 добавлено и 4 удалено
  1. 1 0
      doc/UPDATES
  2. 1 0
      misc/help.txt
  3. 2 2
      src/dcc.c
  4. 2 1
      src/dccutil.c
  5. 6 0
      src/set.c
  6. 1 1
      src/set.h

+ 1 - 0
doc/UPDATES

@@ -57,6 +57,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Rewrote cmd_mdop into cmd_mmode. See 'help mmode' on a leaf bot.
 * Fixed bots having problems with kick/bans on undernet.
 * Added oidentd support. set 'oidentd' on makes bot spoof as BOTNICK.
+* Made 'ident-botnick' variable to decide to send username vs botnick for non-ident.
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 1 - 0
misc/help.txt

@@ -1558,6 +1558,7 @@ See also: reload, backup
 [S]  $bnick$b            The bot's preferred nickname on IRC.
 [N]  $bnotify-time$b     The number of seconds between server notify checks for nick.
 
+[B]  $bident-botnick$b   Send botnick instead of shell username on connect (non-ident)
 [B]  $boidentd$b         Make bot try and use oidentd spoofing as BOTNICK.
  
 [B]  $bdccauth$b         Boolean (0 or 1). Set to use auth checking on dcc/telnet login.

+ 2 - 2
src/dcc.c

@@ -556,8 +556,8 @@ dcc_identd(int idx, char *buf, int atr)
 {
   char outbuf[1024] = "";
 
-  simple_snprintf(outbuf, sizeof outbuf, "%s : USERID : UNIX : %s\n", buf, conf.bot->nick);
-  tputs(dcc[idx].sock, outbuf, strlen(outbuf));
+  size_t len = simple_snprintf(outbuf, sizeof outbuf, "%s : USERID : UNIX : %s\n", buf, botuser);
+  tputs(dcc[idx].sock, outbuf, len);
 
   /* just close it, functions neededing it will open it. */
   identd_close();

+ 2 - 1
src/dccutil.c

@@ -12,6 +12,7 @@
 #include <sys/stat.h>
 #include "common.h"
 #include "color.h"
+#include "chanprog.h"
 #include "userrec.h"
 #include "dcc.h"
 #include "auth.h"
@@ -965,7 +966,7 @@ identd_open()
 
     FILE *f = fopen(oidentd_conf, "w");
     if (f) {
-      fprintf(f, "global { reply \"%s\" }\n", conf.bot->nick);
+      fprintf(f, "global { reply \"%s\" }\n", origbotname);
       fclose(f);
     }
   }

+ 6 - 0
src/set.c

@@ -11,6 +11,7 @@
 #include "chanprog.h"
 #include "match.h"
 #include "misc.h"
+#include "net.h"
 #include "src/mod/server.mod/server.h"
 #include "src/mod/channels.mod/channels.h"
 #include "src/mod/ctcp.mod/ctcp.h"
@@ -27,6 +28,7 @@ char auth_key[51] = "";
 char auth_prefix[2] = "";
 bool auth_obscure;
 bool oidentd;
+bool ident_botnick;
 int dcc_autoaway;
 #ifdef NOT_USED
 int badprocess = DET_IGNORE;
@@ -80,6 +82,7 @@ static variable_t vars[] = {
  VAR("fork-interval",	&fork_interval,		VAR_INT,					10, 0, "0"),
  VAR("hijack",		&hijack,		VAR_INT|VAR_DETECTED|VAR_PERM,			0, 4, "die"),
  VAR("homechan",	homechan,		VAR_STRING|VAR_NOLOC|VAR_HIDE,			0, 0, NULL),
+ VAR("ident-botnick",   &ident_botnick,		VAR_INT|VAR_BOOL|VAR_NOLHUB,			0, 1, "0"),
  VAR("in-bots",		&in_bots,		VAR_INT|VAR_NOLOC,				1, MAX_BOTS, "2"),
  VAR("notify-time",	&ison_time,		VAR_INT|VAR_NOLHUB,				1, 30, "10"),
  VAR("kill-threshold",	&kill_threshold,	VAR_INT|VAR_NOLOC,				0, 0, "0"),
@@ -262,6 +265,9 @@ sdprintf("var (mem): %s -> %s", var->name, datain ? datain : "(NULL)");
       num = 1;
 
     *(bool *) (var->mem) = num;
+
+    if (!strcmp(var->name, "ident-botnick"))
+      strlcpy(botuser, conf.username && !num ? conf.username : origbotname, 21);
   } else if (var->flags & VAR_STRING) {
     if (data)
       strlcpy((char *) var->mem, data, var->size);

+ 1 - 1
src/set.h

@@ -65,7 +65,7 @@ typedef struct rate_b {
 extern char		auth_key[], auth_prefix[2], motd[], *def_chanset, alias[],
 			msgident[], msginvite[], msgop[], msgpass[],
                         homechan[];
-extern bool		dccauth, auth_obscure, offensive_bans, manop_warn, auth_chan, oidentd;
+extern bool		dccauth, auth_obscure, offensive_bans, manop_warn, auth_chan, oidentd, ident_botnick;
 extern int		cloak_script, fight_threshold, fork_interval, in_bots, set_noshare, dcc_autoaway,
 			kill_threshold, lag_threshold, op_bots, hijack, login, promisc, trace,
                         ison_time;