RE: Perl / CGI and IIS6
by Brian Raven other posts by this author
Jun 8 2009 6:41AM messages near this date
RE: Perl / CGI and IIS6
|
RE: Perl / CGI and IIS6
From: activeperl-bounces@[...].com
[mailto:activeperl-bounces@[...].com] On Behalf Of
Campbell, Scott
Sent: 08 June 2009 13:58
To: anthony.okusanya@usbank.com; ActivePerl@[...].com
Subject: RE: Perl / CGI and IIS6
> Anthony, I wrote a little method for my libraries which I use to
authenticate all of my web-based apps off of
> Active Directory (LDAP).
> You will need to use the Net::LDAP module. This works on all
platforms.
>
> Hope this helps,
> Scott
>
Sorry to be picky when you are trying to help somebody, but I have a
couple of issues with your code.
> *******************************************************
> =item B<ldap_authenticate()>
>
> This method accepts a username, password, and an array of LDAP
servers, in that order. It returns a true/false > code, and a message.
> IE: ldap_authenticate("USER@mydomain.com","MYPass",@dc_list)
That example call doesn't appear to match the parameters in the sub
below.
>
> =cut
>
> sub ldap_authenticate{
> my($class,$username,$password,@ldap_servers)=@_;
>
> #LDAP Connect#
> my $ldap = Net::LDAP->new(\@ldap_servers, async => 1);
>
> if(!$ldap){
> return("0","LDAP ERROR! Cannot
connect to LDAP server(s).");
> }
> else{
> #If LDAP servers are listening,
attempt BIND (Authentication)#
> my
$msg=$ldap-> bind("$username",password=>"$password");
Try to avoid useless quoting. See 'perldoc -q quoting'
>
> if($msg->error=~m/success/i){
> $ldap->unbind;
> return(1,"Successful
Logon");
> }
> else{
> $ldap->unbind;
> return(0,"Error: " .
$msg-> error);
> }
> }
> }
> *******************************************************
HTH
--
Brian Raven
This e-mail may contain confidential and/or privileged information. If you are not the inten
ded recipient or have received this e-mail in error, please advise the sender immediately by
reply e-mail and delete this message and any attachments without retaining a copy.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is stric
tly forbidden.
_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Anthony Okusanya
Scott Campbell
Brian Raven
Scott Campbell
Scott Campbell
Bill Luebkert
Brian Raven
|