shithub: tlsclient

Download patch

ref: 5667f2e915e89cfda69b3be28b612d59fea1d56b
parent: cfad51df72ba8e13e685e9246cb42cbf67191635
author: Jacob Moody <moody@posixcafe.org>
date: Tue Aug 1 15:22:03 EDT 2023

pam: close fd after use

--- a/pam.c
+++ b/pam.c
@@ -14,7 +14,6 @@
 
 #include "fncs.h"
 
-/* pasword change TODO */
 PAM_EXTERN int
 pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv )
 {
@@ -21,7 +20,6 @@
 	return PAM_SUCCESS;
 }
 
-/* For checking if the user has expired, has access to specific machine etc */
 PAM_EXTERN int
 pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv)
 {
@@ -30,7 +28,6 @@
 
 char *authserver;
 
-/* expected hook, this is where custom stuff happens */
 PAM_EXTERN int
 pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv )
 {
@@ -54,6 +51,8 @@
 		return PAM_AUTH_ERR;
 
 	ai = p9any(username, password, fd);
+	close(fd);
+
 	if(ai == nil)
 		return PAM_AUTH_ERR;