aboutsummaryrefslogtreecommitdiff
path: root/libpam/pam_password.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 17:05:01 -0800
committerSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 17:27:13 -0800
commit419bd504587ec2bfc9085fe56e7a53433fd1eae6 (patch)
treed516c2ccae28dbd020cb69f50162f5d32acd7648 /libpam/pam_password.c
parentc68dce23face9f26b651917b418c7f80931fa7b7 (diff)
parent9c52e721044e7501c3d4567b36d222dc7326224a (diff)
downloadpam-419bd504587ec2bfc9085fe56e7a53433fd1eae6.tar.gz
pam-419bd504587ec2bfc9085fe56e7a53433fd1eae6.tar.bz2
pam-419bd504587ec2bfc9085fe56e7a53433fd1eae6.zip
merge upstream version 1.0.1
Diffstat (limited to 'libpam/pam_password.c')
-rw-r--r--libpam/pam_password.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/libpam/pam_password.c b/libpam/pam_password.c
new file mode 100644
index 00000000..cd57f20b
--- /dev/null
+++ b/libpam/pam_password.c
@@ -0,0 +1,61 @@
+/* pam_password.c - PAM Password Management */
+
+/*
+ * $Id: pam_password.c,v 1.5 2006/07/24 15:47:40 kukuk Exp $
+ */
+
+/* #define DEBUG */
+
+#include "pam_private.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int pam_chauthtok(pam_handle_t *pamh, int flags)
+{
+ int retval;
+
+ D(("called."));
+
+ IF_NO_PAMH("pam_chauthtok", pamh, PAM_SYSTEM_ERR);
+
+ if (__PAM_FROM_MODULE(pamh)) {
+ D(("called from module!?"));
+ return PAM_SYSTEM_ERR;
+ }
+
+ if (pamh->former.choice == PAM_NOT_STACKED) {
+ _pam_start_timer(pamh); /* we try to make the time for a failure
+ independent of the time it takes to
+ fail */
+ _pam_sanitize(pamh);
+ pamh->former.update = PAM_FALSE;
+ }
+
+ /* first call to check if there will be a problem */
+ if (pamh->former.update ||
+ (retval = _pam_dispatch(pamh, flags|PAM_PRELIM_CHECK,
+ PAM_CHAUTHTOK)) == PAM_SUCCESS) {
+ D(("completed check ok: former=%d", pamh->former.update));
+ pamh->former.update = PAM_TRUE;
+ retval = _pam_dispatch(pamh, flags|PAM_UPDATE_AUTHTOK,
+ PAM_CHAUTHTOK);
+ }
+
+ /* if we completed we should clean up */
+ if (retval != PAM_INCOMPLETE) {
+ _pam_sanitize(pamh);
+ pamh->former.update = PAM_FALSE;
+ _pam_await_timer(pamh, retval); /* if unsuccessful then wait now */
+ D(("pam_chauthtok exit %d - %d", retval, pamh->former.choice));
+ } else {
+ D(("will resume when ready", retval));
+ }
+
+#ifdef HAVE_LIBAUDIT
+ retval = _pam_auditlog(pamh, PAM_CHAUTHTOK, retval, flags);
+#endif
+
+ return retval;
+}
+