summaryrefslogtreecommitdiffstats
path: root/lib/pwdcheck.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 16:18:39 +0000
commit5242eef8fc54636a41701fd9d7083ba6e4a4e0b3 (patch)
treee6a0980092957865a937cc0f34446df3d5194e99 /lib/pwdcheck.c
parentReleasing progress-linux version 1:4.13+dfsg1-5~progress7.99u1. (diff)
downloadshadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.tar.xz
shadow-5242eef8fc54636a41701fd9d7083ba6e4a4e0b3.zip
Merging upstream version 1:4.15.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/pwdcheck.c')
-rw-r--r--lib/pwdcheck.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/pwdcheck.c b/lib/pwdcheck.c
new file mode 100644
index 0000000..93c9f5c
--- /dev/null
+++ b/lib/pwdcheck.c
@@ -0,0 +1,40 @@
+/*
+ * SPDX-FileCopyrightText: 2000 - 2005, Tomasz Kłoczko
+ * SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <config.h>
+
+#ident "$Id$"
+
+#ifndef USE_PAM
+
+#include <stdio.h>
+#include <shadow.h>
+
+#include "attr.h"
+#include "prototypes.h"
+#include "defines.h"
+#include "pwauth.h"
+#include "shadowlog.h"
+
+void passwd_check (const char *user, const char *passwd, MAYBE_UNUSED const char *progname)
+{
+ struct spwd *sp;
+
+ sp = getspnam (user); /* !USE_PAM, no need for xgetspnam */
+ if (NULL != sp) {
+ passwd = sp->sp_pwdp;
+ }
+ if (pw_auth (passwd, user, PW_LOGIN, NULL) != 0) {
+ SYSLOG ((LOG_WARN, "incorrect password for `%s'", user));
+ (void) sleep (1);
+ fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user);
+ exit (EXIT_FAILURE);
+ }
+}
+#else /* USE_PAM */
+extern int ISO_C_forbids_an_empty_translation_unit;
+#endif /* USE_PAM */