6.0.0-beta1
7/4/25

[#8385] webdav and _username_hook_[from|to]backend
Summary webdav and _username_hook_[from|to]backend
Queue Kronolith
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners bklang (at) horde (dot) org
Requester adrieder (at) sbox (dot) tugraz (dot) at
Created 06/27/2009 (5851 days ago)
Due 06/27/2009 (5851 days ago)
Updated 07/01/2011 (5117 days ago)
Assigned 02/20/2011 (5248 days ago)
Resolved 07/01/2011 (5117 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/01/2011 08:41:00 PM Jan Schneider Comment #12
State ⇒ Resolved
Reply to this comment
Should be solved in Horde 4.
02/20/2011 01:49:26 AM Chuck Hagenbuch State ⇒ Assigned
 
10/28/2009 09:10:42 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #11 Reply to this comment
Any idea?


09/11/2009 11:50:43 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #10
New Attachment: debug.log Download
Reply to this comment
attachment
09/11/2009 11:50:10 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #9 Reply to this comment
Unfortunately I do not know how to track this further down...
http://bugs.php.net/bugs-generating-backtrace.php
..well I'm in trouble getting a core file, I have to check that.

But for now I just removed the TZ relevant parts from Horde.php so 
that I can at least go on with the original problem of this ticket.



I double checked everything, but still the 
_username_hook_frombackend() hook gets called again on a already 
"realmed" username:



Here is the code for the username hooks that I'm using:



if (!function_exists('_username_hook_frombackend')) {

      function _username_hook_frombackend($userID)

      {

          $servers = Horde::loadConfiguration('servers.php', 'servers', 'imp');

          $server_key = null;

          $vrealm = null;

          foreach ($servers as $key => $val) {

             if($servers[$key]['server'] == $_SESSION['imp']['server']) {

                 $vrealm = '@' . $key;

             }

          }

          if(empty($vrealm)) {

             $vrealm = '@' . Util::getFormData('server_key');

          }

          if (substr($userID, -strlen($vrealm)) == $vrealm) {

             $log_msg = '_username_hook_frombackend called for user "' 
. $userID . ' - not modifying "';

          } else {

             $log_msg = '_username_hook_frombackend called for user "' 
. $userID . ' - adding "' . $vrealm . '"';

             $userID = $userID . $vrealm;

          }

          Horde::logMessage($log_msg, __FILE__, __LINE__, PEAR_LOG_DEBUG);

          return $userID;

      }

}



if (!function_exists('_username_hook_tobackend')) {

      function _username_hook_tobackend($userID)

      {

          $fullusername = split('@', $userID);

          $log_msg = '_username_hook_tobackend called for user "' . 
$userID . ' - removing "' . $fullusername[1] . '"';

          Horde::logMessage($log_msg, __FILE__, __LINE__, PEAR_LOG_DEBUG);

          return $fullusername[0];

      }

}



In this code there is a workaround that prevents the addition of the 
realm if it is already added, but still that's just a workaround.



As client I'm using Thunderbird/Lighting 0.9

The calendar URL is: 
https://myserver/horde/rpc.php/kronolith/myuser@vrealm/myuser@vrealm.ics?server=vrealm



On authentication prompt I enter:

Username: myuser

Password: mypassword



Hooks settings in horde/conf.php

$conf['hooks']['permsdenied'] = false;

$conf['hooks']['username'] = true;

$conf['hooks']['preauthenticate'] = false;

$conf['hooks']['postauthenticate'] = false;

$conf['hooks']['authldap'] = false;

$conf['hooks']['groupldap'] = false;



Hooks settings in horde/imp/conf.php

$conf['hooks']['vinfo'] = false;

$conf['hooks']['postlogin'] = false;

$conf['hooks']['postsent'] = false;

$conf['hooks']['signature'] = false;

$conf['hooks']['trailer'] = false;

$conf['hooks']['fetchmail_filter'] = false;

$conf['hooks']['mbox_redirect'] = false;

$conf['hooks']['mbox_icon'] = false;

$conf['hooks']['spam_bounce'] = true;

$conf['hooks']['msglist_format'] = false;

$conf['hooks']['display_folder'] = false;



Server settings in horde/imp/servers.php

[...]

$servers['vrealm'] = array(

     'name' => 'Vrealm desc',

     'server' => '12.10.10.35',

     'hordeauth' => false,

     'protocol' => 'imap/notls',

     'port' => 1430,

     'maildomain' => 'mydomain',

     'smtphost' => 'mmysmtphost',

     'smtpport' => 25,

     'realm' => '',

     'preferred' => '',

     'admin' => array(

         'params' => array(

             'login' => 'myadmin',

             'password' => 'mypwd',

             // The 'userhierarchy' parameter defaults to 'user.'

             // If you are using a nonstandard hierarchy for personal

             // mailboxes, you will need to set it here.

             'userhierarchy' => 'user.',

             // Although these defaults are normally all that is required,

             // you can modify the following parameters from their default

             // values.

             'protocol' => 'imap/notls',

             'hostspec' => '12.10.10.35',

             'port' => 1430

         )

     ),

     'quota' => array(

         'driver' => 'imap',

         'params' => array('hide_quota_when_unlimited' => true),

     ),

     'acl' => array(

         'driver' => 'rfc2086',

     ),

);

[...]



attached is a horde debug log with all the entries I get when I 
connect with Lightning.



If there is more information you need please let me know.
09/11/2009 10:58:41 AM Jan Schneider Comment #8 Reply to this comment
Unfortunately I do not know how to track this further down...
http://bugs.php.net/bugs-generating-backtrace.php
09/11/2009 10:53:23 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #7 Reply to this comment
...now I also found the changes in Horde that cause apache to segfault:
See bug #8496 I got the same problem as bhalsema (at) purdue (dot) edu
I noticed that when I remove the putenv() call on line 91 from 
framework/Horde/Horde.php then there is no segfault. Any putenv() call 
there (e.g. putenv('Test=1')) would cause a segfault. Unfortunately I 
do not know how to track this further down...
09/11/2009 09:29:32 AM adrieder (at) sbox (dot) tugraz (dot) at Comment #6 Reply to this comment
...now I also found the changes in Horde that cause apache to segfault:

See bug #8496 I got the same problem as bhalsema (at) purdue (dot) edu


09/08/2009 01:55:28 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #5 Reply to this comment
Sorry, vacations....



I'm using the following hooks:

_prefs_hook_from_addr

_prefs_hook_fullname

_imp_hook_spam_bounce

_username_hook_frombackend

_username_hook_tobackend



The url is:

https://myserver/horde/rpc.php/kronolith/testuser@vrealm/testuser@vrealm.ics?server=vrealm



There is no realm set in imp/config/servers.php



Unfortunately I can't verify this right now, because since a full 
Horde cvs update yesterday the apache on my testsystem is segfaulting 
when trying to login to Horde.


09/01/2009 11:10:32 AM Jan Schneider Comment #4 Reply to this comment
Ping?
08/20/2009 04:27:35 PM Jan Schneider Comment #3
State ⇒ Feedback
Reply to this comment
And you don't have an additional vinfo hook running? Or try 
authenticating at the RPC url with the full username (including 
realm)? Or have a realm setting in imp/config/servers.php?

I only see a single frombackend hook call per request, so the realm 
must have been added before.
06/28/2009 04:20:53 PM Chuck Hagenbuch State ⇒ Assigned
Assigned to Ben Klang
 
06/27/2009 04:26:45 PM adrieder (at) sbox (dot) tugraz (dot) at Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Due ⇒ 06/27/2009
Summary ⇒ webdav and _username_hook_[from|to]backend
Type ⇒ Bug
Queue ⇒ Kronolith
Reply to this comment
When using the _username_hook_[from|to]backend hooks for adding and 
removing a realm it seems that the _username_hook_tobackend() hook 
gets not called in all situations when it should. This ends up in 
getting added the realm twice.



This is when trying to access the calender via webdav:

https://myserver/horde/rpc.php/testuser@vrealm/testuser@vrealm.ics?server=vrealm



(As work around I check in the _username_hook_frombackend() hook if 
the realm is already attached, but I think that's not the correct fix 
for this issue)



Here are the debug logs:

Jun 27 16:23:18 HORDE [debug] [horde] Connected to the following 
memcache servers:xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211, 
xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211 [pid 18456 on line 127 of 
"/usr/local/lib/php_horde3/Horde/Memcache.php"]

Jun 27 16:23:18 HORDE [debug] [horde] Read session data (id = 
b0nh4kmoe5nccain26inra5c81) [pid 18456 on line 184 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler/memcache.php"]

Jun 27 16:23:18 HORDE [debug] [] fullname hook called [pid 18456 on 
line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [] from_addr hook called [pid 18456 on 
line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [horde] fullname hook called [pid 18456 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [horde] from_addr hook called [pid 18456 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [horde] fullname hook called [pid 18456 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [horde] from_addr hook called [pid 18456 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:23:18 HORDE [debug] [horde] Max memory usage: 1048576 bytes 
[pid 18456 on line 339 of 
"/usr/local/lib/php_horde3/Horde/Registry.php"]

Jun 27 16:23:18 HORDE [debug] [horde] Session data unchanged (id = 
b0nh4kmoe5nccain26inra5c81) [pid 18456 on line 253 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler.php"]

Jun 27 16:26:20 HORDE [debug] [horde] Connected to the following 
memcache servers:xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211, 
xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211 [pid 18456 on line 127 of 
"/usr/local/lib/php_horde3/Horde/Memcache.php"]

Jun 27 16:26:20 HORDE [debug] [horde] Error retrieving session data 
(id = m83e4hanv7mj7e04afq7jg3ol3) [pid 18456 on line 174 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler/memcache.php"]

Jun 27 16:26:20 HORDE [debug] [] fullname hook called [pid 18456 on 
line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [] from_addr hook called [pid 18456 on 
line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [horde] fullname hook called [pid 18456 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [horde] from_addr hook called [pid 18456 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [horde] fullname hook called [pid 18456 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [horde] from_addr hook called [pid 18456 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:20 HORDE [debug] [horde] Max memory usage: 1048576 bytes 
[pid 18456 on line 339 of 
"/usr/local/lib/php_horde3/Horde/Registry.php"]

Jun 27 16:26:21 HORDE [debug] [horde] Wrote session data (id = 
m83e4hanv7mj7e04afq7jg3ol3) [pid 18456 on line 232 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler/memcache.php"]

Jun 27 16:26:28 HORDE [debug] [horde] Connected to the following 
memcache servers:xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211, 
xxx.xxx.xxx.xxx:11211, xxx.xxx.xxx.xxx:11211 [pid 18644 on line 127 of 
"/usr/local/lib/php_horde3/Horde/Memcache.php"]

Jun 27 16:26:28 HORDE [debug] [horde] Error retrieving session data 
(id = 9mpglfvb8e0v984qt923aqkga5) [pid 18644 on line 174 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler/memcache.php"]

Jun 27 16:26:28 HORDE [debug] [] fullname hook called [pid 18644 on 
line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [] from_addr hook called [pid 18644 on 
line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [horde] fullname hook called [pid 18644 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [horde] from_addr hook called [pid 18644 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [imp] _username_hook_frombackend called 
for user "testuser - adding "mbox" [pid 18644 on line 278 of 
"/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [imp] fullname hook called [pid 18644 on 
line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [imp] from_addr hook called [pid 18644 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:28 HORDE [debug] [imp] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm, horde [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:28 HORDE [debug] [imp] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm, imp [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:29 HORDE [debug] [imp] Hook _prefs_change_hook_last_login 
in application horde not called. [pid 18644 on line 1688 of 
"/usr/local/lib/php_horde3/Horde.php"]

Jun 27 16:26:29 HORDE [debug] [imp] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm, ingo [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:30 HORDE [notice] [imp] Login success for testuser 
[84.115.176.156] to {xxx.xxx.xxx.xxx:1430 [imap/notls]} [pid 18644 on 
line 307 of "/usr/local/apache/htdocs/horde3/horde/imp/lib/Session.php"]

Jun 27 16:26:30 HORDE [debug] [horde] _username_hook_frombackend 
called for user "testuser@vrealm - adding "mbox" [pid 18644 on line 
278 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:30 HORDE [debug] [horde] fullname hook called [pid 18644 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:30 HORDE [debug] [horde] from_addr hook called [pid 18644 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:30 HORDE [debug] [horde] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm@vrealm, horde [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:30 HORDE [debug] [horde] fullname hook called [pid 18644 
on line 130 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:30 HORDE [debug] [horde] from_addr hook called [pid 18644 
on line 54 of "/usr/local/apache/htdocs/horde3/horde/config/hooks.php"]

Jun 27 16:26:30 HORDE [debug] [horde] Hook 
_prefs_change_hook_last_login in application horde not called. [pid 
18644 on line 1688 of "/usr/local/lib/php_horde3/Horde.php"]

Jun 27 16:26:30 HORDE [debug] [horde] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm@vrealm, kronolith [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:30 HORDE [debug] [kronolith] Hook _horde_hook_share_init 
in application horde not called. [pid 18644 on line 1688 of 
"/usr/local/lib/php_horde3/Horde.php"]

Jun 27 16:26:31 HORDE [debug] [kronolith] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm@vrealm, turba [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [kronolith] SQL Query by 
Prefs_sql::retrieve(): SELECT pref_scope, pref_name, pref_value FROM 
horde_prefs WHERE pref_uid = ? AND pref_scope = ?, values: 
testuser@vrealm@vrealm, nag [pid 18644 on line 148 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [nag] Hook _horde_hook_share_init in 
application horde not called. [pid 18644 on line 1688 of 
"/usr/local/lib/php_horde3/Horde.php"]

Jun 27 16:26:31 HORDE [debug] [horde] Max memory usage: 11272192 bytes 
[pid 18644 on line 339 of 
"/usr/local/lib/php_horde3/Horde/Registry.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
SELECT 1 FROM horde_prefs WHERE pref_uid = ? AND pref_name = ? AND 
pref_scope = ?, values: testuser@vrealm, last_login, imp [pid 18644 on 
line 210 of "/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
UPDATE horde_prefs SET pref_value = ? WHERE pref_uid = ? AND pref_name 
= ? AND pref_scope = ?, values: 
a:2:{s:4:"time";i:1246112789;s:4:"host";s:33:"chello084115176156.graz.surfer.at";}, testuser@vrealm, last_login, imp [pid 18644 on line 244 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
SELECT 1 FROM horde_prefs WHERE pref_uid = ? AND pref_name = ? AND 
pref_scope = ?, values: testuser@vrealm@vrealm, fullname, horde [pid 
18644 on line 210 of "/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
UPDATE horde_prefs SET pref_value = ? WHERE pref_uid = ? AND pref_name 
= ? AND pref_scope = ?, values: , testuser@vrealm@vrealm, fullname, 
horde [pid 18644 on line 244 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
SELECT 1 FROM horde_prefs WHERE pref_uid = ? AND pref_name = ? AND 
pref_scope = ?, values: testuser@vrealm@vrealm, from_addr, horde [pid 
18644 on line 210 of "/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
UPDATE horde_prefs SET pref_value = ? WHERE pref_uid = ? AND pref_name 
= ? AND pref_scope = ?, values: , testuser@vrealm@vrealm, from_addr, 
horde [pid 18644 on line 244 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
SELECT 1 FROM horde_prefs WHERE pref_uid = ? AND pref_name = ? AND 
pref_scope = ?, values: testuser@vrealm@vrealm, last_login, horde [pid 
18644 on line 210 of "/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:31 HORDE [debug] [horde] SQL Query by Prefs_sql::store(): 
UPDATE horde_prefs SET pref_value = ? WHERE pref_uid = ? AND pref_name 
= ? AND pref_scope = ?, values: 
a:2:{s:4:"time";i:1246112790;s:4:"host";s:33:"chello084115176156.graz.surfer.at";}, testuser@vrealm@vrealm, last_login, horde [pid 18644 on line 244 of 
"/usr/local/lib/php_horde3/Horde/Prefs/sql.php"]

Jun 27 16:26:32 HORDE [debug] [horde] Wrote session data (id = 
9mpglfvb8e0v984qt923aqkga5) [pid 18644 on line 232 of 
"/usr/local/lib/php_horde3/Horde/SessionHandler/memcache.php"]


Saved Queries