From e5149d6169e9cf75b00c698b945c6d4ea9d0ee14 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 1 Nov 2012 06:48:08 +0000 Subject: [PATCH] Add module which restricts unauthenticated users from doing anything as channel op. --- extensions/Makefile.in | 1 + extensions/restrict-unauthenticated.c | 39 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 extensions/restrict-unauthenticated.c diff --git a/extensions/Makefile.in b/extensions/Makefile.in index dbc0ba4c..7606d1f5 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -59,6 +59,7 @@ SRCS = \ ip_cloaking_3.0.c \ ip_cloaking_4.0.c \ override.c \ + restrict-unauthenticated.c \ sno_farconnect.c \ sno_globalkline.c \ sno_globaloper.c \ diff --git a/extensions/restrict-unauthenticated.c b/extensions/restrict-unauthenticated.c new file mode 100644 index 00000000..14ffc369 --- /dev/null +++ b/extensions/restrict-unauthenticated.c @@ -0,0 +1,39 @@ +/* + * restrict unauthenticated users from doing anything as channel op + */ + +#include "stdinc.h" +#include "modules.h" +#include "hook.h" +#include "client.h" +#include "ircd.h" +#include "send.h" +#include "hash.h" +#include "s_conf.h" +#include "s_user.h" +#include "s_serv.h" +#include "numeric.h" +#include "privilege.h" +#include "s_newconf.h" + +static void hack_channel_access(void *data); + +mapi_hfn_list_av1 restrict_unauthenticated_hfnlist[] = { + { "get_channel_access", (hookfn) hack_channel_access }, + { NULL, NULL } +}; + +static void +hack_channel_access(void *vdata) +{ + hook_data_channel_approval *data = (hook_data_channel_approval *) vdata; + + if (!MyClient(data->client)) + return; + + if (EmptyString(data->client->user->suser)) + data->approved = 0; +} + +DECLARE_MODULE_AV1(restrict_unauthenticated, NULL, NULL, NULL, NULL, + restrict_unauthenticated_hfnlist, "$Revision: 3526 $");