git: 06986e899972 - main - pam_xdg: Fix user xdg runtime directory's descriptor leak

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Fri, 30 Aug 2024 14:08:53 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=06986e899972ac3a127ab2ab46196672d0e1e5b2

commit 06986e899972ac3a127ab2ab46196672d0e1e5b2
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-08-13 21:04:09 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-08-30 14:08:14 +0000

    pam_xdg: Fix user xdg runtime directory's descriptor leak
    
    Fixes:          6e69612d5df1 ("pam: Add pam_xdg module")
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
---
 lib/libpam/modules/pam_xdg/pam_xdg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libpam/modules/pam_xdg/pam_xdg.c b/lib/libpam/modules/pam_xdg/pam_xdg.c
index 2c80f0a0332f..10c6467776a3 100644
--- a/lib/libpam/modules/pam_xdg/pam_xdg.c
+++ b/lib/libpam/modules/pam_xdg/pam_xdg.c
@@ -108,6 +108,7 @@ _pam_xdg_open(pam_handle_t *pamh, int flags __unused,
 			goto out;
 		}
 	} else {
+		close(rt_dir);
 		/* Check that the already create dir is correctly owned */
 		rv = fstatat(rt_dir_prefix, user, &sb, 0);
 		if (rv == -1) {