[#4462] attachment.php sends mail to null address
Summary attachment.php sends mail to null address
Queue IMP
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners
Requester srrafa (at) usc (dot) es
Created 09/25/2006 (703 days ago)
Due
Updated 10/02/2006 (696 days ago)
Assigned
Resolved 09/26/2006 (702 days ago)
Attachments
Milestone
Patch No

History
10/02/2006 Chuck Hagenbuch Comment #4 Reply to this comment
Updated the test to check for at least 3 characters, thanks.
10/02/2006 srrafa (at) usc (dot) es Comment #3 Reply to this comment
One issue still remains:

  "if ($mail_address)"  always returns true because
getDefaultFromAddress returns addresses enclosed between "<>", no 
matter the content of $addr.

   function getDefaultFromAddress($fullname = false)
     {
         $from_addr = '';

         if ($fullname) {
             $name = $this->getValue('fullname');
             if (!empty($name)) {
                 $from_addr = $name . ' ';
             }
         }

         $addr = $this->getValue('from_addr');
         if (empty($addr)) {
             $addr = Auth::getAuth();
         }

         return $from_addr . '<' . $addr . '>';
     }





09/26/2006 Chuck Hagenbuch Comment #2
State ⇒ Resolved
Reply to this comment
I agree. Fixed in CVS and FW_3. Thanks!
09/25/2006 srrafa (at) usc (dot) es Comment #1
Summary ⇒ attachment.php sends mail to null address
Queue ⇒ IMP
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Reply to this comment
When a user does no have a properly configured profile (from_addr 
field is missing), download notifications are sent to a null address.

attachment.php calls getDefaultFromAddress() de 
lib/Horde/Identity.php, wich returns Auth::GetAuth as email addr when 
from_addr is empty.

         $addr = $this->getValue('from_addr');
         if (empty($addr)) {
             $addr = Auth::getAuth();
         }

The problem (IMHO) with this is that Auth::getAuth returns an empty 
value, because attachment.php is called anonymously.

What do you think about inserting a check before the message is sent?, 
just after this line in attachment.php:

$mail_address = $mail_identity->getDefaultFromAddress(true);