#include "auth-common.h"
#include "passdb.h"
+#include "auth-cache.h"
#if defined(BUILTIN_LUA) || defined(PLUGIN_BUILD)
static struct passdb_module *
passdb_lua_preinit(pool_t pool, const char *args)
{
+ const char *cache_key = "%u";
+ const char *scheme = "PLAIN";
struct dlua_passdb_module *module;
bool blocking = TRUE;
"Field blocking must be yes or no",
value);
}
+ } else if (strncmp(*fields, "cache_key=", 10) == 0) {
+ if (*((*fields)+10) != '\0')
+ cache_key = (*fields)+10;
+ else /* explicitly disable auth caching for lua */
+ cache_key = NULL;
+ } else if (strncmp(*fields, "scheme=", 7) == 0) {
+ scheme = p_strdup(pool, (*fields)+7);
} else {
i_fatal("Unsupported parameter %s", *fields);
}
i_fatal("passdb-lua: Missing mandatory file= parameter");
module->module.blocking = blocking;
+ module->module.default_cache_key =
+ auth_cache_parse_key(pool, cache_key);
+ module->module.default_pass_scheme = scheme;
return &module->module;
}
#include "auth-common.h"
#include "userdb.h"
+#include "auth-cache.h"
#if defined(BUILTIN_LUA) || defined(PLUGIN_BUILD)
userdb_lua_preinit(pool_t pool, const char *args)
{
struct dlua_userdb_module *module;
+ const char *cache_key = "%u";
bool blocking = TRUE;
module = p_new(pool, struct dlua_userdb_module, 1);
"Field blocking must be yes or no",
value);
}
+ } else if (strncmp(*fields, "cache_key=", 10) == 0) {
+ if (*((*fields)+10) != '\0')
+ cache_key = (*fields)+10;
+ else /* explicitly disable auth caching for lua */
+ cache_key = NULL;
} else {
i_fatal("Unsupported parameter %s", *fields);
}
i_fatal("userdb-lua: Missing mandatory file= parameter");
module->module.blocking = blocking;
+ if (cache_key != NULL) {
+ module->module.default_cache_key =
+ auth_cache_parse_key(pool, cache_key);
+ }
return &module->module;
}