ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
RE: Perl / CGI and IIS6
by Scott Campbell other posts by this author
Jun 8 2009 7:01AM messages near this date
RE: Perl / CGI and IIS6 | Re: Perl / CGI and IIS6
Bill's right.  Ignore my naughty calls...long night/day already.

$obj-> ldap_authenticate("USER@mydomain.com","MYPass",@dc_list);

is correct.
Scott

-----Original Message-----
From: activeperl-bounces@[...].com
[mailto:activeperl-bounces@[...].com] On Behalf Of
Campbell, Scott
Sent: Monday, June 08, 2009 9:58 AM
To: Brian Raven; ActivePerl@[...].com
Subject: RE: Perl / CGI and IIS6

Only a couple?  Sorry about that, you're right.  Since it's a method,
the call should be:

ldap_authenticate-> ("USER@mydomain.com","MYPass",@dc_list);

Note, if you are not that excited about putting this sub into a library
of your own, you can put it in locally in your script(s), remove the
"$class" variable in the incoming parameters, and then call as:

ldap_authenticate("USER@mydomain.com","MYPass",@dc_list);

You may quote me :)

Scott

-----Original Message-----
From: activeperl-bounces@[...].com
[mailto:activeperl-bounces@[...].com] On Behalf Of Brian
Raven
Sent: Monday, June 08, 2009 9:41 AM
To: ActivePerl@[...].com
Subject: 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 intended 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 strictly forbidden.

_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
ActivePerl mailing list
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved