From 9abdcf1c645f5dc72cf18707c652eeb392733ffd Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 20:10:46 -0600 Subject: [PATCH] modules: can .la suffix. .la archives are prohibited by most Linux distributions because they clutter up the linker. They may get caught up as victims in scripts that purge .la files. Besides, .la files don't matter for simple loadable modules on most systems. So, what we do now instead is just use the platform suffix detected by libtool. --- Makefile.am | 5 ++ doc/ircd.conf.example | 58 ++++++++--------- doc/reference.conf | 140 +++++++++++++++++++++--------------------- ircd/modules.c | 24 +++++--- 4 files changed, 119 insertions(+), 108 deletions(-) diff --git a/Makefile.am b/Makefile.am index 34e15287..c4a49a6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,3 +37,8 @@ include/serno.h: install-data-hook: test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} + +install-exec-hook: + rm -f ${DESTDIR}${moduledir}/*.la + rm -f ${DESTDIR}${moduledir}/autoload/*.la + rm -f ${DESTDIR}${moduledir}/extensions/*.la diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 49951a5e..9f261661 100644 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -8,33 +8,33 @@ */ /* Extensions */ -#loadmodule "extensions/chm_operonly_compat.la"; -#loadmodule "extensions/chm_quietunreg_compat.la"; -#loadmodule "extensions/chm_sslonly_compat.la"; -#loadmodule "extensions/chm_operpeace.la"; -#loadmodule "extensions/createauthonly.la"; -#loadmodule "extensions/extb_account.la"; -#loadmodule "extensions/extb_canjoin.la"; -#loadmodule "extensions/extb_channel.la"; -#loadmodule "extensions/extb_combi.la"; -#loadmodule "extensions/extb_extgecos.la"; -#loadmodule "extensions/extb_hostmask.la"; -#loadmodule "extensions/extb_oper.la"; -#loadmodule "extensions/extb_realname.la"; -#loadmodule "extensions/extb_server.la"; -#loadmodule "extensions/extb_ssl.la"; -#loadmodule "extensions/hurt.la"; -#loadmodule "extensions/m_extendchans.la"; -#loadmodule "extensions/m_findforwards.la"; -#loadmodule "extensions/m_identify.la"; -#loadmodule "extensions/no_oper_invis.la"; -#loadmodule "extensions/sno_farconnect.la"; -#loadmodule "extensions/sno_globalkline.la"; -#loadmodule "extensions/sno_globalnickchange.la"; -#loadmodule "extensions/sno_globaloper.la"; -#loadmodule "extensions/sno_whois.la"; -#loadmodule "extensions/override.la"; -#loadmodule "extensions/no_kill_services.la"; +#loadmodule "extensions/chm_operonly_compat"; +#loadmodule "extensions/chm_quietunreg_compat"; +#loadmodule "extensions/chm_sslonly_compat"; +#loadmodule "extensions/chm_operpeace"; +#loadmodule "extensions/createauthonly"; +#loadmodule "extensions/extb_account"; +#loadmodule "extensions/extb_canjoin"; +#loadmodule "extensions/extb_channel"; +#loadmodule "extensions/extb_combi"; +#loadmodule "extensions/extb_extgecos"; +#loadmodule "extensions/extb_hostmask"; +#loadmodule "extensions/extb_oper"; +#loadmodule "extensions/extb_realname"; +#loadmodule "extensions/extb_server"; +#loadmodule "extensions/extb_ssl"; +#loadmodule "extensions/hurt"; +#loadmodule "extensions/m_extendchans"; +#loadmodule "extensions/m_findforwards"; +#loadmodule "extensions/m_identify"; +#loadmodule "extensions/no_oper_invis"; +#loadmodule "extensions/sno_farconnect"; +#loadmodule "extensions/sno_globalkline"; +#loadmodule "extensions/sno_globalnickchange"; +#loadmodule "extensions/sno_globaloper"; +#loadmodule "extensions/sno_whois"; +#loadmodule "extensions/override"; +#loadmodule "extensions/no_kill_services"; /* * IP cloaking extensions: use ip_cloaking_4.0 @@ -43,8 +43,8 @@ * releases. */ -#loadmodule "extensions/ip_cloaking_4.0.la"; -#loadmodule "extensions/ip_cloaking.la"; +#loadmodule "extensions/ip_cloaking_4.0"; +#loadmodule "extensions/ip_cloaking"; serverinfo { name = "hades.arpa"; diff --git a/doc/reference.conf b/doc/reference.conf index 19e337c5..2cb078c7 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -43,73 +43,73 @@ * Charybdis contains several extensions that are not enabled by default. * To use them, uncomment the lines below. * - * Channel mode +-A (admin only) -- chm_adminonly.la - * Channel mode +-O (oper only) -- chm_operonly.la - * Channel mode +-S (ssl only) -- chm_sslonly.la - * Emulates channel mode +-O (oper only) (+-iI $o) -- chm_operonly_compat.la - * Emulates channel mode +-R (quiet unreg) (+-q $~a) -- chm_quietunreg_compat.la - * Emulates channel mode +-S (ssl only) (+-b $~z) -- chm_sslonly_compat.la - * Channel mode +-M (disallow KICK on IRC ops) -- chm_operpeace.la - * Restrict channel creation to logged in users -- createauthonly.la - * Account bans (+b $a[:mask]) -- extb_account.la - * Banned from another channel (+b $j:mask) -- extb_canjoin.la - * Other-channel bans (+b $c:mask) -- extb_channel.la - * Combination extbans -- extb_combi.la - * Extended ban (+b $x:mask) -- extb_extgecos.la - * Hostmask bans (for combination extbans) -- extb_hostmask.la - * Oper bans (+b $o) -- extb_oper.la - * Realname (gecos) bans (+b $r:mask) -- extb_realname.la - * Server bans (+b $s:mask) -- extb_server.la - * SSL bans (+b $z) -- extb_ssl.la - * Helpops system (umode +H) -- helpops.la - * HURT system -- hurt.la - * New host mangling (umode +x) -- ip_cloaking_4.0.la - * Old host mangling (umode +h) -- ip_cloaking.la - * Dynamically extend channel limits -- m_extendchans.la - * Find channel forwards -- m_findforwards.la - * /identify support -- m_identify.la - * Opers cannot be invisible (umode +i) -- no_oper_invis.la - * Far connection notices (snomask +F) -- sno_farconnect.la - * Remote k/d/x line active notices -- sno_globalkline.la - * Remote oper up notices -- sno_globaloper.la - * Global nick-change notices -- sno_globalnickchange.la - * /whois notifications (snomask +W) -- sno_whois.la - * Oper-override (modehacking only) -- override.la - * Stop services kills -- no_kill_services.la + * Channel mode +-A (admin only) -- chm_adminonly + * Channel mode +-O (oper only) -- chm_operonly + * Channel mode +-S (ssl only) -- chm_sslonly + * Emulates channel mode +-O (oper only) (+-iI $o) -- chm_operonly_compat + * Emulates channel mode +-R (quiet unreg) (+-q $~a) -- chm_quietunreg_compat + * Emulates channel mode +-S (ssl only) (+-b $~z) -- chm_sslonly_compat + * Channel mode +-M (disallow KICK on IRC ops) -- chm_operpeace + * Restrict channel creation to logged in users -- createauthonly + * Account bans (+b $a[:mask]) -- extb_account + * Banned from another channel (+b $j:mask) -- extb_canjoin + * Other-channel bans (+b $c:mask) -- extb_channel + * Combination extbans -- extb_combi + * Extended ban (+b $x:mask) -- extb_extgecos + * Hostmask bans (for combination extbans) -- extb_hostmask + * Oper bans (+b $o) -- extb_oper + * Realname (gecos) bans (+b $r:mask) -- extb_realname + * Server bans (+b $s:mask) -- extb_server + * SSL bans (+b $z) -- extb_ssl + * Helpops system (umode +H) -- helpops + * HURT system -- hurt + * New host mangling (umode +x) -- ip_cloaking_4.0 + * Old host mangling (umode +h) -- ip_cloaking + * Dynamically extend channel limits -- m_extendchans + * Find channel forwards -- m_findforwards + * /identify support -- m_identify + * Opers cannot be invisible (umode +i) -- no_oper_invis + * Far connection notices (snomask +F) -- sno_farconnect + * Remote k/d/x line active notices -- sno_globalkline + * Remote oper up notices -- sno_globaloper + * Global nick-change notices -- sno_globalnickchange + * /whois notifications (snomask +W) -- sno_whois + * Oper-override (modehacking only) -- override + * Stop services kills -- no_kill_services */ -#loadmodule "extensions/chm_adminonly.la"; -#loadmodule "extensions/chm_operonly.la"; -#loadmodule "extensions/chm_sslonly.la"; -#loadmodule "extensions/chm_operonly_compat.la"; -#loadmodule "extensions/chm_quietunreg_compat.la"; -#loadmodule "extensions/chm_sslonly_compat.la"; -#loadmodule "extensions/chm_operpeace.la"; -#loadmodule "extensions/createauthonly.la"; -#loadmodule "extensions/extb_account.la"; -#loadmodule "extensions/extb_canjoin.la"; -#loadmodule "extensions/extb_channel.la"; -#loadmodule "extensions/extb_combi.la"; -#loadmodule "extensions/extb_extgecos.la"; -#loadmodule "extensions/extb_hostmask.la"; -#loadmodule "extensions/extb_oper.la"; -#loadmodule "extensions/extb_realname.la"; -#loadmodule "extensions/extb_server.la"; -#loadmodule "extensions/extb_ssl.la"; -#loadmodule "extensions/helpops.la"; -#loadmodule "extensions/hurt.la"; -#loadmodule "extensions/ip_cloaking_4.0.la"; -#loadmodule "extensions/ip_cloaking.la"; -#loadmodule "extensions/m_extendchans.la"; -#loadmodule "extensions/m_findforwards.la"; -#loadmodule "extensions/m_identify.la"; -#loadmodule "extensions/no_oper_invis.la"; -#loadmodule "extensions/sno_farconnect.la"; -#loadmodule "extensions/sno_globalkline.la"; -#loadmodule "extensions/sno_globalnickchange.la"; -#loadmodule "extensions/sno_globaloper.la"; -#loadmodule "extensions/sno_whois.la"; -#loadmodule "extensions/override.la"; -#loadmodule "extensions/no_kill_services.la"; +#loadmodule "extensions/chm_adminonly"; +#loadmodule "extensions/chm_operonly"; +#loadmodule "extensions/chm_sslonly"; +#loadmodule "extensions/chm_operonly_compat"; +#loadmodule "extensions/chm_quietunreg_compat"; +#loadmodule "extensions/chm_sslonly_compat"; +#loadmodule "extensions/chm_operpeace"; +#loadmodule "extensions/createauthonly"; +#loadmodule "extensions/extb_account"; +#loadmodule "extensions/extb_canjoin"; +#loadmodule "extensions/extb_channel"; +#loadmodule "extensions/extb_combi"; +#loadmodule "extensions/extb_extgecos"; +#loadmodule "extensions/extb_hostmask"; +#loadmodule "extensions/extb_oper"; +#loadmodule "extensions/extb_realname"; +#loadmodule "extensions/extb_server"; +#loadmodule "extensions/extb_ssl"; +#loadmodule "extensions/helpops"; +#loadmodule "extensions/hurt"; +#loadmodule "extensions/ip_cloaking_4.0"; +#loadmodule "extensions/ip_cloaking"; +#loadmodule "extensions/m_extendchans"; +#loadmodule "extensions/m_findforwards"; +#loadmodule "extensions/m_identify"; +#loadmodule "extensions/no_oper_invis"; +#loadmodule "extensions/sno_farconnect"; +#loadmodule "extensions/sno_globalkline"; +#loadmodule "extensions/sno_globalnickchange"; +#loadmodule "extensions/sno_globaloper"; +#loadmodule "extensions/sno_whois"; +#loadmodule "extensions/override"; +#loadmodule "extensions/no_kill_services"; /* serverinfo {}: Contains information about the server. (OLD M:) */ serverinfo { @@ -569,7 +569,7 @@ connect "irc.uplink.com" { flags = compressed, topicburst; }; -connect "ipv6.lame.server" { +connect "ipv6me.server" { /* Hosts that are IPv6 addresses must be in :: shortened form * if applicable. Addresses starting with a colon get an extra * zero prepended, for example: 0::1 @@ -625,8 +625,8 @@ cluster { * all - share all of the above */ - /* share klines/unklines/xlines with *.lan */ - name = "*.lan"; + /* share klines/unklines/xlines with *n */ + name = "*n"; flags = kline, unkline, xline; /* share locops with irc.ircd-ratbox.org and ircd.ircd-ratbox.org */ @@ -1349,5 +1349,5 @@ modules { path = "/usr/local/ircd/modules/autoload"; /* module: the name of a module to load on startup/rehash */ - #module = "some_module.la"; + #module = "some_module"; }; diff --git a/ircd/modules.c b/ircd/modules.c index 8175c624..6f509ed9 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -39,6 +39,10 @@ #include +#ifndef LT_MODULE_EXT +# error "Charybdis requires loadable module support." +#endif + struct module **modlist = NULL; static const char *core_module_table[] = { @@ -223,8 +227,8 @@ load_all_modules(int warn) DIR *system_module_dir = NULL; struct dirent *ldirent = NULL; char module_fq_name[PATH_MAX + 1]; - int len; - + static size_t module_ext_len = strlen(LT_MODULE_EXT); + modules_init(); modlist = (struct module **) rb_malloc(sizeof(struct module *) * (MODS_INCREMENT)); @@ -241,8 +245,11 @@ load_all_modules(int warn) while ((ldirent = readdir(system_module_dir)) != NULL) { + struct stat s; + size_t len; + len = strlen(ldirent->d_name); - if((len > 3) && !strcmp(ldirent->d_name+len-3, ".la")) + if(len > module_ext_len && !strcasecmp(ldirent->d_name + (len - module_ext_len), LT_MODULE_EXT)) { (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); (void) load_a_module(module_fq_name, warn, MAPI_ORIGIN_CORE, 0); @@ -267,14 +274,14 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, - core_module_table[i], ".la"); + snprintf(module_name, sizeof(module_name), "%s/%s", MODPATH, + core_module_table[i]); if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1) { ilog(L_MAIN, - "Error loading core module %s%s: terminating ircd", - core_module_table[i], ".la"); + "Error loading core module %s: terminating ircd", + core_module_table[i]); exit(0); } } @@ -809,7 +816,7 @@ load_a_module(const char *path, int warn, int origin, int core) mod_basename = rb_basename(path); - tmpptr = lt_dlopen(path); + tmpptr = lt_dlopenext(path); if(tmpptr == NULL) { @@ -822,7 +829,6 @@ load_a_module(const char *path, int warn, int origin, int core) return -1; } - /* * _mheader is actually a struct mapi_mheader_*, but mapi_version * is always the first member of this structure, so we treate it