I am trying to migrate a server from Zentyal 2.2 to 3.0. One of the issues is backups. I wrote a custom perl script that connected to the LDAP server, got a list of users, and then conditionally backed up their email by user based on the information I got out. I did a search and found that Zentyal no longer uses the default port, and I am past that problem. However, now that I can search, the search itself is failing. I am using the actual domain instead of "blahblah" indicated below. Even though I think it's a nice solution, I'm not set on using LDAP, so if there is a better way to get a list of users out of Zentyal from the command line I would be happy to use it. Here is a snippet from by script, and any help is appreciated.
use Net::LDAP;
my $LDAP = Net::LDAP->new( 'localhost:390' ) or
warn("Unable to connect to LDAP server: $@");
my $Result = $LDAP->bind();
if ($Result->code) {
warn("Unable to bind to LDAP server: $Result->error");
}
$Result =$LDAP->search(base => "ou=Users,dc=blahblah,dc=com",
attrs => ['uid','mail','description'],
filter => "(objectClass=passwordHolder)");
if ($Result->code) {
warn("Unable to search to LDAP server: $Result->error");
}
foreach my $entry ($Result->entries) {
my $UID = $entry->get_value('uid');
}