pam_xdg: pam_get_item can return NULL

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
This commit is contained in:
Andre Albsmeier 2024-05-27 08:31:34 +02:00 committed by Emmanuel Vadot
parent f5f40dd63b
commit cca0ce62f3

View file

@ -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;
}
@ -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;
}