aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_unix/unix_chkpwd.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2022-08-16 22:06:15 -0700
committerSteve Langasek <steve.langasek@canonical.com>2022-08-16 22:06:15 -0700
commit99d0d1c5c4f07332daa86e73981267a761bc966e (patch)
treea56fe41110023676d7082028cbaa47ca4b6e6164 /modules/pam_unix/unix_chkpwd.c
parentf6d08ed47a3da3c08345bce2ca366e961c52ad7c (diff)
parent40f7d85f3736d058c26de1dafa4fed46de7d75ef (diff)
downloadpam-99d0d1c5c4f07332daa86e73981267a761bc966e.tar.gz
pam-99d0d1c5c4f07332daa86e73981267a761bc966e.tar.bz2
pam-99d0d1c5c4f07332daa86e73981267a761bc966e.zip
New upstream version 1.5.2
Diffstat (limited to 'modules/pam_unix/unix_chkpwd.c')
-rw-r--r--modules/pam_unix/unix_chkpwd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/pam_unix/unix_chkpwd.c b/modules/pam_unix/unix_chkpwd.c
index 88647e58..3931bab2 100644
--- a/modules/pam_unix/unix_chkpwd.c
+++ b/modules/pam_unix/unix_chkpwd.c
@@ -33,6 +33,7 @@
#include <security/_pam_macros.h>
#include "passverify.h"
+#include "pam_inline.h"
static int _check_expiry(const char *uname)
{
@@ -89,7 +90,7 @@ static int _audit_log(int type, const char *uname, int rc)
int main(int argc, char *argv[])
{
- char pass[MAXPASS + 1];
+ char pass[PAM_MAX_RESP_SIZE + 1];
char *option;
int npass, nullok;
int blankpass = 0;
@@ -136,7 +137,7 @@ int main(int argc, char *argv[])
user = getuidname(getuid());
/* if the caller specifies the username, verify that user
matches it */
- if (strcmp(user, argv[1])) {
+ if (user == NULL || strcmp(user, argv[1])) {
user = argv[1];
/* no match -> permanently change to the real user and proceed */
if (setuid(getuid()) != 0)
@@ -162,7 +163,7 @@ int main(int argc, char *argv[])
}
/* read the password from stdin (a pipe from the pam_unix module) */
- npass = read_passwords(STDIN_FILENO, 1, passwords);
+ npass = pam_read_passwords(STDIN_FILENO, 1, passwords);
if (npass != 1) { /* is it a valid password? */
helper_log_err(LOG_DEBUG, "no password supplied");
@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
retval = helper_verify_password(user, pass, nullok);
- memset(pass, '\0', MAXPASS); /* clear memory of the password */
+ memset(pass, '\0', PAM_MAX_RESP_SIZE); /* clear memory of the password */
/* return pass or fail */