[SCM] pam wrapper repository - branch master updated
Andreas Schneider
asn at samba.org
Thu Feb 22 15:47:29 UTC 2018
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 <asn at samba.org>
Date: Thu Feb 22 15:46:12 2018 +0100
Bump version to 1.0.5
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 6bea1e19edf520985776787c3ba3fcea3ca89faa
Author: Nikos Mavrogiannopoulos <nmav at gnutls.org>
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 <nmav at gnutls.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
-----------------------------------------------------------------------
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 <libgen.h>
#include <signal.h>
#include <limits.h>
+#include <ctype.h>
#include <ftw.h>
@@ -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, &sb);
+ if (rc == 0) {
+ PWRAP_LOG(PWRAP_LOG_TRACE,
+ "Check if pam_wrapper dir %s is a "
+ "stale directory",
+ tmp_config_dir);
+ pwrap_clean_stale_dirs(tmp_config_dir);
+ } else if (rc < 0) {
+ if (errno != ENOENT) {
+ continue;
+ }
+ break; /* found */
+ }
}
- tmp_config_dir[len - 1] = c;
- rc = lstat(tmp_config_dir, &sb);
- if (rc == 0) {
- PWRAP_LOG(PWRAP_LOG_TRACE,
- "Check if pam_wrapper dir %s is a "
- "stale directory",
- tmp_config_dir);
- pwrap_clean_stale_dirs(tmp_config_dir);
- continue;
- } else if (errno == ENOENT) {
- break;
- }
+ letter++;
+ letter %= 127;
}
- if (i == 36) {
+ if (i == 127) {
PWRAP_LOG(PWRAP_LOG_ERROR,
"Failed to find a possible path to create "
"pam_wrapper config dir: %s",
@@ -810,6 +816,10 @@ static void pwrap_init(void)
exit(1);
}
+ PWRAP_LOG(PWRAP_LOG_DEBUG, "Initialize pam_wrapper");
+
+ pwrap_clean_stale_dirs(tmp_config_dir);
+
pwrap.config_dir = strdup(tmp_config_dir);
if (pwrap.config_dir == NULL) {
PWRAP_LOG(PWRAP_LOG_ERROR,
--
pam wrapper repository
More information about the samba-cvs
mailing list