-
Notifications
You must be signed in to change notification settings - Fork 64
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
Undefined Indices in Logs #56
Comments
thank you for reporting this! @MaxiBoether & @Flachzange could you provide some details about your configurations? Maybe it depends on the php environment or something specific for this to show up in the logs... |
I get these errors on my setup: User External App version: 0.6 Operating system: CentOS 7 Web server: nginx PHP version: 7.1.8 Nextcloud version: 15.0.5.3 To remove errors from error log I have added isset for $parts to line 149, and deleted if block at line 945 because it seams that force_caps is used only in that block and nowhere else. Diff of my changes:
|
I'm running Ubuntu Server 18.04 LTS, apache/2.4.29 and php 7.2 via fastcgi. The NextCloud & User_External versions are up to date as well. @Wuk-jvi's solution seems to be possible, but I don't really a) know why we are using RoundCube sourcecode (I am running RoundCube as a webmail interface and it's not spamming my logs) here and b) if it's a viable solution because I don't see what the Regex and stuff like force_caps is doing. |
Same issue on up-to-date Debian 9, PHP 7.0.33-0+deb9u3, nginx/1.10.3, spamming logs in sub-second intervals. |
If php throws a warning or error, the global Nextcloud error handler will capture and log it. Try lowering your log level in config.php to have Nextcloud log more. |
@Wuk-jvi patch works. But there's also another problem in the config when using version 6.0.1. @@ -985,7 +984,7 @@ class imap_rcube // set connection identifier for debug output $this->resourceid = strtoupper(substr(md5(microtime() . $host . $this->user), 0, 4)); - $_host = ($this->prefs['ssl_mode'] === 'tls' ? 'tls://' : '') . $host . ':' . $this->prefs['port']; + $_host = ($this->prefs['ssl_mode'] === 'tls' ? 'tls://' : 'notls') . $host . ':' . $this->prefs['port']; My config: 'user_backends' => array ( 0 => array ( 'class' => 'OC_User_IMAP', 'arguments' => array ( 0 => 'imap.example.com', 1 => 993, 2 => 'ssl', 3 => '', ), ), ), Now i have no warnings and the authentication works. Best regards |
thank you @fskale |
Hi violoncelloCH , |
Can we please have a permanent fix for this. I do not want to patch the file with every update in the future. |
@fskale how does it look like; did you find some time? |
Hi, |
Add ssl_mode and force_caps to connection params, and correctly handle AUTHENTICATE PLAIN in putLineC to reduce warnings in logs. Signed-off-by: Scott Shambarger <[email protected]>
Since no one has submitted a patch yet, I added one to fix the warnings in a slightly different way by creating the missing connection parameters (ssl_mode & force_caps).... I also included the isset() check in putLineC to handle authenticates that don't use the {#} escaped format too (ie AUTHENTICATE PLAIN), not sure why warnings are created in roundcubemail though :) |
It's not created in roundcubemail, the nextcloud project is using an imap library that is borrowed from the roundcube project. The real question I have is why in line 149 there is a check for parts[$i+1] when you don't seem to have any tests to check that parts is at least 2 elements long ? dumping the content of that array in a temporary file I could see that in a period of 5 minutes the array had a cardinality of 1 every time. The error about indice 1 isn't being found in the parts array is really annoying. @Wuk-jvi's isset() is working of course but that's just a hack and doesn't help understand what the code should really look like (why do we even look for parts[$i+1] and not parts[$i] for example) |
line 149 in "nextcloudinstallfolder"/apps/user_external/lib/imap/imap_rcube.php:
I don't really actually know what this command is doing, but if we remove the "skip 1" for $parts array
just define this variable in this function "connect". line 81 - 83 in "nextcloudinstallfolder"/apps/user_external/lib/imap.php:
If there notdefined/empty/false groupDomain for the domain.tld ($pieces[1]) then $groups = 0. and please use the full nextcloud config.php part which is documented in the README.MD:
And all your messages should be gone! I haven't had any issues with https://github.com/roundcube/roundcubemail/blob/master/program/lib/Roundcube/rcube_imap_generic.php#L986
This only will set $_host to "tls://example.com" or "notlsexample.com" if you set tls as your encryption in "nextcloud config.php" - was it just a try to fix these error messages? Best regards |
That is not how I configured my nextcloud external users, and maybe this is the reason why I got those errors :
This is how it used to be (back in owncloud days)
And this is how it is documented in the config.sample.php that came with nextcloud ($NEXTCLOUDSERVERSRC/config/config.sample.php):
I can't find this sample in the recent nextcloud-server/config/config.sample.php file, but it was there in 15.0.6 (see : https://github.com/nextcloud/server/blob/v15.0.6/config/config.sample.php#L285) |
Add ssl_mode and force_caps to connection params, and correctly handle AUTHENTICATE PLAIN in putLineC to reduce warnings in logs. Signed-off-by: Scott Shambarger <[email protected]>
Fix Issue #56: Undefined Indices in Logs
Steps to reproduce
Expected behaviour
The debug output shouldn't spam the logs.
Actual behaviour
I get like almost every second one of these two errors:
Undefined offset: 1 at /var/www/cloud/public/apps/user_external/lib/imap/imap_rcube.php#149
Undefined index: force_caps at /var/www/cloud/public/apps/user_external/lib/imap/imap_rcube.php#945
Affected Authentication backend
IMAP
The text was updated successfully, but these errors were encountered: