diff options
-rwxr-xr-x | configure | 52 | ||||
-rw-r--r-- | docs/conf/modules.conf.example | 11 | ||||
-rw-r--r-- | make/check_epoll.cpp | 1 | ||||
-rw-r--r-- | make/check_eventfd.cpp | 2 | ||||
-rw-r--r-- | make/check_kqueue.cpp | 26 | ||||
-rw-r--r-- | make/check_stdint.cpp | 25 | ||||
-rw-r--r-- | make/check_strlcpy.cpp | 25 | ||||
-rw-r--r-- | make/gnutlscert.pm | 13 | ||||
-rw-r--r-- | make/opensslcert.pm | 5 | ||||
-rw-r--r-- | make/template/main.mk | 7 | ||||
-rw-r--r-- | make/template/org.inspircd.plist | 4 | ||||
-rw-r--r-- | make/utilities.pm | 3 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_kill.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nationalchars.cpp | 19 | ||||
-rw-r--r-- | win/CMakeLists.txt | 4 | ||||
-rw-r--r-- | win/inspircd_win32wrapper.h | 7 |
17 files changed, 144 insertions, 64 deletions
@@ -257,7 +257,8 @@ if ($config{OSNAME} =~ /darwin/i) elsif ($config{OSNAME} =~ /freebsd/i) { chomp(my $fbsd_version = `uname -r`); - $config{CC} = $fbsd_version ge '10.0' ? 'clang++' : 'g++'; + $fbsd_version =~ s/^(\d+\.\d+).*/$1/g; + $config{CC} = $fbsd_version >= 10.0 ? 'clang++' : 'g++'; } else { @@ -352,51 +353,16 @@ $exec = $config{CC} . " -dumpversion | cut -c 3"; chomp($config{GCCMINOR} = `$exec`); printf "Checking if stdint.h exists... "; -$config{HAS_STDINT} = "true"; -our $fail = 0; -open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false"; -if ($config{HAS_STDINT} eq "true") { - close(STDINT); -} -print "yes\n" if $config{HAS_STDINT} eq "true"; -print "no\n" if $config{HAS_STDINT} eq "false"; +$config{HAS_STDINT} = test_compile('stdint'); +print $config{HAS_STDINT} ? "yes\n" : "no\n"; printf "Checking if strlcpy exists... "; -# Perform the strlcpy() test.. -$config{HAS_STRLCPY} = "false"; -$fail = 0; -open(STRLCPY, "</usr/include/string.h") or $fail = 1; -if (!$fail) { - while (defined(my $line = <STRLCPY>)) { - chomp($line); - # try and find the delcaration of: - # size_t strlcpy(...) - if ($line =~ /size_t(\0x9|\s)+strlcpy/) { - $config{HAS_STRLCPY} = "true"; - } - } - close(STRLCPY); -} -print "yes\n" if $config{HAS_STRLCPY} eq "true"; -print "no\n" if $config{HAS_STRLCPY} eq "false"; +$config{HAS_STRLCPY} = test_compile('strlcpy'); +print $config{HAS_STRLCPY} ? "yes\n" : "no\n"; printf "Checking if kqueue exists... "; -$has_kqueue = 0; -$fail = 0; -open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1; -if (!$fail) { - while (defined(my $line = <KQUEUE>)) { - chomp($line); - # try and find the delcaration of: - # int kqueue(void); - if ($line =~ /int(\0x9|\s)+kqueue/) { - $has_kqueue = 1; - } - } - close(KQUEUE); -} -print "yes\n" if $has_kqueue == 1; -print "no\n" if $has_kqueue == 0; +$has_kqueue = test_compile('kqueue'); +print $has_kqueue ? "yes\n" : "no\n"; printf "Checking for epoll support... "; $has_epoll = test_compile('epoll'); @@ -1008,7 +974,7 @@ EOF for my $var (qw( CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR DATA_DIR UID - STARTSCRIPT DESTINATION SOCKETENGINE + STARTSCRIPT DESTINATION SOCKETENGINE LOG_DIR )) { s/\@$var\@/$config{$var}/g; } diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 32701f0c4..364c30a14 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1148,10 +1148,13 @@ # 2) Allows using custom (national) casemapping over the network. #<module name="m_nationalchars.so"> # -# file - filename of existing file in "locales" directory -# casemapping - custom value for 005 numeric (if you want it to be -# different from the filename). Set this to the name of -# the locale if you are specifying an absolute path. +# file - Location of the file which contains casemapping rules. If this +# is a relative path then it is relative to "<PWD>/../locales" +# on UNIX and "<PWD>/locales" on Windows. +# casemapping - The name of the casemapping sent to clients in the 005 +# numeric. If this is not set then it defaults to the name +# of the casemapping file unless the file name contains a +# space in which case you will have to specify it manually. #<nationalchars file="bynets/russian-w1251-charlink" casemapping="ru_RU.cp1251-charlink"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# diff --git a/make/check_epoll.cpp b/make/check_epoll.cpp index 918d3907e..a5ed1c10b 100644 --- a/make/check_epoll.cpp +++ b/make/check_epoll.cpp @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org> * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public diff --git a/make/check_eventfd.cpp b/make/check_eventfd.cpp index 980d04485..9b38b793b 100644 --- a/make/check_eventfd.cpp +++ b/make/check_eventfd.cpp @@ -1,6 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2012 William Pitcock <nenolod@dereferenced.org> + * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org> * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public diff --git a/make/check_kqueue.cpp b/make/check_kqueue.cpp new file mode 100644 index 000000000..6034253df --- /dev/null +++ b/make/check_kqueue.cpp @@ -0,0 +1,26 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2015 Peter Powell <petpow@saberuk.com> + * + * This file is part of InspIRCd. InspIRCd 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, version 2. + * + * 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, see <http://www.gnu.org/licenses/>. + */ + + +#include <sys/types.h> +#include <sys/event.h> + +int main() { + int fd = kqueue(); + return (fd < 0); +} diff --git a/make/check_stdint.cpp b/make/check_stdint.cpp new file mode 100644 index 000000000..fbd01b80d --- /dev/null +++ b/make/check_stdint.cpp @@ -0,0 +1,25 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2015 Peter Powell <petpow@saberuk.com> + * + * This file is part of InspIRCd. InspIRCd 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, version 2. + * + * 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, see <http://www.gnu.org/licenses/>. + */ + + +#include <stdint.h> + +int main() { + uint32_t ret = 0; + return ret; +} diff --git a/make/check_strlcpy.cpp b/make/check_strlcpy.cpp new file mode 100644 index 000000000..e51d18d40 --- /dev/null +++ b/make/check_strlcpy.cpp @@ -0,0 +1,25 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2015 Peter Powell <petpow@saberuk.com> + * + * This file is part of InspIRCd. InspIRCd 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, version 2. + * + * 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, see <http://www.gnu.org/licenses/>. + */ + + +#include <string.h> + +int main() { + char test[5]; + strlcpy(test, "test", sizeof(test)); +} diff --git a/make/gnutlscert.pm b/make/gnutlscert.pm index 1204369a9..2c46e0e63 100644 --- a/make/gnutlscert.pm +++ b/make/gnutlscert.pm @@ -29,9 +29,16 @@ use Exporter 'import'; use make::configure; our @EXPORT = qw(make_gnutls_cert); +# On OS X the GnuTLS certtool is prefixed to avoid collision with the system certtool. +my $certtool = $^O eq 'darwin' ? 'gnutls-certtool' : 'certtool'; sub make_gnutls_cert() { + if (system "$certtool --version >/dev/null 2>&1") + { + print "\e[1;31mError:\e[0m unable to find '$certtool' in the PATH!\n"; + return 1; + } open (FH, ">certtool.template"); my $timestr = time(); my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com'); @@ -133,12 +140,6 @@ ocsp_signing_key time_stamping_key __END__ close(FH); -my $certtool = "certtool"; -if (`uname -s` eq "Darwin\n") { - # On OS X the certtool binary name is different to prevent - # collisions with the system certtool from NSS. - $certtool = "gnutls-certtool"; -} if ( (my $status = system("$certtool --generate-privkey --outfile key.pem")) ne 0) { return 1; } if ( (my $status = system("$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template")) ne 0) { return 1; } unlink("certtool.template"); diff --git a/make/opensslcert.pm b/make/opensslcert.pm index b8c9d164f..1bf27df15 100644 --- a/make/opensslcert.pm +++ b/make/opensslcert.pm @@ -32,6 +32,11 @@ our @EXPORT = qw(make_openssl_cert); sub make_openssl_cert() { + if (system 'openssl version >/dev/null 2>&1') + { + print "\e[1;31mCertificate generation failed:\e[0m unable to find 'openssl' in the PATH!\n"; + return; + } open (FH, ">openssl.template"); my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com'); my $email = promptstring_s('What email address can you be contacted at?', 'example@example.com'); diff --git a/make/template/main.mk b/make/template/main.mk index d5705d928..fa2375ac1 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -42,6 +42,7 @@ PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS) BASE = "$(DESTDIR)@BASE_DIR@" CONPATH = "$(DESTDIR)@CONFIG_DIR@" MODPATH = "$(DESTDIR)@MODULE_DIR@" +LOGPATH = "$(DESTDIR)@LOG_DIR@" DATPATH = "$(DESTDIR)@DATA_DIR@" BINPATH = "$(DESTDIR)@BINARY_DIR@" INSTALL = install @@ -220,8 +221,8 @@ install: target exit 1; \ fi @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE) - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/data - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/logs + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules @@ -313,4 +314,6 @@ help: @echo ' deinstall Removes the files created by "make install"' @echo +.NOTPARALLEL: + .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall squeakyclean configureclean help diff --git a/make/template/org.inspircd.plist b/make/template/org.inspircd.plist index 2656d1df3..4dac209f6 100644 --- a/make/template/org.inspircd.plist +++ b/make/template/org.inspircd.plist @@ -21,6 +21,10 @@ </array> <key>ServiceIPC</key> <false/> + <key>StandardOutPath</key> + <string>@LOG_DIR@/launchd-stdout.log</string> + <key>StandardErrorPath</key> + <string>@LOG_DIR@/launchd-stderr.log</string> <key>UserName</key> <string>ircdaemon</string> </dict> diff --git a/make/utilities.pm b/make/utilities.pm index ae16ce3dc..baba584ad 100644 --- a/make/utilities.pm +++ b/make/utilities.pm @@ -29,6 +29,7 @@ use warnings FATAL => qw(all); use Exporter 'import'; use POSIX; +use File::Temp; use Getopt::Long; use Fcntl; our @EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs pkgconfig_check_version translate_functions promptstring); @@ -404,7 +405,7 @@ sub translate_functions($$) my $tmpfile; do { - $tmpfile = tmpnam(); + $tmpfile = File::Temp::tmpnam(); } until sysopen(TF, $tmpfile, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0700); print "(Created and executed \e[1;32m$tmpfile\e[0m)\n"; print TF $1; diff --git a/src/channels.cpp b/src/channels.cpp index 9f1eafd0c..6802e3d7d 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -412,7 +412,7 @@ Channel* Channel::ForceChan(Channel* Ptr, User* user, const std::string &privs, if (IS_LOCAL(user)) { - if (Ptr->topicset) + if (!Ptr->topic.empty()) { user->WriteNumeric(RPL_TOPIC, "%s %s :%s", user->nick.c_str(), Ptr->name.c_str(), Ptr->topic.c_str()); user->WriteNumeric(RPL_TOPICTIME, "%s %s %s %lu", user->nick.c_str(), Ptr->name.c_str(), Ptr->setby.c_str(), (unsigned long)Ptr->topicset); diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 17c8a76a0..99ac39d42 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -134,7 +134,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User u->Write(":%s KILL %s :%s!%s!%s (%s)", ServerInstance->Config->HideKillsServer.empty() ? user->GetFullHost().c_str() : ServerInstance->Config->HideKillsServer.c_str(), u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), - user->dhost.c_str(), + ServerInstance->Config->HideKillsServer.empty() ? user->dhost.c_str() : ServerInstance->Config->HideKillsServer.c_str(), ServerInstance->Config->HideKillsServer.empty() ? user->nick.c_str() : ServerInstance->Config->HideKillsServer.c_str(), parameters[1].c_str()); } diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index bf95f0f9f..bc90c9fad 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -284,11 +284,19 @@ class ModuleNationalChars : public Module { ConfigTag* tag = ServerInstance->Config->ConfValue("nationalchars"); charset = tag->getString("file"); - casemapping = tag->getString("casemapping", charset); + casemapping = tag->getString("casemapping", ServerConfig::CleanFilename(charset.c_str())); + if (casemapping.find(' ') != std::string::npos) + throw ModuleException("<nationalchars:casemapping> must not contain any spaces!"); +#if defined _WIN32 + if (!ServerInstance->Config->StartsWithWindowsDriveLetter(charset)) + charset.insert(0, "./locales/"); +#else if(charset[0] != '/') charset.insert(0, "../locales/"); +#endif unsigned char * tables[8] = { m_additional, m_additionalMB, m_additionalUp, m_lower, m_upper, m_additionalUtf8, m_additionalUtf8range, m_additionalUtf8interval }; - loadtables(charset, tables, 8, 5); + if (!loadtables(charset, tables, 8, 5)) + throw ModuleException("The locale file failed to load. Check your log file for more information."); forcequit = tag->getBool("forcequit"); CheckForceQuit("National character set changed"); CheckRehash(); @@ -330,13 +338,13 @@ class ModuleNationalChars : public Module } /*so Bynets Unreal distribution stuff*/ - void loadtables(std::string filename, unsigned char ** tables, unsigned char cnt, char faillimit) + bool loadtables(std::string filename, unsigned char ** tables, unsigned char cnt, char faillimit) { std::ifstream ifs(filename.c_str()); if (ifs.fail()) { ServerInstance->Logs->Log("m_nationalchars",DEFAULT,"loadtables() called for missing file: %s", filename.c_str()); - return; + return false; } for (unsigned char n=0; n< cnt; n++) @@ -351,11 +359,12 @@ class ModuleNationalChars : public Module if (loadtable(ifs, tables[n], 255) && (n < faillimit)) { ServerInstance->Logs->Log("m_nationalchars",DEFAULT,"loadtables() called for illegal file: %s (line %d)", filename.c_str(), n+1); - return; + return false; } } makereverse(m_additional, m_reverse_additional, sizeof(m_additional)); + return true; } unsigned char symtoi(const char *t,unsigned char base) diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt index 087bd7970..10653cf74 100644 --- a/win/CMakeLists.txt +++ b/win/CMakeLists.txt @@ -74,6 +74,10 @@ install(FILES ${EXTRA_DLLS} DESTINATION .) file(GLOB_RECURSE EXAMPLE_CONFIGS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/docs/conf/*.example") install(FILES ${EXAMPLE_CONFIGS} DESTINATION conf) +# Install nationalchars files +file(GLOB_RECURSE EXAMPLE_LOCALES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/locales/*") +install(FILES ${EXAMPLE_LOCALES} DESTINATION locales) + # Create an empty data and logs directory and install them file(MAKE_DIRECTORY ${DATA_PATH}) install(DIRECTORY ${DATA_PATH} DESTINATION .) diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h index be437d4a3..d7ceb73aa 100644 --- a/win/inspircd_win32wrapper.h +++ b/win/inspircd_win32wrapper.h @@ -63,6 +63,7 @@ /* Disable the deprecation warnings.. it spams :P */ #define _CRT_SECURE_NO_DEPRECATE +#define _WINSOCK_DEPRECATED_NO_WARNINGS /* Normal windows (platform-specific) includes */ #include <winsock2.h> @@ -90,9 +91,11 @@ CoreExport const char * insp_inet_ntop(int af, const void * src, char * dst, soc #define inet_pton insp_inet_pton #define inet_ntop insp_inet_ntop -/* Safe printf functions aren't defined in VC++ */ +/* Safe printf functions aren't defined in VC++ releases older than v14 */ +#if _MSC_VER <= 1800 #define snprintf _snprintf #define vsnprintf _vsnprintf +#endif /* Unix-style sleep (argument is in seconds) */ __inline void sleep(int seconds) { Sleep(seconds * 1000); } @@ -136,11 +139,13 @@ struct DIR bool first; }; +#if _MSC_VER <= 1800 struct timespec { time_t tv_sec; long tv_nsec; }; +#endif CoreExport DIR * opendir(const char * path); CoreExport dirent * readdir(DIR * handle); |