#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <stdio.h>
#include "../lib/sstring.h"
if(!th) {
trustgroup *tg;
- tg = tglist;
for(tg=tglist;tg;tg=tg->next) {
th = tg->hosts;
if(th)
if(th->next) {
th = th->next;
} else {
- if(!th->group->next)
+ trustgroup *tg = th->group;
+
+ do {
+ tg = tg->next;
+ } while (tg && !tg->hosts);
+
+ if(!tg)
return NULL;
- th = th->group->next->hosts;
+
+ th = tg->hosts;
}
- if(!th || th->parent == orig)
+ if(th->parent == orig)
return th;
}
}
}
for(tg=tglist;tg;tg=tg->next)
- if(!strcmp(name, tg->name->content))
+ if(!strcasecmp(name, tg->name->content))
return tg;
return NULL;
}
void th_adjusthosts(trusthost *th, trusthost *superset, trusthost *subset) {
+ struct irc_in_addr ipaddress_canonical;
+
/*
* First and foremost, CIDR doesn't allow hosts to cross boundaries, i.e. everything with a smaller prefix
* is entirely contained with the prefix that is one smaller.
nick *np, *nnp;
for(np=superset->users;np;np=nnp) {
nnp = nextbytrust(np);
- if(ipmask_check(&np->p_nodeaddr, &th->ip, th->bits)) {
+ ip_canonicalize_tunnel(&ipaddress_canonical, &np->ipaddress);
+ if(ipmask_check(&ipaddress_canonical, &th->ip, th->bits)) {
trusts_lostnick(np, 1);
trusts_newnick(np, 1);
}
nick *np;
int i;
- for(i=0;i<NICKHASHSIZE;i++)
- for(np=nicktable[i];np;np=np->next)
- if(!gettrusthost(np) && ipmask_check(&np->p_nodeaddr, &th->ip, th->bits))
+ for(i=0;i<NICKHASHSIZE;i++) {
+ for(np=nicktable[i];np;np=np->next) {
+ ip_canonicalize_tunnel(&ipaddress_canonical, &np->ipaddress);
+ if(!gettrusthost(np) && ipmask_check(&ipaddress_canonical, &th->ip, th->bits))
trusts_newnick(np, 1);
+ }
+ }
}
}
/* id remains the same, count/hosts/marker/next/exts are ignored */
vnewtg.trustedfor = newtg->trustedfor;
- vnewtg.mode = newtg->mode;
+ vnewtg.flags = newtg->flags;
vnewtg.maxperident = newtg->maxperident;
vnewtg.maxusage = newtg->maxusage;
vnewtg.expires = newtg->expires;