nick **nh;
char *fakehost;
char *accountts;
+ struct irc_in_addr ipaddress;
if (cargc==2) { /* rename */
/* Nyklon 1017697578 */
Error("nick",ERR_WARNING,"Received NICK with invalid numeric %s from %s.",cargv[cargc-2],sender);
return CMD_ERROR;
}
-
+
+ base64toip(cargv[cargc-3], &ipaddress);
+ if (!irc_in_addr_valid(&ipaddress)) {
+ Error("nick",ERR_ERROR,"Received NICK with invalid ipaddress for %s from %s.",cargv[0],sender);
+ return CMD_ERROR;
+ }
+
/* At this stage the nick is cleared to proceed */
np=newnick();
strncpy(np->nick,cargv[0],NICKLEN);
np->nextbyrealname=np->realname->nicks;
np->realname->nicks=np;
np->timestamp=timestamp;
- np->ipaddress=numerictolong(cargv[cargc-3],6);
+
+ base64toip(cargv[cargc-3], &ipaddress);
+ /* todo: use a single node for /64 prefixes */
+ np->ipnode = refnode(iptree, &ipaddress, irc_in_addr_is_ipv4(&ipaddress) ? PATRICIA_MAXBITS : 64);
+
np->shident=NULL;
np->sethost=NULL;
np->umodes=0;
target->authname[ACCOUNTLEN]='\0';
triggerhook(HOOK_NICK_ACCOUNT, (void *)target);
-
+
return CMD_OK;
}