pam_wrapper.git
4 years agopython: Fix typos
Bastien Nocera [Mon, 20 Jan 2020 17:35:40 +0000 (18:35 +0100)]
python: Fix typos

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agopwrap: Add support for pam_start_confdir()
Andreas Schneider [Fri, 6 Mar 2020 16:35:28 +0000 (17:35 +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 <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Add a check for pam_start_confdir()
Andreas Schneider [Fri, 6 Mar 2020 16:18:06 +0000 (17:18 +0100)]
cmake: Add a check for pam_start_confdir()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Add link to compile database
Andreas Schneider [Fri, 6 Mar 2020 16:35:16 +0000 (17:35 +0100)]
cmake: Add link to compile database

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agogitlab-ci: Setup CI for pam_wrapper
Andreas Schneider [Fri, 31 Jan 2020 13:01:27 +0000 (14:01 +0100)]
gitlab-ci: Setup CI for pam_wrapper

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Do not run python tests with AddressSanitizer
Andreas Schneider [Fri, 31 Jan 2020 13:57:44 +0000 (14:57 +0100)]
cmake: Do not run python tests with AddressSanitizer

It will complain about python malloc and fail.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Write new cmake config files
Andreas Schneider [Fri, 31 Jan 2020 12:59:52 +0000 (13:59 +0100)]
cmake: Write new cmake config files

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use GNUInstallDirs
Andreas Schneider [Fri, 31 Jan 2020 12:47:37 +0000 (13:47 +0100)]
cmake: Use GNUInstallDirs

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use target_include_directories()
Andreas Schneider [Fri, 31 Jan 2020 12:41:35 +0000 (13:41 +0100)]
cmake: Use target_include_directories()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Support running the tests with AddressSanitizer
Andreas Schneider [Fri, 31 Jan 2020 12:32:46 +0000 (13:32 +0100)]
cmake: Support running the tests with AddressSanitizer

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Add AddressSanitizer and UndefinedSanitizer
Andreas Schneider [Fri, 31 Jan 2020 12:21:06 +0000 (13:21 +0100)]
cmake: Add AddressSanitizer and UndefinedSanitizer

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Update add_cmocka_test()
Andreas Schneider [Fri, 31 Jan 2020 12:25:59 +0000 (13:25 +0100)]
cmake: Update add_cmocka_test()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Look for cmocka 1.1.0 at least
Andreas Schneider [Fri, 31 Jan 2020 12:22:50 +0000 (13:22 +0100)]
cmake: Look for cmocka 1.1.0 at least

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Move compiler flags to new file
Andreas Schneider [Fri, 31 Jan 2020 12:19:41 +0000 (13:19 +0100)]
cmake: Move compiler flags to new file

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Improve checks for compiler flags
Andreas Schneider [Fri, 31 Jan 2020 12:16:45 +0000 (13:16 +0100)]
cmake: Improve checks for compiler flags

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Update cmake defaults
Andreas Schneider [Fri, 31 Jan 2020 12:06:13 +0000 (13:06 +0100)]
cmake: Update cmake defaults

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Require at least cmake 3.5.0
Andreas Schneider [Fri, 31 Jan 2020 11:59:31 +0000 (12:59 +0100)]
cmake: Require at least cmake 3.5.0

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoREADME: Rename to a markdown file
Andreas Schneider [Fri, 31 Jan 2020 12:03:33 +0000 (13:03 +0100)]
README: Rename to a markdown file

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agodoc: Document PAM_WRAPPER_DISABLE_DEEPBIND
Andreas Schneider [Fri, 31 Jan 2020 11:48:58 +0000 (12:48 +0100)]
doc: Document PAM_WRAPPER_DISABLE_DEEPBIND

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agopwrap: Fix pso_copy to work with libpam.so.0.84.2
Andreas Schneider [Fri, 15 Nov 2019 08:58:27 +0000 (09:58 +0100)]
pwrap: Fix pso_copy to work with libpam.so.0.84.2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agopwrap: Use a define in pso_copy()
Andreas Schneider [Fri, 15 Nov 2019 08:45:22 +0000 (09:45 +0100)]
pwrap: Use a define in pso_copy()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agopwrap: Improve logging
Andreas Schneider [Fri, 15 Nov 2019 08:40:04 +0000 (09:40 +0100)]
pwrap: Improve logging

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Add checks for getprogname() and getexecname()
Andreas Schneider [Fri, 15 Nov 2019 08:39:21 +0000 (09:39 +0100)]
cmake: Add checks for getprogname() and getexecname()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agopwrap: Add support for running with Sanitizers
Andreas Schneider [Fri, 15 Nov 2019 08:34:03 +0000 (09:34 +0100)]
pwrap: Add support for running with Sanitizers

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocpack: Do not package pyc files
Andreas Schneider [Thu, 28 Feb 2019 11:58:28 +0000 (12:58 +0100)]
cpack: Do not package pyc files

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoBump version to 1.0.7 pam_wrapper-1.0.7
Andreas Schneider [Tue, 25 Sep 2018 18:16:47 +0000 (20:16 +0200)]
Bump version to 1.0.7

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
5 years agopwrap: Don't do a deep bind if we run with libasan
Andreas Schneider [Sat, 1 Sep 2018 17:46:36 +0000 (19:46 +0200)]
pwrap: Don't do a deep bind if we run with libasan

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
5 years agopam_set_items: Add logging
Andreas Schneider [Thu, 20 Sep 2018 08:08:00 +0000 (10:08 +0200)]
pam_set_items: Add logging

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
5 years agopypamtest: Fix number of responses
Andreas Schneider [Mon, 25 Jun 2018 09:02:45 +0000 (11:02 +0200)]
pypamtest: Fix number of responses

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
5 years agopwrap: Add PAM_TEXT_INFO and PAM_ERROR_MSG to responses
Andreas Schneider [Tue, 26 Jun 2018 06:46:44 +0000 (08:46 +0200)]
pwrap: Add PAM_TEXT_INFO and PAM_ERROR_MSG to responses

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
5 years agolibpamtest: Check that message count matches response count
Andreas Schneider [Mon, 25 Jun 2018 08:39:51 +0000 (10:39 +0200)]
libpamtest: Check that message count matches response count

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
5 years agocmake: Don't keep CMAKE_REQUIRED_LIBRARIES around
Andreas Schneider [Tue, 28 Aug 2018 09:18:36 +0000 (11:18 +0200)]
cmake: Don't keep CMAKE_REQUIRED_LIBRARIES around

This can cause issues with detecting features.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoctest: Move to new dashboard
Andreas Schneider [Thu, 5 Jul 2018 08:16:27 +0000 (10:16 +0200)]
ctest: Move to new dashboard

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocmake: Fix python2 and python3 detection
Andreas Schneider [Tue, 3 Jul 2018 09:33:04 +0000 (11:33 +0200)]
cmake: Fix python2 and python3 detection

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agopwrap: Improve error message
Andreas Schneider [Fri, 29 Jun 2018 13:23:34 +0000 (15:23 +0200)]
pwrap: Improve error message

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agopwrap: Don't clean the stale dir twice
Andreas Schneider [Fri, 29 Jun 2018 13:23:12 +0000 (15:23 +0200)]
pwrap: Don't clean the stale dir twice

This is already done above.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agotests: Fix length calulation
Andreas Schneider [Mon, 25 Jun 2018 09:02:22 +0000 (11:02 +0200)]
tests: Fix length calulation

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoRename COPYING to LICENSE
Andreas Schneider [Fri, 22 Jun 2018 07:14:29 +0000 (09:14 +0200)]
Rename COPYING to LICENSE

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocpack: Do not package build dirs in source tarball
Andreas Schneider [Fri, 22 Jun 2018 07:13:52 +0000 (09:13 +0200)]
cpack: Do not package build dirs in source tarball

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agoBump version to 1.0.6 pam_wrapper-1.0.6
Andreas Schneider [Tue, 27 Mar 2018 09:05:04 +0000 (11:05 +0200)]
Bump version to 1.0.6

Signed-off-by: Andreas Schneider <asn@samba.org>
6 years agopwrap: remove pdir handling from p_copy()
Ralph Boehme [Mon, 26 Mar 2018 16:03:08 +0000 (18:03 +0200)]
pwrap: remove pdir handling from p_copy()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agopwrap: Fix overflow checking
Ralph Boehme [Mon, 26 Mar 2018 14:42:00 +0000 (16:42 +0200)]
pwrap: Fix overflow checking

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agopwrap: Avoid strncpy in pwrap_init()
Andreas Schneider [Mon, 26 Mar 2018 13:45:43 +0000 (15:45 +0200)]
pwrap: Avoid strncpy in pwrap_init()

CID 47508

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agopwrap: Add missing config.h includes
Andreas Schneider [Tue, 27 Feb 2018 08:17:06 +0000 (09:17 +0100)]
pwrap: Add missing config.h includes

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agopwrap: Remove trailing whitespaces
Andreas Schneider [Thu, 22 Feb 2018 16:02:12 +0000 (17:02 +0100)]
pwrap: Remove trailing whitespaces

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agoBump version to 1.0.5 pam_wrapper-1.0.5
Andreas Schneider [Thu, 22 Feb 2018 14:46:12 +0000 (15:46 +0100)]
Bump version to 1.0.5

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agopwrap: Use a more unique name for pamdir
Nikos Mavrogiannopoulos [Mon, 19 Feb 2018 20:23:23 +0000 (21:23 +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 <nmav@gnutls.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agocmake: Build python2 and python3 modules if possible
Andreas Schneider [Mon, 12 Feb 2018 11:01:22 +0000 (12:01 +0100)]
cmake: Build python2 and python3 modules if possible

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agocmake: Improve PAM_WRAPPER_LOACATION
Andreas Schneider [Wed, 22 Nov 2017 14:27:44 +0000 (15:27 +0100)]
cmake: Improve PAM_WRAPPER_LOACATION

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
6 years agopam_wrapper: Use a constant string format specifier in test
Uri Simchoni [Wed, 22 Nov 2017 20:48:23 +0000 (20:48 +0000)]
pam_wrapper: Use a constant string format specifier in test

This fixes a warning about non-constant format specifier.
clang 4.0.0 warns against non-constant format specifier since
it cannot validate the format against the parameters.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agopam_wrapper: use uintptr_t as base for const-discarding
Uri Simchoni [Sun, 19 Nov 2017 13:08:30 +0000 (13:08 +0000)]
pam_wrapper: use uintptr_t as base for const-discarding

Seems like HAVE_INTPTR_T is not available on FreeBSD. Use
the uintptr_t-base const discarding to avoid picky compiler
warnings (other places in Samba also use uintptr_t).

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agopam_wrapper: #ifdef-out unused functions
Uri Simchoni [Wed, 22 Nov 2017 14:23:26 +0000 (15:23 +0100)]
pam_wrapper: #ifdef-out unused functions

When pam_vsyslog is not available, avoid building functions
that are being used to wrap it, in order to avoid picky
compiler warnings.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
6 years agopypamtest: Fix Python 2.6 compatibility
Lumir Balhar [Fri, 13 Oct 2017 13:36:15 +0000 (15:36 +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 <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoBump version to 1.0.4 pam_wrapper-1.0.4
Andreas Schneider [Mon, 15 May 2017 14:37:44 +0000 (16:37 +0200)]
Bump version to 1.0.4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
7 years agopwrap: Do not leak srcfd on error
Andreas Schneider [Tue, 11 Apr 2017 06:39:44 +0000 (08:39 +0200)]
pwrap: Do not leak srcfd on error

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
7 years agopam_wrapper: Fix the build without pam_vsyslog
Volker Lendecke [Mon, 1 May 2017 15:57:27 +0000 (17:57 +0200)]
pam_wrapper: Fix the build without pam_vsyslog

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoBump version to 1.0.3 pam_wrapper-1.0.3
Andreas Schneider [Thu, 6 Apr 2017 07:55:29 +0000 (09:55 +0200)]
Bump version to 1.0.3

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agodoc: Document PAM_WRAPPER_USE_SYSLOG variable
Andreas Schneider [Thu, 6 Apr 2017 09:51:32 +0000 (11:51 +0200)]
doc: Document PAM_WRAPPER_USE_SYSLOG variable

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopwrap: Do not log to syslog by default but use our logging
Andreas Schneider [Thu, 6 Apr 2017 09:47:37 +0000 (11:47 +0200)]
pwrap: Do not log to syslog by default but use our logging

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopwrap: Do an early return in pwrap_vlog if log level doesn't match
Andreas Schneider [Thu, 6 Apr 2017 10:08:54 +0000 (12:08 +0200)]
pwrap: Do an early return in pwrap_vlog if log level doesn't match

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopwrap: Add pwrap_vlog() functions
Andreas Schneider [Thu, 6 Apr 2017 09:41:12 +0000 (11:41 +0200)]
pwrap: Add pwrap_vlog() functions

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopwrap: Remove useless break
Andreas Schneider [Thu, 6 Apr 2017 07:56:15 +0000 (09:56 +0200)]
pwrap: Remove useless break

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agolibpamtest: Do not declare variable in for-loop
Andreas Schneider [Thu, 6 Apr 2017 07:15:07 +0000 (09:15 +0200)]
libpamtest: Do not declare variable in for-loop

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopypamtest: Add sanity checks in new_conv_list()
Andreas Schneider [Thu, 6 Apr 2017 07:13:40 +0000 (09:13 +0200)]
pypamtest: Add sanity checks in new_conv_list()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agopypamtest: Do not use variable declaration in for-loop
Andreas Schneider [Thu, 6 Apr 2017 07:09:53 +0000 (09:09 +0200)]
pypamtest: Do not use variable declaration in for-loop

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agocmake: Add Python 3.6 if we look for the python library
Andreas Schneider [Thu, 30 Mar 2017 06:46:44 +0000 (08:46 +0200)]
cmake: Add Python 3.6 if we look for the python library

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agopwrap: Do not discard const value
Andreas Schneider [Wed, 29 Mar 2017 14:16:18 +0000 (16:16 +0200)]
pwrap: Do not discard const value

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agocmake: Remove unused define
Andreas Schneider [Wed, 29 Mar 2017 13:53:20 +0000 (15:53 +0200)]
cmake: Remove unused define

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agocmake: Do not check for pam_(v)syslog twice
Andreas Schneider [Wed, 29 Mar 2017 13:51:06 +0000 (15:51 +0200)]
cmake: Do not check for pam_(v)syslog twice

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoBump version to 1.0.2 pam_wrapper-1.0.2
Andreas Schneider [Tue, 24 May 2016 06:00:48 +0000 (08:00 +0200)]
Bump version to 1.0.2

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agopwrap: Disable audit on BSD
Andreas Schneider [Mon, 9 May 2016 07:51:00 +0000 (09:51 +0200)]
pwrap: Disable audit on BSD

This allows us to use pam_wrapper on BSD

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agomodules: Add the path where we install the helper PAM modules to the .pc file
Jakub Hrozek [Fri, 6 May 2016 10:00:10 +0000 (12:00 +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 <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agolibpamtest: Only reply in conversation for echo_on and echo_off
Jakub Hrozek [Thu, 5 May 2016 13:53:46 +0000 (15:53 +0200)]
libpamtest: Only reply in conversation for echo_on and echo_off

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoBump version to 1.0.1 pam_wrapper-1.0.1
Andreas Schneider [Mon, 18 Jan 2016 08:18:56 +0000 (09:18 +0100)]
Bump version to 1.0.1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Fix a possible timing issue in p_copy()
Andreas Schneider [Fri, 15 Jan 2016 14:20:24 +0000 (15:20 +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 <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Improve p_rmdirs() do avoid timing issues
Jakub Hrozek [Fri, 15 Jan 2016 11:55:51 +0000 (12:55 +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 <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Remove superfloues lstat()
Andreas Schneider [Fri, 15 Jan 2016 10:11:50 +0000 (11:11 +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 <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Make sure we have a terminating null byte
Andreas Schneider [Fri, 15 Jan 2016 10:44:14 +0000 (11:44 +0100)]
pwrap: Make sure we have a terminating null byte

This is just to silence Coverity.

CID: 47508

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopam_matrix: Set a secure umask before calling mkstemp()
Andreas Schneider [Fri, 15 Jan 2016 10:38:00 +0000 (11:38 +0100)]
pam_matrix: Set a secure umask before calling mkstemp()

CID: 47516

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Return EPROTONOSUPPORT in audit_open()
Andreas Schneider [Thu, 14 Jan 2016 16:04:33 +0000 (17:04 +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 <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agocmake: Link python module against the python library
Andreas Schneider [Thu, 14 Jan 2016 16:04:07 +0000 (17:04 +0100)]
cmake: Link python module against the python library

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agocmake: Do not require a C++ compiler
Andreas Schneider [Thu, 14 Jan 2016 12:46:01 +0000 (13:46 +0100)]
cmake: Do not require a C++ compiler

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agoInitial release of pam_wrapper 1.0.0
Andreas Schneider [Wed, 13 Jan 2016 08:42:09 +0000 (09:42 +0100)]
Initial release of pam_wrapper 1.0.0

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopam_matrix: Call umask before mkstemp()
Andreas Schneider [Wed, 13 Jan 2016 09:57:44 +0000 (10:57 +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 <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Make sure pam_library is null-terminated
Andreas Schneider [Wed, 13 Jan 2016 09:54:36 +0000 (10:54 +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 <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agolibpamtest: Make sure ri is not used uninitialized
Andreas Schneider [Wed, 13 Jan 2016 09:50:05 +0000 (10:50 +0100)]
libpamtest: Make sure ri is not used uninitialized

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agopwrap: Wrap audit_open() to fix sshd
Andreas Schneider [Fri, 18 Dec 2015 10:10:53 +0000 (11:10 +0100)]
pwrap: Wrap audit_open() to fix sshd

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agoCoverity: Remove deadcode
Jakub Hrozek [Wed, 16 Dec 2015 14:17:42 +0000 (15:17 +0100)]
Coverity: Remove deadcode

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agoCoverity: Fix memory leak in libpamtest on error
Jakub Hrozek [Wed, 16 Dec 2015 14:20:48 +0000 (15:20 +0100)]
Coverity: Fix memory leak in libpamtest on error

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agopython: Remove dead code in test_result_list_concat()
Andreas Schneider [Wed, 16 Dec 2015 14:19:56 +0000 (15:19 +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 <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agotests: Fix a possible memory leak in pwrap_conv()
Andreas Schneider [Wed, 16 Dec 2015 14:16:36 +0000 (15:16 +0100)]
tests: Fix a possible memory leak in pwrap_conv()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agotests: Do not dreference key before NULL check in string_in_list()
Andreas Schneider [Wed, 16 Dec 2015 14:13:59 +0000 (15:13 +0100)]
tests: Do not dreference key before NULL check in string_in_list()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agocmake: Link pam_wrapper to libdl
Andreas Schneider [Wed, 16 Dec 2015 14:02:43 +0000 (15:02 +0100)]
cmake: Link pam_wrapper to libdl

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agodoc: Also install pam_matrix manpage
Jakub Hrozek [Wed, 16 Dec 2015 12:40:13 +0000 (13:40 +0100)]
doc: Also install pam_matrix manpage

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agocmake: Install pypamtest
Andreas Schneider [Wed, 16 Dec 2015 09:48:14 +0000 (10:48 +0100)]
cmake: Install pypamtest

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agocmake: Find the python executable and site libs
Andreas Schneider [Wed, 16 Dec 2015 09:36:22 +0000 (10:36 +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 <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agocmake: Add FindPythonSiteLibs.cmake
Andreas Schneider [Wed, 16 Dec 2015 09:29:29 +0000 (10:29 +0100)]
cmake: Add FindPythonSiteLibs.cmake

This adds support do discover PYTHON_SITELIB location.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agocmake: Use python_add_module function
Andreas Schneider [Wed, 16 Dec 2015 09:16:32 +0000 (10:16 +0100)]
cmake: Use python_add_module function

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agopwrap: Do not close negative fds in p_copy()
Andreas Schneider [Wed, 16 Dec 2015 14:24:13 +0000 (15:24 +0100)]
pwrap: Do not close negative fds in p_copy()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
8 years agopwrap: Fix a resource leak in p_rmdirs()
Andreas Schneider [Wed, 16 Dec 2015 14:22:09 +0000 (15:22 +0100)]
pwrap: Fix a resource leak in p_rmdirs()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>