From 352dcb74a92b964cba046d89645c43af1ed13a80 Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Wed, 29 May 2019 20:07:18 -0700 Subject: [PATCH 1/2] Fix Issue #56: Undefined Indices in Logs 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 --- lib/imap.php | 5 ++--- lib/imap/imap_rcube.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/imap.php b/lib/imap.php index fee0813..37926b1 100644 --- a/lib/imap.php +++ b/lib/imap.php @@ -86,9 +86,8 @@ class OC_User_IMAP extends \OCA\user_external\Base { $params = ["port"=>$this->port, "timeout"=>10]; - if ($this->sslmode !== null){ - $params["ssl_mode"] = $this->sslmode; - } + $params["ssl_mode"] = $this->sslmode ? $this->sslmode : null; + $params["force_caps"] = false; $canconnect = $rcube->connect( $this->mailbox, $username, diff --git a/lib/imap/imap_rcube.php b/lib/imap/imap_rcube.php index f5b5b79..ceec1e5 100644 --- a/lib/imap/imap_rcube.php +++ b/lib/imap/imap_rcube.php @@ -146,7 +146,7 @@ class imap_rcube $res = 0; if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) { for ($i=0, $cnt=count($parts); $i<$cnt; $i++) { - if (preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) { + if (isset($parts[$i+1]) && preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) { // LITERAL+ support if ($this->prefs['literal+']) { $parts[$i+1] = sprintf("{%d+}\r\n", $matches[1]); From 386ed12d2f493691566c860efa096dc74d83f5f1 Mon Sep 17 00:00:00 2001 From: Jonas Sulzer Date: Thu, 27 Jun 2019 09:49:29 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=96=20DOC:=20changes=20to=20imap?= =?UTF-8?q?=5Frcube,=20so=20we=20can=20keep=20track=20of=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonas Sulzer --- lib/imap/imap_rcube.changes2upstream | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/imap/imap_rcube.changes2upstream diff --git a/lib/imap/imap_rcube.changes2upstream b/lib/imap/imap_rcube.changes2upstream new file mode 100644 index 0000000..6f7dea8 --- /dev/null +++ b/lib/imap/imap_rcube.changes2upstream @@ -0,0 +1,24 @@ +commit 97dc6583c41605beda7eced3ba05fc578cfd6111 +Author: Scott Shambarger +Date: Wed May 29 20:07:18 2019 -0700 + + Fix Issue #56: Undefined Indices in Logs + + 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 + +diff --git a/lib/imap/imap_rcube.php b/lib/imap/imap_rcube.php +index f5b5b79..ceec1e5 100644 +--- a/lib/imap/imap_rcube.php ++++ b/lib/imap/imap_rcube.php +@@ -146,7 +146,7 @@ class imap_rcube + $res = 0; + if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) { + for ($i=0, $cnt=count($parts); $i<$cnt; $i++) { +- if (preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) { ++ if (isset($parts[$i+1]) && preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) { + // LITERAL+ support + if ($this->prefs['literal+']) { + $parts[$i+1] = sprintf("{%d+}\r\n", $matches[1]);