[Tickets #14110] Re: [ActiveSync] Custom hook breaks send mail functionality

noreply at bugs.horde.org noreply at bugs.horde.org
Wed Sep 16 20:51:01 UTC 2015


BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE  
E-MAIL-ADRESSE WERDEN NICHT GELESEN.

Ticket-URL: https://bugs.horde.org/ticket/14110
------------------------------------------------------------------------------
  Ticket           | 14110
  Aktualisiert Von | hn at axxedia-it.de
  Zusammenfassung  | [ActiveSync] Custom hook breaks send mail functionality
  Warteschlange    | Synchronization
  Version          | FRAMEWORK_5_2
  Typ              | Bug
  Status           | Feedback
  Priorität        | 1. Low
  Milestone        |
  Patch            |
  Zuständige       | Michael Rubinsky
------------------------------------------------------------------------------


hn at axxedia-it.de (2015-09-16 20:51) hat geschrieben:

I think you mean this piece of code:

/**
      * Return the current user's From/Reply_To address.
      *
      * @return string  A RFC822 valid email string.
      */
     protected function _getIdentityFromAddress()
     {
         global $prefs;

         $ident = $GLOBALS['injector']
             ->getInstance('Horde_Core_Factory_Identity')
             ->create($this->_user);

         $as_ident = $prefs->getValue('activesync_identity');
         $name = $ident->getValue('fullname', $as_ident == 'horde' ?  
$prefs->getValue('default_identity') :  
$prefs->getValue('activesync_identity'));
         $from_addr = $ident->getValue('from_addr', $as_ident ==  
'horde' ? $prefs->getValue('default_identity') :  
$prefs->getValue('activesync_identity'));
         $rfc822 = new Horde_Mail_Rfc822_Address($from_addr);
         $rfc822->personal = $name;

         return $rfc822->encoded;
     }

 From what I understand here is, that this function does a lookup for  
the full username and the corresponding mail address of the default  
ActiveSync user identity. I checked the user and the ActiveSync  
identity is set to default. Changing it from default does not give a  
different result. I also checked the default user identity on the  
horde web interface, and it shows up populated with the correct values  
for the full user name and the mail address.
Maybe this is not ActiveSync related at all, but I do use custom hooks  
to populate the user identity.

Here are my custom hooks for the default identity:

public function prefs_init($pref, $value, $username, $scope_ob)
     {
        switch ($pref) {

        case 'id':
                 if (is_null($uid)) {
                         $uid = $GLOBALS['registry']->getAuth('bare');
                 }
         return $uid;

         case 'from_addr':
         if (is_null($username)) {
                 return ;
         }

         $cmd = 'ldapsearch -H ldaps://my-dc.mylocal.net:636 -x -D  
cn=horde,cn=Users,dc=mylocal,dc=net -w somepassword -b  
dc=mylocal,dc=net samaccountname=' . $username . ' | /bin/grep mail: |  
  /usr/bin/awk \'{print $2}\'';;
         $mails = `$cmd`;
         $mail_array = explode("\n", $mails);
         $mail = $mail_array['0'];
         return empty($mail)
         ? ''
         : $mail;


        case 'fullname':
             // Set the fullname.

             // Set the fullname from the GECOS information in
             // the passwd file.
             if (is_null($username)) {
                 return $value;
             }

             $user = $GLOBALS['registry']->getAuth('bare');

             $array = posix_getpwnam($user);
             $gecos_array = explode(',', $array['gecos']);
             return empty($gecos_array)
                 ? $user
                 : $gecos_array[0];
         }
    }

I could also use ldap to read the fullname from my Active Directory,  
but I was lazy and winbind gives GECOS all the information I need  
here, so I just copied that one from the examples.

So could it be a problem caused by the custom hooks? I think they are  
executed every time a user does a log in, and so the default user  
identity always gets these values set anew.






More information about the bugs mailing list