[Tickets #14110] Re: [ActiveSync] Custom hook breaks send mail functionality
noreply at bugs.horde.org
noreply at bugs.horde.org
Mon Sep 14 13:35:18 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 <hn at axxedia-it.de>
Zusammenfassung | [ActiveSync] Custom hook breaks send mail functionality
Warteschlange | Horde Groupware Webmail Edition
Version | 5.2.10
Typ | Bug
Status | Unconfirmed
Priorität | 1. Low
Milestone |
Patch |
Zuständige |
------------------------------------------------------------------------------
hn at axxedia-it.de (2015-09-14 13:34) hat geschrieben:
I was trying to implement a custom hook that detects the correct
username for ActiveSync login from a given mail address. This is the
hook I'm using (server and login information changed for privacy
reasons, but you get the idea):
public function activesync_get_autodiscover_username($email)
{
$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 mail=' . $email . ' | /bin/grep sAMAccountName: |
/usr/bin/awk \'{print $2}\'';;
$username = `$cmd`;
return $username;
}
This works quite well, I can use my e-mail address and the hook
provides the correct username and the ActiveSync login is ok.
If the e-mail address is: max.mustermann at mylocal.net it returns the
corresponding username: maxmus
The downside of this approach is, that I cannot send mails from
ActiveSync devices anymore. The ActiveSync.log gives me:
ERR: Address is missing domain.
It seems that ActiveSync is using the username maxmus without a domain
as from address which cannot work, thus the error message is correct.
This shouldn't be happening as I understand that the hook only
provides a login username and nothing more. The example shows exactly
that:
/**
* ActiveSync hook for determing a Horde username from an email address.
*
* @param string $email The email address
*
* @return string The username to use to authenticate to Horde with.
*/
// public function activesync_get_autodiscover_username($email)
// {
// return substr($email, 0, strpos($email, '@'));
// }
Only the username (part of the mail address in that case) is returned.
I assume there must be some kind of bug in Driver.php but I'm no php
specialist, so I have no idea where to look at right now.
When I disable the custom hook in the ActiveSync configuration, all
works as expected, but I have to enter the username manually (not a
big deal, but the end user has to know the username for this to work).
If you need further Information, please ask.
Best regards,
Hendrik
More information about the bugs
mailing list