aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_auth_anonymous.lua3
-rw-r--r--util-src/pposix.c28
2 files changed, 29 insertions, 2 deletions
diff --git a/plugins/mod_auth_anonymous.lua b/plugins/mod_auth_anonymous.lua
index 3cb7cf98..c080177d 100644
--- a/plugins/mod_auth_anonymous.lua
+++ b/plugins/mod_auth_anonymous.lua
@@ -32,10 +32,9 @@ function new_default_provider(host)
return nil, "Account creation/modification not supported.";
end
- function provider.get_sasl_handler(session)
+ function provider.get_sasl_handler()
local anonymous_authentication_profile = {
anonymous = function(sasl, username, realm)
- session.roster = {}; -- so that the null storage backend doesn't upset rostermanager
return true; -- for normal usage you should always return true here
end
};
diff --git a/util-src/pposix.c b/util-src/pposix.c
index a5a89d55..8dfd6c75 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -34,6 +34,11 @@
#include "lua.h"
#include "lauxlib.h"
+#if (defined(_SVID_SOURCE) && !defined(WITHOUT_MALLINFO))
+ #include <malloc.h>
+ #define WITH_MALLINFO
+#endif
+
/* Daemonization support */
static int lc_daemonize(lua_State *L)
@@ -612,6 +617,25 @@ int lc_setenv(lua_State* L)
return 1;
}
+#ifdef WITH_MALLINFO
+int lc_meminfo(lua_State* L)
+{
+ struct mallinfo info = mallinfo();
+ lua_newtable(L);
+ lua_pushinteger(L, info.arena);
+ lua_setfield(L, -2, "allocated");
+ lua_pushinteger(L, info.hblkhd);
+ lua_setfield(L, -2, "allocated_mmap");
+ lua_pushinteger(L, info.uordblks);
+ lua_setfield(L, -2, "used");
+ lua_pushinteger(L, info.fordblks);
+ lua_setfield(L, -2, "unused");
+ lua_pushinteger(L, info.keepcost);
+ lua_setfield(L, -2, "returnable");
+ return 1;
+}
+#endif
+
/* Register functions */
int luaopen_util_pposix(lua_State *L)
@@ -645,6 +669,10 @@ int luaopen_util_pposix(lua_State *L)
{ "setenv", lc_setenv },
+#ifdef WITH_MALLINFO
+ { "meminfo", lc_meminfo },
+#endif
+
{ NULL, NULL }
};