roundcube mail_host issue using 10_roundcube_tls.pl

  • Hello,


    I noticed that when using the 10_roundcube_tls.pl listener file the hostname of the user login does not match the mail_host entry in the database because the hostname in the roundcube config is changed from localhost to BASE_SERVER_VHOST. So all user settings are saved as new entry in the database because during the i-MSCP update all mail_host entries are updated to localhost again (Roudcube installer -> sub _updateDatabase). Perhaps the listener should also update the database table.


    Regards Jörg

    (Ubuntu 16.04, i-MSCP 1.5.1, php-Fpm, Plugins: ClamAV, CronJobs, InstantSSH, LetsEncrypt, Mailgraph, Monitorix, OpenDKIM, PhpSwitcher, PolicydSPF, Postscreen, RecaptchaPMA, RoundcubePlugins, ServerDefaultPage, SpamAssassin, YubiKeyAuth)

  • @UncleJ


    Updating database also through the listener wouldn't be a good solution. The best thing I can do is to trigger an event in the roundcube package (installer) which will let any 3rd-party component (such as the listener) to override the default host (here localhost) before updating the database.


    Something like:


    Perl
    1. ... my $hostname = 'localhost'; $rs = $self->{'eventManager'}->trigger('beforeUpdateRoundCubeMailHostEntries', \$hostname); return $rs if $rs; $rs ||= $db->doQuery( 'u', "UPDATE IGNORE users SET mail_host = ?", $hostname ); unless (ref $rs eq 'HASH') { error( $rs ); return 1; } $rs = $db->doQuery( 'd', "DELETE FROM users WHERE mail_host <> ?", $hostname ); unless (ref $rs eq 'HASH') { error( $rs ); return 1; }...

    Then, in the listener, we could do:


    Perl
    1. iMSCP::EventManager->getInstance()->register(
    2. 'beforeUpdateRoundCubeMailHostEntries',
    3. sub {
    4. my $hostname = shift;
    5. ${$hostname} = $main::imscpConfig{'BASE_SERVER_VHOST'};
    6. 0;
    7. }
    8. );

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @Nuxwin


    Thanks for your reply. I think this would be a good solution. Or do you think a plugin would be a better solution?
    From my point of view both would be fine - better than updating the mail_host entry manually after each update.


    Regards Jörg

    (Ubuntu 16.04, i-MSCP 1.5.1, php-Fpm, Plugins: ClamAV, CronJobs, InstantSSH, LetsEncrypt, Mailgraph, Monitorix, OpenDKIM, PhpSwitcher, PolicydSPF, Postscreen, RecaptchaPMA, RoundcubePlugins, ServerDefaultPage, SpamAssassin, YubiKeyAuth)

  • @UncleJ


    A fix has been added in our development branch. See

    This fix will be part of next release.


    Thank you for your report.
    Thread closed.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206