aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_exec/pam_exec.c
diff options
context:
space:
mode:
authorSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
committerSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
commit4f3cfaf827bfa42a239c255092a128a3a02198bf (patch)
treeeac7f023f043739b79b2a51bd68c3006acb12964 /modules/pam_exec/pam_exec.c
parent6408d4b1baff9a7e58fd66e1d1c0871be0823777 (diff)
parent7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3 (diff)
downloadpam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.gz
pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.bz2
pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.zip
Update upstream source from tag 'upstream/1.7.0'
Update to upstream version '1.7.0' with Debian dir 0b3cd490884352e14273caeca2f05c6a525499fa
Diffstat (limited to 'modules/pam_exec/pam_exec.c')
-rw-r--r--modules/pam_exec/pam_exec.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c
index 9d2145dc..e328be16 100644
--- a/modules/pam_exec/pam_exec.c
+++ b/modules/pam_exec/pam_exec.c
@@ -33,9 +33,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(HAVE_CONFIG_H)
#include "config.h"
-#endif
#include <time.h>
#include <errno.h>
@@ -55,6 +53,7 @@
#include <security/pam_ext.h>
#include <security/_pam_macros.h>
#include "pam_inline.h"
+#include "pam_i18n.h"
#define ENV_ITEM(n) { (n), #n }
static struct {
@@ -156,7 +155,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
if (expose_authtok == 1)
{
- if (strcmp (pam_type, "auth") != 0)
+ if (strcmp (pam_type, "auth") != 0 && strcmp (pam_type, "password") != 0)
{
pam_syslog (pamh, LOG_ERR,
"expose_authtok not supported for type %s", pam_type);
@@ -268,16 +267,15 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
if (use_stdout)
{
- char buf[4096];
+ char *buf = NULL;
+ size_t n = 0;
close(stdout_fds[1]);
- while (fgets(buf, sizeof(buf), stdout_file) != NULL)
+ while (getline(&buf, &n, stdout_file) != -1)
{
- size_t len;
- len = strlen(buf);
- if (buf[len-1] == '\n')
- buf[len-1] = '\0';
+ buf[strcspn(buf, "\n")] = '\0';
pam_info(pamh, "%s", buf);
}
+ free(buf);
fclose(stdout_file);
}
@@ -436,7 +434,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
_exit (err);
}
- arggv = calloc (argc + 4, sizeof (char *));
+ arggv = calloc ((size_t) argc + 1, sizeof (char *));
if (arggv == NULL)
_exit (ENOMEM);