diff options
author | Gerald Carter <jerry@samba.org> | 2003-01-19 03:51:32 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-01-19 03:51:32 +0000 |
commit | ea5ffa0371712f822093240a42a9e93c9ff7a28d (patch) | |
tree | 533eb1e2e01d64b0fce10b183b6d4f5b213480eb /examples/LDAP/export_smbpasswd.pl | |
parent | e2f25587530e8c8345c7d24cd6ed7a26c757cabf (diff) | |
download | samba-ea5ffa0371712f822093240a42a9e93c9ff7a28d.tar.gz samba-ea5ffa0371712f822093240a42a9e93c9ff7a28d.tar.bz2 samba-ea5ffa0371712f822093240a42a9e93c9ff7a28d.zip |
only supporting the Net::LDAP module now
(This used to be commit 3e9c970597b190335529e8854f3d2af2c7d8d80e)
Diffstat (limited to 'examples/LDAP/export_smbpasswd.pl')
-rw-r--r-- | examples/LDAP/export_smbpasswd.pl | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/examples/LDAP/export_smbpasswd.pl b/examples/LDAP/export_smbpasswd.pl deleted file mode 100644 index 3f67dc6242..0000000000 --- a/examples/LDAP/export_smbpasswd.pl +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -## -## Example script to export ldap entries into an smbpasswd file format -## using the Mozilla PerLDAP module. -## -## writen by jerry@samba.org -## - -use Mozilla::LDAP::Conn; -use Mozilla::LDAP::Entry; - -###################################################### -## Set these values to whatever you need for your site -## - -$DN="ou=people,dc=plainjoe,dc=org"; -$ROOTDN="cn=Manager,dc=plainjoe,dc=org"; -$rootpw = "secret"; -$LDAPSERVER="localhost"; - -## -## end local site variables -###################################################### - - -$conn = new Mozilla::LDAP::Conn ("$LDAPSERVER", "389", $ROOTDN, $rootpw ); -die "Unable to connect to LDAP server $LDAPSERVER" unless $conn; - -print "##\n"; -print "## Autogenerated smbpasswd file via ldapsearch\n"; -print "## from $LDAPSERVER ($DN)\n"; -print "##\n"; - -## scheck for the existence of the posixAccount first -$result = $conn->search ("$DN", "sub", "(objectclass=smbPasswordEntry)"); - - -## loop over the entries we found -while ($result) { - - @uid = $result->getValue("uid"); - @uidNumber = $result->getValue("uidNumber"); - @lm_pw = $result->getValue("lmpassword"); - @nt_pw = $result->getValue("ntpassword"); - @acct = $result->getValue("acctFlags"); - @pwdLastSet = $result->getValue("pwdLastSet"); - - if (($#uid+1) && ($#uidNumber+1)) { - - $lm_pw[0] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" if (! ($#lm_pw+1)); - $nt_pw[0] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" if (! ($#nt_pw+1)); - $acct[0] = "[DU ]" if (! ($#acct+1)); - $pwdLastSet[0] = "FFFFFFFF" if (! ($#pwdLastSet+1)); - - print "$uid[0]:$uidNumber[0]:$lm_pw[0]:$nt_pw[0]:$acct[0]:LCT-$pwdLastSet[0]\n"; - } - - $result = $conn->nextEntry(); - -} - -$conn->close(); -exit 0; |