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
af019b9a
Verified
Commit
af019b9a
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[Cache] Add some more debugging and error logging
parent
bdae34be
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/cache.rs
+17
-5
17 additions, 5 deletions
src/cache.rs
with
17 additions
and
5 deletions
src/cache.rs
+
17
−
5
View file @
af019b9a
...
@@ -273,7 +273,10 @@ impl UserInfo {
...
@@ -273,7 +273,10 @@ impl UserInfo {
// Determine XDG directories now
// Determine XDG directories now
let
base_dirs
=
match
BaseDirectories
::
with_prefix
(
BASE_NAME
)
{
let
base_dirs
=
match
BaseDirectories
::
with_prefix
(
BASE_NAME
)
{
Ok
(
b
)
=>
b
,
Ok
(
b
)
=>
b
,
Err
(
e
)
=>
return
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
e
))
Err
(
e
)
=>
{
error!
(
"Could not determine XDG base directories: {}"
,
e
);
return
Err
(
io
::
Error
::
new
(
io
::
ErrorKind
::
Other
,
e
));
}
};
};
// Restore $HOME to original if we changed it earlier
// Restore $HOME to original if we changed it earlier
...
@@ -292,7 +295,10 @@ impl UserInfo {
...
@@ -292,7 +295,10 @@ impl UserInfo {
fn
place_user_cache_file
(
&
mut
self
,
filename
:
String
)
->
Result
<
PathBuf
,
io
::
Error
>
{
fn
place_user_cache_file
(
&
mut
self
,
filename
:
String
)
->
Result
<
PathBuf
,
io
::
Error
>
{
match
self
.get_user_xdg_base_directories
()
{
match
self
.get_user_xdg_base_directories
()
{
Ok
(
b
)
=>
b
.place_cache_file
(
filename
),
Ok
(
b
)
=>
b
.place_cache_file
(
filename
),
Err
(
e
)
=>
Err
(
e
)
Err
(
e
)
=>
{
error!
(
"Error placing cache file {}: {}"
,
filename
,
e
);
Err
(
e
)
}
}
}
}
}
...
@@ -328,7 +334,7 @@ impl UserInfo {
...
@@ -328,7 +334,7 @@ impl UserInfo {
/// write the token to disk afterwards
/// write the token to disk afterwards
pub
fn
set_access_token
(
&
mut
self
,
token
:
BasicTokenResponse
)
->
Result
<
(),
io
::
Error
>
{
pub
fn
set_access_token
(
&
mut
self
,
token
:
BasicTokenResponse
)
->
Result
<
(),
io
::
Error
>
{
self
.access_token
=
Some
(
token
.clone
());
self
.access_token
=
Some
(
token
.clone
());
debug!
(
"Saved token
for
in memory"
);
debug!
(
"Saved token in memory"
);
// Try to write user's token cache file
// Try to write user's token cache file
// We need to ensure privileges were dropped successfully to avoid symlink attacks
// We need to ensure privileges were dropped successfully to avoid symlink attacks
...
@@ -339,9 +345,15 @@ impl UserInfo {
...
@@ -339,9 +345,15 @@ impl UserInfo {
debug!
(
"Storing token for in cache file"
);
debug!
(
"Storing token for in cache file"
);
save_json
(
path
,
token
)
save_json
(
path
,
token
)
},
},
Err
(
e
)
=>
Err
(
e
)
Err
(
e
)
=>
{
error!
(
"Error getting cache path in user home: {}"
,
e
);
Err
(
e
)
}
},
},
Err
(
e
)
=>
Err
(
e
)
Err
(
e
)
=>
{
error!
(
"Error dropping privileges to store token in user home: {}"
,
e
);
Err
(
e
)
}
};
};
self
.restore_privileges
();
self
.restore_privileges
();
return
res
;
return
res
;
...
...
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