6.0.0-beta1
7/5/25

[#11635] ActiveSync AutoProvision - User name / email address option for AutoDiscovery not honoured
Summary ActiveSync AutoProvision - User name / email address option for AutoDiscovery not honoured
Queue Synchronization
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester horde (at) agotnes (dot) com
Created 11/03/2012 (4627 days ago)
Due
Updated 11/06/2012 (4624 days ago)
Assigned 11/05/2012 (4625 days ago)
Resolved 11/06/2012 (4624 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
11/06/2012 10:13:01 PM Michael Rubinsky Comment #13
State ⇒ Resolved
Reply to this comment
This is as fixed as it's going to get.

Most clients will work correctly, even those that don't properly 
request Autodiscovery. Those that don't work, will simply have to 
manually enter account details on the device.
11/06/2012 10:11:39 PM Michael Rubinsky Comment #12 Reply to this comment
PHP Fatal error:  Call to a member function debug() on a non-object 
in /usr/share/php/Horde/ActiveSync/Request/Autodiscover.php on line 40
Looks like you applied an interim patch. This part was fixed shortly 
afterwards...

[Show Quoted Text - 15 lines]
This was already applied in a previous commit in Git, and will be 
released with the next Horde/Horde release.


11/06/2012 10:04:24 PM Git Commit Comment #11 Reply to this comment
Changes have been made in Git (master):

commit fc9e244516f45495ebad57cfd55f86ee355eafe2
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Tue Nov 6 16:56:55 2012 -0500

     Bug: 11635 Yet Another fix for broken ActiveSync clients.

     Some android clients not only incorrectly send the email address
     as the username in an Authorization header, but they also completely
     fail to send the XML Autodiscover request. Try to recover from this
     by getting the email from the Authorization header and hope for the best.

     Note, these same clients will incorrectly auto populate the username
     field with the email address.

  .../lib/Horde/ActiveSync/Request/Autodiscover.php  |   23 ++++++++++++++++---
  1 files changed, 19 insertions(+), 4 deletions(-)

http://git.horde.org/horde-git/-/commit/fc9e244516f45495ebad57cfd55f86ee355eafe2
11/06/2012 08:57:03 PM horde (at) agotnes (dot) com Comment #10 Reply to this comment
Progress! :)

I applied a couple of the patches you made overnight manually against 
2.0.2 which I'm running;

http://git.horde.org/horde-git/-/commit/0e7e68077813b44f2a52bf673a992187992e38c6

Firstly I found that the log entry added simply did not appear, 
leading me to believe the code wasn't executed. See the last small 
patch for more on that;

Once I made the small change in the last patch below

I had to remove the log entry here as the _logger object doesn't seem 
initialised. You might have done so in another patch I missed, once 
the log statement was commented out things went quite well :) Error 
below;
PHP Fatal error:  Call to a member function debug() on a non-object in 
/usr/share/php/Horde/ActiveSync/Request/Autodiscover.php on line 40

http://git.horde.org/horde-git/-/commit/2276673c168f530bb734830a8a15ec7923a9a0ea
This one I applied and am now running with

I also found a couple of error messages from of all things Ingo when 
auto-provisioning. I get these when logging in to Imp, but as I don't 
use Ingo much I've yet to dig into these and fix them. I thought it 
odd to get Ingo messages when AS was kicking in and thought it might 
be that autodiscover wasn't picked up - so what I found was that in my 
rpc.php in the web directory it still matched using strpos, not 
stripos for auto discovery;

line 36 in rpc.php changed;
    (stripos($_SERVER['REQUEST_URI'], 'autodiscover/autodiscover.xml') 
!== false)) {
(add 'i')

And with this I now get auto-provisoning going for iOS6.0.1!

I see this is patched in;
http://git.horde.org/commit.php/?rt=horde-git&commit=a86c01f0a9aafc49fd14215174bc5676b305df3b

already, but obviously not yet released as I just ran the upgrade of 
all components :)

So I've now got a manually hacked version which works and only need 
the relevant fixes (incl I guess a logging init somewhere) released 
going before AutoProv is fully going :)

Hope my early morning notes makes sense :)
11/06/2012 07:19:14 PM Git Commit Comment #9 Reply to this comment
Changes have been made in Git (master):

commit 2276673c168f530bb734830a8a15ec7923a9a0ea
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Tue Nov 6 14:16:10 2012 -0500

     Ensure we use the correct username for broken clients.

     Some clients evidently use the full email address when building the
     Authorization header for Autoconfigure requests.

     Potentially a fix for Bug: 11635

  framework/ActiveSync/lib/Horde/ActiveSync.php |    7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)

http://git.horde.org/horde-git/-/commit/2276673c168f530bb734830a8a15ec7923a9a0ea
11/06/2012 11:53:07 AM horde (at) agotnes (dot) com Comment #8 Reply to this comment

[Show Quoted Text - 54 lines]
Found the code here ;
/usr/share/php/Horde/ActiveSync :)

Will review tomorrow :)
11/06/2012 04:17:54 AM horde (at) agotnes (dot) com Comment #7 Reply to this comment

[Show Quoted Text - 23 lines]
Interestingly - I can't find these methods so I might be missing 
something from the install!

I ran a few grep commands and can't find anything like;
Horde_Core_ActiveSync_Driver::getUsernameFromEmail()
or
Horde_ActiveSync_Request_Autodiscover::handle()

The latter I looked for using ;
grep -r -i autodiscover *

And found;

config/conf.php:$conf['activesync']['autodiscovery'] = 'user';
config/conf.xml:     <configheader>Autodiscovery</configheader>
config/conf.xml:     <configenum name="autodiscovery" desc="Some 
devices attempt to use an
config/conf.xml:     Autodiscovery service to configure the device's 
account using only the
config/conf.xml:     alias on your webserver to point 
/autodiscover/autodiscover.xml to
config/conf.bak.php:$conf['activesync']['autodiscovery'] = 'hook';
rpc.php:   (strpos($_SERVER['REQUEST_URI'], 
'autodiscover/autodiscover.xml') !== false)) {

Can you confirm which Horde files these methods should be in and I'll 
review and try to re-install the package maybe?

The trick is - AS works ok for me now for email using a couple of iOS 
6.0.1 devices - can't be missing that much?
11/06/2012 04:11:31 AM horde (at) agotnes (dot) com Comment #6 Reply to this comment

[Show Quoted Text - 14 lines]
Yep, the config is correct insofar as I can see the log entries 
indicating it connects to the autodiscover address and is redirected 
to rpc.php. Happy to provide traces, but see my other response...

11/05/2012 02:54:42 PM Michael Rubinsky Comment #5 Reply to this comment
It seems the next issue is around bug

http://bugs.horde.org/ticket/11624

In that I get a 501 returned. I tried the manual hacks suggested in 
this bug with partial success insofar as the 501 became a 200 but I 
still didn't complete the autoprovision - I'm probably missing 
something :)
Have you properly configured the webserver to answer the autoconfigure 
requests as described in the wiki?

If so, will need a log and/or wiretrace to see why it's failing for you.

11/05/2012 02:52:59 PM Michael Rubinsky Comment #4
State ⇒ Feedback
Reply to this comment

[Show Quoted Text - 12 lines]
I can't reproduce this. Translating an email address to user works 
fine for me.  You will have to track this down yourself.

The code that is responsible for returning the username given an email 
address is in Horde_Core_ActiveSync_Driver::getUsernameFromEmail(). 
You can clearly see the code that returns only the mailbox portion of 
the email address.  It is called from 
Horde_ActiveSync_Request_Autodiscover::handle().

11/05/2012 11:29:28 AM Jan Schneider Assigned to Michael Rubinsky
State ⇒ Assigned
 
11/04/2012 05:53:09 PM Michael Rubinsky Priority ⇒ 1. Low
 
11/04/2012 12:01:46 AM horde (at) agotnes (dot) com Comment #3 Reply to this comment
It seems the next issue is around bug

http://bugs.horde.org/ticket/11624

In that I get a 501 returned. I tried the manual hacks suggested in 
this bug with partial success insofar as the 501 became a 200 but I 
still didn't complete the autoprovision - I'm probably missing 
something :)

Enough bug hunting for one day for me :)
11/03/2012 11:35:26 PM horde (at) agotnes (dot) com Comment #2 Reply to this comment
Changing the parameter to 'hook' and hard-coding my credentials in 
imp/config/hooks.php using the preauthenticate function leads to a 
successful login to Dovecot (2 successful ones, in fact).

So assuming a fix is made to strip out the @domain.com part - we get 
an IMAP session ok.

Now, however, I get no errors in the Horde log files nor does the 
Provisioning work - it still requests me to manually enter details. 
Ideas welcome :)
11/03/2012 11:00:47 PM horde (at) agotnes (dot) com Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ ActiveSync AutoProvision - User name / email address option for AutoDiscovery not honoured
Queue ⇒ Synchronization
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
I have set the option to strip the email address of everything from @ onwards;
$conf['activesync']['autodiscovery'] = 'user';

When using AutoDiscovery from an iOS6 device I get these login entries 
from Dovecot indicating this option isn't honoured;

Nov  3 10:00:03 skadi dovecot: imap-login: Disconnected (auth failed, 
2 attempts in 13 secs): user=<horde@agotnes.com>

I had a quick look around the sourcecode for where the stripping code 
is but couldn't find it :)

Happy to test if provided a diff.

Saved Queries