pimlie / authres_status

Roundcube plugin that checks the Authentication-Results headers (rfc5451) of your emails and displays the verification status.
Other
36 stars 20 forks source link

Icons in column disappear #15

Closed texxasrulez closed 7 years ago

texxasrulez commented 8 years ago

Upon a new email arrival, the icons in column disappear. A refresh is required to see them again. I love this plugin. Thanks and keep up the great work

pimlie commented 7 years ago

Do the icons disappear or the whole column? If its just the icons that disappear, could you please open the developer console (F12 in most browsers) and use the 'Select element' tool to sent me the contents of the table cell containing the image. It should start with something like <td class="authres_status">, the contents of that TD element are what I am looking for.

Furthermore, which RC version are you using? Do you have the internal DKIM verifier enabled? Are there any errors in your logs? Do you have any other plugins that add columns to the message overview?

Unfortunately I am unable to reproduce this problem in v1.2.0 and v1.2.2, so I need your help to find the cause of the problem :)

texxasrulez commented 7 years ago

Sorry, I did not post exactly what I have done and have ...

I have RC 1.2.2 .. I did disable ALL plugins except authres_status. I do not have DKIM verifier enabled. I do not see any "td class="authres_status"" in console developer. I have never tried to copy entire text output and couldn't figure it out, but I did search it and look manually for the class tag as well and still never saw it. There are no errors in log either.

Icons disappear, column is still shown icons disappear when clicking the "Refresh" button in Roundcube to check for new mail. A refresh of browser (F5) corrects the problem and images are shown properly. This one is definitely a head scratcher for sure. Thanks for you work. I do dig this plugin.

Here is an image for clarity ... authres_status

pimlie commented 7 years ago

Which browser are you using?

And that column with the checkbox, how did you get that? Is that provided by the roundcube/chbox plugin?

texxasrulez commented 7 years ago

I use Chrome. The checkbox column is provided by chbox plugin, I did disable the chbox plugin (and ALL the other plugins as well) during testing to make sure that is not causing the issue

johnwayne4d commented 7 years ago

@pimlie I am not running the chbox plugin and am having the same issue in the latest version of chrome on pc. also could not get the plugin to detect a spf hard failure, it just yielded a result of no records. rc 1.1.6

johnwayne4d commented 7 years ago

@pimlie i sorted out the spf failure not showing in the header, i had to enable spamassassin at my provider. yet authres_status does not check for the spamassassin spf result: [-0.0 SPF_PASS SPF: sender matches SPF record] in the header. but the bigger problem is the icons disappearing in the column.

pimlie commented 7 years ago

@texxasrulez I am sorry but I am unable to reproduce this problem, are you sure the new email should show an icon? In settings, can you make sure that you have selected to display all status (including no signature found)? Then at least we know whether the request did include the plugin or not.

@johnwayne4d The spf result you are showing does not look like an Authentication-Results header. Does the email contain a full signature? Then you could try to enable the Internal DKIM Verifier. If you see an icon after enabling that, then you probably need to re-configure your MTA to include a milter service like opendkim so the Authentication-Results header is always added

johnwayne4d commented 7 years ago

@pimlie yes my system does not have dkim, so that answers all that. but I am having the same disappearing icon problem @texxasrulez is having. fresh install of rc 1.1.6LTS, yes the all statuses feature is on, icons will be there, then after a new email comes in, they all blank out until a manual refresh.

pimlie commented 7 years ago

I also tried with 1.1.6, copied composer.json-dist and only added "roundcube/authres_status": "*" as require package but then I am still unable to reproduce this issue. Tried both with and without the internal verifier.

So we have to eleminate each possiblity step by step, first could you please try to:

Does that show as HTTP ERROR 500 or does it redirect you to your inbox?

texxasrulez commented 7 years ago

I get 500 Error

johnwayne4d commented 7 years ago

signed in to roundcube, then put the edited php on the server, then opened the link requested, trying both in the same window and in a new tab. I get a 500 error. I will note that the link requested differed from the link displayed after signin by not having "&_mbox=INBOX" before the "&_action.." of the requested link, but even including the "&_mbox=INBOX" still yielded a 500 error. also when I signed in, and then sent the bad php to the server, just waiting for the RC refresh interval would yield the "INTERNAL SERVER ERROR" popup.

johnwayne4d commented 7 years ago

i know that my provider imap box structure is: INBOX INBOX.drafts INBOX.sent and so on,

it is NOT: INBOX DRAFTS SENT and so on...

if that matters at all (which i do not think it would, just trying to be thorough).

pimlie commented 7 years ago

Thanks, now we know that at least the plugin is loaded on the refresh action.

Could you please replace the messages_list method with the following:

function messages_list($p)
{
    if (!empty($p['messages'])) {
            $rcmail = rcmail::get_instance();
            if ($rcmail->config->get('enable_authres_status_column')) {
                    $show_statuses = (int)$rcmail->config->get('show_statuses');
                    foreach ($p['messages'] as $index => $message) {
                            $img_status = $this->get_authentication_status($message, $show_statuses, $message->uid);
                            rcmail::console('Message: '.$index.' has '.count($message).' headers', $img_status);
                            $p['messages'][$index]->list_cols['authres_status'] = $img_status;
                    }
            }else{
                    rcmail::console('Not processing authres_status because config says the column is disabled');
            }
    }else{
            rcmail::console('$p[messages] is empty. If the mailbox is empty this is ok');
    }
}

And check the file $log_dir/console what it says when RC refreshes and a new email is available. For me it lists e.g.:

[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 0 has 1 headers;
<img src="plugins/authres_status/images/status_nores.png" alt="Signature found but no auth. results header. Server configuration problem?" title="Signature found but no auth. results header. Server configuration problem?" width="14" height="14" />
[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 1 has 1 headers;
<img src="plugins/authres_status/images/status_nores.png" alt="Signature found but no auth. results header. Server configuration problem?" title="Signature found but no auth. results header. Server configuration problem?" width="14" height="14" />
[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 2 has 1 headers;
<img src="plugins/authres_status/images/status_nores.png" alt="Signature found but no auth. results header. Server configuration problem?" title="Signature found but no auth. results header. Server configuration problem?" width="14" height="14" />
[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 3 has 1 headers;

[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 4 has 1 headers;
<img src="plugins/authres_status/images/status_third.png" alt="Signed by third party, signature is present but for different domain than from address. verified for " title="Signed by third party, signature is present but for different domain than from address. verified for td35.tripolis.com by dkim=pass (1024-bit key; unprotected) ; for td35.tripolis.com by dkim=pass (1024-bit key; unprotected) " width="14" height="14" />
[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 5 has 1 headers;

[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 6 has 1 headers;
...
[08-Nov-2016 12:23:06 +0100]: <ttgdbmo7> Message: 49 has 1 headers;

If you get this list too but it's just empty all the time and never shows an <img tag with a status, please show the headers in the $message variable for the email that should have a status.

johnwayne4d commented 7 years ago

with your code change in place

state of a specific email message in console with icon showing -

this.add_message_row(1162,{"subject":"OMITTED","fromto":"<span class=\"adr\"><span title=\"OMITTED@gmail.com\" class=\"rcmContactAddress\">OMITTED@gmail.com<\/span><\/span>","date":"2016-10-25 5:23 pm","size":"129 KB","authres_status":"<img src=\"plugins\/authres_status\/images\/status_nores.png\" alt=\"Signature found but no auth. results header. Server configuration problem?\" title=\"Signature found but no auth. results header. Server configuration problem?\" width=\"14\" height=\"14\" \/> "},{"seen":1,"ctype":"multipart\/mixed","mbox":"INBOX"},false);

state of same email message after a click of the refresh button in the RC toolbar that happens to bring in additional emails -

this.add_message_row(1162,{"subject":"OMITTED","fromto":"<span class=\"adr\"><span title=\"OMITTED@gmail.com\" class=\"rcmContactAddress\">OMITTED@gmail.com<\/span><\/span>","date":"2016-10-25 5:23 pm","size":"129 KB","authres_status":""},{"seen":1,"ctype":"multipart\/mixed","mbox":"INBOX"},false);

the email message doesnt return to the prior state until after a refresh/reload of the entire page (the browser button, not the RC button)

this is exactly how it acted prior to the code change.

here is the header of that email that "looses" its icon -

Return-path: <OMITTED@gmail.com>
Envelope-to: OMITTED@OMITTED.net
Delivery-date: Tue, 25 Oct 2016 18:30:44 -0400
Received: from OMITTED.google.com ([OMITTED]:32916)
    by OMITTED.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
    (Exim 4.87)
    (envelope-from <OMITTED@gmail.com>)
    id 1bzAF2-000QEp-N5
    for OMITTED@OMITTED.net; Tue, 25 Oct 2016 18:30:44 -0400
Received: by OMITTED.google.com with SMTP id y2so123582833oie.0
    for <OMITTED@OMITTED.net>; Tue, 25 Oct 2016 15:30:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=gmail.com; s=20120113;
    h=from:to:cc:subject:date:message-id:mime-version:thread-index
    :content-language;
    bh=pWlsvUildoUprd6lXtEF4xLWmL6FQaYuO1mnOIzDvzM=;
    b=cOEwGquh9Kte3azv16fFPZuT6XjUMucAVERWyu45kVqD+qW/vlsujWeCSJcfGJUh7E
    A75lLI3AIyYgafb0vucsBIrosMj2DgaCCzMRwIR27T5jdHkxDAyQ/IVyx6Fr499ofDPK
    vAOp8e/P3Kybv2ssXT7+1kgGyZtRMyiS1rokODbeVQvFGRet9NJUjZCVWUkWfzhVjAFP
    aOz+t3gY0rdwPzJ0WhK6agUuYRTH1dEMPkj7UPstTcf74lFnIX8xeE1mbwHiIhZ6S00J
    /9F/q/YuFnT/76A5/sKjtevz+htogdsuN5feoFE9kVIYrdl1YkOJDHkIkbW+KCrggdpS
    LkNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=1e100.net; s=20130820;
    h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
    :thread-index:content-language;
    bh=pWlsvUildoUprd6lXtEF4xLWmL6FQaYuO1mnOIzDvzM=;
    b=NSCtg1hhhm8WTQPpNDU2eQZtU2wiSmsoSwC4ErNTr4HXa9b7m1Tz0AnLYjjwKeASZx
    ZldIFDKPy8b68Hi3tCTOsl1J6Zm7iWLCyvBnFi0BDrMV4QtU9j20J+THWzUl6SAa5QeT
    S/v38LkTuh13hgYPYxUKo6M6ZYTcZBNaRgyoijhwLRAAxtIRpewA5ZISSnHPMBhEAvmW
    xNHokWrxWSOGQLc3QL4pNilvN86BbSAN0dpjTu7J67YFuYsoNnrEp9fySJZxjEQzhtZq
    gh1zNZBu6D0IpthuZr9bPJHD2YiOItWt0i8PMrSPbo8c2QSB3vCrfR5w4t5ZU8BvKlS2
    hU7g==
X-Gm-Message-State: ABUngvcSLvrv8qH9MDHzQeyOXzvCOxbn/WX/OvCimRfir40gReohHhRokXyJUmldiUnFyw==
X-Received: by OMITTED with SMTP id h30mr7174449oth.205.1477434294340;
    Tue, 25 Oct 2016 15:24:54 -0700 (PDT)
Received: from OMITTED (c-OMITTED.hsd1.OMITTED.net. [OMITTED])
    by smtp.gmail.com with ESMTPSA id g22sm7539323oib.23.2016.10.25.15.24.53
    for <OMITTED@OMITTED.net>
    (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
    Tue, 25 Oct 2016 15:24:53 -0700 (PDT)
From: <OMITTED@gmail.com>
To: <OMITTED@att.net>
Cc: <OMITTED@OMITTED.net>
Subject: OMITTED
Date: Tue, 25 Oct 2016 17:23:29 -0500
Message-ID: <000601d22f0e$6b4e8000$41eb8000$@com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_NextPart_000_0007_01D22EE4.82787800"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AdIvDmd8h+iKZYaTQdiiOkB9t8bRow==
Content-Language: en-us
X-MS-TNEF-Correlator: 00000000581AE6ACC4E39744B0C1D0FD9B9352E944805900
pimlie commented 7 years ago

Thanks for the info, could you please try to include the code sample from my previous comment and show me the log? Sorry, I think I misunderstood and you already included my changes. But could you check the log file in your RC web folder? The path should be something like <rc_install_path>/logs/console

From your headers I agree with you that the plugin should return a 'Signature found but no auth. results header' status. Unfortunately I have no idea why it doesnt do that happens. When RC does a refresh it firsts executes the storage_init method and then executes the messages_list method from my plugin. Within that last method the plugin checks the auth status for each message it gets passed from RC. That is why I included the debugging info in the code snipplet in my previous comment, that would show us what happens within that method.

It would also be interesting to see $p['fetch_headers'] from within the storage_init method. What does that contain before and after my plugin add those two headers?

pimlie commented 7 years ago

It seems there is a bug that the column is not initiated when you search. Could that be the same issue you had?

texxasrulez commented 7 years ago

I do not use the search function, so I would think not ...

robin-thoni commented 7 years ago

Hello there, I got the same problem, Roundcube 1.2.2, when RC refresh automatically (_action=refresh) every X minutes, everything goes well (even when a new mail comes), but if I refresh manually using the RC button (_action=check-recent) and a new mail comes, every icons are lost.

Edit: I don't have any problem when using search

pimlie commented 7 years ago

@robin-thoni, thanks for mentioning the action's. I have added the check-recent action in commit d666c34b91687d337ae675dfd0fa188241db44f7, please check if this fixes this issue

texxasrulez commented 7 years ago

That seems to have done the trick for me. It works in RC1.3beta as well just an fyi ... Thanks

robin-thoni commented 7 years ago

That's ok for me too, in 1.2.2. Thanks!