[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Jul 23 13:54:01 UTC 2024


The branch, master has been updated
       via  34c586680ea s3:tests: let modprinter.pl use $TMPDIR
       via  92ea6b00e71 third_party: Update pam_wrapper to version 1.1.7
       via  6481fab912b selftest:Samba3: don't use PAM_WRAPPER_KEEP_DIR and PAM_WRAPPER_DEBUGLEVEL
      from  ead5a3111f3 ctdb-daemon: Use ctdb_parse_node_address() in ctdbd

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


- Log -----------------------------------------------------------------
commit 34c586680eaa324421a9375033fb2d1786b2df75
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 23 11:46:57 2024 +0200

    s3:tests: let modprinter.pl use $TMPDIR
    
    We should avoid using /tmp in selftest
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Tue Jul 23 13:53:13 UTC 2024 on atb-devel-224

commit 92ea6b00e712e3d2c1fa6c465cf39f6fe83d5095
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jul 23 10:41:30 2024 +0200

    third_party: Update pam_wrapper to version 1.1.7
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9705
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 6481fab912bb5d14e39a0140cb882f99fe330081
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 23 09:27:37 2024 +0200

    selftest:Samba3: don't use PAM_WRAPPER_KEEP_DIR and PAM_WRAPPER_DEBUGLEVEL
    
    They are both only for debugging problems.
    
    In normal runs we don't need them and this avoids leaving to many
    /tmp/pam.* directories arround.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=9705
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 buildtools/wafsamba/samba_third_party.py    |  2 +-
 selftest/target/Samba3.pm                   |  3 +-
 source3/script/tests/printing/modprinter.pl |  6 ++-
 third_party/pam_wrapper/pam_wrapper.c       | 69 +++++++++--------------------
 third_party/pam_wrapper/wscript             |  3 +-
 5 files changed, 29 insertions(+), 54 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_third_party.py b/buildtools/wafsamba/samba_third_party.py
index 96484893b2f..d6fe609c896 100644
--- a/buildtools/wafsamba/samba_third_party.py
+++ b/buildtools/wafsamba/samba_third_party.py
@@ -44,5 +44,5 @@ Build.BuildContext.CHECK_UID_WRAPPER = CHECK_UID_WRAPPER
 
 @conf
 def CHECK_PAM_WRAPPER(conf):
-    return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.1.4')
+    return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.1.7')
 Build.BuildContext.CHECK_PAM_WRAPPER = CHECK_PAM_WRAPPER
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index c7cdbefc72d..b35769266ae 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1809,9 +1809,8 @@ sub setup_simpleserver
 	close(FILE);
 
 	$vars->{PAM_WRAPPER} = "1";
-	$vars->{PAM_WRAPPER_KEEP_DIR} = "1";
 	$vars->{PAM_WRAPPER_SERVICE_DIR} = $pam_service_dir;
-	$vars->{PAM_WRAPPER_DEBUGLEVEL} = "3";
+	#$vars->{PAM_WRAPPER_DEBUGLEVEL} = "3";
 
 	if (not $self->check_or_start(
 		env_vars => $vars,
diff --git a/source3/script/tests/printing/modprinter.pl b/source3/script/tests/printing/modprinter.pl
index 28817dbd284..bfe395a8509 100755
--- a/source3/script/tests/printing/modprinter.pl
+++ b/source3/script/tests/printing/modprinter.pl
@@ -122,7 +122,11 @@ while (<CONFIGFILE>) {
 	}
 }
 if ($opt_add) {
-	print CONFIGFILE_NEW "[$share_name]\n\tprintable = yes\n\tpath = /tmp\n";
+	my $tmpdir = "/tmp";
+	if (defined($ENV{TMPDIR})) {
+		$tmpdir = $ENV{TMPDIR};
+	}
+	print CONFIGFILE_NEW "[$share_name]\n\tprintable = yes\n\tpath = $tmpdir\n";
 }
 close (CONFIGFILE);
 close (CONFIGFILE_NEW);
diff --git a/third_party/pam_wrapper/pam_wrapper.c b/third_party/pam_wrapper/pam_wrapper.c
index da2c7381656..606fb66e7d5 100644
--- a/third_party/pam_wrapper/pam_wrapper.c
+++ b/third_party/pam_wrapper/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 */
@@ -749,6 +749,7 @@ static int copy_confdir(const char *src)
 
 static int p_rmdirs(const char *path);
 
+#ifndef HAVE_PAM_START_CONFDIR
 static void pwrap_clean_stale_dirs(const char *dir)
 {
 	size_t len = strlen(dir);
@@ -816,20 +817,18 @@ static void pwrap_clean_stale_dirs(const char *dir)
 
 	return;
 }
+#endif /* HAVE_PAM_START_CONFDIR */
 
 #ifdef HAVE_PAM_START_CONFDIR
 static void pwrap_init(void)
 {
-	char tmp_config_dir[] = "/tmp/pam.X";
-	size_t len = strlen(tmp_config_dir);
+	const char *tmpdir = getenv("TMPDIR");
+	char *tmp_config_dir = NULL;
 	const char *env;
-	struct stat sb;
 	int rc;
-	unsigned i;
 	ssize_t ret;
 	FILE *pidfile;
 	char pidfile_path[1024] = { 0 };
-	char letter;
 
 	if (!pam_wrapper_enabled()) {
 		return;
@@ -839,62 +838,33 @@ static void pwrap_init(void)
 		return;
 	}
 
-	/*
-	 * 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 */
-			}
-		}
+	PWRAP_LOG(PWRAP_LOG_DEBUG, "Initialize pam_wrapper");
 
-		letter++;
-		letter %= 127;
+	if (tmpdir == NULL || strlen(tmpdir) == 0 ||
+	    strlen(tmpdir) >= PATH_MAX - 12)
+	{
+		tmpdir = "/tmp";
 	}
 
-	if (i == 127) {
-		PWRAP_LOG(PWRAP_LOG_ERROR,
-			  "Failed to find a possible path to create "
-			  "pam_wrapper config dir: %s",
-			  tmp_config_dir);
+	rc = asprintf(&pwrap.config_dir, "%s/pam.XXXXXX", tmpdir);
+	if (rc <= 0) {
+		PWRAP_LOG(PWRAP_LOG_ERROR, "Failed to create path");
 		exit(1);
 	}
 
-	PWRAP_LOG(PWRAP_LOG_DEBUG, "Initialize pam_wrapper");
-
-	pwrap.config_dir = strdup(tmp_config_dir);
-	if (pwrap.config_dir == NULL) {
+	tmp_config_dir = mkdtemp(pwrap.config_dir);
+	if (tmp_config_dir == NULL) {
 		PWRAP_LOG(PWRAP_LOG_ERROR,
-			  "No memory");
+			  "Failed to create temporary directory based "
+			  "on template: %s",
+			  pwrap.config_dir);
 		exit(1);
 	}
+
 	PWRAP_LOG(PWRAP_LOG_TRACE,
 		  "pam_wrapper config dir: %s",
 		  tmp_config_dir);
 
-	rc = mkdir(pwrap.config_dir, 0755);
-	if (rc != 0) {
-		PWRAP_LOG(PWRAP_LOG_ERROR,
-			  "Failed to create pam_wrapper config dir: %s - %s",
-			  tmp_config_dir, strerror(errno));
-	}
-
 	/* Create file with the PID of the the process */
 	ret = snprintf(pidfile_path, sizeof(pidfile_path),
 		       "%s/pid", pwrap.config_dir);
@@ -1121,6 +1091,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 */
diff --git a/third_party/pam_wrapper/wscript b/third_party/pam_wrapper/wscript
index a60bd044071..4ee5765269e 100644
--- a/third_party/pam_wrapper/wscript
+++ b/third_party/pam_wrapper/wscript
@@ -2,7 +2,7 @@
 
 import os
 
-VERSION="1.1.4"
+VERSION="1.1.7"
 
 def find_library(library_names, lookup_paths):
     for directory in lookup_paths:
@@ -22,6 +22,7 @@ def configure(conf):
         pam_matrix_so_path = find_library(['pam_matrix.so'],
                                           ['/usr/lib64/pam_wrapper', '/usr/lib/pam_wrapper'])
     else:
+        conf.CHECK_HEADERS('gnu/lib-names.h')
 
         if conf.CONFIG_SET("HAVE___THREAD"):
             conf.DEFINE("HAVE_GCC_THREAD_LOCAL_STORAGE", 1)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list