[SCM] pam wrapper repository - branch master updated

Andreas Schneider asn at samba.org
Fri Jun 25 08:34:49 UTC 2021


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 <asn at samba.org>
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 <asn at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit beba95f1eac18d08c8821be131fb879a16c692fe
Author: Andreas Schneider <asn at samba.org>
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 <scabrero at samba.org>

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

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, &sb);
-		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(&buf[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 {
-				cmp = memcmp(buf, "usr/etc/pam.d", 13);
-				if (cmp == 0) {
-					memcpy(buf, pdir + 1, 9);
-					memset(&buf[9], '\0', 4);
-				} else {
-					cmp = memcmp(buf, "etc/pam.d", 9);
-					if (cmp == 0) {
-						memcpy(buf, pdir + 1, 9);
-					}
-				}
-			}
-			found_slash = false;
-		}
-
-		bwritten = write(dstfd, buf, bread);
-		if (bwritten < 0) {
-			errno = EIO;
-			rc = -1;
-			goto out;
-		}
-
-		if (bread != bwritten) {
-			errno = EFAULT;
-			rc = -1;
-			goto out;
-		}
-	}
-
-	rc = 0;
-out:
-	if (srcfd != -1) {
-		close(srcfd);
-	}
-	if (dstfd != -1) {
-		close(dstfd);
-	}
-	if (rc < 0) {
-		unlink(dst);
-	}
-
-	return rc;
-#undef PSO_COPY_READ_SIZE
-}
-#else /* HAVE_PAM_MODUTIL_SEARCH_KEY */
-
 static int pso_copy(const char *src, const char *dst, const char *pdir, mode_t mode)
 {
 #define PSO_COPY_READ_SIZE 9
@@ -1167,7 +1043,6 @@ out:
 	return rc;
 #undef PSO_COPY_READ_SIZE
 }
-#endif /* HAVE_PAM_MODUTIL_SEARCH_KEY */
 
 static void pwrap_init(void)
 {


-- 
pam wrapper repository



More information about the samba-cvs mailing list