db-lua.c (dovecot-2.3.16) | : | db-lua.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 306 | skipping to change at line 306 | |||
lua_newtable(L); | lua_newtable(L); | |||
lua_pushlightuserdata(L, req); | lua_pushlightuserdata(L, req); | |||
lua_setfield(L, -2, "item"); | lua_setfield(L, -2, "item"); | |||
luaL_setmetatable(L, "userdb_"AUTH_LUA_AUTH_REQUEST); | luaL_setmetatable(L, "userdb_"AUTH_LUA_AUTH_REQUEST); | |||
lua_setfield(L, -2, "userdb"); | lua_setfield(L, -2, "userdb"); | |||
lua_pushboolean(L, req->fields.skip_password_check); | lua_pushboolean(L, req->fields.skip_password_check); | |||
lua_setfield(L, -2, "skip_password_check"); | lua_setfield(L, -2, "skip_password_check"); | |||
#undef LUA_TABLE_SETBOOL | #undef LUA_TABLE_SET_BOOL | |||
#define LUA_TABLE_SETBOOL(field) \ | #define LUA_TABLE_SET_BOOL(field) \ | |||
lua_pushboolean(L, req->field); \ | lua_pushboolean(L, req->field); \ | |||
lua_setfield(L, -2, #field); | lua_setfield(L, -2, #field); | |||
LUA_TABLE_SETBOOL(passdbs_seen_user_unknown); | LUA_TABLE_SET_BOOL(passdbs_seen_user_unknown); | |||
LUA_TABLE_SETBOOL(passdbs_seen_internal_failure); | LUA_TABLE_SET_BOOL(passdbs_seen_internal_failure); | |||
LUA_TABLE_SETBOOL(userdbs_seen_internal_failure); | LUA_TABLE_SET_BOOL(userdbs_seen_internal_failure); | |||
} | } | |||
static struct auth_request * | static struct auth_request * | |||
auth_lua_check_auth_request(lua_State *L, int arg) | auth_lua_check_auth_request(lua_State *L, int arg) | |||
{ | { | |||
if (!lua_istable(L, arg)) { | if (!lua_istable(L, arg)) { | |||
(void)luaL_error(L, "Bad argument #%d, expected %s got %s", | (void)luaL_error(L, "Bad argument #%d, expected %s got %s", | |||
arg, "auth_request", | arg, "auth_request", | |||
lua_typename(L, lua_type(L, arg))); | lua_typename(L, lua_type(L, arg))); | |||
} | } | |||
skipping to change at line 373 | skipping to change at line 373 | |||
DLUA_TABLE_ENUM(USERDB_RESULT_OK), | DLUA_TABLE_ENUM(USERDB_RESULT_OK), | |||
DLUA_TABLE_END | DLUA_TABLE_END | |||
}; | }; | |||
static luaL_Reg auth_lua_dovecot_auth_methods[] = { | static luaL_Reg auth_lua_dovecot_auth_methods[] = { | |||
{ NULL, NULL } | { NULL, NULL } | |||
}; | }; | |||
static void auth_lua_dovecot_auth_register(lua_State *L) | static void auth_lua_dovecot_auth_register(lua_State *L) | |||
{ | { | |||
dlua_getdovecot(L); | dlua_get_dovecot(L); | |||
/* Create new table for holding values */ | /* Create new table for holding values */ | |||
lua_newtable(L); | lua_newtable(L); | |||
/* register constants */ | /* register constants */ | |||
dlua_setmembers(L, auth_lua_dovecot_auth_values, -1); | dlua_set_members(L, auth_lua_dovecot_auth_values, -1); | |||
/* push new metatable to stack */ | /* push new metatable to stack */ | |||
luaL_newmetatable(L, AUTH_LUA_DOVECOT_AUTH); | luaL_newmetatable(L, AUTH_LUA_DOVECOT_AUTH); | |||
/* this will register functions to the metatable itself */ | /* this will register functions to the metatable itself */ | |||
luaL_setfuncs(L, auth_lua_dovecot_auth_methods, 0); | luaL_setfuncs(L, auth_lua_dovecot_auth_methods, 0); | |||
/* point __index to self */ | /* point __index to self */ | |||
lua_pushvalue(L, -1); | lua_pushvalue(L, -1); | |||
lua_setfield(L, -1, "__index"); | lua_setfield(L, -1, "__index"); | |||
/* set table's metatable, pops stack */ | /* set table's metatable, pops stack */ | |||
lua_setmetatable(L, -2); | lua_setmetatable(L, -2); | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added |