From cbfcfa142819edc92f2ccdb9fa188d9a9fa42ada Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 6 Jun 2022 09:18:05 +0200 Subject: [PATCH] Create src/modules/rpc directory --- Makefile.in | 3 +++ configure | 3 ++- configure.ac | 1 + src/modules/Makefile.in | 2 ++ src/modules/rpc/Makefile.in | 53 +++++++++++++++++++++++++++++++++++++ src/modules/rpc/user.c | 34 ++++++++++++++++++++++++ src/modules/webserver.c | 4 +-- 7 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 src/modules/rpc/Makefile.in create mode 100644 src/modules/rpc/user.c diff --git a/Makefile.in b/Makefile.in index df3b20d80..c6d4fe84b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -218,6 +218,9 @@ install: all $(INSTALL) -m 0700 -d $(DESTDIR)@MODULESDIR@/extbans @rm -f $(DESTDIR)@MODULESDIR@/extbans/*.so 1>/dev/null 2>&1 $(INSTALL) -m 0700 src/modules/extbans/*.so $(DESTDIR)@MODULESDIR@/extbans + $(INSTALL) -m 0700 -d $(DESTDIR)@MODULESDIR@/rpc + @rm -f $(DESTDIR)@MODULESDIR@/rpc/*.so 1>/dev/null 2>&1 + $(INSTALL) -m 0700 src/modules/rpc/*.so $(DESTDIR)@MODULESDIR@/rpc @#If the conf/ssl directory exists then rename it here to conf/tls @#and add a symlink for backwards compatibility (so that f.e. certbot @#doesn't randomly fail after an upgrade to U5). diff --git a/configure b/configure index 934ef5a97..29fb1be68 100755 --- a/configure +++ b/configure @@ -8954,7 +8954,7 @@ fi -ac_config_files="$ac_config_files Makefile src/Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd" +ac_config_files="$ac_config_files Makefile src/Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile src/modules/rpc/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -9653,6 +9653,7 @@ do "src/modules/chanmodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/chanmodes/Makefile" ;; "src/modules/usermodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/usermodes/Makefile" ;; "src/modules/extbans/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/extbans/Makefile" ;; + "src/modules/rpc/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/rpc/Makefile" ;; "src/modules/third/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/third/Makefile" ;; "extras/unrealircd-upgrade-script") CONFIG_FILES="$CONFIG_FILES extras/unrealircd-upgrade-script" ;; "unrealircd") CONFIG_FILES="$CONFIG_FILES unrealircd" ;; diff --git a/configure.ac b/configure.ac index 1a22f3fa4..f6979a551 100644 --- a/configure.ac +++ b/configure.ac @@ -873,6 +873,7 @@ AC_CONFIG_FILES([Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile + src/modules/rpc/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd]) diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 97cb4803a..f46e1c9d4 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -94,6 +94,7 @@ build: $(MODULES) cd chanmodes; $(MAKE) all cd usermodes; $(MAKE) all cd extbans; $(MAKE) all + cd rpc; $(MAKE) all cd third; $(MAKE) all clean: @@ -101,6 +102,7 @@ clean: cd chanmodes; $(MAKE) clean cd usermodes; $(MAKE) clean cd extbans; $(MAKE) clean + cd rpc; $(MAKE) clean cd third; $(MAKE) clean # Generic *.so rule: diff --git a/src/modules/rpc/Makefile.in b/src/modules/rpc/Makefile.in new file mode 100644 index 000000000..82278029e --- /dev/null +++ b/src/modules/rpc/Makefile.in @@ -0,0 +1,53 @@ +#************************************************************************ +#* IRC - Internet Relay Chat, src/modules/rpc/Makefile +#* Copyright (C) Carsten V. Munk 2001 & The UnrealIRCd Team +#* +#* This program is free software; you can redistribute it and/or modify +#* it under the terms of the GNU General Public License as published by +#* the Free Software Foundation; either version 1, or (at your option) +#* any later version. +#* +#* This program is distributed in the hope that it will be useful, +#* but WITHOUT ANY WARRANTY; without even the implied warranty of +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#* GNU General Public License for more details. +#* +#* You should have received a copy of the GNU General Public License +#* along with this program; if not, write to the Free Software +#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#*/ + +CC = "==== DO NOT RUN MAKE FROM THIS DIRECTORY ====" + +INCLUDES = ../../include/channel.h \ + ../../include/common.h ../../include/config.h ../../include/dbuf.h \ + ../../include/dynconf.h ../../include/fdlist.h ../../include/h.h \ + ../../include/ircsprintf.h \ + ../../include/license.h \ + ../../include/modules.h ../../include/modversion.h ../../include/msg.h \ + ../../include/numeric.h ../../include/dns.h \ + ../../include/resource.h ../../include/setup.h \ + ../../include/struct.h ../../include/sys.h \ + ../../include/types.h \ + ../../include/version.h ../../include/whowas.h + +R_MODULES= \ + user.so + +MODULES=$(R_MODULES) +MODULEFLAGS=@MODULEFLAGS@ +RM=@RM@ + +.SUFFIXES: +.SUFFIXES: .c .h .so + +all: build + +build: $(MODULES) + +clean: + $(RM) -f *.o *.so *~ core + +%.so: %.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o $@ $< diff --git a/src/modules/rpc/user.c b/src/modules/rpc/user.c new file mode 100644 index 000000000..92ece4cf9 --- /dev/null +++ b/src/modules/rpc/user.c @@ -0,0 +1,34 @@ +/* user.* RPC calls + * (C) Copyright 2022-.. Bram Matthys (Syzop) and the UnrealIRCd team + * License: GPLv2 or later + */ + +#include "unrealircd.h" + +ModuleHeader MOD_HEADER += { + "rpc/user", + "1.0.0", + "user.* RPC calls", + "UnrealIRCd Team", + "unrealircd-6", +}; + +/* Forward declarations */ + +MOD_INIT() +{ + MARK_AS_OFFICIAL_MODULE(modinfo); + + return MOD_SUCCESS; +} + +MOD_LOAD() +{ + return MOD_SUCCESS; +} + +MOD_UNLOAD() +{ + return MOD_SUCCESS; +} diff --git a/src/modules/webserver.c b/src/modules/webserver.c index 6190c0eb7..bc5522187 100644 --- a/src/modules/webserver.c +++ b/src/modules/webserver.c @@ -400,8 +400,8 @@ int webserver_handle_request_header(Client *client, const char *readbuf, int *le if ((n <= 0) || IsDead(client)) return n; /* byebye */ - /* There could be data directly after the request header (eg for a PUT), - * check for it here so it isn't lost. + /* There could be data directly after the request header (eg for + * a POST or PUT), check for it here so it isn't lost. */ nextframe = find_end_of_request(netbuf2, totalsize, &remaining_bytes); if (nextframe)