Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nss-pam-webapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
magicfelix
nss-pam-webapi
Commits
b599803f
Verified
Commit
b599803f
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[NSS] Move context_user initialisation to nss_hook_prepare
parent
ddd9971a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nss.rs
+7
-14
7 additions, 14 deletions
src/nss.rs
with
7 additions
and
14 deletions
src/nss.rs
+
7
−
14
View file @
b599803f
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment