diff options
Diffstat (limited to 'libmisc/pam_pass_non_interactive.c')
-rw-r--r-- | libmisc/pam_pass_non_interactive.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/libmisc/pam_pass_non_interactive.c b/libmisc/pam_pass_non_interactive.c index 3c95c88c..d031284a 100644 --- a/libmisc/pam_pass_non_interactive.c +++ b/libmisc/pam_pass_non_interactive.c @@ -1,30 +1,7 @@ /* - * Copyright (c) 2009 - 2010, Nicolas François - * All rights reserved. + * SPDX-FileCopyrightText: 2009 - 2010, Nicolas François * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the copyright holders or contributors may not be used to - * endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #include <config.h> @@ -38,6 +15,7 @@ #include <stdlib.h> #include <security/pam_appl.h> #include "prototypes.h" +#include "shadowlog.h" /*@null@*/ /*@only@*/static const char *non_interactive_password = NULL; static int ni_conv (int num_msg, @@ -76,9 +54,9 @@ static int ni_conv (int num_msg, switch (msg[count]->msg_style) { case PAM_PROMPT_ECHO_ON: - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: PAM modules requesting echoing are not supported.\n"), - Prog); + log_get_progname()); goto failed_conversation; case PAM_PROMPT_ECHO_OFF: responses[count].resp = strdup (non_interactive_password); @@ -88,7 +66,7 @@ static int ni_conv (int num_msg, break; case PAM_ERROR_MSG: if ( (NULL == msg[count]->msg) - || (fprintf (shadow_logfd, "%s\n", msg[count]->msg) <0)) { + || (fprintf (log_get_logfd(), "%s\n", msg[count]->msg) <0)) { goto failed_conversation; } responses[count].resp = NULL; @@ -101,9 +79,9 @@ static int ni_conv (int num_msg, responses[count].resp = NULL; break; default: - (void) fprintf (shadow_logfd, + (void) fprintf (log_get_logfd(), _("%s: conversation type %d not supported.\n"), - Prog, msg[count]->msg_style); + log_get_progname(), msg[count]->msg_style); goto failed_conversation; } } @@ -143,19 +121,19 @@ int do_pam_passwd_non_interactive (const char *pam_service, ret = pam_start (pam_service, username, &non_interactive_pam_conv, &pamh); if (ret != PAM_SUCCESS) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: (user %s) pam_start failure %d\n"), - Prog, username, ret); + log_get_progname(), username, ret); return 1; } non_interactive_password = password; ret = pam_chauthtok (pamh, 0); if (ret != PAM_SUCCESS) { - fprintf (shadow_logfd, + fprintf (log_get_logfd(), _("%s: (user %s) pam_chauthtok() failed, error:\n" "%s\n"), - Prog, username, pam_strerror (pamh, ret)); + log_get_progname(), username, pam_strerror (pamh, ret)); } (void) pam_end (pamh, PAM_SUCCESS); |