]> jfr.im git - solanum.git/blame - extensions/extb_extgecos.c
Normalize snprintf size to use sizeof where possible
[solanum.git] / extensions / extb_extgecos.c
CommitLineData
212380e3
AC
1/*
2 * Extended extban type: bans all users with matching nick!user@host#gecos.
3 * Requested by Lockwood.
4 * - nenolod
212380e3
AC
5 */
6
7#include "stdinc.h"
8#include "modules.h"
9#include "client.h"
10#include "ircd.h"
11
eeabf33a
EM
12static const char extb_desc[] = "Extended mask ($x) extban type";
13
212380e3
AC
14static int _modinit(void);
15static void _moddeinit(void);
16static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
17
c81afd15 18DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
212380e3
AC
19
20static int
21_modinit(void)
22{
23 extban_table['x'] = eb_extended;
24
25 return 0;
26}
27
28static void
29_moddeinit(void)
30{
31 extban_table['x'] = NULL;
32}
33
34static int eb_extended(const char *data, struct Client *client_p,
35 struct Channel *chptr, long mode_type)
36{
37 char buf[BUFSIZE];
212380e3
AC
38
39 (void)chptr;
40
41 if (data == NULL)
42 return EXTBAN_INVALID;
43
57aa79ac 44 snprintf(buf, sizeof buf, "%s!%s@%s#%s",
212380e3
AC
45 client_p->name, client_p->username, client_p->host, client_p->info);
46
788e1a98 47 return match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
212380e3 48}