Perl / CGI and IIS6

Perl / CGI and IIS6

am 08.06.2009 14:46:12 von anthony.okusanya

This is a multipart message in MIME format.
--===============1393215416==
Content-Type: multipart/alternative;
boundary="=_alternative 0046295B862575CF_="

This is a multipart message in MIME format.
--=_alternative 0046295B862575CF_=
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii

Greetings Perl experts
I am trying to convert a ton of standalone tools written in perl
to be web based
these tools are mostly windows administration tools.
Just looking for some advice on using perl on IIS. I have used the CGI
module
to create dynamic pages but Im not sure how to handle things like
authentication.
For instance I would like to have my users authenticated against and
Active Directory service
which will validate what they can use on the site.


Tony B. Okusanya




Tony B. Okusanya

Windows Standards Group
Phone (651)-962-2702
Pager: 7639136132@messaging.sprintpcs.com
Cell: (763)-913-6132
Fax: (651)-767-3122
Mail Code:EP-MN-O2NS
U.S. BANCORP made the following annotations
------------------------------------------------------------ ---------
Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation.



------------------------------------------------------------ ---------


--=_alternative 0046295B862575CF_=
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
charset=us-ascii



Greetings Perl experts

        I
am trying to convert a ton of standalone tools written in perl to be web
based


these tools are mostly windows administration
tools.


Just looking for some advice on using
perl on IIS. I have used the CGI module


to create dynamic pages but Im not sure
how to handle things like authentication.


For instance I would like to have my
users authenticated against and Active Directory service


which will validate what they can use
on the site.





Tony B. Okusanya










Tony B. Okusanya



Windows Standards Group

Phone (651)-962-2702

Pager: 7639136132@messaging.sprintpcs.com

  Cell:  (763)-913-6132

   Fax: (651)-767-3122

Mail Code:EP-MN-O2NS

U.S. BANCORP made the following annotations
------------------------------------------------------------ ---------
Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation.



------------------------------------------------------------ ---------


--=_alternative 0046295B862575CF_=--

--===============1393215416==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1393215416==--

RE: Perl / CGI and IIS6

am 08.06.2009 14:58:01 von Scott_Campbell

--===============1048266622==
Content-Class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C9E838.C189AC88"

------_=_NextPart_001_01C9E838.C189AC88
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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.

=20

Hope this helps,

Scott

=20

*******************************************************

=3Ditem B

=20

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)

=20

=3Dcut

=20

sub ldap_authenticate{

my($class,$username,$password,@ldap_servers)=3D@_;

=20

#LDAP Connect#

my $ldap =3D Net::LDAP->new(\@ldap_servers, async =3D> =
1);

=20

if(!$ldap){

return("0","LDAP ERROR! Cannot connect
to LDAP server(s).");

} =20

else{

#If LDAP servers are listening, attempt
BIND (Authentication)#

my
$msg=3D$ldap->bind("$username",password=3D>"$password");

=20

if($msg->error=3D~m/success/i){

$ldap->unbind;


return(1,"Successful
Logon");

}

else{

$ldap->unbind;

return(0,"Error: " .
$msg->error);

}

}

}

*******************************************************

=20

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
anthony.okusanya@usbank.com
Sent: Monday, June 08, 2009 8:46 AM
To: ActivePerl@listserv.ActiveState.com
Subject: Perl / CGI and IIS6

=20


Greetings Perl experts=20
I am trying to convert a ton of standalone tools written in perl
to be web based=20
these tools are mostly windows administration tools.=20
Just looking for some advice on using perl on IIS. I have used the CGI
module=20
to create dynamic pages but Im not sure how to handle things like
authentication.=20
For instance I would like to have my users authenticated against and
Active Directory service=20
which will validate what they can use on the site.


Tony B. Okusanya=20




Tony B. Okusanya

Windows Standards Group
Phone (651)-962-2702
Pager: 7639136132@messaging.sprintpcs.com
Cell: (763)-913-6132
Fax: (651)-767-3122
Mail Code:EP-MN-O2NS=20

U.S. BANCORP made the following annotations
------------------------------------------------------------ ---------
Electronic Privacy Notice. This e-mail, and any attachments, contains
information that is, or may be, covered by electronic communications
privacy laws, and is also confidential and proprietary in nature. If you
are not the intended recipient, please be advised that you are legally
prohibited from retaining, using, copying, distributing, or otherwise
disclosing this information in any manner. Instead, please reply to the
sender that you have received this communication in error, and then
immediately delete it. Thank you in advance for your cooperation.

------------------------------------------------------------ ---------


------_=_NextPart_001_01C9E838.C189AC88
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" =
xmlns:odc=3D"urn:schemas-microsoft-com:office:odc" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" =
xmlns:rtc=3D"http://microsoft.com/officenet/conferencing" =
xmlns:D=3D"DAV:" xmlns:Repl=3D"http://schemas.microsoft.com/repl/" =
xmlns:mt=3D"http://schemas.microsoft.com/sharepoint/soap/mee tings/" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/x ml" =
xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/oi s/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/di rectory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/20 02/1/alerts/"=
xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/soap" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " =
xmlns:udcp2p=3D"http://schemas.microsoft.com/data/udc/partto part" =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/wor kflow/" =
xmlns:dsss=3D"http://schemas.microsoft.com/office/2006/digsi g-setup" =
xmlns:dssi=3D"http://schemas.microsoft.com/office/2006/digsi g" =
xmlns:mdssi=3D"http://schemas.openxmlformats.org/package/200 6/digital-sig=
nature" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compa tibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/200 6/relationshi=
ps" xmlns:spwp=3D"http://microsoft.com/sharepoint/webpartpages" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/2006/types"=
=
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/2006/messag=
es" =
xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ SlideLibrary/=
" =
xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor talServer/Pub=
lishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" =
xmlns:st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>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).



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>You will need to use the Net::LDAP module.  This =
works on
all platforms.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Hope this helps,



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Scott



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>********************************************* ********** p>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>=3Ditem =
B<ldap_authenticate()>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>This method accepts a username, password, and an array of =
LDAP
servers, in that order.  It returns a true/false code, and a =
message.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>IE: =
ldap_authenticate("USER@mydomain.com","MYPass",@dc_li=
st)



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>=3Dcut



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>sub ldap_authenticate{



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      =
my($class,$username,$password,@ldap_servers)=3D@_;



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      #LDAP
Connect#



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      my
$ldap =3D Net::LDAP->new(\@ldap_servers, async =3D> =
1);



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;     



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      if(!$ldap){



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          =
return("0","LDAP
ERROR!  Cannot connect to LDAP =
server(s).");



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      =
}            =
            &=
nbsp;    



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      else{



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          #If
LDAP servers are listening, attempt BIND =
(Authentication)#



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          my
$msg=3D$ldap->bind("$username",password=3D>"$passwor=
d");



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          =
if($msg->error=3D~m/success/i){



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;            =
            &=
nbsp; =
$ldap->unbind;         &n=
bsp;           &nb=
sp;           =



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;            =
            &=
nbsp; return(1,"Successful
Logon");



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          =
}



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          =
else{



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;            =
            &=
nbsp; $ldap->unbind;



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;            =
            &=
nbsp; return(0,"Error:
" . $msg->error);



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;            =
;          =
}



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>         &nbs=
p;      }



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>}



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>********************************************* ********** p>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



0in 0in 0in'>

style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >From:=
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of =
anthony.okusanya@usbank.com

Sent: Monday, June 08, 2009 8:46 AM

To: ActivePerl@listserv.ActiveState.com

Subject: Perl / CGI and IIS6





 





style=3D'font-size:10.0pt;font-family:"Arial","sans-serif"'> Greetings =
Perl
experts


  =
 
    I am trying to convert a ton of standalone tools written =
in perl
to be web based


these =
tools are
mostly windows administration tools.


Just =
looking
for some advice on using perl on IIS. I have used the CGI module
=


to =
create
dynamic pages but Im not sure how to handle things like =
authentication.


For =
instance I
would like to have my users authenticated against and Active Directory =
service



which =
will
validate what they can use on the site.





Tony B. Okusanya










Tony B. Okusanya



Windows Standards Group

Phone (651)-962-2702

Pager: 7639136132@messaging.sprintpcs.com

  Cell:  (763)-913-6132

   Fax: (651)-767-3122

Mail Code:EP-MN-O2NS



U.S. BANCORP made the following annotations

------------------------------------------------------------ ---------
=

style=3D'font-size:10.0pt;font-family:"Arial","sans-serif"'> Electronic
Privacy Notice. This e-mail, and any attachments, contains information =
that is,
or may be, covered by electronic communications privacy laws, and is =
also
confidential and proprietary in nature. If you are not the intended =
recipient,
please be advised that you are legally prohibited from retaining, using,
copying, distributing, or otherwise disclosing this information in any =
manner.
Instead, please reply to the sender that you have received this =
communication
in error, and then immediately delete it. Thank you in advance for your
cooperation.




------------------------------------------------------------ --------- >









------_=_NextPart_001_01C9E838.C189AC88--

--===============1048266622==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1048266622==--

RE: Perl / CGI and IIS6

am 08.06.2009 15:41:12 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Campbell, Scott
Sent: 08 June 2009 13:58
To: anthony.okusanya@usbank.com; ActivePerl@listserv.ActiveState.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
>
> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Perl / CGI and IIS6

am 08.06.2009 15:57:53 von Bill Luebkert

Brian Raven wrote:
> From: activeperl-bounces@listserv.ActiveState.com
> [mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
> Campbell, Scott

> Sorry to be picky when you are trying to help somebody, but I have a
> couple of issues with your code.
>
>> *******************************************************
>> =item B
>>
>> 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.

It kinda does if it's a 'method' rather than a plain old sub. Maybe better
written/documented in that case as:

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

>>
>> =cut
>>
>> sub ldap_authenticate{
>> my($class,$username,$password,@ldap_servers)=@_;
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Perl / CGI and IIS6

am 08.06.2009 15:58:28 von Scott_Campbell

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@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Brian
Raven
Sent: Monday, June 08, 2009 9:41 AM
To: ActivePerl@listserv.ActiveState.com
Subject: RE: Perl / CGI and IIS6

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Campbell, Scott
Sent: 08 June 2009 13:58
To: anthony.okusanya@usbank.com; ActivePerl@listserv.ActiveState.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
>
> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


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

RE: Perl / CGI and IIS6

am 08.06.2009 16:01:16 von Scott_Campbell

Bill's right. Ignore my naughty calls...long night/day already.

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

is correct.
Scott

-----Original Message-----
From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Campbell, Scott
Sent: Monday, June 08, 2009 9:58 AM
To: Brian Raven; ActivePerl@listserv.ActiveState.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@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Brian
Raven
Sent: Monday, June 08, 2009 9:41 AM
To: ActivePerl@listserv.ActiveState.com
Subject: RE: Perl / CGI and IIS6

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Campbell, Scott
Sent: 08 June 2009 13:58
To: anthony.okusanya@usbank.com; ActivePerl@listserv.ActiveState.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
>
> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


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


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

RE: Perl / CGI and IIS6

am 08.06.2009 16:12:42 von Brian Raven

Bill Luebkert <> wrote:
> Brian Raven wrote:
>> From: activeperl-bounces@listserv.ActiveState.com
>> [mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
>> Campbell, Scott
>
>> Sorry to be picky when you are trying to help somebody, but I have a
>> couple of issues with your code.
>>
>>> ******************************************************* =item
>>> B
>>>
>>> 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.
>
> It kinda does if it's a 'method' rather than a plain old sub. Maybe
> better written/documented in that case as:
>
> $obj->ldap_authenticate('USER@mydomain.com', 'MYPass', @dc_list)
>

Yes, good point. Its good to see that you corrected the double quoting
as well, unless, of course, the array @mydomain is supposed to be
interpolated there.

--
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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs