Skip to content
Snippets Groups Projects
Verified Commit b599803f authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[NSS] Move context_user initialisation to nss_hook_prepare

parent ddd9971a
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,13 @@ fn nss_hook_prepare() -> Config {
}
setup_log(log_level);
// Set the context user to the current user, but only if not already set
// When doing PAM, we might get called back into by libc to do some NSS
// lookup, and we want to keep the PAM login user context in that case
if !get_cache().context_user.is_initialized() {
get_cache().context_user.set_current_user();
}
return conf;
}
......@@ -59,13 +66,6 @@ impl PasswdHooks for OidcPasswd {
fn get_all_entries() -> Response<Vec<Passwd>> {
let conf = nss_hook_prepare();
// Set the context user to the current user, but only if not already set
// When doing PAM, we might get called back into by libc to do some NSS
// lookup, and we want to keep the PAM login user context in that case
if !get_cache().context_user.is_initialized() {
get_cache().context_user.set_current_user();
}
let mut cache = get_cache();
let user_token_res = cache.context_user.get_access_token();
// FIXME Implement caching of system token
......@@ -98,10 +98,6 @@ impl PasswdHooks for OidcPasswd {
fn get_entry_by_uid(uid: libc::uid_t) -> Response<Passwd> {
let conf = nss_hook_prepare();
if !get_cache().context_user.is_initialized() {
get_cache().context_user.set_current_user();
}
let mut cache = get_cache();
let user_token_res = cache.context_user.get_access_token();
// FIXME Implement caching of system token
......@@ -133,9 +129,6 @@ impl PasswdHooks for OidcPasswd {
fn get_entry_by_name(name: String) -> Response<Passwd> {
let conf = nss_hook_prepare();
if !get_cache().context_user.is_initialized() {
get_cache().context_user.set_current_user();
}
let mut cache = get_cache();
let user_token_res = cache.context_user.get_access_token();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment