summaryrefslogtreecommitdiff
blob: 946ec8ee74c0b0df940ebb26dd9121eae5a3d3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 10ad8990c92f2b4c4f4d550e0b42fb083aa90f84 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@gentoo.org>
Date: Wed, 6 Dec 2017 03:43:22 +1300
Subject: Use ENV settings for LDAP tests

This absolves the need for users to patch sources just to configure
a test server.
---
 test.pl | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/test.pl b/test.pl
index 7deb1a6..1a0871b 100644
--- a/test.pl
+++ b/test.pl
@@ -18,20 +18,22 @@ print "modinit  - ok\n";
 ## Change these values for test to work...
 ##
 
-print "\nEnter LDAP Server: ";
-chomp($ldap_host = <>);
-print "Enter port: ";
-chomp($ldap_port = <>);
-print "Enter Search Filter (ex. uid=abc123): ";
-chomp($filter = <>);
-print "Enter LDAP Search Base (ex. o=Org, c=US): ";
-chomp($BASEDN = <>);
-print "\n";
-
-if (!$ldap_host)
+if (!$ENV{LDAP_TEST_HOST})
 {
-   die "Please edit \$BASEDN, \$filter and \$ldap_host in test.pl.\n";
+   die "LDAP_TEST_HOST not set";
 }
+$ldap_host = $ENV{LDAP_TEST_HOST};
+$ldap_port = $ENV{LDAP_TEST_PORT};
+$filter    = $ENV{LDAP_TEST_FILTER};
+$BASEDN    = $ENV{LDAP_TEST_BASEDN};
+
+printf "\nLDAP Server: %s", $ldap_host;
+printf "\nLDAP port: %s", $ldap_port;
+printf "\nSearch Filter (ex. uid=abc123): %s", $filter;
+printf "\nLDAP Search Base (ex. o=Org, c=US): %s", $BASEDN;
+print "\n";
+
+
 
 ##
 ##  Initialize LDAP Connection
-- 
2.14.3