From e7513e59f9cd6608756e80678395915454f155a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org>
Date: Thu, 2 Jul 2020 13:39:04 +0200
Subject: [PATCH] FIX: allow ldap server and domain to be different

---
 misc/pam_authentication/ldap.conf              | 9 +++++----
 misc/pam_authentication/ldap_authentication.sh | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/misc/pam_authentication/ldap.conf b/misc/pam_authentication/ldap.conf
index 117d1074..9d2cf4fb 100644
--- a/misc/pam_authentication/ldap.conf
+++ b/misc/pam_authentication/ldap.conf
@@ -1,7 +1,8 @@
 # This file is sourced by the LDAP authentication script
 
-
-# Set the ldap server here.  This is also used to generate a fully qualified
-# user name: <USER>@$LDAP_SERVER
-
+# Set the ldap server here.  
 # LDAP_SERVER="example.com"
+
+# Set the ldap domain here. This is used to generate a fully qualified
+# user name: <USER>@$LDAP_DOMAIN
+# LDAP_DOMAIN="example.com"
diff --git a/misc/pam_authentication/ldap_authentication.sh b/misc/pam_authentication/ldap_authentication.sh
index f887bf99..1b86b8e1 100755
--- a/misc/pam_authentication/ldap_authentication.sh
+++ b/misc/pam_authentication/ldap_authentication.sh
@@ -35,7 +35,7 @@ exe_dir=$(dirname $0)
 
 # If the second argument is empty or "-", take password from stdin, else use the argument as a file.
 testpw() {
-    username="${1}@${LDAP_SERVER}"
+    username="${1}@${LDAP_DOMAIN}"
     pwfile="$2"
     pwargs=("-w" "$pwfile")
     if [[ $pwfile == "-" ]] ; then
-- 
GitLab