Hello,
I have to send this from my hotmail account, I apologize in advance if it's completely unreadable;)


I am using CGI::Session, storing the session data in mysql. I am able to store the appropriate values into the id and a_session columns. However, I am also trying to store store group information in the session record. There doesn't seem to be much to it, but obviously I'm missing something. The column I created is called group_list and it is text. I thought I only needed a single line of code to accomplish this: $session->param("group_list", $groups). But it isn't working. Any help is appreciated.

...
if (param('login')) {
 $params{username} = UnTaint_Credentials($params{username});
 $params{password} = UnTaint_Credentials($params{password});
 my $ldap = Net::LDAP->new ("$domain_controller" ) or die "$@";
 my $mesg = $ldap->bind ("$app_account",
                          password => "$password",
                          version => 3 );
 my $result = $ldap->search(
                       base     => "DC=corp,DC=workplace,DC=com",
                       filter   => "CN=$params{username}",
                       attrs    => [ "distinguishedName", "memberOf" ],
                       scope    => "sub",
                       sizelimit => 5);
 if ($result->count > 1) {
   $err = "LDAP search on supplied username returned multiple entries.";
   print_html();
 }
 my $dn = $result->entry(0)->dn();
 my $groups = $result->entry(0)->get_value("memberOf");
 $result = $ldap->bind ("$dn",
                        password => "$params{password}",
                        version => 3 ) or die "I am dead";
 if ($result->code == 0) {
   ## bind successful, create session and store group info
   ## remember, authorization based on group membership handled by app
   my $session = new CGI::Session("driver:MySQL", undef, {Handle=>$dbh});
   $session->expire('+1h');
   $session->param("group_list", $groups);
   $cookie = $q->cookie(CGISESSID => $session->id);
   $cookie->secure('1');
 }
 else {
   ## bind failed
   $err .= "Authentication Failed. Please try again.";
 }
}

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! hthttp://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to