]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Remove ipnode moving functionality.
authorGunnar Beutner <redacted>
Tue, 18 Jun 2013 06:24:11 +0000 (08:24 +0200)
committerGunnar Beutner <redacted>
Tue, 18 Jun 2013 06:24:11 +0000 (08:24 +0200)
--HG--
branch : shroudtrusts

core/hooks.h
nick/nick.c
nick/nick.h
patricianick/patricianick.c
patricianick/patricianick.h
trusts/events.c
trusts/trusts_db.c
trusts/trusts_policy.c

index 198e525f76c08086b59c85d55c9d46c059024074..e02e1db8880f4513561c891be928c6bfcd8f2672 100644 (file)
@@ -41,7 +41,6 @@
 #define HOOK_NICK_MODEOPER         307  /* Argument is void*[2] (nick, modes) */
 #define HOOK_NICK_KILL             308  /* Argument is void*[2] (nick, reason) */
 #define HOOK_NICK_MASKPRIVMSG      309  /* Argument is void*[3] (nick, target, message) ** NICK COULD BE NULL ** */
-#define HOOK_NICK_MOVENODE         310  /* Argument is void*[2] (nick, oldnode) */
 
 #define HOOK_CHANNEL_BURST         400  /* Argument is channel pointer */
 #define HOOK_CHANNEL_CREATE        401  /* Argument is void*[2] (channel, nick) */
index 05fea70cbb7dd71108501462d7a5a214d32d67f5..52d7075dc13db030173190f03e12650f29e642da 100644 (file)
@@ -370,31 +370,6 @@ char *visibleuserhost(nick *np, char *buf) {
   return buf;
 }
 
-/*
- * setipnodebits:
- *  Moves the nick to a different ipnode.
- */
-void setipnodebits(nick *np, int bits) {
-  struct irc_in_addr ipaddress;
-  patricia_node_t *oldnode;
-  void *harg[2];
-
-  if(np->ipnode->prefix->bitlen == bits)
-    return;
-
-  memcpy(&ipaddress, &np->p_nodeaddr, sizeof(ipaddress));
-  node_decrement_usercount(np->ipnode);
-  oldnode = np->ipnode;
-  np->ipnode = refnode(iptree, &ipaddress, bits);
-  node_increment_usercount(np->ipnode);
-
-  harg[0] = np;
-  harg[1] = oldnode;
-  triggerhook(HOOK_NICK_MOVENODE, harg);
-
-  derefnode(iptree, oldnode);
-}
-
 #if 0
 
 /*
index eab487b1b2ddcc1cd39d46c0ab2472f2c79f6386..7090c9de97d9c072cd5d1a5753ea9df34b3aec64 100644 (file)
@@ -200,7 +200,6 @@ int findnickext(const char *name);
 void releasenickext(int index);
 char *visiblehostmask(nick *np, char *buf);
 char *visibleuserhost(nick *np, char *buf);
-void setipnodebits(nick *np, int bits);
 
 /* nickhandlers.c functions */
 int handlenickmsg(void *source, int cargc, char **cargv);
index 91f86e549145fe486895dfe0259723ae549e8a72..9eca059ebcfe9d2705dca3b1be23f76512c4d727 100644 (file)
@@ -46,7 +46,6 @@ void _init() {
 
   registerhook(HOOK_NICK_NEWNICK, &pn_hook_newuser);
   registerhook(HOOK_NICK_LOSTNICK, &pn_hook_lostuser);
-  registerhook(HOOK_NICK_MOVENODE, &pn_hook_nodemoveuser);
 
   registercontrolhelpcmd("nodeuserlist", NO_OPER, 1, &pn_cmd_nodeuserlist, "Usage: nodeuserlist <ipv4|ipv6|cidr4|cidr6>\nLists all users on a given IP address or CIDR range.");
 }
@@ -64,7 +63,6 @@ void _fini() {
 
   deregisterhook(HOOK_NICK_NEWNICK, &pn_hook_newuser);
   deregisterhook(HOOK_NICK_LOSTNICK, &pn_hook_lostuser);
-  deregisterhook(HOOK_NICK_MOVENODE, &pn_hook_nodemoveuser);
 
   deregistercontrolcmd("nodeuserlist", &pn_cmd_nodeuserlist);
 }
@@ -148,14 +146,6 @@ void pn_hook_lostuser(int hook, void *arg) {
   deletenickfromnode(np->ipnode, np);
 }
 
-void pn_hook_nodemoveuser(int hook, void *arg) {
-  nick *np = ((void **)arg)[0];
-  patricia_node_t *oldnode = ((void **)arg)[1];
-
-  deletenickfromnode(oldnode, np);
-  addnicktonode(np->ipnode, np);
-}
-
 int pn_cmd_nodeuserlist(void *source, int cargc, char **cargv) {
   nick *np=(nick *)source;
   struct irc_in_addr sin;
index 68d34174f3e5d5d3a4544b38b43fc462156d0f9a..339c20d10880f43b042543bbf98ec6955fbf285c 100644 (file)
@@ -16,7 +16,6 @@ extern int pnick_ext;
 
 void pn_hook_newuser(int hook, void *arg);
 void pn_hook_lostuser(int hook, void *arg);
-void pn_hook_nodemoveuser(int hook, void *arg);
 
 void addnicktonode(patricia_node_t *node, nick *nick);
 void deletenickfromnode(patricia_node_t *node, nick *nick);
index d60d2a227c3f96763a586754f5718741e2c267ea..eed30b5aa54e11dc29fdb3e818d4fc16ef3684b6 100644 (file)
@@ -18,7 +18,6 @@ void trusts_newnick(nick *sender, int moving) {
   } else {
     setnextbytrust(sender, th->users);
     th->users = sender;
-    setipnodebits(sender, th->nodebits);
   }
 
   arg[0] = sender;
index 5aa8c304020a73b13c6ebaaec6d91d37441e015d..f6938a9f42a5e086865698b108fd964cc7a9f74d 100644 (file)
@@ -357,11 +357,6 @@ void tg_delete(trustgroup *tg) {
 }
 
 void th_update(trusthost *th) {
-  nick *np;
-
-  for(np=th->users;np;np=nextbytrust(np))
-    setipnodebits(np, th->nodebits);
-
   trustsdb->squery(trustsdb,
     "UPDATE ? SET maxpernode = ?, nodebits = ? WHERE id = ?",
     "Tuuu", "hosts", th->maxpernode, th->nodebits, th->id
index 74a9fe18fb7dea5f6fb0080dbdebc46ced4e9498..30c6692314159b6c298081a6c5c513a6fd48d6fb 100644 (file)
@@ -11,6 +11,8 @@ static void policycheck(int hooknum, void *arg) {
   long moving = (long)args[1];
   trusthost *th = gettrusthost(np);
   trustgroup *tg;
+  patricia_node_t *node;
+  int nodecount;
 
   if(moving)
     return;
@@ -20,7 +22,11 @@ static void policycheck(int hooknum, void *arg) {
 
   tg = th->group;
 
-  if(th->maxpernode && np->ipnode->usercount > th->maxpernode) {
+  node = refnode(iptree, &th->ip, th->nodebits);
+  nodecount = node->usercount;
+  derefnode(iptree, node);
+
+  if(th->maxpernode && nodecount > th->maxpernode) {
     controlwall(NO_OPER, NL_TRUSTS, "Hard connection limit exceeded on IP: %s (group: %s) %d connected, %d max.", IPtostr(np->p_ipaddr), tg->name->content, np->ipnode->usercount, th->maxpernode);
     return;
   }