Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

FAQ.pod: update, mention Net::LDAP::Extra::AD

  • Loading branch information...
commit ed1907f54d5c82d90a678f4a09069eb9d3847973 1 parent b23ae5f
Peter Marschall authored October 05, 2012

Showing 1 changed file with 26 additions and 7 deletions. Show diff stats Hide diff stats

  1. 33  lib/Net/LDAP/FAQ.pod
33  lib/Net/LDAP/FAQ.pod
Source Rendered
@@ -1313,10 +1313,29 @@ adding the new one.
1313 1313
 When doing it as a user with administrative priviledges replacing
1314 1314
 the unicodePwd's value with a new one is allowed too.
1315 1315
 
  1316
+Perl-ldap contains convenience methods for Active Directory that
  1317
+allow one to perform this task very easily.
  1318
+
1316 1319
 Here's an example that demonstrates setting your own password
1317 1320
 (again almost no error checking):
1318 1321
 
1319 1322
   use Net::LDAP;
  1323
+  use Net::LDAP::Extra qw(AD);
  1324
+
  1325
+  my $ldap = Net::LDAP->new('ldaps://ads.domain.controller')  or  die "$@";
  1326
+
  1327
+  my $mesg = $ldap->bind('cn=Joe User,dc=your,dc=ads,dc=domain',
  1328
+                         password => $oldPW);
  1329
+
  1330
+  $mesg = $ldap->change_ADpassword('cn=Joe User,dc=your,dc=ads,dc=domain',
  1331
+                                   $oldPW, $newPW);
  1332
+
  1333
+  $ldap->unbind();
  1334
+
  1335
+
  1336
+And the same for perl-ldap versions before 0.49:
  1337
+
  1338
+  use Net::LDAP;
1320 1339
   use Unicode::Map8;
1321 1340
   use Unicode::String qw(utf16);
1322 1341
 
@@ -1331,7 +1350,7 @@ Here's an example that demonstrates setting your own password
1331 1350
   my $ldap = Net::LDAP->new('ldaps://ads.domain.controller')  or  die "$@";
1332 1351
 
1333 1352
   my $mesg = $ldap->bind('cn=Joe User,dc=your,dc=ads,dc=domain',
1334  
-                         password => 'oldPW');
  1353
+                         password => $oldPW);
1335 1354
 
1336 1355
   $mesg = $ldap->modify('cn=Joe User,dc=your,dc=ads,dc=domain',
1337 1356
                         changes => [
@@ -1346,7 +1365,12 @@ Here's an example that demonstrates setting your own password
1346 1365
 Perl-ldap does not do server failover, however there are several
1347 1366
 programming options for getting around this situation.
1348 1367
 
1349  
-Here is one possible solution.
  1368
+Here is one possible solution:
  1369
+
  1370
+  $ldaps = Net::LDAPS->new([ $ldapserverone, $ldapservertwo ],
  1371
+                           port=>636, timeout=>5)  or  die "$@";
  1372
+
  1373
+For perl-ldap versions before 0.27, thes same goal can be achieved using:
1350 1374
 
1351 1375
   unless ( $ldaps =
1352 1376
             Net::LDAPS->new($ldapserverone,
@@ -1358,11 +1382,6 @@ Here is one possible solution.
1358 1382
               "Can't connect to $ldapserverone or $ldapservertwo via LDAPS: $@";
1359 1383
           }
1360 1384
 
1361  
-As of version 0.27 of perl-ldap the above can be expressed much simpler:
1362  
-
1363  
-  $ldaps = Net::LDAPS->new([ $ldapserverone, $ldapservertwo ],
1364  
-                           port=>636, timeout=>5)  or  die "$@";
1365  
-
1366 1385
 
1367 1386
 =head1 Using X.509 certificates.
1368 1387
 

0 notes on commit ed1907f

Please sign in to comment.
Something went wrong with that request. Please try again.