aboutsummaryrefslogtreecommitdiff
path: root/lib/libpam
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2016-06-08 11:47:19 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2016-06-08 11:47:19 +0000
commit328e4174b659b26b5c490f18283910a2e6c19710 (patch)
treef43fd83735ab95fb6ee4d79ff878079962e382be /lib/libpam
parent646fa3876792383a2b173b928581d7708c76c4ab (diff)
downloadsrc-328e4174b659b26b5c490f18283910a2e6c19710.tar.gz
src-328e4174b659b26b5c490f18283910a2e6c19710.zip
Replace _pam_verbose_error() with a macro. This was the last difference
between our libpam and stock OpenPAM, meaning that it is now possible to replace the base libpam with a hypothetical ports version of OpenPAM.
Notes
Notes: svn path=/head/; revision=301602
Diffstat (limited to 'lib/libpam')
-rw-r--r--lib/libpam/Makefile.inc2
-rw-r--r--lib/libpam/libpam/Makefile2
-rw-r--r--lib/libpam/libpam/pam_debug_log.c62
-rw-r--r--lib/libpam/libpam/security/pam_mod_misc.h17
4 files changed, 9 insertions, 74 deletions
diff --git a/lib/libpam/Makefile.inc b/lib/libpam/Makefile.inc
index 59a8ced858be..c0463625a609 100644
--- a/lib/libpam/Makefile.inc
+++ b/lib/libpam/Makefile.inc
@@ -26,7 +26,7 @@
CFLAGS+= -DOPENPAM_DEBUG
-SHLIB_MAJOR= 5
+SHLIB_MAJOR= 6
STATIC_CFLAGS+= -DOPENPAM_STATIC_MODULES
diff --git a/lib/libpam/libpam/Makefile b/lib/libpam/libpam/Makefile
index 531feab83b44..1e634b705496 100644
--- a/lib/libpam/libpam/Makefile
+++ b/lib/libpam/libpam/Makefile
@@ -100,8 +100,6 @@ SRCS= openpam_asprintf.c \
pam_verror.c \
pam_vinfo.c \
pam_vprompt.c
-# Local additions
-SRCS+= pam_debug_log.c
MAN?= openpam.3 \
openpam_borrow_cred.3 \
diff --git a/lib/libpam/libpam/pam_debug_log.c b/lib/libpam/libpam/pam_debug_log.c
deleted file mode 100644
index c3fe8e3f8467..000000000000
--- a/lib/libpam/libpam/pam_debug_log.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright 2001 Mark R V Murray
- * All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <libgen.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <security/pam_appl.h>
-#include <security/openpam.h>
-#include <security/pam_mod_misc.h>
-
-/* Print a verbose error, including the function name and a
- * cleaned up filename.
- */
-void
-_pam_verbose_error(pam_handle_t *pamh, int flags,
- const char *file, const char *function, const char *format, ...)
-{
- va_list ap;
- char *fmtbuf, *modname, *period;
-
- if (!(flags & PAM_SILENT) && !openpam_get_option(pamh, "no_warn")) {
- modname = basename(file);
- period = strchr(modname, '.');
- if (period == NULL)
- period = strchr(modname, '\0');
- va_start(ap, format);
- asprintf(&fmtbuf, "%.*s: %s: %s\n", (int)(period - modname),
- modname, function, format);
- pam_verror(pamh, fmtbuf, ap);
- free(fmtbuf);
- va_end(ap);
- }
-}
diff --git a/lib/libpam/libpam/security/pam_mod_misc.h b/lib/libpam/libpam/security/pam_mod_misc.h
index c9fc8d770187..13ff0f3a4c28 100644
--- a/lib/libpam/libpam/security/pam_mod_misc.h
+++ b/lib/libpam/libpam/security/pam_mod_misc.h
@@ -39,18 +39,17 @@
#define PAM_OPT_ECHO_PASS "echo_pass"
#define PAM_OPT_DEBUG "debug"
-__BEGIN_DECLS
-void _pam_verbose_error(pam_handle_t *, int, const char *,
- const char *, const char *, ...);
-__END_DECLS
-
-#define PAM_LOG(...) \
+#define PAM_LOG(...) \
openpam_log(PAM_LOG_DEBUG, __VA_ARGS__)
-#define PAM_RETURN(arg) \
+#define PAM_RETURN(arg) \
return (arg)
-#define PAM_VERBOSE_ERROR(...) \
- _pam_verbose_error(pamh, flags, __FILE__, __func__, __VA_ARGS__)
+#define PAM_VERBOSE_ERROR(...) \
+ do { \
+ if (!(flags & PAM_SILENT) && \
+ !openpam_get_option(pamh, "no_warn")) \
+ pam_error(pamh, __VA_ARGS__); \
+ } while (0);
#endif