| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 2000-2015 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 2000-2018 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 45 |
|
static void |
| 46 |
|
list_accepts(struct Client *source_p) |
| 47 |
|
{ |
| 48 |
– |
int len = 0; |
| 48 |
|
char nicks[IRCD_BUFSIZE] = ""; |
| 49 |
|
char *t = nicks; |
| 50 |
< |
const dlink_node *node = NULL; |
| 50 |
> |
dlink_node *node; |
| 51 |
|
|
| 52 |
|
/* :me.name 281 source_p->name :n1!u1@h1 n2!u2@h2 ...\r\n */ |
| 53 |
|
/* 1 23456 78 9 10 */ |
| 54 |
< |
len = strlen(me.name) + strlen(source_p->name) + 10; |
| 54 |
> |
int len = strlen(me.name) + strlen(source_p->name) + 10; |
| 55 |
|
|
| 56 |
|
DLINK_FOREACH(node, source_p->connection->acceptlist.head) |
| 57 |
|
{ |
| 90 |
|
static void |
| 91 |
|
add_accept(const struct split_nuh_item *nuh, struct Client *source_p) |
| 92 |
|
{ |
| 93 |
< |
struct split_nuh_item *const accept_p = MyCalloc(sizeof(*accept_p)); |
| 93 |
> |
struct split_nuh_item *accept_p = xcalloc(sizeof(*accept_p)); |
| 94 |
|
|
| 95 |
|
accept_p->nickptr = xstrdup(nuh->nickptr); |
| 96 |
|
accept_p->userptr = xstrdup(nuh->userptr); |
| 115 |
|
static int |
| 116 |
|
m_accept(struct Client *source_p, int parc, char *parv[]) |
| 117 |
|
{ |
| 118 |
< |
char *mask = NULL; |
| 119 |
< |
char *p = NULL; |
| 118 |
> |
struct split_nuh_item nuh; |
| 119 |
> |
struct split_nuh_item *accept_p = NULL; |
| 120 |
|
char nick[NICKLEN + 1] = ""; |
| 121 |
|
char user[USERLEN + 1] = ""; |
| 122 |
|
char host[HOSTLEN + 1] = ""; |
| 123 |
< |
struct split_nuh_item nuh; |
| 124 |
< |
struct split_nuh_item *accept_p = NULL; |
| 123 |
> |
char *p = NULL; |
| 124 |
> |
char *mask = collapse(parv[1]); |
| 125 |
|
|
| 126 |
< |
if (EmptyString(parv[1]) || !strcmp(parv[1], "*")) |
| 126 |
> |
if (EmptyString(mask) || strcmp(mask, "*") == 0) |
| 127 |
|
{ |
| 128 |
|
list_accepts(source_p); |
| 129 |
|
return 0; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
< |
for (mask = strtoken(&p, parv[1], ","); mask; |
| 133 |
< |
mask = strtoken(&p, NULL, ",")) |
| 132 |
> |
for (mask = strtok_r(mask, ",", &p); mask; |
| 133 |
> |
mask = strtok_r(NULL, ",", &p)) |
| 134 |
|
{ |
| 135 |
|
if (*mask == '-' && *++mask) |
| 136 |
|
{ |
| 155 |
|
} |
| 156 |
|
else if (*mask) |
| 157 |
|
{ |
| 158 |
< |
if (dlink_list_length(&source_p->connection->acceptlist) >= |
| 160 |
< |
ConfigGeneral.max_accept) |
| 158 |
> |
if (dlink_list_length(&source_p->connection->acceptlist) >= ConfigGeneral.max_accept) |
| 159 |
|
{ |
| 160 |
|
sendto_one_numeric(source_p, &me, ERR_ACCEPTFULL); |
| 161 |
|
return 0; |