-aConfItem *make_conf(void)
-{
- Reg1 aConfItem *aconf;
-
- aconf = (struct ConfItem *)RunMalloc(sizeof(aConfItem));
-#ifdef DEBUGMODE
- aconfs.inuse++;
-#endif
- memset(&aconf->ipnum, 0, sizeof(struct in_addr));
- aconf->next = NULL;
- aconf->host = aconf->passwd = aconf->name = NULL;
- aconf->status = CONF_ILLEGAL;
- aconf->clients = 0;
- aconf->port = 0;
- aconf->hold = 0;
- aconf->confClass = NULL;
- return (aconf);
-}
-
-void delist_conf(aConfItem *aconf)
-{
- if (aconf == conf)
- conf = conf->next;
- else
- {
- aConfItem *bconf;
-
- for (bconf = conf; aconf != bconf->next; bconf = bconf->next);
- bconf->next = aconf->next;
- }
- aconf->next = NULL;
-}
-
-void free_conf(aConfItem *aconf)
-{
- del_queries((char *)aconf);
- RunFree(aconf->host);
- if (aconf->passwd)
- memset(aconf->passwd, 0, strlen(aconf->passwd));
- RunFree(aconf->passwd);
- RunFree(aconf->name);
- RunFree(aconf);
-#ifdef DEBUGMODE
- aconfs.inuse--;
-#endif
- return;
-}
-
-aGline *make_gline(int is_ipmask, char *host, char *reason,
- char *name, time_t expire)
-{
- Reg4 aGline *agline;
-#ifdef BADCHAN
- int gtype=0;
- if(*host == '#' || *host == '&' || *host == '+')
- gtype=1; /* BAD CHANNEL GLINE */
-#endif
-
- agline = (struct Gline *)RunMalloc(sizeof(aGline)); /* alloc memory */
- DupString(agline->host, host); /* copy vital information */
- DupString(agline->reason, reason);
- DupString(agline->name, name);
- agline->expire = expire;
- agline->gflags = GLINE_ACTIVE; /* gline is active */
- if (is_ipmask)
- SetGlineIsIpMask(agline);
-
-#ifdef BADCHAN
- if(gtype)
- { agline->next = badchan; /* link it into the list */
- return (badchan = agline);
- }
-#endif
- agline->next = gline; /* link it into the list */
- return (gline = agline);
-}
-
-aGline *find_gline(aClient *cptr, aGline **pgline)
-{
- Reg3 aGline *agline = gline, *a2gline = NULL;
-
- while (agline)
- { /* look through all glines */
- if (agline->expire <= TStime())
- { /* handle expired glines */
- free_gline(agline, a2gline);
- agline = a2gline ? a2gline->next : gline;
- if (!agline)
- break; /* agline == NULL means gline == NULL */
- continue;
- }
-
- /* Does gline match? */
- /* Added a check against the user's IP address as well -Kev */
- if ((GlineIsIpMask(agline) ?
- match(agline->host, inetntoa(cptr->ip)) :
- match(agline->host, cptr->sockhost)) == 0 &&
- match(agline->name, cptr->user->username) == 0)
- {
- if (pgline)
- *pgline = a2gline; /* If they need it, give them the previous gline
- entry (probably for free_gline, below) */
- return agline;
- }
-
- a2gline = agline;
- agline = agline->next;
- }
-
- return NULL; /* found no glines */
-}
-
-void free_gline(aGline *agline, aGline *pgline)
-{
- if (pgline)
- pgline->next = agline->next; /* squeeze agline out */
- else
- {
-#ifdef BADCHAN
- if(*agline->host =='#' || *agline->host == '&' || *agline->host == '+')
- {
- badchan = agline->next;
- }
- else
-#endif
- gline = agline->next;
- }
-
- RunFree(agline->host); /* and free up the memory */
- RunFree(agline->reason);
- RunFree(agline->name);
- RunFree(agline);
-}
-
-#ifdef BADCHAN
-int bad_channel(char *name)
-{ aGline *agline;
-
- agline=badchan;
- while(agline)
- {
- if ((agline->gflags&GLINE_ACTIVE) && (agline->expire >TStime()) &&
- !mmatch(agline->host,name))
- { return 1;
- }
- agline=agline->next;
- }
- return 0;
-}
-#endif
-
-#ifdef DEBUGMODE
-void send_listinfo(aClient *cptr, char *name)