[rt-users] Re: [bestpractical.com #1401] Re: Module versionQuestion

John Gedeon jgedeon at qualcomm.com
Wed Mar 3 14:09:01 EST 2004


Silly me forgot to attach the file!

------------------------------------
I don't know if I can send you my code, due to my companies IP rules. I have attached the original User_Local.pm file that I based my stuff on. I didn't have to change it much. I used the config vars that they suggest in the header and put the file in /opt/rt3/local/lib/RT/ , made my changes, and stopped and started apache.

I had to change line 62 from
  use Net::LDAP;
 to
  use Net::LDAP qw(LDAP_SUCCESS LDAP_PARTIAL_RESULTS);
  use Net::LDAP::Util qw (ldap_error_name);

 and the bug on line 86 is just a flawed if staetment. Currently it says
  if (($mesg->code != LDAP_SUCCESS) or ($mesg->code != LDAP_PARTIAL_RESULTS))
  {
   $RT::Logger->debug("GetExternalUserWithLDAP: Could not search for $filter: ",
                      $mesg->code, "" , ldap_error_name($mesg->code) ,"\n");
   return 0;
  }

 but if you think about it $mesg->code will never be both LDAP_SUCCESS and LDAP_PARTIAL_RESULTS which is the only case where this module will not fail.

 A better if statement is 
  if (!(($mesg->code == LDAP_SUCCESS) or ($mesg->code == LDAP_PARTIAL_RESULTS)))

But as I said I can't post my code due to IP rules here that I do not want to risk breaking.

HTH
John
On Wed, Mar 03, 2004 at 10:39:10AM -0800, Kevin Sonney wrote:
> Would you be willing to post your ldap code and RT config files?
> 
> Thanks,
> 
> Kevin
> 
> -----Original Message-----
> From: John Gedeon [mailto:jgedeon at qualcomm.com] 
> Sent: Wednesday, March 03, 2004 10:15 AM
> To: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Re: [bestpractical.com #1401] Re: Module
> versionQuestion
> 
> 
> Found my problem, seems that the User Local.pm ldap solution didn't
> import the LDAP error codes or the ldap_error_name function. I added to
> the script and the error disappeared!
>      use Net::LDAP qw(LDAP_SUCCESS LDAP_PARTIAL_RESULTS);
>      use Net::LDAP::Util qw(ldap_error_name);
> 
> John
> On Wed, Mar 03, 2004 at 09:34:10AM -0800, John Gedeon wrote:
> > Hi all,
> >   I am trying to make RT3.0.9 work with LDAP. I can't use Apache to do
> 
> > the authentication since we need to have a login screen where we can 
> > post messages to the users. So I am modifying User_Local.pm based on 
> > the User_Local.pm file I found on the maillist.  I wrote a function in
> User_Local.pm that does the LDAP auth, based on the User_Local.pm code
> that I found in the maillist.  I need the login screen to create a user
> on the fly, so I am adding local/html/Callbacks/XYZ/autohandler/Auth to
> do that based on the code under webexternal auth. To verify that the
> user logging in I try to call RT::User::_LDAPAUTH($user,$pass,FLAG); but
> get the following error, I also tried to pass the object to my function
> by calling it $UserObj->_LDAPAUTH($user,$pass,FLAG) but still get the
> same error?
> >  
> >  Any tips welcome
> > 
> > TIA
> > John
> > 
> > error:  Can't call method "_Accessible" without a package or object 
> > reference at
> /opt/rt/perl/lib/site_perl/5.8.3/DBIx/SearchBuilder/Record.pm line 406.
> >  
> > context:  ...   
> > 402:  my $self = shift; 
> > 403:   
> > 404:  no strict 'refs'; 
> > 405:   
> > 406:  if ($AUTOLOAD =~ /.*::(\w+)/o && $self->_Accessible($1,'read') )
> 
> > {
> > 407:  my $Attrib = $1; 
> > 408:   
> > 409:  *{$AUTOLOAD} = sub { return ($_[0]->_Value($Attrib))}; 
> > 410:  return($self->_Value($Attrib)); 
> > ...   
> >  
> > code stack:  
> > /opt/rt/perl/lib/site_perl/5.8.3/DBIx/SearchBuilder/Record.pm:406
> > /opt/rt/rt3/local/lib/RT/User_Local.pm:179
> > /opt/rt/rt3/local/html/Callbacks/QCTES/autohandler/Auth:18
> > /opt/rt/rt3/share/html/Elements/Callback:59
> > /opt/rt/rt3/share/html/autohandler:164
> > _______________________________________________
> > rt-users mailing list
> > rt-users at lists.bestpractical.com
> > http://lists.bestpractical.com/mailman/listinfo/rt-users
> > 
> > Have you read the FAQ? The RT FAQ Manager lives at 
> > http://fsck.com/rtfm
> _______________________________________________
> rt-users mailing list
> rt-users at lists.bestpractical.com
> http://lists.bestpractical.com/mailman/listinfo/rt-users
> 
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
> _______________________________________________
> rt-users mailing list
> rt-users at lists.bestpractical.com
> http://lists.bestpractical.com/mailman/listinfo/rt-users
> 
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: User_Local.pm
Type: application/x-perl
Size: 3328 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20040303/8ad335b1/attachment.bin>


More information about the rt-users mailing list