summaryrefslogtreecommitdiffstats
path: root/debian/tests/create_account
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:35:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:35:33 +0000
commit1f641814b2bfbbf2dc3347e11a3fe901bfdf1efc (patch)
tree77094b19bf9091ceb6f6ab7d0267f70fef9c8323 /debian/tests/create_account
parentAdding upstream version 2.5.13+dfsg. (diff)
downloadopenldap-debian.tar.xz
openldap-debian.zip
Adding debian version 2.5.13+dfsg-5.debian/2.5.13+dfsg-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/create_account24
1 files changed, 24 insertions, 0 deletions
diff --git a/debian/tests/create_account b/debian/tests/create_account
new file mode 100755
index 0000000..a5051af
--- /dev/null
+++ b/debian/tests/create_account
@@ -0,0 +1,24 @@
+#! /usr/bin/perl -w
+
+# Shows how to create an entry on the LDAP server
+
+$host = "localhost"; # LDAP server
+$basedn = "dc=galaxy"; # Base DN
+$admindn = "cn=admin, $basedn"; # Admin entry
+$adminpass = "foo"; # Password
+
+use Net::LDAP;
+
+$ldap = Net::LDAP->new("$host", onerror => "die");
+$ldap->bind($admindn, password => $adminpass);
+
+# Create "ou=People" entry if not there
+
+$results = $ldap->search(base => "$basedn",
+ filter => "ou=People", scope => "one");
+unless ($results->count > 0) {
+ $ldap->add("ou=People, $basedn", attr => [
+ ou => "People",
+ objectClass => [ "top", "organizationalUnit" ]
+ ]);
+}