| 126 |
|
static char star[] = "*"; |
| 127 |
|
|
| 128 |
|
if (EmptyString(s)) |
| 129 |
< |
return (star); |
| 129 |
> |
return star; |
| 130 |
|
|
| 131 |
|
for (; *s; ++s) |
| 132 |
|
{ |
| 137 |
|
} |
| 138 |
|
} |
| 139 |
|
|
| 140 |
< |
return (str); |
| 140 |
> |
return str; |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
/* |
| 150 |
|
int |
| 151 |
|
add_id(struct Client *client_p, struct Channel *chptr, char *banid, int type) |
| 152 |
|
{ |
| 153 |
< |
dlink_list *list; |
| 154 |
< |
dlink_node *ban; |
| 153 |
> |
dlink_list *list = NULL; |
| 154 |
> |
dlink_node *ban = NULL; |
| 155 |
|
size_t len = 0; |
| 156 |
< |
struct Ban *actualBan; |
| 156 |
> |
struct Ban *ban_p = NULL; |
| 157 |
|
unsigned int num_mask; |
| 158 |
< |
char *name = NULL, *user = NULL, *host = NULL; |
| 158 |
> |
char name[NICKLEN]; |
| 159 |
> |
char user[USERLEN + 1]; |
| 160 |
> |
char host[HOSTLEN + 1]; |
| 161 |
> |
struct split_nuh_item nuh; |
| 162 |
|
|
| 163 |
|
/* dont let local clients overflow the b/e/I lists */ |
| 164 |
|
if (MyClient(client_p)) |
| 177 |
|
collapse(banid); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
< |
split_nuh(check_string(banid), &name, &user, &host); |
| 180 |
> |
nuh.nuhmask = check_string(banid); |
| 181 |
> |
nuh.nickptr = name; |
| 182 |
> |
nuh.userptr = user; |
| 183 |
> |
nuh.hostptr = host; |
| 184 |
> |
|
| 185 |
> |
nuh.nicksize = sizeof(name); |
| 186 |
> |
nuh.usersize = sizeof(user); |
| 187 |
> |
nuh.hostsize = sizeof(host); |
| 188 |
> |
|
| 189 |
> |
split_nuh(&nuh); |
| 190 |
|
|
| 191 |
|
/* |
| 192 |
< |
* Assemble a n!u@h and print it back to banid for sending |
| 192 |
> |
* Re-assemble a new n!u@h and print it back to banid for sending |
| 193 |
|
* the mode to the channel. |
| 194 |
|
*/ |
| 195 |
|
len = ircsprintf(banid, "%s!%s@%s", name, user, host); |
| 214 |
|
|
| 215 |
|
DLINK_FOREACH(ban, list->head) |
| 216 |
|
{ |
| 217 |
< |
actualBan = ban->data; |
| 218 |
< |
if (!irccmp(actualBan->name, name) && |
| 219 |
< |
!irccmp(actualBan->username, user) && |
| 220 |
< |
!irccmp(actualBan->host, host)) |
| 217 |
> |
ban_p = ban->data; |
| 218 |
> |
if (!irccmp(ban_p->name, name) && |
| 219 |
> |
!irccmp(ban_p->username, user) && |
| 220 |
> |
!irccmp(ban_p->host, host)) |
| 221 |
|
{ |
| 210 |
– |
MyFree(name); |
| 211 |
– |
MyFree(user); |
| 212 |
– |
MyFree(host); |
| 222 |
|
return 0; |
| 223 |
|
} |
| 224 |
|
} |
| 225 |
|
|
| 226 |
< |
actualBan = BlockHeapAlloc(ban_heap); |
| 227 |
< |
actualBan->when = CurrentTime; |
| 228 |
< |
actualBan->name = name; |
| 229 |
< |
actualBan->username = user; |
| 230 |
< |
actualBan->host = host; |
| 231 |
< |
actualBan->len = len-2; /* -2 for @ and ! */ |
| 232 |
< |
actualBan->type = parse_netmask(host, &actualBan->addr, &actualBan->bits); |
| 226 |
> |
ban_p = BlockHeapAlloc(ban_heap); |
| 227 |
> |
|
| 228 |
> |
DupString(ban_p->name, name); |
| 229 |
> |
DupString(ban_p->username, user); |
| 230 |
> |
DupString(ban_p->host, host); |
| 231 |
> |
|
| 232 |
> |
ban_p->when = CurrentTime; |
| 233 |
> |
ban_p->len = len - 2; /* -2 for @ and ! */ |
| 234 |
> |
ban_p->type = parse_netmask(host, &ban_p->addr, &ban_p->bits); |
| 235 |
|
|
| 236 |
|
if (IsClient(client_p)) |
| 237 |
|
{ |
| 238 |
< |
actualBan->who = |
| 239 |
< |
MyMalloc(strlen(client_p->name) + |
| 240 |
< |
strlen(client_p->username) + |
| 241 |
< |
strlen(client_p->host) + 3); |
| 242 |
< |
ircsprintf(actualBan->who, "%s!%s@%s", |
| 232 |
< |
client_p->name, client_p->username, client_p->host); |
| 238 |
> |
ban_p->who = MyMalloc(strlen(client_p->name) + |
| 239 |
> |
strlen(client_p->username) + |
| 240 |
> |
strlen(client_p->host) + 3); |
| 241 |
> |
ircsprintf(ban_p->who, "%s!%s@%s", client_p->name, |
| 242 |
> |
client_p->username, client_p->host); |
| 243 |
|
} |
| 244 |
|
else |
| 245 |
< |
DupString(actualBan->who, client_p->name); |
| 245 |
> |
DupString(ban_p->who, client_p->name); |
| 246 |
|
|
| 247 |
< |
dlinkAdd(actualBan, &actualBan->node, list); |
| 247 |
> |
dlinkAdd(ban_p, &ban_p->node, list); |
| 248 |
|
|
| 249 |
|
return 1; |
| 250 |
|
} |
| 262 |
|
dlink_list *list; |
| 263 |
|
dlink_node *ban; |
| 264 |
|
struct Ban *banptr; |
| 265 |
< |
char *name = NULL, *user = NULL, *host = NULL; |
| 265 |
> |
char name[NICKLEN]; |
| 266 |
> |
char user[USERLEN + 1]; |
| 267 |
> |
char host[HOSTLEN + 1]; |
| 268 |
> |
struct split_nuh_item nuh; |
| 269 |
|
|
| 270 |
|
if (banid == NULL) |
| 271 |
|
return 0; |
| 272 |
|
|
| 273 |
< |
split_nuh(check_string(banid), &name, &user, &host); |
| 273 |
> |
nuh.nuhmask = check_string(banid); |
| 274 |
> |
nuh.nickptr = name; |
| 275 |
> |
nuh.userptr = user; |
| 276 |
> |
nuh.hostptr = host; |
| 277 |
> |
|
| 278 |
> |
nuh.nicksize = sizeof(name); |
| 279 |
> |
nuh.usersize = sizeof(user); |
| 280 |
> |
nuh.hostsize = sizeof(host); |
| 281 |
> |
|
| 282 |
> |
split_nuh(&nuh); |
| 283 |
|
|
| 284 |
|
/* |
| 285 |
< |
* Assemble a n!u@h and print it back to banid for sending |
| 285 |
> |
* Re-assemble a new n!u@h and print it back to banid for sending |
| 286 |
|
* the mode to the channel. |
| 287 |
|
*/ |
| 288 |
|
ircsprintf(banid, "%s!%s@%s", name, user, host); |
| 303 |
|
default: |
| 304 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 305 |
|
"del_id() called with unknown ban type %d!", type); |
| 306 |
< |
MyFree(name); |
| 285 |
< |
MyFree(user); |
| 286 |
< |
MyFree(host); |
| 287 |
< |
return(0); |
| 306 |
> |
return 0; |
| 307 |
|
} |
| 308 |
|
|
| 309 |
|
DLINK_FOREACH(ban, list->head) |
| 311 |
|
banptr = ban->data; |
| 312 |
|
|
| 313 |
|
if (!irccmp(name, banptr->name) && |
| 314 |
< |
!irccmp(user, banptr->username) && |
| 315 |
< |
!irccmp(host, banptr->host)) |
| 314 |
> |
!irccmp(user, banptr->username) && |
| 315 |
> |
!irccmp(host, banptr->host)) |
| 316 |
|
{ |
| 317 |
|
remove_ban(banptr, list); |
| 299 |
– |
MyFree(name); |
| 300 |
– |
MyFree(user); |
| 301 |
– |
MyFree(host); |
| 318 |
|
return 1; |
| 319 |
|
} |
| 320 |
|
} |
| 321 |
|
|
| 306 |
– |
MyFree(name); |
| 307 |
– |
MyFree(user); |
| 308 |
– |
MyFree(host); |
| 322 |
|
return 0; |
| 323 |
|
} |
| 324 |
|
|