[#7050] httpd segfaults with sidebar.php
Summary httpd segfaults with sidebar.php
Queue IMP
Queue Version HEAD
Type Bug
State Not A Bug
Priority 1. Low
Owners Michael Slusarz <slusarz (at) horde (dot) org>
Requester horde (at) olen (dot) net
Created 07/09/2008 (134 days ago)
Due
Updated 08/22/2008 (90 days ago)
Assigned 07/15/2008 (128 days ago)
Resolved 08/03/2008 (109 days ago)
Attachments
Milestone
Patch No

History
08/22/2008 Michael Slusarz Comment #22 Reply to this comment

The main issue seems to be that i had hordeauth set in servers.php
I would still like to keep it that way, but there seems to be a
problem i redirect.php so $imapuser is not set, and this causes the
test on line 154
  if (($imapuser !== null) && ($pass !== null)) {
to fail so it never really logs in on the server.

The second issue is that if I unset hordauth in servers.php, but
keeps $conf['server']['server_list'] = 'none'; in conf.php I somehow
end up in an endless redirect loop.

After changing this to "hidden" and removing "hordeauth" from
servers.php I am at least able to log in and use horde again.  But
I'd like to get rid of the extra login to imp, when I have the same
user/pass on the mailserver as in horde.
Sounds like you have some configuration errors.  These support issues 
are best asked on the mailing lists.

Please use the mailing list to ask for support.
http://www.horde.org/mail/ contains a list of all available mailing lists.

Please use the mailing list to ask for support.
http://www.horde.org/mail/ contains a list of all available mailing lists.
08/18/2008 horde (at) olen (dot) net Comment #21 Reply to this comment
I have now debugged a bit more (and googled for similar problems) and 
there seems to be two (unrelated) issues here.

The main issue seems to be that i had hordeauth set in servers.php
I would still like to keep it that way, but there seems to be a 
problem i redirect.php so $imapuser is not set, and this causes the 
test on line 154
  if (($imapuser !== null) && ($pass !== null)) {
to fail so it never really logs in on the server.

The second issue is that if I unset hordauth in servers.php, but keeps 
$conf['server']['server_list'] = 'none'; in conf.php I somehow end up 
in an endless redirect loop.

After changing this to "hidden" and removing "hordeauth" from 
servers.php I am at least able to log in and use horde again.  But I'd 
like to get rid of the extra login to imp, when I have the same 
user/pass on the mailserver as in horde.

08/03/2008 Michael Slusarz Comment #20
State ⇒ Not A Bug
Reply to this comment
This makes absolutely no sense.  Your imp session variable *must* 
contain, at a minimum, 20-30 different values (see the top of 
imp/lib/Session.php).  You have absolutely no username/password 
information, for example.  You probably have a critical error in your 
authentication somewhere but this configuration error is a support 
issue that should be dealt with on the lists, not the bug tracker.
07/30/2008 horde (at) olen (dot) net Comment #19 Reply to this comment
Sorry.
Been away for a while.

I added a print_r($_SESSION['imp']) to openIMAPStream() (in imp/lib/IMAP.php)

This is parsed several times when I click "mail" and

$_SESSION['imp'][namespace] is always empty.

Here is the complete array:

Array
(
     [namespace] =>
     [cache] => Array
         (
             [imp_tree] => Array
                 (
                     [s] => Array
                         (
                             [0] => 6
                         )

                     [ob] => 
O:8:"IMP_Tree":17:{s:5:"_tree";a:1:{s:1:"%";a:2:{s:1:"a";i:64;s:1:"v";s:1:"%";}}s:11:"_currparent";N;s:8:"_currkey";N;s:10:"_currstack";a:0:{}s:10:"_showunsub";b:0;s:7:"_parent";a:0:{}s:5:"_poll";N;s:9:"_expanded";N;s:11:"_subscribed";N;s:8:"_changed";b:0;s:10:"_unsubview";b:0;s:10:"_imap_sort";N;s:7:"_server";s:3:"{/}";s:10:"_delimiter";N;s:11:"_namespaces";N;s:8:"_eltdiff";N;s:10:"_forceopen";b:0;}
                 )

             [folder_cache] => Array
                 (
                     [835cd6d32792d188273817906dbc9b77] => 
1916acc2f7363afd4b855fcbd6f4e675
                 )

         )

     [viewmode] => imp
)


07/28/2008 Michael Slusarz Comment #18 Reply to this comment
Ping?
07/18/2008 Michael Slusarz Comment #17 Reply to this comment
Both _namespaces and _server is "{/}"
This makes absolutely no sense.  _namespaces must be an array, and 
_server should be of the form {host/protocol}.

For whatever reason, IMP's session variables are not being set (you 
might want to do a print_r($_SESSION['imp']) anywhere in IMP code to 
see what is happening).
07/16/2008 horde (at) olen (dot) net Comment #16 Reply to this comment
a print_r($mbox); on line 144 in imp/lib/IMAP.php (inside 
openIMAPStream) shows an empty string, which seems a bit strange.


07/16/2008 horde (at) olen (dot) net Comment #15 Reply to this comment
Both _namespaces and _server is "{/}"

Also, if I do a tcpdump of port 143, I don't see any traffic at all on 
that port, so it seems like horde is never actually trying to connect 
to the IMAP-server.
07/15/2008 Michael Slusarz Comment #14
Priority ⇒ 1. Low
State ⇒ Feedback
Reply to this comment
Line 303 in imp/lib/IMAP/Tree.php, right before "foreach 
($this->_namespaces..", do both

print_r($this->_namespaces);
print_r($this->_server);

Still don't know why you are not seeing the INBOX though because the 
INBOX is explicitly defined in the results on line 298, so even if the 
imap_list/imap_lsub calls fail, it still should at least return INBOX.
07/15/2008 horde (at) olen (dot) net Comment #13 Reply to this comment
I turned on some more debug in horde, and there seems to be a problem 
with the imap-config.

I'm getting these in my debug.log:
Jul 15 23:24:03 HORDE [debug] [imp] IMAP errors: Can't open mailbox 
{/}: invalid remote specification Can't open mailbox {/}: invalid 
remote specification Can't open mailbox {/}: invalid remote 
specification Can't open mailbox {/}: invalid remote specification 
Can't open mailbox {/}: invalid remote specification [pid 6125 on line 
184 of "/usr/share/horde/imp/lib/IMAP.php"]

Just to be sure, I tested http://server/imp/test.php and entering my 
server name and login-info there worked fine.

imp/config/servers.php only contains

         # 'server' => 'mail.olen.net',
         # 'protocol' => 'imap/notls',
         # 'port' => 143,

$servers['imap'] = array(
         'name' => 'Lupus',
         'server' => 'mail.olen.net',
         'protocol' => 'imap/tls/novalidate-cert',
         'port' => '143',
         'hordeauth' => true,
         'maildomain' => 'olen.net',
         'smtphost' => 'smtp.nytt.no',
         'smtpport' => 25,
         'realm' => '',
         'preferred' => '',
);

(I tested both notls and tls/novalidate-cert but to no avail).
07/15/2008 horde (at) olen (dot) net Comment #12 Reply to this comment
Uhm.
I am using IMAP, and folders are enabled:

grep folders horde/imp/config/conf.php
$conf['user']['allow_folders'] = true;
$conf['server']['cache_folders'] = true;


Cvs seems unavailable now, but I added your patch and re-added the 
lines I commented out, and still have a segfault in sidebar.php

Any other print_r()s you want?
07/15/2008 Michael Slusarz Comment #11
State ⇒ Resolved
Assigned to Michael Slusarz
Reply to this comment
Fixed in IMP 4.2.1.  For a bug report like this, it would have been 
very helpful to know that you either have folders turned off in IMP's 
conf or you are using POP3.
07/15/2008 CVS Commit Comment #10 Reply to this comment
07/15/2008 CVS Commit Comment #9 Reply to this comment
07/15/2008 horde (at) olen (dot) net Comment #8 Reply to this comment
Tree_ob

Array
(
     [0] => Array
         (
             [0] => Array
                 (
                     [display] =>
                     [peek] =>
                 )

         )

     [1] => Array
         (
         )

     [2] => Array
         (
             [0] =>
         )

)

07/15/2008 Michael Slusarz Comment #7 Reply to this comment
If you give me some hints on where to start looking to find out why
the variable is empty, so I don't have to search and grep everywhere
in the code, I'll be happy to do so.
print_r($tree_ob);
right after line 65 ($tree_ob = $imptree->build($mask, null, null, 
false);) would be most useful.
07/10/2008 horde (at) olen (dot) net Comment #6 Reply to this comment
If you give me some hints on where to start looking to find out why 
the variable is empty, so I don't have to search and grep everywhere 
in the code, I'll be happy to do so.
07/09/2008 Michael Slusarz Comment #5 Reply to this comment
So the real question is why, on line 86, is $val['value'] empty?  It 
is impossible to have an empty mailbox name.  That's the real problem 
- this has nothing to do with the 1.70 change.
07/09/2008 Michael Slusarz State ⇒ Feedback
 
07/09/2008 Michael Slusarz Comment #4
Taken from Michael Slusarz
Reply to this comment
Michael, looks like you did the commit in question
(http://cvs.horde.org/diff.php/imp/lib/Block/tree_folders.php?r1=1.69&r2=1.70) - do you remember what this 
was
for?
Well... besides the fact that without that code *no* mailboxes show 
up, it's kind of just a little bit important.

I don't see anything wrong with that code.  We want to show mailboxes 
in the bottom level of the namespace (when $val['level'] is empty) 
directly under the 'imp' entry (which is what $parent should be).   
However, we can't directly use "$parent . $val['parent']" as the 
parent ID in this case because $val['parent'] is equal to 
IMPTREE_BASE_ELT -- which is '%'.  The parent entry "imp%" does not 
exist, obviously, so none of these folders (nor any of its children) 
will ever show up.

IMPTREE_BASE_ELT used to be equal to \01 I belive which would allowed 
this code to work before 6/07.  For various reasons, using \01 to 
stand for the base was not a good idea, so thus the need to catch the 
space 'base level' case.
07/09/2008 Chuck Hagenbuch Comment #3
State ⇒ Assigned
Assigned to Michael Slusarz
Reply to this comment
Michael, looks like you did the commit in question 
(http://cvs.horde.org/diff.php/imp/lib/Block/tree_folders.php?r1=1.69&r2=1.70
- do you remember what this was for?
07/09/2008 Matt Selsky Comment #2 Reply to this comment
07/09/2008 horde (at) olen (dot) net Comment #1
Patch ⇒
Milestone ⇒
Queue ⇒ IMP
Summary ⇒ httpd segfaults with sidebar.php
Type ⇒ Bug
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Reply to this comment
I know you usually reply that "segfaults are not caused by horde", but 
there seems to be some kind of recursion somewhere that causes php to 
segfault.

The problem seems to be related to either the pear-package Horde/Tree.php
or imp/lib/Block/tree_folders.php

Please look at
https://bugzilla.redhat.com/show_bug.cgi?id=454219