2008-04-27 00:40:09 +00:00
|
|
|
/*
|
2021-12-05 09:35:27 -06:00
|
|
|
* SPDX-FileCopyrightText: 2000 - 2005, Tomasz Kłoczko
|
|
|
|
* SPDX-FileCopyrightText: 2007 - 2008, Nicolas François
|
2008-04-27 00:40:09 +00:00
|
|
|
*
|
2021-12-05 09:35:27 -06:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2008-04-27 00:40:09 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-07 11:44:44 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2007-11-10 23:46:11 +00:00
|
|
|
#ident "$Id$"
|
2007-10-07 11:47:01 +00:00
|
|
|
|
2008-05-24 14:11:31 +00:00
|
|
|
#ifndef USE_PAM
|
|
|
|
|
2007-10-07 11:46:34 +00:00
|
|
|
#include <stdio.h>
|
2008-05-24 14:11:31 +00:00
|
|
|
#include <shadow.h>
|
2007-10-07 11:44:44 +00:00
|
|
|
#include "prototypes.h"
|
|
|
|
#include "defines.h"
|
2008-01-05 16:33:43 +00:00
|
|
|
#include "pwauth.h"
|
2021-11-28 17:37:53 -06:00
|
|
|
#include "shadowlog.h"
|
2008-05-24 14:11:31 +00:00
|
|
|
|
2009-04-23 20:17:02 +00:00
|
|
|
void passwd_check (const char *user, const char *passwd, unused const char *progname)
|
2007-10-07 11:44:44 +00:00
|
|
|
{
|
|
|
|
struct spwd *sp;
|
|
|
|
|
2008-05-24 14:11:31 +00:00
|
|
|
sp = getspnam (user); /* !USE_PAM, no need for xgetspnam */
|
|
|
|
if (NULL != sp) {
|
2007-10-07 11:44:44 +00:00
|
|
|
passwd = sp->sp_pwdp;
|
2008-05-24 14:11:31 +00:00
|
|
|
}
|
2023-02-01 02:50:14 +01:00
|
|
|
if (pw_auth (passwd, user, PW_LOGIN, NULL) != 0) {
|
2008-05-24 14:11:31 +00:00
|
|
|
SYSLOG ((LOG_WARN, "incorrect password for `%s'", user));
|
2009-04-23 20:17:02 +00:00
|
|
|
(void) sleep (1);
|
2021-11-28 17:37:53 -06:00
|
|
|
fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user);
|
2009-04-23 20:17:02 +00:00
|
|
|
exit (EXIT_FAILURE);
|
2007-10-07 11:44:44 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-24 14:11:31 +00:00
|
|
|
#else /* USE_PAM */
|
2022-12-21 19:02:25 +01:00
|
|
|
extern int ISO_C_forbids_an_empty_translation_unit;
|
2008-05-24 14:11:31 +00:00
|
|
|
#endif /* USE_PAM */
|