Skip to content

Commit

Permalink
auth: db-lua - Expose some auth request members
Browse files Browse the repository at this point in the history
These are particularly useful for finding out if user
has already been authenticated.
  • Loading branch information
cmouse committed May 8, 2018
1 parent 2bd90d6 commit 7f1e1fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/auth/db-lua.c
Expand Up @@ -270,6 +270,16 @@ static void auth_lua_push_auth_request(struct dlua_script *script, struct auth_r
lua_setfield(script->L, -2, "item");
luaL_setmetatable(script->L, "userdb_"AUTH_LUA_AUTH_REQUEST);
lua_setfield(script->L, -2, "userdb");

#undef LUA_TABLE_SETBOOL
#define LUA_TABLE_SETBOOL(field) \
lua_pushboolean(script->L, req->field ? 1 : 0); \
lua_setfield(script->L, -2, #field);

LUA_TABLE_SETBOOL(skip_password_check);
LUA_TABLE_SETBOOL(passdbs_seen_user_unknown);
LUA_TABLE_SETBOOL(passdbs_seen_internal_failure);
LUA_TABLE_SETBOOL(userdbs_seen_internal_failure);
}

static struct auth_request *
Expand Down

0 comments on commit 7f1e1fa

Please sign in to comment.