[SCM] pam wrapper repository - branch master updated

Andreas Schneider asn at samba.org
Thu Nov 23 10:51:31 UTC 2017


The branch, master has been updated
       via  9beb9f9 cmake: Improve PAM_WRAPPER_LOACATION
       via  9265da3 pam_wrapper: Use a constant string format specifier in test
       via  c611121 pam_wrapper: use uintptr_t as base for const-discarding
       via  38d359a pam_wrapper: #ifdef-out unused functions
      from  3b5417b pypamtest: Fix Python 2.6 compatibility

https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9beb9f9aaa223864128fd8222f0f92ba8ae697b7
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Nov 22 15:27:44 2017 +0100

    cmake: Improve PAM_WRAPPER_LOACATION
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 9265da3857e9cfa7a00d1ab35aae1e0b0286efad
Author: Uri Simchoni <uri at samba.org>
Date:   Wed Nov 22 20:48:23 2017 +0000

    pam_wrapper: Use a constant string format specifier in test
    
    This fixes a warning about non-constant format specifier.
    clang 4.0.0 warns against non-constant format specifier since
    it cannot validate the format against the parameters.
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit c611121eec7b5f2c39cab7b1c0295eddefdddb1d
Author: Uri Simchoni <uri at samba.org>
Date:   Sun Nov 19 13:08:30 2017 +0000

    pam_wrapper: use uintptr_t as base for const-discarding
    
    Seems like HAVE_INTPTR_T is not available on FreeBSD. Use
    the uintptr_t-base const discarding to avoid picky compiler
    warnings (other places in Samba also use uintptr_t).
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 38d359a686aa44b1d6cce8d6d9aac9687dd8d708
Author: Uri Simchoni <uri at samba.org>
Date:   Wed Nov 22 15:23:26 2017 +0100

    pam_wrapper: #ifdef-out unused functions
    
    When pam_vsyslog is not available, avoid building functions
    that are being used to wrap it, in order to avoid picky
    compiler warnings.
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/CMakeLists.txt     |  6 +-----
 src/pam_wrapper.c      |  8 ++++++--
 src/python/pypamtest.c | 16 ++++++++--------
 3 files changed, 15 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 713625b..76a87d6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,8 +74,4 @@ if (PYTHONLIBS_FOUND)
 endif()
 
 # This needs to be at the end
-if (POLICY CMP0026)
-    cmake_policy(SET CMP0026 OLD)
-endif()
-get_target_property(PAM_WRAPPER_LOCATION pam_wrapper LOCATION)
-set(PAM_WRAPPER_LOCATION ${PAM_WRAPPER_LOCATION} PARENT_SCOPE)
+set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE)
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 4be8146..473df4e 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -508,20 +508,20 @@ static const char *libpam_pam_strerror(pam_handle_t *pamh, int errnum)
 	return pwrap.libpam.symbols._libpam_pam_strerror.f(discard_const_p(pam_handle_t, pamh), errnum);
 }
 
+#ifdef HAVE_PAM_VSYSLOG
 static void libpam_pam_vsyslog(const pam_handle_t *pamh,
 			       int priority,
 			       const char *fmt,
 			       va_list args)
 {
-#ifdef HAVE_PAM_VSYSLOG
 	pwrap_bind_symbol_libpam(pam_vsyslog);
 
 	pwrap.libpam.symbols._libpam_pam_vsyslog.f(pamh,
 						   priority,
 						   fmt,
 						   args);
-#endif
 }
+#endif /* HAVE_PAM_VSYSLOG */
 
 /*********************************************************
  * PWRAP INIT
@@ -1487,6 +1487,7 @@ const char *pam_strerror(pam_handle_t *pamh, int errnum)
 				  errnum);
 }
 
+#if defined(HAVE_PAM_VSYSLOG) || defined(HAVE_PAM_SYSLOG)
 static void pwrap_pam_vsyslog(const pam_handle_t *pamh,
 			      int priority,
 			      const char *fmt,
@@ -1503,11 +1504,13 @@ static void pwrap_pam_vsyslog(const pam_handle_t *pamh,
 
 	PWRAP_LOG(PWRAP_LOG_TRACE, "pwrap_pam_vsyslog called");
 
+#ifdef HAVE_PAM_VSYSLOG
 	d = getenv("PAM_WRAPPER_USE_SYSLOG");
 	if (d != NULL && d[0] == '1') {
 		libpam_pam_vsyslog(pamh, priority, fmt, args);
 		return;
 	}
+#endif /* HAVE_PAM_VSYSLOG */
 
 	switch(priority) {
 	case 0: /* LOG_EMERG */
@@ -1533,6 +1536,7 @@ static void pwrap_pam_vsyslog(const pam_handle_t *pamh,
 
 	pwrap_vlog(dbglvl, syslog_str, fmt, args);
 }
+#endif /* defined(HAVE_PAM_VSYSLOG) || defined(HAVE_PAM_SYSLOG) */
 
 #ifdef HAVE_PAM_VSYSLOG
 void pam_vsyslog(const pam_handle_t *pamh,
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index a71fd35..e25900f 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -24,8 +24,8 @@
 #define PYTHON_MODULE_NAME  "pypamtest"
 
 #ifndef discard_const_p
-#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
-# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
+#if defined(__intptr_t_defined) || defined(HAVE_UINTPTR_T)
+# define discard_const_p(type, ptr) ((type *)((uintptr_t)(ptr)))
 #else
 # define discard_const_p(type, ptr) ((type *)(ptr))
 #endif
@@ -67,9 +67,9 @@ static PyObject *PyExc_PamTestError;
  *** helper functions
  **********************************************************/
 
-static const char *repr_fmt = "{ pam_operation [%d] "
-			      "expected_rv [%d] "
-			      "flags [%d] }";
+#define REPR_FMT "{ pam_operation [%d] " \
+			      "expected_rv [%d] " \
+			      "flags [%d] }"
 
 static char *py_strdup(const char *string)
 {
@@ -267,7 +267,7 @@ set_pypamtest_exception(PyObject *exc,
 			size_t num_tests)
 {
 	PyObject *obj = NULL;
-	/* repr_fmt is fixed and contains just %d expansions, so this is safe */
+	/* REPR_FMT contains just %d expansions, so this is safe */
 	char test_repr[256] = { '\0' };
 	union {
 		char *str;
@@ -286,7 +286,7 @@ set_pypamtest_exception(PyObject *exc,
 	if (perr == PAMTEST_ERR_CASE) {
 		failed = _pamtest_failed_case(tests, num_tests);
 		if (failed) {
-			snprintf(test_repr, sizeof(test_repr), repr_fmt,
+			snprintf(test_repr, sizeof(test_repr), REPR_FMT,
 				 failed->pam_operation,
 				 failed->expected_rv,
 				 failed->flags);
@@ -422,7 +422,7 @@ static int TestCase_init(TestCaseObject *self,
  */
 static PyObject *TestCase_repr(TestCaseObject *self)
 {
-	return PyUnicode_FromFormat(repr_fmt,
+	return PyUnicode_FromFormat(REPR_FMT,
 				    self->pam_operation,
 				    self->expected_rv,
 				    self->flags);


-- 
pam wrapper repository



More information about the samba-cvs mailing list