BUGFIX: External user lookup

Heya. I’ve found an important bug in rt-mailgate in version 2.0.8
regarding forced external lookups. The fix is to add one more item to the
test.

*** rt-mailgate.orig Tue Oct 30 17:01:46 2001
— rt-mailgate Tue Oct 30 17:02:24 2001
*** 186,193 ****

! if ($RT::LookupSenderInExternalDatabase &&
! $RT::SenderMustExistInExternalDatabase ) {

  MailError(To => $RT::OwnerEmail,
      Subject => "RT Bounce: $Subject",

— 186,194 ----

! if ($RT::LookupSenderInExternalDatabase &&
! $RT::SenderMustExistInExternalDatabase &&
! !$CurrentUser->Id ) {

  MailError(To => $RT::OwnerEmail,
      Subject => "RT Bounce: $Subject",

Also, I found a tiny typo in RT/Interface/Email.pm.

*** Email.pm.orig Tue Oct 30 17:03:08 2001
Email.pm Tue Oct 30 17:03:20 2001
*** 420,426 ****
#Load the new user object
$CurrentUser->LoadByEmail($Address);

! unless ($CurrentUser->id) {
$RT::Logger->warning(“Couldn’t load user ‘$Address’.”.
" Defaulting to nobody\n");

— 420,426 ----
#Load the new user object
$CurrentUser->LoadByEmail($Address);

! unless ($CurrentUser->Id) {
$RT::Logger->warning(“Couldn’t load user ‘$Address’.”.
" Defaulting to nobody\n");

Regards,
Christian

Christian Gilmore
Team Lead
Web Infrastructure & Tools
IBM Software Group

I didn’t do enough testing on my bugfix, which just changed the behavior
from always denying requests to always allowing them. Whoops! Here’s an
appropriate fix.

*** rt-mailgate.orig Tue Oct 30 17:01:46 2001
— rt-mailgate Wed Oct 31 10:49:47 2001
*** 186,193 ****

! if ($RT::LookupSenderInExternalDatabase &&
! $RT::SenderMustExistInExternalDatabase ) {

  MailError(To => $RT::OwnerEmail,
      Subject => "RT Bounce: $Subject",

— 186,194 ----

! if ($RT::LookupSenderInExternalDatabase &&
! $RT::SenderMustExistInExternalDatabase &&
! $CurrentUser->Id == $RT::Nobody->Id) {

  MailError(To => $RT::OwnerEmail,
      Subject => "RT Bounce: $Subject",

Regards,
Christian

Christian Gilmore
Team Lead
Web Infrastructure & Tools
IBM Software Group