]> jfr.im git - solanum.git/blobdiff - ircd/modules.c
chmode: Get elevated access for op-only queries
[solanum.git] / ircd / modules.c
index 25b69c1c3d14fae5edfde734bb0ea55b5e963bb7..e4dc728bdb4a000a448f3146ada82169ecaa39da 100644 (file)
@@ -41,7 +41,7 @@
 #include <ltdl.h>
 
 #ifndef LT_MODULE_EXT
-#      error "Charybdis requires loadable module support."
+#      error "Solanum requires loadable module support."
 #endif
 
 rb_dlink_list module_list;
@@ -51,6 +51,7 @@ static const char *core_module_table[] = {
        "m_ban",
        "m_die",
        "m_error",
+       "m_identified",
        "m_join",
        "m_kick",
        "m_kill",
@@ -297,6 +298,10 @@ load_one_module(const char *path, int origin, bool coremodule)
        }
 
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "Cannot locate module %s", path);
+
+       if (server_state_foreground)
+               ierror("cannot locate module %s", path);
+
        return false;
 }
 
@@ -423,6 +428,7 @@ unload_one_module(const char *name, bool warn)
 
        rb_dlinkDelete(&mod->node, &module_list);
        rb_free(mod->name);
+       rb_free(mod->path);
        rb_free(mod);
 
        if(warn)
@@ -641,7 +647,7 @@ load_a_module(const char *path, bool warn, int origin, bool core)
                                        int priority = m->priority;
                                        if (priority == 0)
                                                priority = HOOK_NORMAL;
-                                       add_hook(m->hapi_name, m->fn);
+                                       add_hook_prio(m->hapi_name, m->fn, priority);
                                }
                        }
 
@@ -677,6 +683,7 @@ load_a_module(const char *path, bool warn, int origin, bool core)
        mod->mapi_header = mapi_version;
        mod->mapi_version = MAPI_VERSION(*mapi_version);
        mod->origin = origin;
+       mod->path = rb_strdup(path);
        rb_dlinkAdd(mod, &mod->node, &module_list);
 
        if(warn)
@@ -715,6 +722,7 @@ modules_do_reload(void *info_)
        int check_core;
        int origin;
        char *m_bn = rb_basename(info->module);
+       char *path;
        struct Client *source_p = find_id(info->id);
 
        if((mod = findmodule_byname(m_bn)) == NULL)
@@ -727,6 +735,7 @@ modules_do_reload(void *info_)
 
        origin = mod->origin;
        check_core = mod->core;
+       path = rb_strdup(mod->path);
 
        mod_remember_clicaps();
 
@@ -735,10 +744,11 @@ modules_do_reload(void *info_)
                if (source_p) sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
                rb_free(info);
                rb_free(m_bn);
+               rb_free(path);
                return;
        }
 
-       if((load_one_module(m_bn, origin, check_core) == false) && check_core)
+       if((load_a_module(path, true, origin, check_core) == false) && check_core)
        {
                sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                     "Error reloading core module: %s: terminating ircd", m_bn);
@@ -750,6 +760,7 @@ modules_do_reload(void *info_)
 
        rb_free(info);
        rb_free(m_bn);
+       rb_free(path);
 }
 
 void