plugins/kolab_addressbook

Thomas Brüderli bruederli at kolabsys.com
Fri Jun 27 12:05:48 CEST 2014


 plugins/kolab_addressbook/kolab_addressbook.php |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 6665b7877baf6a96120e5159f45d23ac066336de
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Fri Jun 27 12:05:39 2014 +0200

    Avoid decoding of old-style (non-encoded) address book identifiers

diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index b07e439..dba4ca7 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -370,9 +370,12 @@ class kolab_addressbook extends rcube_plugin
                 $p['instance'] = $this->sources[$p['id']];
             }
             else {
-                $folder = kolab_storage::get_folder(kolab_storage::id_decode($p['id']));
-                if ($folder->type) {  // try with unencoded (old-style) identifier
-                    $folder = kolab_storage::get_folder(kolab_storage::id_decode($p['id'], false));
+                $id = kolab_storage::id_decode($p['id']);
+                if (preg_match('![^A-Za-z0-9/+=]!', $id))  // check for falsely base64 decoded identifier
+                    $id = $p['id'];
+                $folder = kolab_storage::get_folder($id);
+                if (!$folder->type && $id != $p['id']) {  // try with unencoded (old-style) identifier
+                    $folder = kolab_storage::get_folder($p['id']);
                 }
                 if ($folder->type) {
                     $this->sources[$p['id']] = new rcube_kolab_contacts($folder->name);




More information about the commits mailing list