SHARE
TWEET

Untitled

a guest Dec 3rd, 2010 585 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. use Net::LDAP;
  4.  
  5. $ldap = Net::LDAP->new("smbpdc.home.net") or die "$@";
  6. my $dc = "dc=smbpdc,dc=home,dc=net";
  7. $mesg = $ldap->bind( "cn=Administrator,".$dc, password => "pa$$w0rd" );
  8.  
  9. # Add new user
  10.  
  11. $result = $ldap->add(   "cn=John Doe,".$dc,
  12.                         attr => [ 'cn' => 'John Doe',
  13.                                   'sn' => 'Doe',
  14.                                   'givenName' => 'John',
  15.                                   'objectclass' => ['top', 'person', 'organizationalPerson', 'inetOrgPerson' ]
  16.                                 ]
  17. );
  18.  
  19. $result->error && warn "error: ", $result->error;
  20. $ldap->unbind;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top