From 6fa2454d1a15fec7d1196ba64804760572c3f320 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Tue, 26 Apr 2022 11:07:59 +0200
Subject: [PATCH] WIP: ldap_authentication.sh escaping "'"

---
 misc/pam_authentication/ldap_authentication.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/misc/pam_authentication/ldap_authentication.sh b/misc/pam_authentication/ldap_authentication.sh
index 23011f99..052458cf 100755
--- a/misc/pam_authentication/ldap_authentication.sh
+++ b/misc/pam_authentication/ldap_authentication.sh
@@ -32,8 +32,8 @@
 exe_dir=$(dirname "$0")
 . "$exe_dir/ldap.env"
 LDAPTLS_REQCERT="${LDAP_TLS_REQCERT:-hard}"
-BIND_DN_PATTERN="${BIND_DN_PATTERN:-'cn=${USER_NAME},${USER_BASE}'}"
-WHO_AM_I_PATTERN="${WHO_AM_I_PATTERN:-'dn:${USER_NAME},${USER_BASE}'}"
+BIND_DN_PATTERN="${BIND_DN_PATTERN:-"cn=\${USER_NAME},\${USER_BASE}"}"
+WHO_AM_I_PATTERN="${WHO_AM_I_PATTERN:-"dn:cn=\${USER_NAME},\${USER_BASE}"}"
 
 # If the second argument is empty or "-", take password from stdin, else use the argument as a file.
 testpw() {
@@ -56,6 +56,8 @@ testpw() {
     elif [ "$result" = "$who_am_i" ] ; then
         return 0
     fi
+    echo "result : $result"
+    echo "pattern: $who_am_i"
     return 1
 
 }
-- 
GitLab