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

* Delay leaf linking to localhub until it has received a userfile

This will likely cause grief later as it will increase segmentation.
Allowing child bots to link directly to hubs would help a lot, but
then the hub restrict-telnet will need revising.
Bryan Drewery 16 лет назад
Родитель
Сommit
3ac164cdc8
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      src/dcc.c

+ 9 - 3
src/dcc.c

@@ -222,9 +222,15 @@ greet_new_bot(int idx)
   dcc[idx].u.bot->version[0] = 0;
   dcc[idx].u.bot->sysname[0] = 0;
   dcc[idx].u.bot->numver = 0;
-  if ((conf.bot->hub || conf.bot->localhub) && dcc[idx].user && (!(dcc[idx].user->flags & USER_OP))) {
-    putlog(LOG_BOTS, "*", "Rejecting link from %s", dcc[idx].nick);
-    dprintf(idx, "error You are being rejected.\n");
+  // Reject -o bots, and if we're a localhub who hasnt linked to hub yet, dont allow links in
+  if ((conf.bot->hub || conf.bot->localhub) && dcc[idx].user && (!(dcc[idx].user->flags & USER_OP) || (conf.bot->localhub && !have_linked_to_hub))) {
+    if (!(dcc[idx].user->flags & USER_OP)) {
+      putlog(LOG_BOTS, "*", "Rejecting link from %s", dcc[idx].nick);
+      dprintf(idx, "error You are being rejected.\n");
+    } else if (conf.bot->localhub && !have_linked_to_hub) {
+      putlog(LOG_BOTS, "*", "Delaying link from %s", dcc[idx].nick);
+      dprintf(idx, "error Delaying your link until I get userfile.\n");
+    }
     dprintf(idx, "bye\n");
     killsock(dcc[idx].sock);
     lostdcc(idx);