[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/sbin/ -> cnCorrect.pl (source)

   1  #!/usr/bin/perl
   2  
   3  use Net::LDAP;
   4  
   5  require '/etc/SeConfig.ph';
   6  
   7  $ldap = Net::LDAP->new(
   8                  "$slapdIp",
   9                  port    => "$slapdPort",
  10                  debug   => "$slapdDebug",
  11                  timeout => "$slapdTimeout",
  12                  version => "$slapdVersion"
  13                 );
  14  $ldap->bind(
  15           $adminDn,
  16           password => $adminPw
  17          );
  18  
  19  $res = $ldap->search(
  20               base   => "ou=People,$baseDn",
  21               scope  => 'one',
  22               filter => 'uid=*'
  23              );
  24  
  25  warn $res->error if $res->code != LDAP_SUCCESS;
  26  
  27  foreach $entry ($res->entries) {
  28    
  29    $dn = $entry->dn;
  30    $cn = $entry->get_value('cn');
  31    $sn = $entry->get_value('sn');
  32    $newCn = "$cn $sn";
  33    
  34    $res = $ldap->modify(
  35                 $dn,
  36                 replace => {
  37                     cn => "$newCn",
  38                    }
  39                );
  40    
  41    warn $res->error if $res->code != LDAP_SUCCESS;
  42  }


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1