[SCM] pam wrapper repository - branch master updated

2023-11-10 Thread Andreas Schneider
The branch, master has been updated
   via  9f0cccf pwrap: Fix PAM_WRAPPER_DISABLE_DEEPBIND environment variable
  from  164d598 tests: Define PATH_MAX for Hurd.

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


- Log -
commit 9f0cccf7432dd9be1de953f9b13a7f9b06c40442
Author: Andreas Schneider 
Date:   Fri Nov 10 15:38:37 2023 +0100

pwrap: Fix PAM_WRAPPER_DISABLE_DEEPBIND environment variable

Signed-off-by: Andreas Schneider 
Reviewed-by: Pavel Filipenský 

---

Summary of changes:
 src/pam_wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 66673f0..c47b564 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -336,7 +336,7 @@ static void *pwrap_load_lib_handle(enum pwrap_lib lib)
 
 #ifdef RTLD_DEEPBIND
const char *env_preload = getenv("LD_PRELOAD");
-   const char *env_deepbind = getenv("UID_WRAPPER_DISABLE_DEEPBIND");
+   const char *env_deepbind = getenv("PAM_WRAPPER_DISABLE_DEEPBIND");
bool enable_deepbind = true;
 
/* Don't do a deepbind if we run with libasan */


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2023-11-10 Thread Andreas Schneider
The branch, master has been updated
   via  164d598 tests: Define PATH_MAX for Hurd.
   via  9023c89 doc/pam_matrix.8: Fix typo 'allows to'.
   via  7bd24b0 die quickly upon mkdir failure
  from  b223df9 Bump version to 1.1.5

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


- Log -
commit 164d598f34da901cb9eb4fd164475ed38715341a
Author: Simon Josefsson 
Date:   Tue Aug 22 08:53:30 2023 +0200

tests: Define PATH_MAX for Hurd.

Signed-off-by: Simon Josefsson 
Reviewed-by: Andreas Schneider 
Reviewed-by: Pavel Filipenský 

commit 9023c89459d3ad1fe28d211a0da6b69e6f3f7d64
Author: Simon Josefsson 
Date:   Fri Aug 18 11:25:54 2023 +0200

doc/pam_matrix.8: Fix typo 'allows to'.

Signed-off-by: Simon Josefsson 
Reviewed-by: Andreas Schneider 
Reviewed-by: Pavel Filipenský 

commit 7bd24b0e54995da5f333575f97c9f1fa796fe0f1
Author: Jan Kundrát 
Date:   Mon Nov 6 18:34:58 2023 +0100

die quickly upon mkdir failure

We just had this failure in our CI system that's currently running just
three PAM-wrapped tests in parallel. Since this is a classic TOCTOU race
(albeit in a test code, and therefore with little to no security
implications), the `mkdir` can fail, and when that happens it's much
better to just die quickly rather than continuing as if nothing
happened.

Signed-off-by: Jan Kundrát 
Reviewed-by: Pavel Filipenský 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 doc/pam_matrix.8 | 2 +-
 doc/pam_matrix.8.txt | 2 +-
 src/modules/pam_matrix.c | 4 
 src/pam_wrapper.c| 2 ++
 4 files changed, 8 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/pam_matrix.8 b/doc/pam_matrix.8
index 80d5190..23ba1fa 100644
--- a/doc/pam_matrix.8
+++ b/doc/pam_matrix.8
@@ -34,7 +34,7 @@ pam_matrix \- A PAM test module to retrieve module\-specific 
PAM items
 pam_matrix\&.so [\&...]
 .SH "DESCRIPTION"
 .sp
-Testing PAM application often requires to set up an authentication backend 
with as little effort as possible\&. The \fBpam_matrix\fR module allows to 
authenticate against a key\-value text file, provided by an option or with an 
environment variable\&.
+Testing PAM application often requires to set up an authentication backend 
with as little effort as possible\&. The \fBpam_matrix\fR module allows one to 
authenticate against a key\-value text file, provided by an option or with an 
environment variable\&.
 .SH "IMPORTANT"
 .sp
 pam_matrix is a \fBtest tool\fR\&. It should be considered completely insecure 
and never used outside test environments! As you\(cqll see when reading 
description of the options and actions, many of them don\(cqt make any sense in 
the real world and were added just to make tests possible\&.
diff --git a/doc/pam_matrix.8.txt b/doc/pam_matrix.8.txt
index fb54f05..b15b11a 100644
--- a/doc/pam_matrix.8.txt
+++ b/doc/pam_matrix.8.txt
@@ -14,7 +14,7 @@ pam_matrix.so [...]
 DESCRIPTION
 ---
 Testing PAM application often requires to set up an authentication backend with
-as little effort as possible. The *pam_matrix* module allows to authenticate
+as little effort as possible. The *pam_matrix* module allows one to 
authenticate
 against a key-value text file, provided by an option or with an environment
 variable.
 
diff --git a/src/modules/pam_matrix.c b/src/modules/pam_matrix.c
index 6fb6a2f..cc6fbf3 100644
--- a/src/modules/pam_matrix.c
+++ b/src/modules/pam_matrix.c
@@ -33,6 +33,10 @@
 #include 
 #include 
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 #ifndef discard_const
 #define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 #endif
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index da2c738..66673f0 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -893,6 +893,7 @@ static void pwrap_init(void)
PWRAP_LOG(PWRAP_LOG_ERROR,
  "Failed to create pam_wrapper config dir: %s - %s",
  tmp_config_dir, strerror(errno));
+   exit(1);
}
 
/* Create file with the PID of the the process */
@@ -1121,6 +1122,7 @@ static void pwrap_init(void)
PWRAP_LOG(PWRAP_LOG_ERROR,
  "Failed to create pam_wrapper config dir: %s - %s",
  tmp_config_dir, strerror(errno));
+   exit(1);
}
 
/* Create file with the PID of the the process */


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2023-08-08 Thread Andreas Schneider
The branch, master has been updated
   via  b223df9 Bump version to 1.1.5
  from  39d9af8 cmake: Remove -Werror=declaration-after-statement

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


- Log -
commit b223df9f35e750811f812c8cfb85bc81c196102e
Author: Andreas Schneider 
Date:   Mon Jul 17 14:50:14 2023 +0200

Bump version to 1.1.5

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

---

Summary of changes:
 CHANGELOG  | 4 
 CMakeLists.txt | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CHANGELOG b/CHANGELOG
index 608f45b..5e2da7c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 ChangeLog
 ==
 
+version 1.1.5 (released 2023-08-08)
+  * Fixed building with Python 3.12
+  * Removed Python 2 support
+
 version 1.1.4 (released 2020-10-28)
   * NOTE: pam_wrapper stopped working with the latest OpenPAM on FreeBSD 12.
 Help is needed to add back support.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37dff75..7b01937 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(pam_wrapper VERSION 1.1.4 LANGUAGES C)
+project(pam_wrapper VERSION 1.1.5 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
@@ -25,7 +25,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 # Increment PATCH.
 set(LIBRARY_VERSION_MAJOR 0)
 set(LIBRARY_VERSION_MINOR 0)
-set(LIBRARY_VERSION_PATCH 7)
+set(LIBRARY_VERSION_PATCH 8)
 set(LIBRARY_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
 set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
 


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2023-07-17 Thread Andreas Schneider
The branch, master has been updated
   via  39d9af8 cmake: Remove -Werror=declaration-after-statement
  from  8e94874 cmake: Fix cmocka >= 1.1.6 find_package() in CONFIG mode

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


- Log -
commit 39d9af80cdae1be805346bca4f40b71149d62ba8
Author: Andreas Schneider 
Date:   Mon Jul 10 11:32:23 2023 +0200

cmake: Remove -Werror=declaration-after-statement

This is not compatible with Python 3.12

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

---

Summary of changes:
 CompilerChecks.cmake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake
index 6c74b0b..559ecf9 100644
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -32,7 +32,8 @@ if (UNIX)
 add_c_compiler_flag("-Wpointer-arith" SUPPORTED_COMPILER_FLAGS)
 add_c_compiler_flag("-Werror=pointer-arith" SUPPORTED_COMPILER_FLAGS)
 add_c_compiler_flag("-Wdeclaration-after-statement" 
SUPPORTED_COMPILER_FLAGS)
-add_c_compiler_flag("-Werror=declaration-after-statement" 
SUPPORTED_COMPILER_FLAGS)
+# Not compatible with Python 3.12 headers
+#add_c_compiler_flag("-Werror=declaration-after-statement" 
SUPPORTED_COMPILER_FLAGS)
 add_c_compiler_flag("-Wreturn-type" SUPPORTED_COMPILER_FLAGS)
 add_c_compiler_flag("-Werror=return-type" SUPPORTED_COMPILER_FLAGS)
 add_c_compiler_flag("-Wuninitialized" SUPPORTED_COMPILER_FLAGS)


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2023-02-27 Thread Andreas Schneider
The branch, master has been updated
   via  8e94874 cmake: Fix cmocka >= 1.1.6 find_package() in CONFIG mode
   via  9e7f8ac cmake: Drop FindCMocka.cmake Module
  from  2b486d5 Drop support for Python 2

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


- Log -
commit 8e94874bf5c0d569a16985eafa9922d8c527a9fb
Author: Andreas Schneider 
Date:   Fri Feb 17 17:51:27 2023 +0100

cmake: Fix cmocka >= 1.1.6 find_package() in CONFIG mode

Signed-off-by: Andreas Schneider 
Reviewed-by: Pavel Filipenský 

commit 9e7f8ac9ee1f968ac8af2d9c2e9dbd91a3090b73
Author: Andreas Schneider 
Date:   Fri Feb 17 18:08:45 2023 +0100

cmake: Drop FindCMocka.cmake Module

We should use config mode.

Signed-off-by: Andreas Schneider 
Reviewed-by: Pavel Filipenský 

---

Summary of changes:
 cmake/Modules/FindCMocka.cmake | 49 --
 tests/CMakeLists.txt   |  4 
 2 files changed, 4 insertions(+), 49 deletions(-)
 delete mode 100644 cmake/Modules/FindCMocka.cmake


Changeset truncated at 500 lines:

diff --git a/cmake/Modules/FindCMocka.cmake b/cmake/Modules/FindCMocka.cmake
deleted file mode 100644
index 2dd9fc5..000
--- a/cmake/Modules/FindCMocka.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-# - Try to find CMocka
-# Once done this will define
-#
-#  CMOCKA_ROOT_DIR - Set this variable to the root installation of CMocka
-#
-# Read-Only variables:
-#  CMOCKA_FOUND - system has CMocka
-#  CMOCKA_INCLUDE_DIR - the CMocka include directory
-#  CMOCKA_LIBRARIES - Link these to use CMocka
-#  CMOCKA_DEFINITIONS - Compiler switches required for using CMocka
-#
-#=
-#  Copyright (c) 2011-2012 Andreas Schneider 
-#
-#  Distributed under the OSI-approved BSD License (the "License");
-#  see accompanying file Copyright.txt for details.
-#
-#  This software is distributed WITHOUT ANY WARRANTY; without even the
-#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#  See the License for more information.
-#=
-#
-
-find_path(CMOCKA_INCLUDE_DIR
-NAMES
-cmocka.h
-PATHS
-${CMOCKA_ROOT_DIR}/include
-)
-
-find_library(CMOCKA_LIBRARY
-NAMES
-cmocka
-PATHS
-${CMOCKA_ROOT_DIR}/include
-)
-
-if (CMOCKA_LIBRARY)
-  set(CMOCKA_LIBRARIES
-  ${CMOCKA_LIBRARIES}
-  ${CMOCKA_LIBRARY}
-  )
-endif (CMOCKA_LIBRARY)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES 
CMOCKA_INCLUDE_DIR)
-
-# show the CMOCKA_INCLUDE_DIR and CMOCKA_LIBRARIES variables only in the 
advanced view
-mark_as_advanced(CMOCKA_INCLUDE_DIR CMOCKA_LIBRARIES)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9d56f21..26f2da2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,5 +1,9 @@
 project(tests C)
 
+if (TARGET cmocka::cmocka)
+set(CMOCKA_LIBRARY cmocka::cmocka)
+endif()
+
 set(PAM_MATRIX_PATH "${CMAKE_BINARY_DIR}/src/modules/pam_matrix.so")
 
 configure_file(services/matrix.in ${CMAKE_CURRENT_BINARY_DIR}/services/matrix 
@ONLY)


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2022-08-31 Thread Andreas Schneider
The branch, master has been updated
   via  2b486d5 Drop support for Python 2
   via  7932e58 gitlab-ci: Introduce test stages
   via  1c924d4 gitlab-ci: Change the obj-dir so it doesn't create problems
   via  514610b gitlab-ci: Fix indentation found by yamllint
  from  d938a84 Bump version to 1.1.4

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


- Log -
commit 2b486d5eb124562460a91e49eaf7bbef6fd3d168
Author: Andreas Schneider 
Date:   Tue Aug 2 09:21:55 2022 +0200

Drop support for Python 2

Python 2 is already EOL!

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 7932e582ec0e4332ee417fbddfab3516e9ed575a
Author: Andreas Schneider 
Date:   Tue Aug 2 11:45:05 2022 +0200

gitlab-ci: Introduce test stages

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 1c924d3eb8f9065145c256a2e796069563e4
Author: Andreas Schneider 
Date:   Tue Aug 2 11:55:02 2022 +0200

gitlab-ci: Change the obj-dir so it doesn't create problems

The artifacts seem to be downloaded in the analysis stage if something
fails in the test stage. This should fix it for now.

Reviewed-by: Ralph Boehme 

commit 514610bcc4a8825b36cbbb838c496657e0b99bef
Author: Andreas Schneider 
Date:   Tue Aug 2 11:40:42 2022 +0200

gitlab-ci: Fix indentation found by yamllint

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 .gitlab-ci.yml| 209 +-
 src/python/CMakeLists.txt |   3 +-
 src/python/python2/CMakeLists.txt |  45 
 tests/CMakeLists.txt  |   9 --
 tests/pypamtest_test.py   |  14 +--
 5 files changed, 121 insertions(+), 159 deletions(-)
 delete mode 100644 src/python/python2/CMakeLists.txt


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1439b2c..c205528 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,4 @@
+---
 variables:
   GIT_DEPTH: 3
   BUILD_IMAGES_PROJECT: cmocka/gitlab-build-images
@@ -6,18 +7,24 @@ variables:
   TUMBLEWEED_BUILD: buildenv-tumbleweed
   UBUNTU_BUILD: buildenv-ubuntu
 
+stages:
+  - build
+  - test
+  - analysis
+
 centos7/x86_64:
+  stage: test
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
   script:
-  - mkdir -p obj && cd obj && cmake3
--DCMAKE_BUILD_TYPE=RelWithDebInfo
--DPICKY_DEVELOPER=ON
--DUNIT_TESTING=ON .. &&
-make -j$(nproc) && ctest --output-on-failure
+- mkdir -p obj && cd obj && cmake3
+  -DCMAKE_BUILD_TYPE=RelWithDebInfo
+  -DPICKY_DEVELOPER=ON
+  -DUNIT_TESTING=ON .. &&
+  make -j$(nproc) && ctest --output-on-failure
   tags:
-  - shared
+- shared
   except:
-  - tags
+- tags
   artifacts:
 expire_in: 1 week
 when: on_failure
@@ -25,18 +32,19 @@ centos7/x86_64:
   - obj/
 
 fedora/x86_64:
+  stage: test
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
   script:
-  - mkdir -p obj && cd obj && cmake
--DCMAKE_INSTALL_PREFIX=/tmp/local
--DCMAKE_BUILD_TYPE=RelWithDebInfo
--DPICKY_DEVELOPER=ON
--DUNIT_TESTING=ON .. &&
-make -j$(nproc) && ctest --output-on-failure && make install
+- mkdir -p obj && cd obj && cmake
+  -DCMAKE_INSTALL_PREFIX=/tmp/local
+  -DCMAKE_BUILD_TYPE=RelWithDebInfo
+  -DPICKY_DEVELOPER=ON
+  -DUNIT_TESTING=ON .. &&
+  make -j$(nproc) && ctest --output-on-failure && make install
   tags:
-  - shared
+- shared
   except:
-  - tags
+- tags
   artifacts:
 expire_in: 1 week
 when: on_failure
@@ -44,17 +52,18 @@ fedora/x86_64:
   - obj/
 
 fedora/address-sanitizer:
+  stage: build
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
   script:
-  - mkdir -p obj && cd obj && cmake
--DCMAKE_BUILD_TYPE=AddressSanitizer
--DPICKY_DEVELOPER=ON
--DUNIT_TESTING=ON .. &&
-make -j$(nproc) && ctest --output-on-failure
+- mkdir -p obj && cd obj && cmake
+  -DCMAKE_BUILD_TYPE=AddressSanitizer
+  -DPICKY_DEVELOPER=ON
+  -DUNIT_TESTING=ON .. &&
+  make -j$(nproc) && ctest --output-on-failure
   tags:
-  - shared
+- shared
   except:
-  - tags
+- tags
   artifacts:
 expire_in: 1 week
 when: on_failure
@@ -62,17 +71,18 @@ fedora/address-sanitizer:
   - obj/
 
 fedora/undefined-sanitizer:
+  stage: analysis
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
   script:
-  - mkdir -p obj && cd obj && cmake
--DCMAKE_BUILD_TYPE=UndefinedSanitizer
--DPICKY_DEVELOPER=ON
--DUNIT_TESTING=ON ..
-&& make -j$(nproc) && ctest --output-on-failure
+- mkdir -p obj && cd obj && cmake
+  -DCMAKE_BUILD_TYPE=UndefinedSanitizer
+  -DPICKY_DEVELOPER=ON
+  -DUNIT_TESTING=ON ..
+  && make -j$(nproc) && ctest --output-on-failure
   

[SCM] pam wrapper repository - branch master updated

2021-10-28 Thread Andreas Schneider
The branch, master has been updated
   via  d938a84 Bump version to 1.1.4
   via  42f9d4d gitlab-ci: Allow freebsd to fail
   via  6df5d14 tests: Allow to filter tests
   via  de959bc cmake: Check for -Wno-bad-function-cast
  from  4efe631 cmake: Remove configure check for pam_modutil_search_key

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


- Log -
commit d938a84d88c5882a08babfb5e10f03a9135237a3
Author: Andreas Schneider 
Date:   Fri Jun 25 10:12:07 2021 +0200

Bump version to 1.1.4

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 42f9d4dee0c46174f305e65f87d82b2bcb12fe58
Author: Andreas Schneider 
Date:   Tue Oct 5 09:31:12 2021 +0200

gitlab-ci: Allow freebsd to fail

Reviewed-by: Ralph Boehme 

commit 6df5d14e49edc586b5000d552a26e0629b1f3b41
Author: Andreas Schneider 
Date:   Fri Jun 25 13:45:31 2021 +0200

tests: Allow to filter tests

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit de959bc431c9f87eb25b9e006b3a783a66048bd0
Author: Andreas Schneider 
Date:   Fri Jun 25 10:52:14 2021 +0200

cmake: Check for -Wno-bad-function-cast

Fixes the build on freebsd.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 .gitlab-ci.yml| 3 +++
 CHANGELOG | 9 +
 CMakeLists.txt| 8 
 CompilerChecks.cmake  | 3 +++
 src/python/CMakeLists.txt | 8 +---
 tests/test_pam_wrapper.c  | 7 ++-
 6 files changed, 30 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 839c834..1439b2c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -132,6 +132,9 @@ freebsd/x86_64:
 when: on_failure
 paths:
   - obj/
+  # pam_wrapper stopped to work with the latest OpenPAM version, this is a
+  # bigger effort to investigate.
+  allow_failure: true
 
 tumbleweed/x86_64/gcc:
   image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
diff --git a/CHANGELOG b/CHANGELOG
index 39772b3..608f45b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,15 @@
 ChangeLog
 ==
 
+version 1.1.4 (released 2020-10-28)
+  * NOTE: pam_wrapper stopped working with the latest OpenPAM on FreeBSD 12.
+Help is needed to add back support.
+  * Added support to retrieve the PAM environment from a python's
+PAMTEST_GETENVLIST
+  * Added a new keyword parameter to reuse the PAM handle in libpamtest
+  * Fixed pid range
+  * Fixed constructor/destructor on AIX
+
 version 1.1.3 (released 2020-03-26)
   * Fixed paths in pkgconfig and cmake config files
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b453ec3..37dff75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(pam_wrapper VERSION 1.1.3 LANGUAGES C)
+project(pam_wrapper VERSION 1.1.4 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
@@ -25,13 +25,13 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 # Increment PATCH.
 set(LIBRARY_VERSION_MAJOR 0)
 set(LIBRARY_VERSION_MINOR 0)
-set(LIBRARY_VERSION_PATCH 6)
+set(LIBRARY_VERSION_PATCH 7)
 set(LIBRARY_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
 set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
 
-set(PAMTEST_LIBRARY_VERSION_MAJOR 0)
+set(PAMTEST_LIBRARY_VERSION_MAJOR 1)
 set(PAMTEST_LIBRARY_VERSION_MINOR 0)
-set(PAMTEST_LIBRARY_VERSION_PATCH 5)
+set(PAMTEST_LIBRARY_VERSION_PATCH 0)
 set(PAMTEST_LIBRARY_VERSION 
"${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
 set(PAMTEST_LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
 
diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake
index 4fa1a83..6c74b0b 100644
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -95,6 +95,9 @@ if (UNIX)
 add_c_compiler_flag("-Wno-error=tautological-compare" 
SUPPORTED_COMPILER_FLAGS)
 endif()
 
+# Needed by src/python/CMakeLists.txt
+check_c_compiler_flag("-Wno-cast-function-type" 
WITH_WNO_CAST_FUNCTION_TYPE)
+
 # Unset CMAKE_REQUIRED_FLAGS
 unset(CMAKE_REQUIRED_FLAGS)
 endif()
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index e8730d9..faaf569 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -3,6 +3,8 @@ project(pypamtest C)
 add_subdirectory(python2)
 add_subdirectory(python3)
 
-set_source_files_properties(pypamtest.c
-DIRECTORY python2 python3
-PROPERTIES COMPILE_OPTIONS 
"-Wno-cast-function-type")
+if (WITH_WNO_CAST_FUNCTION_TYPE)
+set_source_files_properties(pypamtest.c
+DIRECTORY python2 python3

[SCM] pam wrapper repository - branch master updated

2021-06-25 Thread Andreas Schneider
The branch, master has been updated
   via  4efe631 cmake: Remove configure check for pam_modutil_search_key
   via  beba95f Revert "pwrap: Add back pso_copy for openSUSE Tumbleweed"
  from  71253c1 libpamtest: Fix missing pam_handle argument in 
run_pamtest_conv macro

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


- Log -
commit 4efe631246d9b1475b6e8836d68e71f482493f6a
Author: Andreas Schneider 
Date:   Fri Oct 23 18:37:57 2020 +0200

cmake: Remove configure check for pam_modutil_search_key

This was just temporary for openSUSE Tumbleweed.

Signed-off-by: Andreas Schneider 
Reviewed-by: Samuel Cabrero 

commit beba95f1eac18d08c8821be131fb879a16c692fe
Author: Andreas Schneider 
Date:   Fri Oct 23 18:37:08 2020 +0200

Revert "pwrap: Add back pso_copy for openSUSE Tumbleweed"

Tumbleweed has pam 1.4.0 now!

This reverts commit 97fdcec92ee34cf061222e3d12c2624ec7ab4ff7.

Reviewed-by: Samuel Cabrero 

---

Summary of changes:
 ConfigureChecks.cmake |   3 --
 config.h.cmake|   1 -
 src/pam_wrapper.c | 125 --
 3 files changed, 129 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index dcf5f31..d28cf66 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -77,9 +77,6 @@ set(CMAKE_REQUIRED_LIBRARIES ${PAM_LIBRARY})
 check_function_exists(pam_syslog HAVE_PAM_SYSLOG)
 check_function_exists(pam_vsyslog HAVE_PAM_VSYSLOG)
 check_function_exists(pam_start_confdir HAVE_PAM_START_CONFDIR)
-# This is available in current PAM master and will be used as a workaround
-# till pam_start_confdir() is available.
-check_function_exists(pam_modutil_search_key HAVE_PAM_MODUTIL_SEARCH_KEY)
 unset(CMAKE_REQUIRED_LIBRARIES)
 
 # OPTIONS
diff --git a/config.h.cmake b/config.h.cmake
index 80208aa..7d6ee24 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -21,7 +21,6 @@
 #cmakedefine HAVE_PAM_VSYSLOG 1
 #cmakedefine HAVE_PAM_SYSLOG 1
 #cmakedefine HAVE_PAM_START_CONFDIR 1
-#cmakedefine HAVE_PAM_MODUTIL_SEARCH_KEY 1
 
 #cmakedefine HAVE_PAM_VPROMPT_CONST 1
 #cmakedefine HAVE_PAM_PROMPT_CONST 1
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index efa7cbb..da2c738 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -948,130 +948,6 @@ static void pwrap_init(void)
 
 #else /* HAVE_PAM_START_CONFDIR */
 
-#ifdef HAVE_PAM_MODUTIL_SEARCH_KEY
-/*
- * This is needed to workaround Tumbleweed which packages a libpam git version.
- */
-static int pso_copy(const char *src, const char *dst, const char *pdir, mode_t 
mode)
-{
-#define PSO_COPY_READ_SIZE 16
-   int srcfd = -1;
-   int dstfd = -1;
-   int rc = -1;
-   ssize_t bread, bwritten;
-   struct stat sb;
-   char buf[PSO_COPY_READ_SIZE + 1];
-   size_t pso_copy_read_size = PSO_COPY_READ_SIZE;
-   int cmp;
-   size_t to_read;
-   bool found_slash;
-
-   cmp = strcmp(src, dst);
-   if (cmp == 0) {
-   return -1;
-   }
-
-   srcfd = open(src, O_RDONLY, 0);
-   if (srcfd < 0) {
-   return -1;
-   }
-
-   if (mode == 0) {
-   rc = fstat(srcfd, );
-   if (rc != 0) {
-   rc = -1;
-   goto out;
-   }
-   mode = sb.st_mode;
-   }
-
-   dstfd = open(dst, O_CREAT|O_WRONLY|O_TRUNC, mode);
-   if (dstfd < 0) {
-   rc = -1;
-   goto out;
-   }
-
-   found_slash = false;
-   to_read = 1;
-
-   for (;;) {
-   bread = read(srcfd, buf, to_read);
-   if (bread == 0) {
-   /* done */
-   break;
-   } else if (bread < 0) {
-   errno = EIO;
-   rc = -1;
-   goto out;
-   }
-
-   to_read = 1;
-   if (!found_slash && buf[0] == '/') {
-   found_slash = true;
-   to_read = pso_copy_read_size;
-   }
-
-   if (found_slash && bread == PSO_COPY_READ_SIZE) {
-   cmp = memcmp(buf, "usr/etc/pam.d/%s", 16);
-   if (cmp == 0) {
-   char tmp[16] = {0};
-
-   snprintf(tmp, sizeof(tmp), "%s/%%s", pdir + 1);
-
-   memcpy(buf, tmp, 12);
-   memset([12], '\0', 4);
-
-   /*
-* If we found this string, we need to reduce
-* the read size to not miss, the next one.
-*/
-   pso_copy_read_size = 13;
-   } else {
- 

[SCM] pam wrapper repository - branch master updated

2021-06-25 Thread Andreas Schneider
The branch, master has been updated
   via  71253c1 libpamtest: Fix missing pam_handle argument in 
run_pamtest_conv macro
  from  3508ad2 Accept whole range of supported pids

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


- Log -
commit 71253c15cced205e58e3ae0e1220e95b49e38695
Author: Samuel Cabrero 
Date:   Fri Jun 25 10:06:09 2021 +0200

libpamtest: Fix missing pam_handle argument in run_pamtest_conv macro

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 include/libpamtest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/include/libpamtest.h b/include/libpamtest.h
index 4ebe83f..4b4a50e 100644
--- a/include/libpamtest.h
+++ b/include/libpamtest.h
@@ -180,7 +180,7 @@ enum pamtest_err run_pamtest_conv(const char *service,
  struct pam_testcase test_cases[],
  pam_handle_t *pam_handle);
 #else
-#define run_pamtest_conv(service, user, conv_fn, conv_data, test_cases) \
+#define run_pamtest_conv(service, user, conv_fn, conv_data, test_cases, 
pam_handle) \
_pamtest_conv(service, user, conv_fn, conv_data, test_cases, 
sizeof(test_cases)/sizeof(test_cases[0], pam_handle)
 #endif
 


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2021-06-25 Thread Andreas Schneider
The branch, master has been updated
   via  3508ad2 Accept whole range of supported pids
  from  88b9921 cmake: Silence warning with gcc version >= 8

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


- Log -
commit 3508ad2704103e863fca8c45ecda25021850befc
Author: Jakub Jelen 
Date:   Thu Jun 24 10:24:31 2021 +0200

Accept whole range of supported pids

Signed-off-by: Jakub Jelen 
Reviewed-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 src/pam_wrapper.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 6801d7b..efa7cbb 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -791,14 +791,20 @@ static void pwrap_clean_stale_dirs(const char *dir)
buf[sizeof(buf) - 1] = '\0';
 
tmp = strtol(buf, NULL, 10);
-   if (tmp == 0 || tmp > 0x || errno == ERANGE) {
+   if (tmp == 0 || errno == ERANGE) {
PWRAP_LOG(PWRAP_LOG_ERROR,
  "Failed to parse pid, buf=%s",
  buf);
return;
}
 
-   pid = (pid_t)(tmp & 0x);
+   pid = (pid_t)tmp;
+   /* Check if we are out of pid_t range on this system */
+   if ((long)pid != tmp) {
+   PWRAP_LOG(PWRAP_LOG_ERROR,
+ "pid out of range: %ld", tmp);
+   return;
+   }
 
rc = kill(pid, 0);
if (rc == -1) {


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2021-06-24 Thread Andreas Schneider
The branch, master has been updated
   via  88b9921 cmake: Silence warning with gcc version >= 8
   via  1330009 python: Export pam_setcred flags, to be used in python 
testcase objects
   via  6ada64a libpamtest: Add a new keyword parameter to reuse the PAM 
handle
   via  dd5608b python: Store the pam handle in the python test object
   via  b0ff06b python: Store the pam env in the python test object
  from  0e28e3e tests: Correctly implement free_vlist()

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


- Log -
commit 88b9921bd106ad3d06062e42fd76898525a9d542
Author: Samuel Cabrero 
Date:   Mon Jun 21 12:46:20 2021 +0200

cmake: Silence warning with gcc version >= 8

src/python/pypamtest.c:1149:17: warning[-Wcast-function-type]: cast between
incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *,
PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *,
struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’
{aka ‘struct _object * (*)(struct _object *, struct _object *)’}

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

commit 1330009d5277e7e4673112be0ff9de9cf0e1a618
Author: Samuel Cabrero 
Date:   Fri Jun 18 15:38:31 2021 +0200

python: Export pam_setcred flags, to be used in python testcase objects

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

commit 6ada64a7ab52c07417bc012a200ac6e9fa5d5c2f
Author: Samuel Cabrero 
Date:   Fri Jun 18 10:36:17 2021 +0200

libpamtest: Add a new keyword parameter to reuse the PAM handle

Add a new keyword parameter to pass and reuse a PAM handle obtained by a
previous run having a test object of type PAMTEST_KEEPHANDLE.

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

commit dd5608b36a5f6d7121a8ba6590de1eacd0cc48b3
Author: Samuel Cabrero 
Date:   Fri Jun 18 09:21:12 2021 +0200

python: Store the pam handle in the python test object

There was no way to get the PAM handler from a PAMTEST_KEEPHANDLE test
object.

The PAM handle is stored in the pam_handle member of the test object.

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

commit b0ff06ba02a3c08fd4a60aacf716bc97efec9588
Author: Samuel Cabrero 
Date:   Fri Jun 18 09:19:25 2021 +0200

python: Store the pam env in the python test object

There was no way to retrieve the PAM environment from a
PAMTEST_GETENVLIST test object.

The PAM environment is stored as a dictionary in the pam_env member of
the test object.

Signed-off-by: Samuel Cabrero 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 include/libpamtest.h  |  22 --
 src/libpamtest.c  |  19 +++--
 src/python/CMakeLists.txt |   4 +
 src/python/pypamtest.c| 192 +++---
 tests/test_pam_wrapper.c  |  30 
 5 files changed, 229 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/libpamtest.h b/include/libpamtest.h
index 3fa69c7..4ebe83f 100644
--- a/include/libpamtest.h
+++ b/include/libpamtest.h
@@ -156,6 +156,8 @@ struct pamtest_conv_data {
  * @param[in]  test_cases   List of libpamtest test cases. Must end with
  *  PAMTEST_CASE_SENTINEL
  *
+ * @param[in]  pam_handle   The PAM handle to use to run the tests
+ *
  * @code
  * int main(void) {
  * int rc;
@@ -175,10 +177,11 @@ enum pamtest_err run_pamtest_conv(const char *service,
  const char *user,
  pam_conv_fn conv_fn,
  void *conv_userdata,
- struct pam_testcase test_cases[]);
+ struct pam_testcase test_cases[],
+ pam_handle_t *pam_handle);
 #else
 #define run_pamtest_conv(service, user, conv_fn, conv_data, test_cases) \
-   _pamtest_conv(service, user, conv_fn, conv_data, test_cases, 
sizeof(test_cases)/sizeof(test_cases[0])
+   _pamtest_conv(service, user, conv_fn, conv_data, test_cases, 
sizeof(test_cases)/sizeof(test_cases[0], pam_handle)
 #endif
 
 #ifdef DOXYGEN
@@ -196,6 +199,8 @@ enum pamtest_err run_pamtest_conv(const char *service,
  * @param[in]  test_cases   List of libpamtest test cases. Must end with
  *  PAMTEST_CASE_SENTINEL
  *
+ * @param[in]  pam_handle   The PAM handle to use to run the tests
+ *
  * @code
  * int main(void) {
  * int rc;
@@ -214,10 +219,11 @@ enum pamtest_err run_pamtest_conv(const char *service,
 enum pamtest_err run_pamtest(const char *service,
 const char *user,
 struct pamtest_conv_data *conv_data,
- 

[SCM] pam wrapper repository - branch master updated

2021-04-28 Thread Andreas Schneider
The branch, master has been updated
   via  0e28e3e tests: Correctly implement free_vlist()
  from  5eeaa5b libpamtest: fix comments for pamtest_conv_data

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


- Log -
commit 0e28e3e0c980fa8c2c121ba96a641a63b5179301
Author: Andreas Schneider 
Date:   Mon Apr 19 16:12:30 2021 +0200

tests: Correctly implement free_vlist()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 tests/test_pam_wrapper.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/test_pam_wrapper.c b/tests/test_pam_wrapper.c
index c8cb043..7e8b9ee 100644
--- a/tests/test_pam_wrapper.c
+++ b/tests/test_pam_wrapper.c
@@ -340,8 +340,11 @@ static void test_pam_acct_err(void **state)
 
 static inline void free_vlist(char **vlist)
 {
-   free(vlist[0]);
-   free(vlist[1]);
+   size_t i;
+
+   for (i = 0; vlist[i] != NULL; i++) {
+   free(vlist[i]);
+   }
free(vlist);
 }
 


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2021-04-07 Thread Andreas Schneider
The branch, master has been updated
   via  5eeaa5b libpamtest: fix comments for pamtest_conv_data
  from  9fa1392 libpamtest: include stddef.h in libpamtest.h

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


- Log -
commit 5eeaa5bfa0c4df503ccff7f4797057c262e5c55a
Author: Valentin Vidic 
Date:   Sun Feb 7 21:29:01 2021 +0100

libpamtest: fix comments for pamtest_conv_data

Comment descriptions were reversed for out_err and out_info.

Signed-off-by: Valentin Vidic 
Reviewed-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 include/libpamtest.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/libpamtest.h b/include/libpamtest.h
index 98611f0..3fa69c7 100644
--- a/include/libpamtest.h
+++ b/include/libpamtest.h
@@ -129,12 +129,11 @@ struct pamtest_conv_data {
 * an index internally.
 */
const char **in_echo_on;
-
-   /** Captures messages through PAM_TEXT_INFO. The test caller is
+   /** Captures messages through PAM_ERROR_MSG. The test caller is
 * responsible for allocating enough space in the array.
 */
char **out_err;
-   /** Captures messages through PAM_ERROR_MSG. The test caller is
+   /** Captures messages through PAM_TEXT_INFO. The test caller is
 * responsible for allocating enough space in the array.
 */
char **out_info;


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2021-04-07 Thread Andreas Schneider
The branch, master has been updated
   via  9fa1392 libpamtest: include stddef.h in libpamtest.h
  from  7401af4 pam_wrapper.c: fall back to pragma init/fini for 
constructor/destructor if possible

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


- Log -
commit 9fa139275eb2e557fa997b2e559331400bf13ca2
Author: Valentin Vidic 
Date:   Sun Feb 7 21:25:36 2021 +0100

libpamtest: include stddef.h in libpamtest.h

If libpamtest.h is the first include build fails with:

  /usr/include/libpamtest.h:265:11: error: unknown type name ‘size_t’

Signed-off-by: Valentin Vidic 
Reviewed-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 include/libpamtest.h | 1 +
 1 file changed, 1 insertion(+)


Changeset truncated at 500 lines:

diff --git a/include/libpamtest.h b/include/libpamtest.h
index 0307a26..98611f0 100644
--- a/include/libpamtest.h
+++ b/include/libpamtest.h
@@ -19,6 +19,7 @@
 #ifndef __LIBPAMTEST_H_
 #define __LIBPAMTEST_H_
 
+#include 
 #include 
 #include 
 


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2020-12-03 Thread Andreas Schneider
The branch, master has been updated
   via  7401af4 pam_wrapper.c: fall back to pragma init/fini for 
constructor/destructor if possible
   via  f7ba680 configure: check for pragma init/fini for 
constructors/destructors
  from  ab2d90c Bump version to 1.1.3

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


- Log -
commit 7401af4dbe1a8dc5849c3d7fc2a7890413ab394e
Author: Björn Jacke 
Date:   Fri Oct 30 15:52:40 2020 +0100

pam_wrapper.c: fall back to pragma init/fini for constructor/destructor if 
possible

Signed-off-by: Bjoern Jacke 
Reviewed-by: Andreas Schneider 

commit f7ba680493ec6ae191a633799682eededdea1d83
Author: Björn Jacke 
Date:   Fri Oct 30 15:51:38 2020 +0100

configure: check for pragma init/fini for constructors/destructors

Signed-off-by: Bjoern Jacke 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 ConfigureChecks.cmake | 26 ++
 config.h.cmake|  2 ++
 src/pam_wrapper.c |  7 +++
 3 files changed, 35 insertions(+)


Changeset truncated at 500 lines:

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 8dcf978..dcf5f31 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -140,6 +140,32 @@ int main(void) {
 return 0;
 }" HAVE_DESTRUCTOR_ATTRIBUTE)
 
+check_c_source_compiles("
+#pragma init (test_constructor)
+void test_constructor(void);
+
+void test_constructor(void)
+{
+ return;
+}
+
+int main(void) {
+ return 0;
+}" HAVE_PRAGMA_INIT)
+
+check_c_source_compiles("
+#pragma fini (test_destructor)
+void test_destructor(void);
+
+void test_destructor(void)
+{
+return;
+}
+
+int main(void) {
+return 0;
+}" HAVE_PRAGMA_FINI)
+
 check_c_source_compiles("
 void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
 
diff --git a/config.h.cmake b/config.h.cmake
index 01a54f3..80208aa 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -40,6 +40,8 @@
 #cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1
 #cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
 #cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
+#cmakedefine HAVE_PRAGMA_INIT 1
+#cmakedefine HAVE_PRAGMA_FINI 1
 #cmakedefine HAVE_FUNCTION_ATTRIBUTE_FORMAT 1
 
 /*** ENDIAN */
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index dd69c43..6801d7b 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -311,7 +311,14 @@ static struct pwrap pwrap;
  */
 
 bool pam_wrapper_enabled(void);
+#if ! defined(HAVE_CONSTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_INIT)
+/* xlC and other oldschool compilers support (only) this */
+#pragma init (pwrap_constructor)
+#endif
 void pwrap_constructor(void) CONSTRUCTOR_ATTRIBUTE;
+#if ! defined(HAVE_DESTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_FINI)
+#pragma fini (pwrap_destructor)
+#endif
 void pwrap_destructor(void) DESTRUCTOR_ATTRIBUTE;
 
 /*


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2020-03-26 Thread Andreas Schneider
The branch, master has been updated
   via  ab2d90c Bump version to 1.1.3
   via  fca5220 cmake: Fix paths in pkgconfig and cmake config files
  from  6bfbb27 Bump version to 1.1.2

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


- Log -
commit ab2d90c6def33888db86755e23f3c12d417e187f
Author: Andreas Schneider 
Date:   Thu Mar 26 09:17:40 2020 +0100

Bump version to 1.1.3

Signed-off-by: Andreas Schneider 
Reviewed-by: Alexander Bokovoy 

commit fca52209f62c83055edb5f3c9945cca705e1f713
Author: Andreas Schneider 
Date:   Wed Mar 25 13:11:00 2020 +0100

cmake: Fix paths in pkgconfig and cmake config files

Signed-off-by: Andreas Schneider 
Reviewed-by: Alexander Bokovoy 

---

Summary of changes:
 CHANGELOG   | 3 +++
 CMakeLists.txt  | 2 +-
 libpamtest.pc.cmake | 2 +-
 pam_wrapper-config.cmake.in | 4 ++--
 pam_wrapper.pc.cmake| 4 ++--
 5 files changed, 9 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CHANGELOG b/CHANGELOG
index f72b8ad..39772b3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
 ChangeLog
 ==
 
+version 1.1.3 (released 2020-03-26)
+  * Fixed paths in pkgconfig and cmake config files
+
 version 1.1.2 (released 2020-03-24)
   * Fix manpage installation
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a95e8f7..b453ec3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(pam_wrapper VERSION 1.1.2 LANGUAGES C)
+project(pam_wrapper VERSION 1.1.3 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
diff --git a/libpamtest.pc.cmake b/libpamtest.pc.cmake
index 20758c7..6726d76 100644
--- a/libpamtest.pc.cmake
+++ b/libpamtest.pc.cmake
@@ -1,4 +1,4 @@
 Name: libpamtest
 Description: A helper library for PAM testing
 Version: @APPLICATION_VERSION@
-Libs: @LIB_INSTALL_DIR@/libpamtest.so
+Libs: @CMAKE_INSTALL_FULL_LIBDIR@/libpamtest.so
diff --git a/pam_wrapper-config.cmake.in b/pam_wrapper-config.cmake.in
index c93b661..d89e9a4 100644
--- a/pam_wrapper-config.cmake.in
+++ b/pam_wrapper-config.cmake.in
@@ -1,2 +1,2 @@
-set(PAM_WRAPPER_LIBRARY @CMAKE_INSTALL_LIBDIR@/@PAM_WRAPPER_LIB@)
-set(PAM_WRAPPER_MODULE_DIR @CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@)
+set(PAM_WRAPPER_LIBRARY @CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@)
+set(PAM_WRAPPER_MODULE_DIR @CMAKE_INSTALL_FULL_LIBDIR@/@PROJECT_NAME@)
diff --git a/pam_wrapper.pc.cmake b/pam_wrapper.pc.cmake
index 587a54c..7ebe607 100644
--- a/pam_wrapper.pc.cmake
+++ b/pam_wrapper.pc.cmake
@@ -1,6 +1,6 @@
-modules=@CMAKE_INSTALL_LIBDIR@/pam_wrapper
+modules=@CMAKE_INSTALL_FULL_LIBDIR@/pam_wrapper
 
 Name: @PROJECT_NAME@
 Description: The pam_wrapper library
 Version: @PROJECT_VERSION@
-Libs: @CMAKE_INSTALL_LIBDIR@/@PAM_WRAPPER_LIB@
+Libs: @CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2020-03-24 Thread Andreas Schneider
The branch, master has been updated
   via  6bfbb27 Bump version to 1.1.2
   via  55c08e2 doc: Fix manpage installation
  from  4ef299e Bump version to 1.1.1

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


- Log -
commit 6bfbb2772c7dd08ef3b52456b3fc01768fc139e8
Author: Andreas Schneider 
Date:   Tue Mar 24 14:30:35 2020 +0100

Bump version to 1.1.2

Signed-off-by: Andreas Schneider 
Reviewed-by: Alexander Bokovoy 

commit 55c08e27436adfe89d09d5ffa129ed5e9e581ee3
Author: Andreas Schneider 
Date:   Tue Mar 24 14:29:06 2020 +0100

doc: Fix manpage installation

Signed-off-by: Andreas Schneider 
Reviewed-by: Alexander Bokovoy 

---

Summary of changes:
 CHANGELOG  |  3 +++
 CMakeLists.txt |  2 +-
 doc/CMakeLists.txt | 10 +-
 3 files changed, 9 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CHANGELOG b/CHANGELOG
index 86bdfb4..f72b8ad 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
 ChangeLog
 ==
 
+version 1.1.2 (released 2020-03-24)
+  * Fix manpage installation
+
 version 1.1.1 (released 2020-03-24)
   * Fixed pam_wrapper on Ubuntu
   * Improved PAM detection for openSUSE Tumbleweed
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5ff40b..a95e8f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(pam_wrapper VERSION 1.1.1 LANGUAGES C)
+project(pam_wrapper VERSION 1.1.2 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 8a8e60a..498da5e 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,27 +1,27 @@
 install(FILES
 pam_wrapper.1
 DESTINATION
-${MAN_INSTALL_DIR}/man1)
+${CMAKE_INSTALL_MANDIR}/man1)
 
 install(FILES
 pam_matrix.8
 DESTINATION
-${MAN_INSTALL_DIR}/man8)
+${CMAKE_INSTALL_MANDIR}/man8)
 
 install(FILES
 pam_chatty.8
 DESTINATION
-${MAN_INSTALL_DIR}/man8)
+${CMAKE_INSTALL_MANDIR}/man8)
 
 install(FILES
 pam_get_items.8
 DESTINATION
-${MAN_INSTALL_DIR}/man8)
+${CMAKE_INSTALL_MANDIR}/man8)
 
 install(FILES
 pam_set_items.8
 DESTINATION
-${MAN_INSTALL_DIR}/man8)
+${CMAKE_INSTALL_MANDIR}/man8)
 
 #
 # Build the documentation


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2020-03-24 Thread Andreas Schneider
The branch, master has been updated
   via  4ef299e Bump version to 1.1.1
   via  fbb0f45 gitlab-ci: Work around a Python 3.8 bug
   via  3f0088a gitlab-ci: Add ubuntu target
   via  97fdcec pwrap: Add back pso_copy for openSUSE Tumbleweed
   via  9b43dad cmake: Check for pam_modutil_search_key
   via  c7ab357 pwrap: Use PSO_COPY_READ_SIZE in pso_copy()
   via  1f22429 Revert "pwrap: Fix pso_copy to work with libpam.so.0.84.2"
   via  0452102 pwrap: Create two pwrap_init() functions
   via  c559f8d pwrap: Log the return code of pam_start()
   via  345596e pwrap: Improve debug message in p_rmdirs_at()
   via  26be2b9 pwrap: Initialize pointers with NULL in p_rmdirs_at()
   via  ffca010 tests: Define PAM_AUTH_ERROR in init function
   via  36fe0f3 tests: Workaround an off-by-one error in FreeBSD
  from  d247d7a Bump version to 1.1.0

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


- Log -
commit 4ef299e83efc09006ca485162c3bb692c003e1dd
Author: Andreas Schneider 
Date:   Tue Mar 24 08:52:19 2020 +0100

Bump version to 1.1.1

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit fbb0f4515f456d851f77eeb6e8f96370d2dc5855
Author: Andreas Schneider 
Date:   Tue Mar 24 08:08:50 2020 +0100

gitlab-ci: Work around a Python 3.8 bug

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 3f0088a09ee3bab5d66ac703271a9381e1828017
Author: Andreas Schneider 
Date:   Mon Mar 23 18:49:27 2020 +0100

gitlab-ci: Add ubuntu target

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 97fdcec92ee34cf061222e3d12c2624ec7ab4ff7
Author: Andreas Schneider 
Date:   Tue Mar 24 07:32:06 2020 +0100

pwrap: Add back pso_copy for openSUSE Tumbleweed

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 9b43dad109b0e66247a7c909d5cc96bade3cea56
Author: Andreas Schneider 
Date:   Tue Mar 24 07:22:37 2020 +0100

cmake: Check for pam_modutil_search_key

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c7ab357a0c24d48ddd521c282af4eeec016b2eb4
Author: Andreas Schneider 
Date:   Tue Mar 24 11:19:36 2020 +0100

pwrap: Use PSO_COPY_READ_SIZE in pso_copy()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 1f224299e46a44473c42eab06a8fcc369fb3c8f2
Author: Andreas Schneider 
Date:   Tue Mar 24 07:05:28 2020 +0100

Revert "pwrap: Fix pso_copy to work with libpam.so.0.84.2"

This reverts commit 047e9fb616d21e202add9f16347cea208104.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 045210208d5dfc8b4e41735eeb73165d4a37990e
Author: Andreas Schneider 
Date:   Mon Mar 23 17:44:22 2020 +0100

pwrap: Create two pwrap_init() functions

One for pam_start() and one for pam_start_confdir() support.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c559f8d98331ecfa7c32396556fac040c61b7e55
Author: Andreas Schneider 
Date:   Mon Mar 23 17:47:16 2020 +0100

pwrap: Log the return code of pam_start()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 345596e3fdf6d0c94a36f36568766c0534ab082b
Author: Andreas Schneider 
Date:   Mon Mar 23 17:39:57 2020 +0100

pwrap: Improve debug message in p_rmdirs_at()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 26be2b9b8d99ca5aaa05b082765785179a9ba494
Author: Andreas Schneider 
Date:   Mon Mar 23 17:34:37 2020 +0100

pwrap: Initialize pointers with NULL in p_rmdirs_at()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit ffca0103fceb9d283eb36f175cb76597183de255
Author: Andreas Schneider 
Date:   Tue Mar 24 08:37:24 2020 +0100

tests: Define PAM_AUTH_ERROR in init function

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 36fe0f34041ba04f5cfe2f39ee28ebcb7cda3ca6
Author: Andreas Schneider 
Date:   Tue Mar 24 07:39:10 2020 +0100

tests: Workaround an off-by-one error in FreeBSD

https://www.openpam.org/wiki/Errata/2019-02-22

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 .gitlab-ci.yml   |  27 -
 CHANGELOG|   4 +
 CMakeLists.txt   |   4 +-
 ConfigureChecks.cmake|   3 +
 config.h.cmake   |   1 +
 src/pam_wrapper.c| 294 ++-
 tests/pypamtest_test.py  |  14 ++-
 tests/test_pam_wrapper.c |  20 
 8 files changed, 328 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 440521d..839c834 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ variables:
   FEDORA_BUILD: 

[SCM] pam wrapper repository - branch master updated

2020-03-20 Thread Andreas Schneider
The branch, master has been updated
   via  d247d7a Bump version to 1.1.0
   via  2d4494e Rename ChangeLog file
   via  779c61c gitingore: Ignore compile database
   via  3fdd6ad tests: Fix pypamtest_test.py on BSD
   via  70f44f4 pwrap: Set up a pthread_atfork() handler to not delete or 
config directory
   via  84e0bd0 pwrap: Move the constructor to the end of the source file
   via  85feb50 pwrap: Set initialised to false in the destructor
  from  ead5fb5 doc: Add generated pam_chatty.8 man page

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


- Log -
commit d247d7a08640a5f228e3681051fb7fb08dddc613
Author: Andreas Schneider 
Date:   Thu Mar 19 13:09:49 2020 +0100

Bump version to 1.1.0

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 2d4494e576034e2fe55099a1560a83b3f37f9b69
Author: Andreas Schneider 
Date:   Thu Mar 19 13:04:32 2020 +0100

Rename ChangeLog file

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 779c61cd2ff149204586d3ace1f963e18739310c
Author: Andreas Schneider 
Date:   Fri Mar 20 09:34:22 2020 +0100

gitingore: Ignore compile database

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 3fdd6ad7fe83be27064a000bc6061b937cb39baa
Author: Andreas Schneider 
Date:   Fri Mar 20 12:22:30 2020 +0100

tests: Fix pypamtest_test.py on BSD

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 70f44f4b1f46ae51e63dc7607a67e74f35f7d756
Author: Andreas Schneider 
Date:   Fri Mar 20 12:06:58 2020 +0100

pwrap: Set up a pthread_atfork() handler to not delete or config directory

Python3 has some strange behavior. It forks a child which then exits.
This child calls the destructor which deletes our /tmp/pam.X directory.

As we later try to bind the symbol the directory is gone and we detected
and error which results in exit(-1).

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 84e0bd0530c3197d1aba37beb918f3815fa891ca
Author: Andreas Schneider 
Date:   Fri Mar 20 11:57:26 2020 +0100

pwrap: Move the constructor to the end of the source file

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 85feb50228ddf97a1f2b1bc7941af63512a2d416
Author: Andreas Schneider 
Date:   Fri Mar 20 11:52:25 2020 +0100

pwrap: Set initialised to false in the destructor

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 .gitignore  |  1 +
 ChangeLog => CHANGELOG  |  6 +
 CMakeLists.txt  | 26 
 src/pam_wrapper.c   | 64 +++--
 tests/pypamtest_test.py |  8 ++-
 5 files changed, 81 insertions(+), 24 deletions(-)
 rename ChangeLog => CHANGELOG (86%)


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 0baa4fa..751772d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ cscope.*
 tags
 /build
 /obj*
+compile_commands.json
diff --git a/ChangeLog b/CHANGELOG
similarity index 86%
rename from ChangeLog
rename to CHANGELOG
index f0a2c21..ac94d0f 100644
--- a/ChangeLog
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
 ChangeLog
 ==
 
+version 1.1.0 (released 2020-03-20)
+  * Added support for pam_start_confdir()
+  * Added pam_chatty module
+  * Added gitlab CI support
+  * Fixed crash when a PAM module outputs too much data
+
 version 1.0.7 (released 2018-09-26)
   * Added support for running with AddressSanitizer
   * Added logging for pam_set_items module
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94d7146..216699f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,23 +11,29 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(pam_wrapper VERSION 1.0.7 LANGUAGES C)
+project(pam_wrapper VERSION 1.1.0 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
 
-# SOVERSION scheme: CURRENT.AGE.REVISION
+# SOVERSION scheme: MAJOR.MINOR.PATCH
 #   If there was an incompatible interface change:
-# Increment CURRENT. Set AGE and REVISION to 0
+# Increment MAJOR. Set MINOR and PATCH to 0
 #   If there was a compatible interface change:
-# Increment AGE. Set REVISION to 0
+# Increment MINOR. Set PATCH to 0
 #   If the source code was changed, but there were no interface changes:
-# Increment REVISION.
-set(LIBRARY_VERSION "0.0.4")
-set(LIBRARY_SOVERSION "0")
-
-set(PAMTEST_LIBRARY_VERSION "0.0.4")
-set(PAMTEST_LIBRARY_SOVERSION "0")
+# Increment PATCH.
+set(LIBRARY_VERSION_MAJOR 0)
+set(LIBRARY_VERSION_MINOR 0)
+set(LIBRARY_VERSION_PATCH 5)
+set(LIBRARY_VERSION 

[SCM] pam wrapper repository - branch master updated

2020-03-19 Thread Andreas Schneider
The branch, master has been updated
   via  ead5fb5 doc: Add generated pam_chatty.8 man page
   via  00c1573 doc: Add pam_chatty man page source
   via  b3151fa modules: Remove duplicated discard_const* macros
   via  f23566b tests: Add test for verbose PAM modules
   via  9398419 tests: Add service file for chatty module
   via  6a12a71 modules: Add pam_chatty module
   via  c24b23c python: Fix crash when the PAM module outputs too much data
   via  47250d2 python: Add failure test
   via  c348d45 python: Fix typos
  from  e6574f6 pwrap: Add support for pam_start_confdir()

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


- Log -
commit ead5fb506cd229ac592bbb3fc3339a3bba20b739
Author: Bastien Nocera 
Date:   Wed Mar 4 12:50:44 2020 +0100

doc: Add generated pam_chatty.8 man page

And install it.

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 00c1573119ca5eb909b800f4d85f939518e1e3a0
Author: Bastien Nocera 
Date:   Wed Mar 4 12:50:29 2020 +0100

doc: Add pam_chatty man page source

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit b3151fa71d9ff5432eb0a3645e4406277f992ecc
Author: Bastien Nocera 
Date:   Wed Mar 4 12:37:43 2020 +0100

modules: Remove duplicated discard_const* macros

They were already defined a couple of lines above.

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit f23566bf85eceb41579cfe0fac07bf94ce16f21d
Author: Bastien Nocera 
Date:   Wed Jan 22 12:22:30 2020 +0100

tests: Add test for verbose PAM modules

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 9398419a3b653c49dcab7da15d2f99a058ed8669
Author: Bastien Nocera 
Date:   Wed Jan 22 12:21:05 2020 +0100

tests: Add service file for chatty module

So we can test it.

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 6a12a712bf7b7b8be33d0410c5ddd48713580012
Author: Bastien Nocera 
Date:   Wed Jan 22 12:17:03 2020 +0100

modules: Add pam_chatty module

Add a simple PAM module that will output "num_lines" lines of PAM info
and/or error output.

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c24b23c628079c7d64386270968209339d29b78c
Author: Bastien Nocera 
Date:   Wed Jan 22 11:50:37 2020 +0100

python: Fix crash when the PAM module outputs too much data

This code expected each input (whether echo on or echo off input),
to generate at most one info or error output, which is obviously not
correct. A PAM module with external inputs can throw dozens of messages
and warnings even if the only expected input is a password.

Allocate those placeholder arrays to be as big as possible to accomodate
chatty PAM modules.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14245

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 47250d2a974131c7c1db76c13303707dda28aaa4
Author: Bastien Nocera 
Date:   Wed Jan 22 11:49:31 2020 +0100

python: Add failure test

We only had successful pam tests, add a failing one, and check that it
fails.

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c348d45fb518775f6a9b60a6c9b889bb3667d344
Author: Bastien Nocera 
Date:   Mon Jan 20 18:35:40 2020 +0100

python: Fix typos

Signed-off-by: Bastien Nocera 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 doc/CMakeLists.txt |   5 ++
 doc/pam_chatty.8   |  93 ++
 doc/pam_chatty.8.txt   |  46 +
 src/modules/CMakeLists.txt |   2 +-
 src/modules/pam_chatty.c   | 163 +
 src/modules/pam_matrix.c   |   8 ---
 src/python/pypamtest.c |   8 +--
 tests/CMakeLists.txt   |   3 +
 tests/pypamtest_test.py|  12 +++-
 tests/services/chatty.in   |   1 +
 10 files changed, 327 insertions(+), 14 deletions(-)
 create mode 100644 doc/pam_chatty.8
 create mode 100644 doc/pam_chatty.8.txt
 create mode 100644 src/modules/pam_chatty.c
 create mode 100644 tests/services/chatty.in


Changeset truncated at 500 lines:

diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 21850a5..8a8e60a 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -8,6 +8,11 @@ install(FILES
 DESTINATION
 ${MAN_INSTALL_DIR}/man8)
 
+install(FILES
+pam_chatty.8
+DESTINATION
+

[SCM] pam wrapper repository - branch master updated

2020-03-19 Thread Andreas Schneider
The branch, master has been updated
   via  e6574f6 pwrap: Add support for pam_start_confdir()
   via  8ba6072 cmake: Add a check for pam_start_confdir()
   via  f007f04 cmake: Add link to compile database
  from  cb99388 gitlab-ci: Setup CI for pam_wrapper

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


- Log -
commit e6574f666cb92947b136ac0c951112b65360be7c
Author: Andreas Schneider 
Date:   Fri Mar 6 17:35:28 2020 +0100

pwrap: Add support for pam_start_confdir()

This allows us to not do some ugly binary editing hacks to libpam.so.


https://github.com/linux-pam/linux-pam/commit/7a84910896d5579bd9c016696224d7d69a307bd9

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 8ba6072b7581f0b0d9ca380b0b48059d0ad1344a
Author: Andreas Schneider 
Date:   Fri Mar 6 17:18:06 2020 +0100

cmake: Add a check for pam_start_confdir()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit f007f04f674f1c978d0e325c9c7ce899cefb92c1
Author: Andreas Schneider 
Date:   Fri Mar 6 17:35:16 2020 +0100

cmake: Add link to compile database

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 CMakeLists.txt|  4 
 ConfigureChecks.cmake |  1 +
 config.h.cmake|  1 +
 src/pam_wrapper.c | 48 +++-
 4 files changed, 53 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d646da..94d7146 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,10 @@ if (UNIT_TESTING)
 add_subdirectory(tests)
 endif (UNIT_TESTING)
 
+# Link compile database for clangd
+execute_process(COMMAND cmake -E create_symlink
+"${CMAKE_BINARY_DIR}/compile_commands.json"
+"${CMAKE_SOURCE_DIR}/compile_commands.json")
 # pkg-config file
 get_filename_component(PAM_WRAPPER_LIB ${PAM_WRAPPER_LOCATION} NAME)
 
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index ce4a7e5..1d5ca9a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -76,6 +76,7 @@ check_library_exists(${PAM_LIBRARY} openpam_set_option "" 
HAVE_OPENPAM)
 set(CMAKE_REQUIRED_LIBRARIES ${PAM_LIBRARY})
 check_function_exists(pam_syslog HAVE_PAM_SYSLOG)
 check_function_exists(pam_vsyslog HAVE_PAM_VSYSLOG)
+check_function_exists(pam_start_confdir HAVE_PAM_START_CONFDIR)
 unset(CMAKE_REQUIRED_LIBRARIES)
 
 # OPTIONS
diff --git a/config.h.cmake b/config.h.cmake
index 7e4451d..4e74315 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -20,6 +20,7 @@
 
 #cmakedefine HAVE_PAM_VSYSLOG 1
 #cmakedefine HAVE_PAM_SYSLOG 1
+#cmakedefine HAVE_PAM_START_CONFDIR 1
 
 #cmakedefine HAVE_PAM_VPROMPT_CONST 1
 #cmakedefine HAVE_PAM_PROMPT_CONST 1
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 043c00e..2a3a1d8 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -199,6 +199,12 @@ typedef int (*__libpam_pam_start)(const char *service_name,
  const struct pam_conv *pam_conversation,
  pam_handle_t **pamh);
 
+typedef int (*__libpam_pam_start_confdir)(const char *service_name,
+ const char *user,
+ const struct pam_conv 
*pam_conversation,
+ const char *confdir,
+ pam_handle_t **pamh);
+
 typedef int (*__libpam_pam_end)(pam_handle_t *pamh, int pam_status);
 
 typedef int (*__libpam_pam_authenticate)(pam_handle_t *pamh, int flags);
@@ -262,6 +268,7 @@ typedef void (*__libpam_pam_vsyslog)(const pam_handle_t 
*pamh,
 
 struct pwrap_libpam_symbols {
PWRAP_SYMBOL_ENTRY(pam_start);
+   PWRAP_SYMBOL_ENTRY(pam_start_confdir);
PWRAP_SYMBOL_ENTRY(pam_end);
PWRAP_SYMBOL_ENTRY(pam_authenticate);
PWRAP_SYMBOL_ENTRY(pam_chauthtok);
@@ -397,6 +404,22 @@ static void *_pwrap_bind_symbol(enum pwrap_lib lib, const 
char *fn_name)
  * valgrind and has probably something todo with with the linker.
  * So we need load each function at the point it is called the first time.
  */
+#ifdef HAVE_PAM_START_CONFDIR
+static int libpam_pam_start_confdir(const char *service_name,
+   const char *user,
+   const struct pam_conv *pam_conversation,
+   const char *confdir,
+   pam_handle_t **pamh)
+{
+   pwrap_bind_symbol_libpam(pam_start_confdir);
+
+   return pwrap.libpam.symbols._libpam_pam_start_confdir.f(service_name,
+   user,
+   
pam_conversation,
+   

[SCM] pam wrapper repository - branch master updated

2020-03-03 Thread Andreas Schneider
The branch, master has been updated
   via  cb99388 gitlab-ci: Setup CI for pam_wrapper
   via  3157c03 cmake: Do not run python tests with AddressSanitizer
   via  c6e0341 cmake: Write new cmake config files
   via  c79a3f8 cmake: Use GNUInstallDirs
   via  df8ae93 cmake: Use target_include_directories()
   via  81078a8 cmake: Support running the tests with AddressSanitizer
   via  43b185e cmake: Add AddressSanitizer and UndefinedSanitizer
   via  a4880ff cmake: Update add_cmocka_test()
   via  678fa2c cmake: Look for cmocka 1.1.0 at least
   via  ad58c0b cmake: Move compiler flags to new file
   via  ed773b8 cmake: Improve checks for compiler flags
   via  0683ae5 cmake: Update cmake defaults
   via  68aa7b7 cmake: Require at least cmake 3.5.0
   via  8906d52 README: Rename to a markdown file
   via  fdce4f6 doc: Document PAM_WRAPPER_DISABLE_DEEPBIND
   via  047e9fb pwrap: Fix pso_copy to work with libpam.so.0.84.2
   via  50036d0 pwrap: Use a define in pso_copy()
   via  17ca36e pwrap: Improve logging
   via  247cf61 cmake: Add checks for getprogname() and getexecname()
   via  831aeb5 pwrap: Add support for running with Sanitizers
   via  ffd79f8 cpack: Do not package pyc files
  from  61283c9 Bump version to 1.0.7

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


- Log -
commit cb9938838c4dfd5720b4e778fc39aeee7bf49f09
Author: Andreas Schneider 
Date:   Fri Jan 31 14:01:27 2020 +0100

gitlab-ci: Setup CI for pam_wrapper

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 3157c038957c4a0dd29869aa5d5cccdde00efa19
Author: Andreas Schneider 
Date:   Fri Jan 31 14:57:44 2020 +0100

cmake: Do not run python tests with AddressSanitizer

It will complain about python malloc and fail.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c6e0341042ead637ccf6a83f13a4a993b18b17ce
Author: Andreas Schneider 
Date:   Fri Jan 31 13:59:52 2020 +0100

cmake: Write new cmake config files

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit c79a3f83f121ff92925d72bd751dc907be12fd8a
Author: Andreas Schneider 
Date:   Fri Jan 31 13:47:37 2020 +0100

cmake: Use GNUInstallDirs

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit df8ae930178aade3f8d3160735d2157aa5f2cb15
Author: Andreas Schneider 
Date:   Fri Jan 31 13:41:35 2020 +0100

cmake: Use target_include_directories()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 81078a8d6d40189390218b9ae2b42cc258d745aa
Author: Andreas Schneider 
Date:   Fri Jan 31 13:32:46 2020 +0100

cmake: Support running the tests with AddressSanitizer

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 43b185e1696562ba17ea05e3574f030f911aa8cb
Author: Andreas Schneider 
Date:   Fri Jan 31 13:21:06 2020 +0100

cmake: Add AddressSanitizer and UndefinedSanitizer

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit a4880ffaa12b61be8177c099e50e704a29e72f3b
Author: Andreas Schneider 
Date:   Fri Jan 31 13:25:59 2020 +0100

cmake: Update add_cmocka_test()

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 678fa2c414e10c7e3a7ee840536044af036342de
Author: Andreas Schneider 
Date:   Fri Jan 31 13:22:50 2020 +0100

cmake: Look for cmocka 1.1.0 at least

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit ad58c0b68c9f174ed8411e64ea4f1ee0caa6c8ef
Author: Andreas Schneider 
Date:   Fri Jan 31 13:19:41 2020 +0100

cmake: Move compiler flags to new file

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit ed773b8b1e883696531f4a69d74283e2ce473257
Author: Andreas Schneider 
Date:   Fri Jan 31 13:16:45 2020 +0100

cmake: Improve checks for compiler flags

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 0683ae515f12539e2de71e3b770df3a3d637e089
Author: Andreas Schneider 
Date:   Fri Jan 31 13:06:13 2020 +0100

cmake: Update cmake defaults

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 68aa7b7826e84c9fd15bdd0618dd4a2b30896c0d
Author: Andreas Schneider 
Date:   Fri Jan 31 12:59:31 2020 +0100

cmake: Require at least cmake 3.5.0

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 8906d52333bcdf370ca436b8ee6dd64b58291354
Author: Andreas Schneider 
Date:   Fri Jan 31 13:03:33 2020 +0100

README: Rename to a markdown file

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit fdce4f687fe76766a3f336a22a659efcfbef421f
Author: Andreas Schneider 
Date:   Fri Jan 31 12:48:58 2020 +0100

doc: Document PAM_WRAPPER_DISABLE_DEEPBIND

Signed-off-by: Andreas Schneider 

[SCM] pam wrapper repository - branch master updated

2018-09-26 Thread Andreas Schneider
The branch, master has been updated
   via  61283c9 Bump version to 1.0.7
  from  aaeb454 pwrap: Don't do a deep bind if we run with libasan

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


- Log -
commit 61283c98a49204b7bc4d2750fe506e877e31a214
Author: Andreas Schneider 
Date:   Tue Sep 25 20:16:47 2018 +0200

Bump version to 1.0.7

Signed-off-by: Andreas Schneider 
Reviewed-by: Alexander Bokovoy 
Reviewed-by: Guenther Deschner 

---

Summary of changes:
 CMakeLists.txt | 6 +++---
 ChangeLog  | 6 ++
 2 files changed, 9 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4d9e38..3b0f148 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "6")
+set(APPLICATION_VERSION_PATCH "7")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,10 +19,10 @@ set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
 # Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 # Increment REVISION.
-set(LIBRARY_VERSION "0.0.3")
+set(LIBRARY_VERSION "0.0.4")
 set(LIBRARY_SOVERSION "0")
 
-set(PAMTEST_LIBRARY_VERSION "0.0.3")
+set(PAMTEST_LIBRARY_VERSION "0.0.4")
 set(PAMTEST_LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff --git a/ChangeLog b/ChangeLog
index efaee09..f0a2c21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 ChangeLog
 ==
 
+version 1.0.7 (released 2018-09-26)
+  * Added support for running with AddressSanitizer
+  * Added logging for pam_set_items module
+  * Fixed building python modules
+  * Fixed pam conversation in libpamtest
+
 version 1.0.6 (released 2018-03-27)
   * Improved file copy
   * Fixed build warnings


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2018-09-25 Thread Andreas Schneider
The branch, master has been updated
   via  aaeb454 pwrap: Don't do a deep bind if we run with libasan
   via  926c100 pam_set_items: Add logging
   via  66d70c8 pypamtest: Fix number of responses
   via  a3851de pwrap: Add PAM_TEXT_INFO and PAM_ERROR_MSG to responses
   via  a331e42 libpamtest: Check that message count matches response count
  from  2bc5135 cmake: Don't keep CMAKE_REQUIRED_LIBRARIES around

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


- Log -
commit aaeb4549a7b5605faeb5384e9c56db11ba503e99
Author: Andreas Schneider 
Date:   Sat Sep 1 19:46:36 2018 +0200

pwrap: Don't do a deep bind if we run with libasan

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 

commit 926c10099d43a5f1f1304e9b9c97ade76fdee2e9
Author: Andreas Schneider 
Date:   Thu Sep 20 10:08:00 2018 +0200

pam_set_items: Add logging

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 

commit 66d70c8249e0050dcf594d6bf1b8d79c6e5eab11
Author: Andreas Schneider 
Date:   Mon Jun 25 11:02:45 2018 +0200

pypamtest: Fix number of responses

The number of responses needs to match the number of provided messages.

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 

commit a3851def86755da09186622380e9be0b74aa6aea
Author: Andreas Schneider 
Date:   Tue Jun 26 08:46:44 2018 +0200

pwrap: Add PAM_TEXT_INFO and PAM_ERROR_MSG to responses

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 

commit a331e42539d54a5cfdb6df41b5ec0d1b60043648
Author: Andreas Schneider 
Date:   Mon Jun 25 10:39:51 2018 +0200

libpamtest: Check that message count matches response count

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 

---

Summary of changes:
 src/libpamtest.c|  31 +-
 src/modules/pam_set_items.c | 100 +++-
 src/pam_wrapper.c   |  10 -
 src/python/pypamtest.c  |  67 +++--
 4 files changed, 173 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/libpamtest.c b/src/libpamtest.c
index 0a26c19..4474736 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -214,12 +214,11 @@ static int pamtest_simple_conv(int num_msg,
   struct pam_response **response,
   void *appdata_ptr)
 {
-   int i, ri = 0;
+   int i = 0;
int ret;
struct pam_response *reply = NULL;
const char *prompt;
-   struct pamtest_conv_ctx *cctx = \
-   (struct pamtest_conv_ctx *) appdata_ptr;
+   struct pamtest_conv_ctx *cctx = (struct pamtest_conv_ctx *)appdata_ptr;
 
if (cctx == NULL) {
return PAM_CONV_ERR;
@@ -241,15 +240,12 @@ static int pamtest_simple_conv(int num_msg,
 
if (reply != NULL) {
if (prompt != NULL) {
-   ret = add_to_reply([ri], prompt);
+   ret = add_to_reply([i], prompt);
if (ret != PAM_SUCCESS) {
free_reply(reply, num_msg);
return ret;
}
-   } else {
-   reply[ri].resp = NULL;
}
-   ri++;
}
 
cctx->echo_off_idx++;
@@ -264,18 +260,25 @@ static int pamtest_simple_conv(int num_msg,
 
if (reply != NULL) {
if (prompt != NULL) {
-   ret = add_to_reply([ri], prompt);
+   ret = add_to_reply([i], prompt);
if (ret != PAM_SUCCESS) {
free_reply(reply, num_msg);
return ret;
}
}
-   ri++;
}
 
cctx->echo_on_idx++;
break;
case PAM_ERROR_MSG:
+   if (reply != NULL) {
+   ret = add_to_reply([i], msgm[i]->msg);
+   if (ret != PAM_SUCCESS) {
+   free_reply(reply, num_msg);
+   return ret;
+   }
+   }
+
if (cctx->data->out_err != NULL) {

[SCM] pam wrapper repository - branch master updated

2018-08-28 Thread Andreas Schneider
The branch, master has been updated
   via  2bc5135 cmake: Don't keep CMAKE_REQUIRED_LIBRARIES around
   via  6ab4060 ctest: Move to new dashboard
   via  f46fff9 cmake: Fix python2 and python3 detection
   via  83445b6 pwrap: Improve error message
   via  cf805f9 pwrap: Don't clean the stale dir twice
   via  21979a3 tests: Fix length calulation
   via  e2760e0 Rename COPYING to LICENSE
   via  cd067d9 cpack: Do not package build dirs in source tarball
  from  c46af91 Bump version to 1.0.6

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


- Log -
commit 2bc513562c0fc0dc7c61a93bc1cf0e434227459b
Author: Andreas Schneider 
Date:   Tue Aug 28 11:18:36 2018 +0200

cmake: Don't keep CMAKE_REQUIRED_LIBRARIES around

This can cause issues with detecting features.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 6ab4060d52c72d3e5bfae4768afd4babf22f3f26
Author: Andreas Schneider 
Date:   Thu Jul 5 10:16:27 2018 +0200

ctest: Move to new dashboard

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit f46fff9d70dad90ec619a9ebf832ffc9cd64e35a
Author: Andreas Schneider 
Date:   Tue Jul 3 11:33:04 2018 +0200

cmake: Fix python2 and python3 detection

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 83445b6f5a2e79b44c336af0592f14a1534cbdbd
Author: Andreas Schneider 
Date:   Fri Jun 29 15:23:34 2018 +0200

pwrap: Improve error message

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit cf805f9631847aa8be78e78112f2c1c23b3adbaa
Author: Andreas Schneider 
Date:   Fri Jun 29 15:23:12 2018 +0200

pwrap: Don't clean the stale dir twice

This is already done above.

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 21979a32620269c4e31c5c645087b8bb632b343d
Author: Andreas Schneider 
Date:   Mon Jun 25 11:02:22 2018 +0200

tests: Fix length calulation

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit e2760e0460fbf8074ce1a51b5e8c90869b9a8848
Author: Andreas Schneider 
Date:   Fri Jun 22 09:14:29 2018 +0200

Rename COPYING to LICENSE

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit cd067d985ab4c29de496fa3952950db0c357606a
Author: Andreas Schneider 
Date:   Fri Jun 22 09:13:52 2018 +0200

cpack: Do not package build dirs in source tarball

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 CPackConfig.cmake |  4 ++--
 CTestConfig.cmake |  6 +++---
 ConfigureChecks.cmake |  6 +++---
 COPYING => LICENSE|  0
 src/pam_wrapper.c |  4 +---
 src/python/python2/CMakeLists.txt | 40 ---
 src/python/python3/CMakeLists.txt | 40 ---
 tests/test_pam_wrapper.c  |  2 +-
 8 files changed, 60 insertions(+), 42 deletions(-)
 rename COPYING => LICENSE (100%)


Changeset truncated at 500 lines:

diff --git a/CPackConfig.cmake b/CPackConfig.cmake
index 3158a44..88caa30 100644
--- a/CPackConfig.cmake
+++ b/CPackConfig.cmake
@@ -7,7 +7,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The pam_wrapper")
 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
 set(CPACK_PACKAGE_VENDOR "Samba Team")
 set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
 
 
 ### versions
@@ -19,7 +19,7 @@ set(CPACK_PACKAGE_VERSION 
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
 
 ### source generator
 set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_SOURCE_IGNORE_FILES 
"~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;/obj*/;tags;cscope.*")
+set(CPACK_SOURCE_IGNORE_FILES 
"~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
 set(CPACK_SOURCE_PACKAGE_FILE_NAME 
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
 
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "pam_wrapper")
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 94b3d74..57963ee 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -1,9 +1,9 @@
 set(UPDATE_TYPE "true")
 
 set(CTEST_PROJECT_NAME "pam_wrapper")
-set(CTEST_NIGHTLY_START_TIME "01:00:00 CET")
+set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
 
 set(CTEST_DROP_METHOD "https")
-set(CTEST_DROP_SITE "mock.cryptomilk.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=pamwrapper")
+set(CTEST_DROP_SITE "test.cmocka.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=${CTEST_PROJECT_NAME}")
 set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 2fdd296..3148c23 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake

[SCM] pam wrapper repository - branch master updated

2018-03-27 Thread Andreas Schneider
The branch, master has been updated
   via  c46af91 Bump version to 1.0.6
  from  38bc72a pwrap: remove pdir handling from p_copy()

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


- Log -
commit c46af912c0b118d67078db1518d318425c6731df
Author: Andreas Schneider 
Date:   Tue Mar 27 11:05:04 2018 +0200

Bump version to 1.0.6

Signed-off-by: Andreas Schneider 

---

Summary of changes:
 CMakeLists.txt | 2 +-
 ChangeLog  | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f63ca78..a4d9e38 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "5")
+set(APPLICATION_VERSION_PATCH "6")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
diff --git a/ChangeLog b/ChangeLog
index 7dac77c..efaee09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 ChangeLog
 ==
 
+version 1.0.6 (released 2018-03-27)
+  * Improved file copy
+  * Fixed build warnings
+
 version 1.0.5 (released 2018-02-22)
   * Added support to build python2 and python3 module at the same time
   * Improved pam test directory creating


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2018-03-26 Thread Andreas Schneider
The branch, master has been updated
   via  38bc72a pwrap: remove pdir handling from p_copy()
   via  52e852b pwrap: Fix overflow checking
   via  19a77f8 pwrap: Avoid strncpy in pwrap_init()
  from  a15c28e pwrap: Add missing config.h includes

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


- Log -
commit 38bc72aca34574a53ce9704dbc53891224a36487
Author: Ralph Boehme 
Date:   Mon Mar 26 18:03:08 2018 +0200

pwrap: remove pdir handling from p_copy()

Signed-off-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

commit 52e852bfdba6ea3e270c6900803696c18bb3d75e
Author: Ralph Boehme 
Date:   Mon Mar 26 16:42:00 2018 +0200

pwrap: Fix overflow checking

Signed-off-by: Ralph Boehme 
Reviewed-by: Andreas Schneider 

commit 19a77f8ab6978d48ecfe560ac2221b581628f699
Author: Andreas Schneider 
Date:   Mon Mar 26 15:45:43 2018 +0200

pwrap: Avoid strncpy in pwrap_init()

CID 47508

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 src/pam_wrapper.c | 126 --
 1 file changed, 103 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 482b388..8064954 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -531,7 +531,7 @@ static void libpam_pam_vsyslog(const pam_handle_t *pamh,
 #define BUFFER_SIZE 32768
 
 /* copy file from src to dst, overwrites dst */
-static int p_copy(const char *src, const char *dst, const char *pdir, mode_t 
mode)
+static int p_copy(const char *src, const char *dst, mode_t mode)
 {
int srcfd = -1;
int dstfd = -1;
@@ -567,7 +567,6 @@ static int p_copy(const char *src, const char *dst, const 
char *pdir, mode_t mod
}
 
for (;;) {
-   char *p;
bread = read(srcfd, buf, BUFFER_SIZE);
if (bread == 0) {
/* done */
@@ -578,21 +577,6 @@ static int p_copy(const char *src, const char *dst, const 
char *pdir, mode_t mod
goto out;
}
 
-   /* EXTRA UGLY HACK */
-   if (pdir != NULL) {
-   p = buf;
-
-   while (p < buf + BUFFER_SIZE) {
-   if (*p == '/') {
-   cmp = memcmp(p, "/etc/pam.d", 10);
-   if (cmp == 0) {
-   memcpy(p, pdir, 10);
-   }
-   }
-   p++;
-   }
-   }
-
bwritten = write(dstfd, buf, bread);
if (bwritten < 0) {
errno = EIO;
@@ -668,7 +652,7 @@ static int copy_ftw(const char *fpath,
}
 
PWRAP_LOG(PWRAP_LOG_TRACE, "Copying %s", fpath);
-   rc = p_copy(fpath, buf, NULL, sb->st_mode);
+   rc = p_copy(fpath, buf, sb->st_mode);
if (rc != 0) {
return FTW_STOP;
}
@@ -756,6 +740,100 @@ static void pwrap_clean_stale_dirs(const char *dir)
return;
 }
 
+static int pso_copy(const char *src, const char *dst, const char *pdir, mode_t 
mode)
+{
+   int srcfd = -1;
+   int dstfd = -1;
+   int rc = -1;
+   ssize_t bread, bwritten;
+   struct stat sb;
+   char buf[10];
+   int cmp;
+   size_t to_read;
+   bool found_slash;
+
+   cmp = strcmp(src, dst);
+   if (cmp == 0) {
+   return -1;
+   }
+
+   srcfd = open(src, O_RDONLY, 0);
+   if (srcfd < 0) {
+   return -1;
+   }
+
+   if (mode == 0) {
+   rc = fstat(srcfd, );
+   if (rc != 0) {
+   rc = -1;
+   goto out;
+   }
+   mode = sb.st_mode;
+   }
+
+   dstfd = open(dst, O_CREAT|O_WRONLY|O_TRUNC, mode);
+   if (dstfd < 0) {
+   rc = -1;
+   goto out;
+   }
+
+   found_slash = false;
+   to_read = 1;
+
+   for (;;) {
+   bread = read(srcfd, buf, to_read);
+   if (bread == 0) {
+   /* done */
+   break;
+   } else if (bread < 0) {
+   errno = EIO;
+   rc = -1;
+   goto out;
+   }
+
+   to_read = 1;
+   if (!found_slash && buf[0] == '/') {
+   found_slash = true;
+   to_read = 9;
+   }
+
+   if (found_slash && 

[SCM] pam wrapper repository - branch master updated

2018-02-27 Thread Andreas Schneider
The branch, master has been updated
   via  a15c28e pwrap: Add missing config.h includes
   via  ec35a73 pwrap: Remove trailing whitespaces
  from  b7d0a21 Bump version to 1.0.5

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


- Log -
commit a15c28edf44c580e5c8c44b57951addcd79e145f
Author: Andreas Schneider 
Date:   Tue Feb 27 09:17:06 2018 +0100

pwrap: Add missing config.h includes

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit ec35a73f1512663397ee32746f73ddc79bf7a361
Author: Andreas Schneider 
Date:   Thu Feb 22 17:02:12 2018 +0100

pwrap: Remove trailing whitespaces

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 src/libpamtest.c   | 2 ++
 src/pam_wrapper.c  | 2 +-
 src/python/pypamtest.c | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/src/libpamtest.c b/src/libpamtest.c
index c0ab41d..0a26c19 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -16,6 +16,8 @@
  * along with this program.  If not, see .
  */
 
+#include "config.h"
+
 #include 
 #include 
 #include 
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 69bd9ca..482b388 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -1464,7 +1464,7 @@ int pam_prompt(pam_handle_t *pamh,
   args);
va_end(args);
 
-   return rv;  
+   return rv;
 }
 
 #ifdef HAVE_PAM_STRERROR_CONST
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index e25900f..6bb1e20 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -16,6 +16,8 @@
  * along with this program.  If not, see .
  */
 
+#include "config.h"
+
 #include 
 #include 
 


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2018-02-22 Thread Andreas Schneider
The branch, master has been updated
   via  b7d0a21 Bump version to 1.0.5
   via  6bea1e1 pwrap: Use a more unique name for pamdir
  from  5c36d42 cmake: Build python2 and python3 modules if possible

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


- Log -
commit b7d0a21b538f05d81582d44e53a4c394e77905e8
Author: Andreas Schneider 
Date:   Thu Feb 22 15:46:12 2018 +0100

Bump version to 1.0.5

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 6bea1e19edf520985776787c3ba3fcea3ca89faa
Author: Nikos Mavrogiannopoulos 
Date:   Mon Feb 19 21:23:23 2018 +0100

pwrap: Use a more unique name for pamdir

Parallel builds fail quite predictable when using libpam_wrapper.
It seems that the temporary directory used are created sequentially
and that caused issues like:

PWRAP_ERROR(8157) - pwrap_load_lib_handle: Failed to dlopen library: 
/tmp/pam.0/lib/libpam.so.0: cannot open shared object file: No such file or 
directory

When a directory was cleaned up, incorrectly. I have not pin-pointed
the race condition, but this patch starts from a random letter (using
the PID of the process) in the temporary directory name, providing
better assurances of uniqueness.

Signed-off-by: Nikos Mavrogiannopoulos 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 CMakeLists.txt|  6 +++---
 ChangeLog |  6 ++
 src/pam_wrapper.c | 58 ---
 3 files changed, 43 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index af00610..f63ca78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "4")
+set(APPLICATION_VERSION_PATCH "5")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,10 +19,10 @@ set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
 # Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 # Increment REVISION.
-set(LIBRARY_VERSION "0.0.2")
+set(LIBRARY_VERSION "0.0.3")
 set(LIBRARY_SOVERSION "0")
 
-set(PAMTEST_LIBRARY_VERSION "0.0.2")
+set(PAMTEST_LIBRARY_VERSION "0.0.3")
 set(PAMTEST_LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff --git a/ChangeLog b/ChangeLog
index 8440261..7dac77c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 ChangeLog
 ==
 
+version 1.0.5 (released 2018-02-22)
+  * Added support to build python2 and python3 module at the same time
+  * Improved pam test directory creating
+  * Fixed python 2.6 compatibilty
+  * Fixed some build issues on FreeBSD
+
 version 1.0.4 (released 2017-05-15)
   * Fix build on OpenBSD
   * Fix a resource leak
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 473df4e..69bd9ca 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -760,13 +761,15 @@ static void pwrap_init(void)
char tmp_config_dir[] = "/tmp/pam.X";
size_t len = strlen(tmp_config_dir);
const char *env;
-   uint32_t i;
+   struct stat sb;
int rc;
+   unsigned i;
char pam_library[128] = { 0 };
char libpam_path[1024] = { 0 };
ssize_t ret;
FILE *pidfile;
char pidfile_path[1024] = { 0 };
+   char letter;
 
if (!pam_wrapper_enabled()) {
return;
@@ -776,33 +779,36 @@ static void pwrap_init(void)
return;
}
 
-   PWRAP_LOG(PWRAP_LOG_DEBUG, "Initialize pam_wrapper");
-
-   for (i = 0; i < 36; i++) {
-   struct stat sb;
-   char c;
-
-   if (i < 10) {
-   c = (char)(i + 48);
-   } else {
-   c = (char)(i + 87);
+   /*
+* The name is selected to match/replace /etc/pam.d
+* We start from a random alphanum trying letters until
+* an available directory is found.
+*/
+   letter = 48 + (getpid() % 70);
+   for (i = 0; i < 127; i++) {
+   if (isalpha(letter) || isdigit(letter)) {
+   tmp_config_dir[len - 1] = letter;
+
+   rc = lstat(tmp_config_dir, );
+   if (rc == 0) {
+   PWRAP_LOG(PWRAP_LOG_TRACE,
+ "Check if 

[SCM] pam wrapper repository - branch master updated

2018-02-12 Thread Andreas Schneider
The branch, master has been updated
   via  5c36d42 cmake: Build python2 and python3 modules if possible
  from  9beb9f9 cmake: Improve PAM_WRAPPER_LOACATION

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


- Log -
commit 5c36d4284918a3fcc1c58f29f01ca64c65a66fa7
Author: Andreas Schneider 
Date:   Mon Feb 12 12:01:22 2018 +0100

cmake: Build python2 and python3 modules if possible

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 CMakeLists.txt|  5 -
 src/CMakeLists.txt|  4 +---
 src/python/CMakeLists.txt | 15 ++-
 src/python/python2/CMakeLists.txt | 33 +
 src/python/python3/CMakeLists.txt | 33 +
 tests/CMakeLists.txt  | 29 ++---
 tests/pypamtest_test.py   |  5 -
 7 files changed, 95 insertions(+), 29 deletions(-)
 create mode 100644 src/python/python2/CMakeLists.txt
 create mode 100644 src/python/python3/CMakeLists.txt


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f03a137..af00610 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,11 +46,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires 
an out of source buil
 set(CMAKE_THREAD_PREFER_PTHREADS ON)
 find_package(Threads)
 
-find_package(PythonInterp)
-set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4 3.6)
-find_package(PythonLibs)
-find_package(PythonSiteLibs)
-
 # config.h checks
 include(ConfigureChecks.cmake)
 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 76a87d6..e3a1efd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,9 +69,7 @@ install(TARGETS pamtest
 ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
 
 add_subdirectory(modules)
-if (PYTHONLIBS_FOUND)
-add_subdirectory(python)
-endif()
+add_subdirectory(python)
 
 # This needs to be at the end
 set(PAM_WRAPPER_LOCATION 
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}"
 PARENT_SCOPE)
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index cbee2a6..3394a84 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -1,15 +1,4 @@
 project(pypamtest C)
 
-include_directories(${CMAKE_BINARY_DIR})
-include_directories(${pam_wrapper-headers_DIR})
-include_directories(${PYTHON_INCLUDE_DIR})
-
-python_add_module(pypamtest pypamtest.c)
-target_link_libraries(pypamtest pamtest ${PYTHON_LIBRARY})
-
-install(
-TARGETS
-pypamtest
-DESTINATION
-${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}
-)
+add_subdirectory(python2)
+add_subdirectory(python3)
diff --git a/src/python/python2/CMakeLists.txt 
b/src/python/python2/CMakeLists.txt
new file mode 100644
index 000..faceec3
--- /dev/null
+++ b/src/python/python2/CMakeLists.txt
@@ -0,0 +1,33 @@
+project(python2-pamtest C)
+
+unset(PYTHON_EXECUTABLE CACHE)
+unset(PYTHON_INCLUDE_DIR CACHE)
+unset(PYTHON_LIBRARY CACHE)
+unset(PYTHON_SITELIB CACHE)
+unset(PYTHONLIBS_FOUND CACHE)
+unset(PYTHONLIBS_VERSION_STRING CACHE)
+
+set(Python_ADDITIONAL_VERSIONS 2.7 2.6)
+find_package(PythonLibs)
+find_package(PythonInterp)
+find_package(PythonSiteLibs)
+
+if (PYTHONLIBS_FOUND)
+set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH 
"PYTHON2_EXECUTABLE")
+set(PYTHON2_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
+set(PYTHON2_LIBRARY ${PYTHON_LIBRARY})
+set(PYTHON2_SITELIB ${PYTHON_SITELIB})
+
+include_directories(${CMAKE_BINARY_DIR})
+include_directories(${pam_wrapper-headers_DIR})
+include_directories(${PYTHON2_INCLUDE_DIR})
+
+python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
+target_link_libraries(python2-pamtest pamtest ${PYTHON2_LIBRARY})
+set_target_properties(python2-pamtest PROPERTIES OUTPUT_NAME "pypamtest")
+
+install(TARGETS
+python2-pamtest
+DESTINATION
+${CMAKE_INSTALL_PREFIX}/${PYTHON2_SITELIB})
+endif()
diff --git a/src/python/python3/CMakeLists.txt 
b/src/python/python3/CMakeLists.txt
new file mode 100644
index 000..1e1599b
--- /dev/null
+++ b/src/python/python3/CMakeLists.txt
@@ -0,0 +1,33 @@
+project(python3-pamtest C)
+
+unset(PYTHON_EXECUTABLE CACHE)
+unset(PYTHON_INCLUDE_DIR CACHE)
+unset(PYTHON_LIBRARY CACHE)
+unset(PYTHON_SITELIB CACHE)
+unset(PYTHONLIBS_FOUND CACHE)
+unset(PYTHONLIBS_VERSION_STRING CACHE)
+
+set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6)
+find_package(PythonLibs)
+find_package(PythonInterp)
+find_package(PythonSiteLibs)
+
+if (PYTHONLIBS_FOUND)
+set(PYTHON3_LIBRARY ${PYTHON_LIBRARY})
+set(PYTHON3_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
+set(PYTHON3_SITELIB 

[SCM] pam wrapper repository - branch master updated

2017-11-23 Thread Andreas Schneider
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 
Date:   Wed Nov 22 15:27:44 2017 +0100

cmake: Improve PAM_WRAPPER_LOACATION

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit 9265da3857e9cfa7a00d1ab35aae1e0b0286efad
Author: Uri Simchoni 
Date:   Wed Nov 22 20:48:23 2017 +

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 
Reviewed-by: Andreas Schneider 

commit c611121eec7b5f2c39cab7b1c0295eddefdddb1d
Author: Uri Simchoni 
Date:   Sun Nov 19 13:08:30 2017 +

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 
Reviewed-by: Andreas Schneider 

commit 38d359a686aa44b1d6cce8d6d9aac9687dd8d708
Author: Uri Simchoni 
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 
Reviewed-by: Andreas Schneider 

---

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) || 

[SCM] pam wrapper repository - branch master updated

2017-10-18 Thread Andreas Schneider
The branch, master has been updated
   via  3b5417b pypamtest: Fix Python 2.6 compatibility
  from  7d45bbb Bump version to 1.0.4

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


- Log -
commit 3b5417be2f79a0d4bc9bf3c974ffd12219cb60b8
Author: Lumir Balhar 
Date:   Fri Oct 13 15:36:15 2017 +0200

pypamtest: Fix Python 2.6 compatibility

PyErr_NewExceptionWithDoc() isn't available in Python 2.6 so it can
be used only in higher versions of Python.

Signed-off-by: Lumir Balhar 
Reviewed-by: Andrew Bartlet 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 src/python/pypamtest.c | 9 +
 1 file changed, 9 insertions(+)


Changeset truncated at 500 lines:

diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index 585f27d..a71fd35 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -1004,12 +1004,14 @@ static struct PyModuleDef pypamtestdef = {
  *** Initialize the module
  **/
 
+#if PY_VERSION_HEX >= 0x0207 /* >= 2.7.0 */
 PyDoc_STRVAR(PamTestError__doc__,
 "pypamtest specific exception\n\n"
 "This exception is raised if the _pamtest() function fails. If _pamtest() "
 "returns PAMTEST_ERR_CASE (a test case returns unexpected error code), then "
 "the exception also details which test case failed."
 );
+#endif
 
 #if IS_PYTHON3
 PyMODINIT_FUNC PyInit_pypamtest(void)
@@ -1034,10 +1036,17 @@ PyMODINIT_FUNC initpypamtest(void)
  pypamtest_module_methods);
 #endif
 
+#if PY_VERSION_HEX >= 0x0207 /* >= 2.7.0 */
PyExc_PamTestError = PyErr_NewExceptionWithDoc(discard_const_p(char, 
"pypamtest.PamTestError"),
   PamTestError__doc__,
   PyExc_EnvironmentError,
   NULL);
+#else /* < 2.7.0 */
+   PyExc_PamTestError = PyErr_NewException(discard_const_p(char, 
"pypamtest.PamTestError"),
+  PyExc_EnvironmentError,
+  NULL);
+#endif
+
if (PyExc_PamTestError == NULL) {
RETURN_ON_ERROR;
}


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2017-05-15 Thread Andreas Schneider
The branch, master has been updated
   via  7d45bbb Bump version to 1.0.4
   via  c6bb9df pwrap: Do not leak srcfd on error
  from  80f27a3 pam_wrapper: Fix the build without pam_vsyslog

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


- Log -
commit 7d45bbb5c308e322901e90642b4dcf0a4bee200f
Author: Andreas Schneider 
Date:   Mon May 15 16:37:44 2017 +0200

Bump version to 1.0.4

Signed-off-by: Andreas Schneider 
Reviewed-by: Kai Blin 

commit c6bb9dfe74c51621587cc92c496fcde4721e6a6b
Author: Andreas Schneider 
Date:   Tue Apr 11 08:39:44 2017 +0200

pwrap: Do not leak srcfd on error

Signed-off-by: Andreas Schneider 
Reviewed-by: Kai Blin 

---

Summary of changes:
 CMakeLists.txt| 2 +-
 ChangeLog | 4 
 src/pam_wrapper.c | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a929eb2..f03a137 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "3")
+set(APPLICATION_VERSION_PATCH "4")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
diff --git a/ChangeLog b/ChangeLog
index c2be509..8440261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 ChangeLog
 ==
 
+version 1.0.4 (released 2017-05-15)
+  * Fix build on OpenBSD
+  * Fix a resource leak
+
 version 1.0.3 (released 2017-04-06)
   * Fixed some build issues with strict compiler flags
   * Logging to syslog is disabled by default
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 889c79a..4be8146 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -553,7 +553,8 @@ static int p_copy(const char *src, const char *dst, const 
char *pdir, mode_t mod
if (mode == 0) {
rc = fstat(srcfd, );
if (rc != 0) {
-   return -1;
+   rc = -1;
+   goto out;
}
mode = sb.st_mode;
}


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2017-05-04 Thread Andreas Schneider
The branch, master has been updated
   via  80f27a3 pam_wrapper: Fix the build without pam_vsyslog
  from  bb04070 Bump version to 1.0.3

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


- Log -
commit 80f27a3f776db23a79ad1da3e5967ff045c40ebe
Author: Volker Lendecke 
Date:   Mon May 1 17:57:27 2017 +0200

pam_wrapper: Fix the build without pam_vsyslog

Signed-off-by: Volker Lendecke 
Reviewed-by: Andreas Schneider 

---

Summary of changes:
 src/pam_wrapper.c | 2 ++
 1 file changed, 2 insertions(+)


Changeset truncated at 500 lines:

diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index d1ae075..889c79a 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -513,12 +513,14 @@ static void libpam_pam_vsyslog(const pam_handle_t *pamh,
   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
 }
 
 /*


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2017-04-06 Thread Andreas Schneider
The branch, master has been updated
   via  bb04070 Bump version to 1.0.3
   via  48c7b4e doc: Document PAM_WRAPPER_USE_SYSLOG variable
   via  9411daf pwrap: Do not log to syslog by default but use our logging
   via  22a4fbf pwrap: Do an early return in pwrap_vlog if log level 
doesn't match
   via  e7d8276 pwrap: Add pwrap_vlog() functions
   via  09fcd1e pwrap: Remove useless break
  from  91227b3 libpamtest: Do not declare variable in for-loop

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


- Log -
commit bb0407078c357cb0476e49b634faf4fd086f1d12
Author: Andreas Schneider 
Date:   Thu Apr 6 09:55:29 2017 +0200

Bump version to 1.0.3

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 48c7b4e13450930cf479334e0ab6e432fca08a7e
Author: Andreas Schneider 
Date:   Thu Apr 6 11:51:32 2017 +0200

doc: Document PAM_WRAPPER_USE_SYSLOG variable

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 9411daf54d6f2492508fba10e08260779faf1cc9
Author: Andreas Schneider 
Date:   Thu Apr 6 11:47:37 2017 +0200

pwrap: Do not log to syslog by default but use our logging

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 22a4fbf90a8c9b34b893bec2890c0590ddd4cb61
Author: Andreas Schneider 
Date:   Thu Apr 6 12:08:54 2017 +0200

pwrap: Do an early return in pwrap_vlog if log level doesn't match

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit e7d8276736f7c45a3734060c5c7242f018bd9028
Author: Andreas Schneider 
Date:   Thu Apr 6 11:41:12 2017 +0200

pwrap: Add pwrap_vlog() functions

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 09fcd1e8ea1e8e269b2a812dbbb22abafaf17708
Author: Andreas Schneider 
Date:   Thu Apr 6 09:56:15 2017 +0200

pwrap: Remove useless break

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

---

Summary of changes:
 CMakeLists.txt|   2 +-
 ChangeLog |   4 ++
 doc/pam_wrapper.1 |  13 --
 doc/pam_wrapper.1.txt |   8 +++-
 src/pam_wrapper.c | 123 ++
 5 files changed, 106 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0c950f..a929eb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "2")
+set(APPLICATION_VERSION_PATCH "3")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
diff --git a/ChangeLog b/ChangeLog
index 5af21dd..c2be509 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 ChangeLog
 ==
 
+version 1.0.3 (released 2017-04-06)
+  * Fixed some build issues with strict compiler flags
+  * Logging to syslog is disabled by default
+
 version 1.0.2 (released 2016-05-24)
   * Fixed pam_wrapper on some BSDs
   * Fixed simple conversation in libpamtest
diff --git a/doc/pam_wrapper.1 b/doc/pam_wrapper.1
index 0d737a9..3536c82 100644
--- a/doc/pam_wrapper.1
+++ b/doc/pam_wrapper.1
@@ -1,13 +1,13 @@
 '\" t
 .\" Title: pam_wrapper
 .\"Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.78.1 
-.\"  Date: 2015-11-04
+.\" Generator: DocBook XSL Stylesheets v1.79.0 
+.\"  Date: 2017-04-06
 .\"Manual: \ \&
 .\"Source: \ \&
 .\"  Language: English
 .\"
-.TH "PAM_WRAPPER" "1" "2015\-11\-04" "\ \&" "\ \&"
+.TH "PAM_WRAPPER" "1" "2017\-04\-06" "\ \&" "\ \&"
 .\" -
 .\" * Define some portability stuff
 .\" -
@@ -100,6 +100,11 @@ If you need to see what is going on in pam_wrapper itself 
or try to find a bug,
 .RE
 .RE
 .PP
+\fBPAM_WRAPPER_USE_SYSLOG\fR
+.RS 4
+By default pam logs will go to the pam_wrapper DEBUG log level and will not be 
sent to the syslog\&. If you want to log to the syslog to you can set this 
variable to 1\&.
+.RE
+.PP
 \fBPAM_WRAPPER_KEEP_DIR\fR
 .RS 4
 If this option is set to 1, then pam_wrapper won\(cqt delete its temporary 
directories\&. Mostly useful for pam_wrapper development\&.
@@ -123,7 +128,7 @@ session required
/usr/lib/pam_wrapper/pam_matrix\&.so 

[SCM] pam wrapper repository - branch master updated

2017-04-06 Thread Andreas Schneider
The branch, master has been updated
   via  91227b3 libpamtest: Do not declare variable in for-loop
   via  7dce9b5 pypamtest: Add sanity checks in new_conv_list()
   via  14adde1 pypamtest: Do not use variable declaration in for-loop
  from  b6708f7 cmake: Add Python 3.6 if we look for the python library

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


- Log -
commit 91227b3056ef7c16b5c6ea7515f4f1b65feca859
Author: Andreas Schneider 
Date:   Thu Apr 6 09:15:07 2017 +0200

libpamtest: Do not declare variable in for-loop

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 7dce9b5147cb699a1972590b1fb8262a4aa64b18
Author: Andreas Schneider 
Date:   Thu Apr 6 09:13:40 2017 +0200

pypamtest: Add sanity checks in new_conv_list()

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

commit 14adde1d0ea2069b546278529a5e13e113303f51
Author: Andreas Schneider 
Date:   Thu Apr 6 09:09:53 2017 +0200

pypamtest: Do not use variable declaration in for-loop

Signed-off-by: Andreas Schneider 
Reviewed-by: Stefan Metzmacher 

---

Summary of changes:
 src/libpamtest.c   |  4 +++-
 src/python/pypamtest.c | 13 +++--
 2 files changed, 14 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/libpamtest.c b/src/libpamtest.c
index 7119184..c0ab41d 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -117,11 +117,13 @@ enum pamtest_err _pamtest_conv(const char *service,
 
 void pamtest_free_env(char **envlist)
 {
+   size_t i;
+
if (envlist == NULL) {
return;
}
 
-   for (size_t i = 0; envlist[i] != NULL; i++) {
+   for (i = 0; envlist[i] != NULL; i++) {
free(envlist[i]);
}
free(envlist);
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index a1b3054..585f27d 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -133,9 +133,18 @@ static void free_string_list(char **list)
PyMem_Free(list);
 }
 
-static char **new_conv_list(const int list_size)
+static char **new_conv_list(const size_t list_size)
 {
char **list;
+   size_t i;
+
+   if (list_size == 0) {
+   return NULL;
+   }
+
+   if (list_size + 1 < list_size) {
+   return NULL;
+   }
 
list = PyMem_New(char *, list_size + 1);
if (list == NULL) {
@@ -143,7 +152,7 @@ static char **new_conv_list(const int list_size)
}
list[list_size] = NULL;
 
-   for (int i =0; i < list_size; i++) {
+   for (i = 0; i < list_size; i++) {
list[i] = PyMem_New(char, PAM_MAX_MSG_SIZE);
if (list[i] == NULL) {
PyMem_Free(list);


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2017-04-06 Thread Andreas Schneider
The branch, master has been updated
   via  b6708f7 cmake: Add Python 3.6 if we look for the python library
   via  8efb64e pwrap: Do not discard const value
   via  308f344 cmake: Remove unused define
   via  cccdca5 cmake: Do not check for pam_(v)syslog twice
  from  247260d Bump version to 1.0.2

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


- Log -
commit b6708f72588784b5b4c8784df0e1a27817e331d3
Author: Andreas Schneider 
Date:   Thu Mar 30 08:46:44 2017 +0200

cmake: Add Python 3.6 if we look for the python library

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 
Reviewed-by: Ralph Boehme 

commit 8efb64e1b307d4ff294042e95ecd33db1f568c7c
Author: Andreas Schneider 
Date:   Wed Mar 29 16:16:18 2017 +0200

pwrap: Do not discard const value

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 
Reviewed-by: Ralph Boehme 

commit 308f3442499b57f77435f928d56fdd6b085802cd
Author: Andreas Schneider 
Date:   Wed Mar 29 15:53:20 2017 +0200

cmake: Remove unused define

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 
Reviewed-by: Ralph Boehme 

commit cccdca57f275799ee86e189196f0b2642243c763
Author: Andreas Schneider 
Date:   Wed Mar 29 15:51:06 2017 +0200

cmake: Do not check for pam_(v)syslog twice

Signed-off-by: Andreas Schneider 
Reviewed-by: Jakub Hrozek 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 CMakeLists.txt|  2 +-
 ConfigureChecks.cmake |  5 -
 config.h.cmake|  5 -
 src/pam_wrapper.c | 37 +++--
 4 files changed, 20 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f52edf..f0c950f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,7 @@ set(CMAKE_THREAD_PREFER_PTHREADS ON)
 find_package(Threads)
 
 find_package(PythonInterp)
-set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4)
+set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4 3.6)
 find_package(PythonLibs)
 find_package(PythonSiteLibs)
 
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index f3383f9..2fdd296 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -46,11 +46,6 @@ check_function_exists(strncpy HAVE_STRNCPY)
 check_function_exists(vsnprintf HAVE_VSNPRINTF)
 check_function_exists(snprintf HAVE_SNPRINTF)
 
-set(CMAKE_REQUIRED_LIBRARIES pam)
-check_function_exists(pam_vsyslog HAVE_PAM_VSYSLOG)
-check_function_exists(pam_syslog HAVE_PAM_SYSLOG)
-set(CMAKE_REQUIRED_LIBRARIES)
-
 check_prototype_definition(pam_vprompt
 "int pam_vprompt(const pam_handle_t *_pamh, int _style, char **_resp, 
const char *_fmt, va_list _ap)"
 "-1"
diff --git a/config.h.cmake b/config.h.cmake
index 9888219..d587f84 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -20,14 +20,9 @@
 #cmakedefine HAVE_SECURITY_PAM_MODULES_H 1
 #cmakedefine HAVE_SECURITY_PAM_EXT_H 1
 #cmakedefine HAVE_OPENPAM ${HAVE_OPENPAM}
-#cmakedefine HAVE_PAM_SYSLOG 1
-#cmakedefine HAVE_PAM_VSYSLOG 1
 
 /*** FUNCTIONS ***/
 
-/* Define to 1 if you have the `seteuid' function. */
-#cmakedefine HAVE_SETEUID 1
-
 #cmakedefine HAVE_PAM_VSYSLOG 1
 #cmakedefine HAVE_PAM_SYSLOG 1
 
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index bc73f41..168020b 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -1203,55 +1203,56 @@ static int pwrap_pam_get_item(const pam_handle_t *pamh,
case PAM_USER:
PWRAP_LOG(PWRAP_LOG_TRACE,
  "pwrap_get_item PAM_USER=%s",
- (char *) *item);
+ (const char *)*item);
break;
case PAM_SERVICE:
svc = pwrap_get_service((const char *) *item);
 
PWRAP_LOG(PWRAP_LOG_TRACE,
  "pwrap_get_item PAM_SERVICE=%s",
- (char *) svc);
+ svc);
*item = svc;
break;
case PAM_USER_PROMPT:
PWRAP_LOG(PWRAP_LOG_TRACE,
  "pwrap_get_item PAM_USER_PROMPT=%s",
- (char *) *item);
+ (const char *)*item);
break;
case PAM_TTY:
PWRAP_LOG(PWRAP_LOG_TRACE,
 

[SCM] pam wrapper repository - branch master updated

2016-05-24 Thread Andreas Schneider
The branch, master has been updated
   via  247260d Bump version to 1.0.2
  from  615fe23 pwrap: Disable audit on BSD

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


- Log -
commit 247260d3f944c3dade6c52a18d18ccd248659380
Author: Andreas Schneider 
Date:   Tue May 24 08:00:48 2016 +0200

Bump version to 1.0.2

Signed-off-by: Andreas Schneider 

---

Summary of changes:
 CMakeLists.txt | 4 ++--
 ChangeLog  | 4 
 2 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1674909..5f52edf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "1")
+set(APPLICATION_VERSION_PATCH "2")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -22,7 +22,7 @@ set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
 set(LIBRARY_VERSION "0.0.2")
 set(LIBRARY_SOVERSION "0")
 
-set(PAMTEST_LIBRARY_VERSION "0.0.1")
+set(PAMTEST_LIBRARY_VERSION "0.0.2")
 set(PAMTEST_LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff --git a/ChangeLog b/ChangeLog
index 4d7ea27..5af21dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 ChangeLog
 ==
 
+version 1.0.2 (released 2016-05-24)
+  * Fixed pam_wrapper on some BSDs
+  * Fixed simple conversation in libpamtest
+
 version 1.0.1 (released 2016-01-18)
   * Fixed issue with audit_open() and sshd
   * Fixed several issues found by Coverity


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2016-05-10 Thread Andreas Schneider
The branch, master has been updated
   via  615fe23 pwrap: Disable audit on BSD
   via  f3ef1e8 modules: Add the path where we install the helper PAM 
modules to the .pc file
   via  bc51c04 libpamtest: Only reply in conversation for echo_on and 
echo_off
  from  31d374c Bump version to 1.0.1

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


- Log -
commit 615fe23acab323624fd732fd0272a768833e183e
Author: Andreas Schneider 
Date:   Mon May 9 09:51:00 2016 +0200

pwrap: Disable audit on BSD

This allows us to use pam_wrapper on BSD

Signed-off-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit f3ef1e8833fb809d3a4e8dd9051eb4ab31d76c78
Author: Jakub Hrozek 
Date:   Fri May 6 12:00:10 2016 +0200

modules: Add the path where we install the helper PAM modules to the .pc 
file

A test needs to often know where are the helper pam modules
(pam_get_items.so and pam_set_items.so). This patch adds a new variable
to the pkg-config file that lets the user of pam_wrapper query the path
like this:
$ pkg-config --variable=modules pam_wrapper
/usr/lib64/pam_wrapper

And use that variable to define their own service files.

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

commit bc51c0430df83a1fdf8d468920d73a656c32b704
Author: Jakub Hrozek 
Date:   Thu May 5 15:53:46 2016 +0200

libpamtest: Only reply in conversation for echo_on and echo_off

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Ralph Boehme 

---

Summary of changes:
 pam_wrapper.pc.cmake | 2 ++
 src/libpamtest.c | 5 -
 src/pam_wrapper.c| 9 +
 3 files changed, 15 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/pam_wrapper.pc.cmake b/pam_wrapper.pc.cmake
index 3c1c848..c1f407b 100644
--- a/pam_wrapper.pc.cmake
+++ b/pam_wrapper.pc.cmake
@@ -1,3 +1,5 @@
+modules=@LIB_INSTALL_DIR@/pam_wrapper
+
 Name: @APPLICATION_NAME@
 Description: The pam_wrapper library
 Version: @APPLICATION_VERSION@
diff --git a/src/libpamtest.c b/src/libpamtest.c
index c6d5b89..7119184 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -294,9 +294,12 @@ static int pamtest_simple_conv(int num_msg,
}
}
 
-   if (response) {
+   if (response && ri > 0) {
*response = reply;
+   } else {
+   free(reply);
}
+
return PAM_SUCCESS;
 }
 
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index fddc7fa..bc73f41 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -1518,6 +1518,15 @@ int audit_open(void)
return -1;
 }
 
+/* Disable BSD auditing */
+int cannot_audit(int x);
+int cannot_audit(int x)
+{
+   (void) x;
+
+   return 1;
+}
+
 /
  * DESTRUCTOR
  ***/


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2016-01-18 Thread Michael Adam
The branch, master has been updated
   via  31d374c Bump version to 1.0.1
   via  3b1d585 pwrap: Fix a possible timing issue in p_copy()
   via  c91b203 pwrap: Improve p_rmdirs() do avoid timing issues
   via  d3cfb7a pwrap: Remove superfloues lstat()
   via  490ae6a pwrap: Make sure we have a terminating null byte
   via  e2628f0 pam_matrix: Set a secure umask before calling mkstemp()
   via  0b43f0c pwrap: Return EPROTONOSUPPORT in audit_open()
   via  92c01c8 cmake: Link python module against the python library
   via  55ff828 cmake: Do not require a C++ compiler
  from  746496c Initial release of pam_wrapper 1.0.0

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


- Log -
commit 31d374cda4e3ce1f57d290d46ef3a97d6ed0b076
Author: Andreas Schneider 
Date:   Mon Jan 18 09:18:56 2016 +0100

Bump version to 1.0.1

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 3b1d585468c7fbd6402f75e27096a19f3620b940
Author: Andreas Schneider 
Date:   Fri Jan 15 15:20:24 2016 +0100

pwrap: Fix a possible timing issue in p_copy()

Do not rely on stat before open - it is racy.
Open directly and treat failure appropriately.

CID: 47518

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit c91b2033bebe69ff5bab67c8db960ac5ec021268
Author: Jakub Hrozek 
Date:   Fri Jan 15 12:55:51 2016 +0100

pwrap: Improve p_rmdirs() do avoid timing issues

When calling stat and rmdir, we could run into timing issues that the
stat information is incorrect till we are actually running the rmdir()
command. So we open the directory and have the handle open to avoid
that we work on outdated information. It is unlikely but Coverity
complains and we thought better fix it.

CID: 47519

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit d3cfb7af2a8f5ce844c46ce8c5fade8df1e2e429
Author: Andreas Schneider 
Date:   Fri Jan 15 11:11:50 2016 +0100

pwrap: Remove superfloues lstat()

There is no need to check if the file exists, just try to open it.

CID: 47520

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 490ae6a25ddf21963095d6d3c66a086fbc6147f9
Author: Andreas Schneider 
Date:   Fri Jan 15 11:44:14 2016 +0100

pwrap: Make sure we have a terminating null byte

This is just to silence Coverity.

CID: 47508

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit e2628f07ce78abfbe5e29b4d3b6db707c2677063
Author: Andreas Schneider 
Date:   Fri Jan 15 11:38:00 2016 +0100

pam_matrix: Set a secure umask before calling mkstemp()

CID: 47516

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 0b43f0cd311d352806f5cd4f867a4a8efb29546e
Author: Andreas Schneider 
Date:   Thu Jan 14 17:04:33 2016 +0100

pwrap: Return EPROTONOSUPPORT in audit_open()

I don't know why but returning EINVAL doesn't work. It treats it as
success and tries to write to it.

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 92c01c80103034d4a3cdd92aa4d00c34d687300d
Author: Andreas Schneider 
Date:   Thu Jan 14 17:04:07 2016 +0100

cmake: Link python module against the python library

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 55ff828e58ff9a29badb19f6d5b68e7fe7a990f8
Author: Andreas Schneider 
Date:   Thu Jan 14 13:46:01 2016 +0100

cmake: Do not require a C++ compiler

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

---

Summary of changes:
 CMakeLists.txt |   4 +-
 ChangeLog  |   5 ++
 src/modules/CMakeLists.txt |   2 +-
 src/modules/pam_matrix.c   |   2 +-
 src/pam_wrapper.c  | 208 ++---
 src/python/CMakeLists.txt  |   4 +-
 6 files changed, 111 insertions(+), 114 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8709a14..1674909 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "0")
+set(APPLICATION_VERSION_PATCH "1")
 
 

[SCM] pam wrapper repository - branch master updated

2016-01-13 Thread Andreas Schneider
The branch, master has been updated
   via  746496c Initial release of pam_wrapper 1.0.0
   via  2f13c69 pam_matrix: Call umask before mkstemp()
   via  8909db9 pwrap: Make sure pam_library is null-terminated
   via  8eba2fe libpamtest: Make sure ri is not used uninitialized
  from  5d4184d pwrap: Wrap audit_open() to fix sshd

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


- Log -
commit 746496c5f3919c3da532cdcc0b4a2439a437ed4b
Author: Andreas Schneider 
Date:   Wed Jan 13 09:42:09 2016 +0100

Initial release of pam_wrapper 1.0.0

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 2f13c698b304cde08841b7ef39cec6375b6a9887
Author: Andreas Schneider 
Date:   Wed Jan 13 10:57:44 2016 +0100

pam_matrix: Call umask before mkstemp()

Without calling umask() we create and use insecure temporary files that
can leave application and system data vulnerable to attack. Unlikely in
a module created for testing, but better fix it.

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 8909db9fdea8a4740bb3939b25d8fd9b727ddbd3
Author: Andreas Schneider 
Date:   Wed Jan 13 10:54:36 2016 +0100

pwrap: Make sure pam_library is null-terminated

We initialize the array with 0. So do not pass the full size of the
array to make sure the last byte is a null byte.

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 8eba2fe5ccb4e9e1637b831f7b342bcb95b3541a
Author: Andreas Schneider 
Date:   Wed Jan 13 10:50:05 2016 +0100

libpamtest: Make sure ri is not used uninitialized

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

---

Summary of changes:
 ChangeLog| 8 +++-
 src/libpamtest.c | 3 +--
 src/modules/pam_matrix.c | 5 +
 src/pam_wrapper.c| 2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ChangeLog b/ChangeLog
index 329efc7..869aaa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 ChangeLog
 ==
 
-version 1.0.0 (released 2015-xx-xx)
+version 1.0.0 (released 2016-01-14)
   * Initial release
+- pam_wrapper
+- libpamtest
+- pypamtest
+- pam_matrix
+- pam_get_items
+- pam_set_items
diff --git a/src/libpamtest.c b/src/libpamtest.c
index f99c2c7..c6d5b89 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -210,7 +210,7 @@ static int pamtest_simple_conv(int num_msg,
   struct pam_response **response,
   void *appdata_ptr)
 {
-   int i, ri;
+   int i, ri = 0;
int ret;
struct pam_response *reply = NULL;
const char *prompt;
@@ -227,7 +227,6 @@ static int pamtest_simple_conv(int num_msg,
if (reply == NULL) {
return PAM_CONV_ERR;
}
-   ri = 0;
}
 
for (i=0; i < num_msg; i++) {
diff --git a/src/modules/pam_matrix.c b/src/modules/pam_matrix.c
index 89fdd56..bf5c60a 100644
--- a/src/modules/pam_matrix.c
+++ b/src/modules/pam_matrix.c
@@ -19,6 +19,8 @@
 #include "config.h"
 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -195,6 +197,7 @@ static int pam_matrix_lib_items_put(const char *db,
struct pam_lib_items *pli)
 {
int rv;
+   mode_t old_mask;
FILE *fp = NULL;
FILE *fp_tmp = NULL;
char buf[BUFSIZ];
@@ -211,7 +214,9 @@ static int pam_matrix_lib_items_put(const char *db,
}
 
/* We don't support concurrent runs.. */
+   old_mask = umask(0);
rv = mkstemp(template);
+   umask(old_mask);
if (rv <= 0) {
rv = PAM_BUF_ERR;
goto done;
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 9b27bc3..0c451d1 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -879,7 +879,7 @@ static void pwrap_init(void)
  "PAM path: %s",
  libpam_path);
 
-   ret = readlink(libpam_path, pam_library, sizeof(pam_library));
+   ret = readlink(libpam_path, pam_library, sizeof(pam_library) - 1);
PWRAP_LOG(PWRAP_LOG_TRACE,
  "PAM library: %s",
  pam_library);


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2016-01-08 Thread Andreas Schneider
The branch, master has been updated
   via  5d4184d pwrap: Wrap audit_open() to fix sshd
   via  262bced Coverity: Remove deadcode
   via  8eebf23 Coverity: Fix memory leak in libpamtest on error
   via  658b631 python: Remove dead code in test_result_list_concat()
   via  9b9eb66 tests: Fix a possible memory leak in pwrap_conv()
   via  e97bd79 tests: Do not dreference key before NULL check in 
string_in_list()
   via  73f6fe7 cmake: Link pam_wrapper to libdl
   via  62f284e doc: Also install pam_matrix manpage
   via  95e65b2 cmake: Install pypamtest
   via  f2ca116 cmake: Find the python executable and site libs
   via  0195f1e cmake: Add FindPythonSiteLibs.cmake
   via  60079f6 cmake: Use python_add_module function
   via  6ec9881 pwrap: Do not close negative fds in p_copy()
   via  30ccd17 pwrap: Fix a resource leak in p_rmdirs()
   via  c0f5c53 pwrap: Add more debug messages if something goes wrong
   via  20a8d76 pwrap: Do not fail on EOL in pwrap_clean_stale_dirs()
   via  6349655 pwrap: Close the pidfile in pwrap_init()
   via  75d05c9 pwrap: Add log message for directory cleanup
  from  7267de3 py: Fix strict aliasing rules in initpypamtest()

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


- Log -
commit 5d4184db3f8ef11997385c0ebf582b5bc5c7bef3
Author: Andreas Schneider 
Date:   Fri Dec 18 11:10:53 2015 +0100

pwrap: Wrap audit_open() to fix sshd

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 262bceddfcdc844aab550a6506f301c926ef30b6
Author: Jakub Hrozek 
Date:   Wed Dec 16 15:17:42 2015 +0100

Coverity: Remove deadcode

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 8eebf23df143c8ce54af9db62439fca2103ecebb
Author: Jakub Hrozek 
Date:   Wed Dec 16 15:20:48 2015 +0100

Coverity: Fix memory leak in libpamtest on error

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 658b63134f3d3831541fa58f7932d48a0b954d2e
Author: Andreas Schneider 
Date:   Wed Dec 16 15:19:56 2015 +0100

python: Remove dead code in test_result_list_concat()

There is a NULL check already above and the XDECREF does not set the
object to NULL.

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 9b9eb66df9510e099dabd490edd4457b821b2b4b
Author: Andreas Schneider 
Date:   Wed Dec 16 15:16:36 2015 +0100

tests: Fix a possible memory leak in pwrap_conv()

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit e97bd79fda87794219602fef441e62c2d7ea9255
Author: Andreas Schneider 
Date:   Wed Dec 16 15:13:59 2015 +0100

tests: Do not dreference key before NULL check in string_in_list()

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 73f6fe75383130089bc663d1ae013c03e42840d9
Author: Andreas Schneider 
Date:   Wed Dec 16 15:02:43 2015 +0100

cmake: Link pam_wrapper to libdl

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 62f284e9ec40089c8c25cfb35c61a43bb519d293
Author: Jakub Hrozek 
Date:   Wed Dec 16 13:40:13 2015 +0100

doc: Also install pam_matrix manpage

Signed-off-by: Jakub Hrozek 
Reviewed-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 95e65b2e6b1db88d9680ee0b43a9884846fb71f7
Author: Andreas Schneider 
Date:   Wed Dec 16 10:48:14 2015 +0100

cmake: Install pypamtest

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit f2ca1160fa339c03a65c5affb4c321105e352437
Author: Andreas Schneider 
Date:   Wed Dec 16 10:36:22 2015 +0100

cmake: Find the python executable and site libs

This is needed to find the PYTHON_SITELIB directory for module
installation.

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 0195f1ed67cae8643f992fc3e29f2336566995fd
Author: Andreas Schneider 
Date:   Wed Dec 16 10:29:29 2015 +0100

cmake: Add FindPythonSiteLibs.cmake

This adds support do discover PYTHON_SITELIB location.

Signed-off-by: Andreas Schneider 
Reviewed-by: Guenther Deschner 

commit 

[SCM] pam wrapper repository - branch master updated

2015-12-10 Thread Andreas Schneider
The branch, master has been updated
   via  d98750e tests: Do not run python test if python is not present
  from  fbb0abf ctest: Drop ctest results via https

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


- Log -
commit d98750e7294a50262629d11162e23a927688252a
Author: Andreas Schneider 
Date:   Thu Dec 10 17:03:46 2015 +0100

tests: Do not run python test if python is not present

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

---

Summary of changes:
 tests/CMakeLists.txt | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0055280..30f0eb2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -47,9 +47,11 @@ set_property(
 PROPERTY
 ENVIRONMENT ${TEST_ENVIRONMENT})
 
-add_test(pypamtest_test ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py)
-set_property(
-TEST
-pypamtest_test
-PROPERTY
-ENVIRONMENT ${TEST_ENVIRONMENT})
+if (PYTHONLIBS_FOUND)
+add_test(pypamtest_test ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py)
+set_property(
+TEST
+pypamtest_test
+PROPERTY
+ENVIRONMENT ${TEST_ENVIRONMENT})
+endif()


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2015-12-10 Thread Michael Adam
The branch, master has been updated
   via  59ecbfa py: Make sure we do not use failed uninitialized
   via  52ec969 py: Make sure we do not dereference a NULL pointer
   via  776a184 libpamtest: Do not call pam_end() if tc is not set
   via  927a070 libpamtest: Make sure reply is initialized
  from  d98750e tests: Do not run python test if python is not present

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


- Log -
commit 59ecbfa4fb64785c24fe3ce4bfa96a23f804eac3
Author: Andreas Schneider 
Date:   Thu Dec 10 17:32:18 2015 +0100

py: Make sure we do not use failed uninitialized

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 52ec969c2c074f2716c8c3bccd7940a84ddee92b
Author: Andreas Schneider 
Date:   Thu Dec 10 17:30:57 2015 +0100

py: Make sure we do not dereference a NULL pointer

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 776a18460f3e259a12a8b07ee52d70676fdb7258
Author: Andreas Schneider 
Date:   Thu Dec 10 17:13:52 2015 +0100

libpamtest: Do not call pam_end() if tc is not set

This fixes a build warning.

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 927a070eb6d80fb155ccc033704522d336789c28
Author: Andreas Schneider 
Date:   Thu Dec 10 17:10:55 2015 +0100

libpamtest: Make sure reply is initialized

Fixes a build warning

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

---

Summary of changes:
 src/libpamtest.c   | 6 +++---
 src/python/pypamtest.c | 9 +++--
 2 files changed, 10 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/libpamtest.c b/src/libpamtest.c
index 612cdc1..6d6efc6 100644
--- a/src/libpamtest.c
+++ b/src/libpamtest.c
@@ -70,7 +70,7 @@ enum pamtest_err _pamtest_conv(const char *service,
pam_handle_t *ph;
struct pam_conv conv;
size_t tcindex;
-   struct pam_testcase *tc;
+   struct pam_testcase *tc = NULL;
bool call_pam_end = true;
 
conv.conv = conv_fn;
@@ -101,7 +101,7 @@ enum pamtest_err _pamtest_conv(const char *service,
}
}
 
-   if (call_pam_end == true) {
+   if (call_pam_end == true && tc != NULL) {
rv = pam_end(ph, tc->op_rv);
if (rv != PAM_SUCCESS) {
return PAMTEST_ERR_END;
@@ -198,7 +198,7 @@ static int pamtest_simple_conv(int num_msg,
 {
int i, ri;
int ret;
-   struct pam_response *reply;
+   struct pam_response *reply = NULL;
const char *prompt;
struct pamtest_conv_ctx *cctx = \
(struct pamtest_conv_ctx *) appdata_ptr;
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index 1538294..a1b5dd6 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -261,7 +261,12 @@ set_pypamtest_exception(PyObject *exc,
/* repr_fmt is fixed and contains just %d expansions, so this is safe */
char test_repr[256] = { '\0' };
const char *strerr;
-   const struct pam_testcase *failed;
+   const struct pam_testcase *failed = NULL;
+
+   if (exc == NULL) {
+   PyErr_BadArgument();
+   return;
+   }
 
strerr = pamtest_strerror(perr);
 
@@ -275,7 +280,7 @@ set_pypamtest_exception(PyObject *exc,
}
}
 
-   if (test_repr[0] != '\0') {
+   if (test_repr[0] != '\0' && failed != NULL) {
PyErr_Format(exc,
 "Error [%d]: Test case %s retured [%d]",
 perr, test_repr, failed->op_rv);


-- 
pam wrapper repository



[SCM] pam wrapper repository - branch master updated

2015-12-10 Thread Michael Adam
The branch, master has been updated
   via  7267de3 py: Fix strict aliasing rules in initpypamtest()
   via  7505e1c py: Fix strict aliasing rules in set_pypamtest_exception()
  from  59ecbfa py: Make sure we do not use failed uninitialized

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


- Log -
commit 7267de3e692d4e07645488cde7f54c2d4ffa426d
Author: Andreas Schneider 
Date:   Thu Dec 10 17:36:09 2015 +0100

py: Fix strict aliasing rules in initpypamtest()

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

commit 7505e1c7f93fae556bb92b19922791bc703b6be1
Author: Andreas Schneider 
Date:   Thu Dec 10 17:35:51 2015 +0100

py: Fix strict aliasing rules in set_pypamtest_exception()

Signed-off-by: Andreas Schneider 
Reviewed-by: Michael Adam 

---

Summary of changes:
 src/python/pypamtest.c | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index a1b5dd6..a773733 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -260,6 +260,10 @@ set_pypamtest_exception(PyObject *exc,
PyObject *obj = NULL;
/* repr_fmt is fixed and contains just %d expansions, so this is safe */
char test_repr[256] = { '\0' };
+   union {
+   char *str;
+   PyObject *obj;
+   } pypam_str_object;
const char *strerr;
const struct pam_testcase *failed = NULL;
 
@@ -291,7 +295,8 @@ set_pypamtest_exception(PyObject *exc,
PyErr_SetObject(exc, obj);
}
 
-   Py_XDECREF(test_repr);
+   pypam_str_object.str = test_repr;
+   Py_XDECREF(pypam_str_object.obj);
Py_XDECREF(obj);
 }
 
@@ -1008,6 +1013,10 @@ PyMODINIT_FUNC initpypamtest(void)
 #endif
 {
PyObject *m;
+   union {
+   PyTypeObject *type_obj;
+   PyObject *obj;
+   } pypam_object;
int ret;
 
 #if IS_PYTHON3
@@ -1069,18 +1078,19 @@ PyMODINIT_FUNC initpypamtest(void)
RETURN_ON_ERROR;
}
 
-   if (PyType_Ready(_test_case) < 0) {
+   pypam_object.type_obj = _test_case;
+   if (PyType_Ready(pypam_object.type_obj) < 0) {
RETURN_ON_ERROR;
}
-   Py_INCREF(_test_case);
-   PyModule_AddObject(m, "TestCase", (PyObject *) _test_case);
+   Py_INCREF(pypam_object.obj);
+   PyModule_AddObject(m, "TestCase", pypam_object.obj);
 
-   if (PyType_Ready(_test_result) < 0) {
+   pypam_object.type_obj = _test_result;
+   if (PyType_Ready(pypam_object.type_obj) < 0) {
RETURN_ON_ERROR;
}
-   Py_INCREF(_test_result);
-   PyModule_AddObject(m, "TestResult",
-  (PyObject *) _test_result);
+   Py_INCREF(pypam_object.obj);
+   PyModule_AddObject(m, "TestResult", pypam_object.obj);
 
 #if IS_PYTHON3
return m;


-- 
pam wrapper repository