Hello Perl Guru's
It is I Bionicle32 the confused Perl programmer. I am having an issue with a login script. What I want the script to do is to have two textfields displayed via HTML parsed back to the browser if no parameters have been sent. Once the user fills out the form with their UID and PASSWORD I am then trying to make a successful bind using their supplied user id and password.
## Connect and bind to the server.
$ldap = Net::LDAP->new("servername.com",port => 389,version => 3 ) or
+die $!;
my $result = $ldap->bind("id=$uid, o=intra, ou=people, dc=xxxx, dc=xxx
+", password => $pswd);
if ($result->code != LDAP_SUCCESS) {
die $result->error(); # Authentication failed
}
What I am wondering is if my bind is bad code? This is the error sent back to the browser.
Software error:
No such object at login2.cgi line 46.
Which is the if statement for LDAP_SUCCESS. If indeed this is incorrect syntax why and why would I use dn => to start my bind instead of the way I did it above? When I use double qoutes around uid like this
$ldap->bind("uid=$uid"," o=intra, ou=people, dc=xxxx, dc=xxx", password => $pswd); my script works. Is this because I am doing an anonymous bind? All I want to do in short is validate that the user logging into my application is who they say they are. If I have not supplied enough information above please say so and I will explain further so you could help me. I appreciate all of you guys help in the past because your suggestions have helped me in becoming a more knowledgable programmer.
-Bionicle32
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.