Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Panel broken when admin_panel_host is set #1169

Closed
warp03 opened this issue Jun 11, 2023 · 0 comments
Closed

Admin Panel broken when admin_panel_host is set #1169

warp03 opened this issue Jun 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@warp03
Copy link

warp03 commented Jun 11, 2023

Describe the bug
When setting admin_panel_host to a host name, the Admin Panel is not usable anymore (the browser is at the site set in admin_panel_host, of course).

This seems to be because of the empty($aPaths[0]) condition in RainLoop/Service.php:92. If it is true (i.e. if there is any string between the ? and & or end in the URL), and admin_panel_host is set, $bAdmin will never be true, even though the request came with the hostname set in admin_panel_host. Then, any API calls to e.g. ?Json will use the default Actions (instead of AdminActions), which causes problems because the client assumes it is talking to the AdminActions.

Additionally, adding any query string which is not an action shows the regular login window, instead of the Admin Panel login window, even though the host name is the admin_panel_host.

To Reproduce
Steps to reproduce the behavior:

  1. Set a host name for admin_panel_host in the configuration
  2. Go to the host set in admin_panel_host
  3. Try to log in to the Admin Panel
  4. "Unknown error" will be shown as an error message, because DoAdminLogin does not exist in the erroneously used Actions class

Expected behavior
Admin Panel works.

Please complete the following information:

  • Browser: any (presumably)
  • IMAP daemon: not relevant
  • PHP version: 8.2.4
  • SnappyMail Version: 2.28.1
  • Mode: standalone

Debug/logging information

[2023-06-11 12:47:52.148][4b3d230e] [INFO]: [SM:2.28.1][IP:2001:67c:34::ff:fe0c:301][PID:16873][Apache/2.4.56 (FreeBSD) PHP/8.2.4][apache2handler][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET http://x-0000000000000014.p.u9sv.com/]
[2023-06-11 12:47:52.153][4b3d230e] [INFO]: [SM:2.28.1][IP:2001:67c:34::ff:fe0c:301][PID:16873][Apache/2.4.56 (FreeBSD) PHP/8.2.4][apache2handler][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET http://x-0000000000000014.p.u9sv.com/]
[2023-06-11 12:47:52.165][4b3d230e] [INFO]: Memory peak usage: 4MB
[2023-06-11 12:47:52.165][4b3d230e] [INFO]: Time delta: 0.041612863540649
[2023-06-11 12:47:52.466][68cf9ddc] [INFO]: [SM:2.28.1][IP:2001:67c:34::ff:fe0c:301][PID:17017][Apache/2.4.56 (FreeBSD) PHP/8.2.4][apache2handler][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET http://x-0000000000000014.p.u9sv.com/?/AdminAppData/0/14738339580060889/]
[2023-06-11 12:47:52.475][68cf9ddc] COOKIE[DEBUG]: set smtoken
[2023-06-11 12:47:52.478][68cf9ddc] APPDATA[INFO]: {"Auth":false,"title":"omegazero.org Webmail (SnappyMail)","loadingDescription":"omegazero.org Webmail (SnappyMail)","Plugins":[],"System":{"version":"2.28.1","token":"0e43b81b40fe1403cddc970da46ac22a3573272d","languages":["ar-SA","bg-BG","cs-CZ","da-DK","de-DE","el-GR","en","en-GB","eo","es-ES","et-EE","eu","fa-IR","fi-FI","fr-FR","hu-HU","id-ID","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nb-NO","nl-NL","pl-PL","pt","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","tr-TR","uk-UA","vi-VN","zh-CN","zh-TW"],"webPath":"\/","webVersionPath":"\/snappymail\/v\/2.28.1\/","adminHostUse":true,"adminPath":"admin","adminAllowed":true},"allowLanguagesOnLogin":true,"Theme":"BlurredDark","language":"en","userLanguage":"en","PluginsLink":"","StaticLibsJs":"\/snappymail\/v\/2.28.1\/static\/js\/min\/libs.min.js"}
[2023-06-11 12:47:52.485][68cf9ddc] [INFO]: Memory peak usage: 4MB
[2023-06-11 12:47:52.485][68cf9ddc] [INFO]: Time delta: 0.049188137054443

----- Login at browser here -----

[2023-06-11 12:48:05.525][5e2a6c02] [INFO]: [SM:2.28.1][IP:2001:67c:34::ff:fe0c:301][PID:16824][Apache/2.4.56 (FreeBSD) PHP/8.2.4][apache2handler][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][POST http://x-0000000000000014.p.u9sv.com/?/Json/&q[]=/0/]
[2023-06-11 12:48:05.541][5e2a6c02] JSON[INFO]: Action: DoAdminLogin
[2023-06-11 12:48:05.541][5e2a6c02] POST[INFO]: {"Login":"admin","Password":"*******","Action":"AdminLogin"}
[2023-06-11 12:48:05.542][5e2a6c02] SERVICE[WARNING]: UnknownError[999]
#0 /mnt/ji/www/snappymail/v/2.28.1/app/libraries/RainLoop/Service.php(133): RainLoop\ServiceActions->ServiceJson()
#1 /mnt/ji/www/snappymail/v/2.28.1/app/libraries/RainLoop/Service.php(14): RainLoop\Service::RunResult()
#2 /mnt/ji/www/snappymail/v/2.28.1/include.php(143): RainLoop\Service::Handle()
#3 /mnt/ji/www/index.php(11): include('...')
#4 {main}
[2023-06-11 12:48:05.542][5e2a6c02] [NOTICE]: RainLoop\Exceptions\ClientException: UnknownError[999] in /mnt/ji/www/snappymail/v/2.28.1/app/libraries/RainLoop/ServiceActions.php:153
Stack trace:
#0 /mnt/ji/www/snappymail/v/2.28.1/app/libraries/RainLoop/Service.php(133): RainLoop\ServiceActions->ServiceJson()
#1 /mnt/ji/www/snappymail/v/2.28.1/app/libraries/RainLoop/Service.php(14): RainLoop\Service::RunResult()
#2 /mnt/ji/www/snappymail/v/2.28.1/include.php(143): RainLoop\Service::Handle()
#3 /mnt/ji/www/index.php(11): include('...')
#4 {main}
[2023-06-11 12:48:05.542][5e2a6c02] JSON[INFO]: {"Action":"AdminLogin","Result":false,"ErrorCode":999,"ErrorMessage":"","ErrorMessageAdditional":"","epoch":1686487685}
[2023-06-11 12:48:05.554][5e2a6c02] [INFO]: Memory peak usage: 4MB
[2023-06-11 12:48:05.554][5e2a6c02] [INFO]: Time delta: 0.13039994239807

Additional context
This is not a completely vanilla (i.e. new, non-configured) instance, so there might be a small chance something I changed caused this problem to happen.

Proposed solution
Removing empty($aPaths[0]) && at RainLoop/Service.php:92 seems to be the best solution, if there aren't any problems that might appear by doing this.


Other than that, great software, and thank you for continuing RainLoop :)

@the-djmaze the-djmaze added the bug Something isn't working label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants