# arch-tag: automatic-ChangeLog--srvx@srvx.net--2005-srvx/srvx--devo--1.3
#
+2005-10-13 02:20:55 GMT Michael Poole <mdpoole@troilus.org> patch-30
+
+ Summary:
+ Default ?block (etc) to G-line by IP; fix a buffer issue.
+ Revision:
+ srvx--devo--1.3--patch-30
+
+ src/opserv.c (opserv_block): Rewrite to block by IP rather than
+ hostname.
+ (opserv_new_user_check): Avoid overrunning the target buffer.
+
+ modified files:
+ ChangeLog src/opserv.c
+
+
2005-10-08 14:56:31 GMT Michael Poole <mdpoole@troilus.org> patch-29
Summary:
static struct gline *
opserv_block(struct userNode *target, char *src_handle, char *reason, unsigned long duration)
{
- char *mask;
- mask = alloca(MAXLEN);
- snprintf(mask, MAXLEN, "*@%s", target->hostname);
- if (!reason) {
- reason = alloca(MAXLEN);
- snprintf(reason, MAXLEN, "G-line requested by %s.", src_handle);
- }
- if (!duration) duration = opserv_conf.block_gline_duration;
+ char mask[IRC_NTOP_MAX_SIZE+3] = { '*', '@', '\0' };
+ irc_ntop(mask + 2, sizeof(mask) - 2, &target->ip);
+ if (!reason)
+ snprintf(reason = alloca(MAXLEN), MAXLEN,
+ "G-line requested by %s.", src_handle);
+ if (!duration)
+ duration = opserv_conf.block_gline_duration;
return gline_add(src_handle, mask, duration, reason, now, 1);
}
for (nn=0; nn<ohi->clients.used; nn++)
send_message(ohi->clients.list[nn], opserv, "OSMSG_CLONE_WARNING");
} else if (ohi->clients.used > limit) {
- char target[18];
- sprintf(target, "*@%s", addr);
+ char target[IRC_NTOP_MAX_SIZE + 3] = { '*', '@', '\0' };
+ strcpy(target + 2, addr);
gline_add(opserv->nick, target, opserv_conf.clone_gline_duration, "AUTO Excessive connections from a single host.", now, 1);
}
}