aboutsummaryrefslogtreecommitdiff
path: root/libpam
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2024-01-22 21:17:35 +0100
committerTobias Stoeckmann <tobias@stoeckmann.org>2024-01-24 18:19:29 +0100
commit54a0aee65b3d8129a55ece62ab8540f1cac3e929 (patch)
tree63e926ebaed3cb371d0cfdc6c9f742e54a05f7bf /libpam
parent8f9d8239344354c5c80d85a326b1a6c6661ea9b6 (diff)
downloadpam-54a0aee65b3d8129a55ece62ab8540f1cac3e929.tar.gz
pam-54a0aee65b3d8129a55ece62ab8540f1cac3e929.tar.bz2
pam-54a0aee65b3d8129a55ece62ab8540f1cac3e929.zip
libpam_internal: supply debug functionality
Move function bodies from headers into dedicated object files stored in libpam_internal. This library won't be installed. Keep the debug function body in header, even though disabled when building Linux-PAM, to stay API compatible with previous versions. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'libpam')
-rw-r--r--libpam/Makefile.am4
-rw-r--r--libpam/include/security/_pam_macros.h22
2 files changed, 22 insertions, 4 deletions
diff --git a/libpam/Makefile.am b/libpam/Makefile.am
index 5ed045a6..e3f4a3bc 100644
--- a/libpam/Makefile.am
+++ b/libpam/Makefile.am
@@ -23,7 +23,9 @@ noinst_HEADERS = pam_prelude.h pam_private.h pam_tokens.h \
include/test_assert.h
libpam_la_LDFLAGS = -no-undefined -version-info 85:1:85
-libpam_la_LIBADD = @LIBAUDIT@ $(LIBPRELUDE_LIBS) $(ECONF_LIBS) @LIBDL@ @LTLIBINTL@
+libpam_la_LIBADD = $(top_builddir)/libpam_internal/libpam_internal.la \
+ @LIBAUDIT@ $(LIBPRELUDE_LIBS) $(ECONF_LIBS) @LIBDL@ \
+ @LTLIBINTL@
if HAVE_VERSIONING
libpam_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libpam.map
diff --git a/libpam/include/security/_pam_macros.h b/libpam/include/security/_pam_macros.h
index 01274428..cd42bf72 100644
--- a/libpam/include/security/_pam_macros.h
+++ b/libpam/include/security/_pam_macros.h
@@ -94,11 +94,25 @@ do { \
#define _PAM_LOGFILE "/var/run/pam-debug.log"
#endif
+#ifdef PAM_NO_HEADER_FUNCTIONS
+UNUSED
+extern void _pam_output_debug_info(const char *file, const char *fn
+ , const int line);
+UNUSED
+PAM_FORMAT((printf, 1, 2))
+extern void _pam_output_debug(const char *format, ...);
+#else
+#ifdef PAM_DEBUG_C
+#define PAM_DEBUG_SCOPE
+#else
+#define PAM_DEBUG_SCOPE static
+#endif
+
#ifdef UNUSED
UNUSED
#endif
-static void _pam_output_debug_info(const char *file, const char *fn
- , const int line)
+PAM_DEBUG_SCOPE void _pam_output_debug_info(const char *file, const char *fn
+ , const int line)
{
FILE *logfile;
int must_close = 1, fd;
@@ -127,7 +141,7 @@ static void _pam_output_debug_info(const char *file, const char *fn
UNUSED
#endif
PAM_FORMAT((printf, 1, 2))
-static void _pam_output_debug(const char *format, ...)
+PAM_DEBUG_SCOPE void _pam_output_debug(const char *format, ...)
{
va_list args;
FILE *logfile;
@@ -157,6 +171,8 @@ static void _pam_output_debug(const char *format, ...)
va_end(args);
}
+#undef PAM_DEBUG_SCOPE
+#endif
#define D(x) do { \
_pam_output_debug_info(__FILE__, __FUNCTION__, __LINE__); \