Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #use warnings;
- #use diagnostics;
- #use Getopt::Long;
- use Getopt::Std;
- use Net::OpenSSH;
- use Net::LDAP;
- use Net::FTP;
- use LWP;
- use LWP::UserAgent;
- my $email= "esf@midtskarshaugen.no";
- my $AD3 = "127.0.0.1"; # HE-stuff master AD
- my $pwd = "superhemmelig"; # He-stuff
- my $user = "MDDM-LDAP";
- my $base_dn_AD = "ou=Telenor,ou=Hosting,dc=hmcprod,dc=net";
- my $ldap = Net::LDAP->new("$AD3", port=>389,) or die "LDAP connect error: $@";
- $ldap->bind("$user", password=>"$pwd");
- my $mesg = $ldap->search ( filter=>"(cn=$email)",
- base=>"$base_dn_AD",
- scope=>"sub",
- attrs=> ['whenCreated','displayName','pwdLastSet'],
- );
- @when = $mesg->get_value('whenCreated');
- @display = $mesg->get_value('displayName');
- @pwd = $mesg->get_value('pwdLastSet');
- print @when;
- print @display;
- print @pwd;
- $ldap->unbind;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement