The separation was unnecessary, and caused build problems. Let's go wild and obliterate the library. The files are moved to libshadow. Scripted change: $ find libmisc/ -type f \ | grep '\.[chy]$' \ | xargs mv -t lib; Plus updating the Makefile and other references. While at it, I've sorted the sources lists. Link: <https://github.com/shadow-maint/shadow/pull/792> Reported-by: David Seifert <soap@gentoo.org> Cc: Sam James <sam@gentoo.org> Cc: Christian Bricart <christian@bricart.de> Cc: Michael Vetter <jubalh@iodoru.org> Cc: Robert Förster <Dessa@gmake.de> [ soap tested the Gentoo package ] Tested-by: David Seifert <soap@gentoo.org> Acked-by: David Seifert <soap@gentoo.org> Acked-by: Serge Hallyn <serge@hallyn.com> Acked-by: Iker Pedrosa <ipedrosa@redhat.com> Acked-by: <lslebodn@fedoraproject.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 1997 - 1999, Marek Michałkiewicz
|
|
* SPDX-FileCopyrightText: 2001 - 2005, Tomasz Kłoczko
|
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef USE_PAM
|
|
|
|
#ident "$Id$"
|
|
|
|
|
|
/*
|
|
* Change the user's password using PAM.
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include "defines.h"
|
|
#include "pam_defs.h"
|
|
#include "prototypes.h"
|
|
#include "shadowlog.h"
|
|
|
|
void do_pam_passwd (const char *user, bool silent, bool change_expired)
|
|
{
|
|
pam_handle_t *pamh = NULL;
|
|
int flags = 0, ret;
|
|
FILE *shadow_logfd = log_get_logfd();
|
|
|
|
if (silent)
|
|
flags |= PAM_SILENT;
|
|
if (change_expired)
|
|
flags |= PAM_CHANGE_EXPIRED_AUTHTOK;
|
|
|
|
ret = pam_start ("passwd", user, &conv, &pamh);
|
|
if (ret != PAM_SUCCESS) {
|
|
fprintf (shadow_logfd,
|
|
_("passwd: pam_start() failed, error %d\n"), ret);
|
|
exit (10); /* XXX */
|
|
}
|
|
|
|
ret = pam_chauthtok (pamh, flags);
|
|
if (ret != PAM_SUCCESS) {
|
|
fprintf (shadow_logfd, _("passwd: %s\n"), pam_strerror (pamh, ret));
|
|
fputs (_("passwd: password unchanged\n"), shadow_logfd);
|
|
pam_end (pamh, ret);
|
|
exit (10); /* XXX */
|
|
}
|
|
|
|
fputs (_("passwd: password updated successfully\n"), shadow_logfd);
|
|
(void) pam_end (pamh, PAM_SUCCESS);
|
|
}
|
|
#else /* !USE_PAM */
|
|
extern int ISO_C_forbids_an_empty_translation_unit;
|
|
#endif /* !USE_PAM */
|