Skip to content

Commit

Permalink
pam_xdg: pam_get_item can return NULL
Browse files Browse the repository at this point in the history
Fix pam_xdg as pam_get_item can return NULL, this happens when pressing
control + C in xdm for example.

MFC after:	1 week
PR:		279268
  • Loading branch information
Andre Albsmeier authored and evadot committed May 27, 2024
1 parent f5f40dd commit cca0ce6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/libpam/modules/pam_xdg/pam_xdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ _pam_xdg_open(pam_handle_t *pamh, int flags __unused,

/* Get user info */
rv = pam_get_item(pamh, PAM_USER, (const void **)&user);
if (rv != PAM_SUCCESS) {
if (rv != PAM_SUCCESS || user == NULL) {
PAM_VERBOSE_ERROR("Can't get user information");
goto out;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ _pam_xdg_close(pam_handle_t *pamh __unused, int flags __unused,

/* Get user info */
rv = pam_get_item(pamh, PAM_USER, (const void **)&user);
if (rv != PAM_SUCCESS) {
if (rv != PAM_SUCCESS || user == NULL) {
PAM_VERBOSE_ERROR("Can't get user information");
goto out;
}
Expand Down

0 comments on commit cca0ce6

Please sign in to comment.