Software /
code /
prosody
Changeset
1860:5ef1eea887ca
Merge
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 02 Oct 2009 17:14:54 +0500 |
parents | 1859:c965b0accc7c (current diff) 1852:f9b58f37bc14 (diff) |
children | 1861:e9500c4994f3 1863:51b1612325e6 |
files | util-src/encodings.c |
diffstat | 7 files changed, 37 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/core/componentmanager.lua Fri Oct 02 17:07:18 2009 +0500 +++ b/core/componentmanager.lua Fri Oct 02 17:14:54 2009 +0500 @@ -14,6 +14,7 @@ local modulemanager = require "core.modulemanager"; local core_route_stanza = core_route_stanza; local jid_split = require "util.jid".split; +local fire_event = require "core.eventmanager".fire_event; local events_new = require "util.events".new; local st = require "util.stanza"; local hosts = hosts; @@ -51,12 +52,14 @@ for host, host_config in pairs(defined_hosts) do if host ~= "*" and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then - hosts[host] = { type = "component", host = host, connected = false, s2sout = {}, events = events_new() }; + hosts[host] = create_component(host); + hosts[host].connected = false; components[host] = default_component_handler; local ok, err = modulemanager.load(host, host_config.core.component_module); if not ok then log("error", "Error loading %s component %s: %s", tostring(host_config.core.component_module), tostring(host), tostring(err)); else + fire_event("component-activated", host, host_config); log("debug", "Activated %s component: %s", host_config.core.component_module, host); end end @@ -80,9 +83,9 @@ end end -function create_component(host, component) +function create_component(host, component, events) -- TODO check for host well-formedness - return { type = "component", host = host, connected = true, s2sout = {}, events = events_new() }; + return { type = "component", host = host, connected = true, s2sout = {}, events = events or events_new() }; end function register_component(host, component, session) @@ -90,7 +93,7 @@ local old_events = hosts[host] and hosts[host].events; components[host] = component; - hosts[host] = session or create_component(host, component); + hosts[host] = session or create_component(host, component, old_events); -- Add events object if not already one if not hosts[host].events then
--- a/core/hostmanager.lua Fri Oct 02 17:07:18 2009 +0500 +++ b/core/hostmanager.lua Fri Oct 02 17:14:54 2009 +0500 @@ -24,7 +24,7 @@ local defined_hosts = config or configmanager.getconfig(); for host, host_config in pairs(defined_hosts) do - if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) then + if host ~= "*" and (host_config.core.enabled == nil or host_config.core.enabled) and not host_config.core.component_module then activate(host, host_config); end end
--- a/core/modulemanager.lua Fri Oct 02 17:07:18 2009 +0500 +++ b/core/modulemanager.lua Fri Oct 02 17:14:54 2009 +0500 @@ -96,6 +96,7 @@ end end eventmanager.add_event_hook("host-activated", load_modules_for_host); +eventmanager.add_event_hook("component-activated", load_modules_for_host); -- function load(host, module_name, config)
--- a/plugins/mod_saslauth.lua Fri Oct 02 17:07:18 2009 +0500 +++ b/plugins/mod_saslauth.lua Fri Oct 02 17:14:54 2009 +0500 @@ -52,14 +52,14 @@ if status == "failure" then session.sasl_handler = nil; elseif status == "success" then - if not session.sasl_handler.username then -- TODO move this to sessionmanager + local username = nodeprep(session.sasl_handler.username); + session.sasl_handler = nil; + if not username then -- TODO move this to sessionmanager module:log("warn", "SASL succeeded but we didn't get a username!"); - session.sasl_handler = nil; session:reset_stream(); return; end - sm_make_authenticated(session, session.sasl_handler.username); - session.sasl_handler = nil; + sm_make_authenticated(session, username); session:reset_stream(); end end
--- a/util-src/Makefile Fri Oct 02 17:07:18 2009 +0500 +++ b/util-src/Makefile Fri Oct 02 17:14:54 2009 +0500 @@ -24,21 +24,28 @@ encodings.o: encodings.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o encodings.o encodings.c encodings.so: encodings.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o encodings.so encodings.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lidn + MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o encodings.so encodings.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lidn hashes.o: hashes.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o hashes.o hashes.c hashes.so: hashes.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o hashes.so hashes.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lcrypto + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o hashes.so hashes.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lcrypto pposix.o: pposix.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o pposix.o pposix.c pposix.so: pposix.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o pposix.so pposix.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o pposix.so pposix.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) lsignal.o: lsignal.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o lsignal.o lsignal.c signal.so: lsignal.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o signal.so lsignal.o + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o signal.so lsignal.o
--- a/util-src/lsignal.c Fri Oct 02 17:07:18 2009 +0500 +++ b/util-src/lsignal.c Fri Oct 02 17:14:54 2009 +0500 @@ -301,7 +301,7 @@ return 1; } -#ifdef _POSIX_SOURCE +#if defined _POSIX_SOURCE || (defined(sun) || defined(__sun)) /* define some posix only functions */
--- a/util-src/pposix.c Fri Oct 02 17:07:18 2009 +0500 +++ b/util-src/pposix.c Fri Oct 02 17:14:54 2009 +0500 @@ -91,10 +91,14 @@ const char * const facility_strings[] = { "auth", +#if !(defined(sun) || defined(__sun)) "authpriv", +#endif "cron", "daemon", +#if !(defined(sun) || defined(__sun)) "ftp", +#endif "kern", "local0", "local1", @@ -113,10 +117,14 @@ }; int facility_constants[] = { LOG_AUTH, +#if !(defined(sun) || defined(__sun)) LOG_AUTHPRIV, +#endif LOG_CRON, LOG_DAEMON, +#if !(defined(sun) || defined(__sun)) LOG_FTP, +#endif LOG_KERN, LOG_LOCAL0, LOG_LOCAL1, @@ -365,11 +373,13 @@ if (!strcmp(s, "CPU")) return RLIMIT_CPU; if (!strcmp(s, "DATA")) return RLIMIT_DATA; if (!strcmp(s, "FSIZE")) return RLIMIT_FSIZE; + if (!strcmp(s, "NOFILE")) return RLIMIT_NOFILE; + if (!strcmp(s, "STACK")) return RLIMIT_STACK; +#if !(defined(sun) || defined(__sun)) if (!strcmp(s, "MEMLOCK")) return RLIMIT_MEMLOCK; - if (!strcmp(s, "NOFILE")) return RLIMIT_NOFILE; if (!strcmp(s, "NPROC")) return RLIMIT_NPROC; if (!strcmp(s, "RSS")) return RLIMIT_RSS; - if (!strcmp(s, "STACK")) return RLIMIT_STACK; +#endif return -1; }