From 54234e011f22cfffbc434eb1e2d05a8a343a83fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Aug 2019 13:26:56 +0200 Subject: [PATCH] Add version of Sabre lib, add log on login errors. Add compatibility with twoauth --- htdocs/admin/dav.php | 12 +++++++++--- htdocs/dav/fileserver.php | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 6ac210c1ddb..005394739f0 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -68,7 +68,6 @@ $head=dav_admin_prepare_head(); dol_fiche_head($head, 'webdav', '', -1, 'action'); - if ($action == 'edit') { print '
'; @@ -76,7 +75,7 @@ if ($action == 'edit') print ''; print ''; - print ''; + print ''; foreach($arrayofparameters as $key => $val) { @@ -112,7 +111,7 @@ if ($action == 'edit') else { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print ''; + print ''; foreach($arrayofparameters as $key => $val) { @@ -177,6 +176,13 @@ if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) } print $message; +print '


'; + +require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php'; +$version = Sabre\DAV\Version::VERSION; +print ''.$langs->trans("BaseOnSabeDavVersion").' : '.$version.''; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 4e99cf92613..143f48d2033 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -72,15 +72,25 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p global $dolibarr_main_authentication; if (empty($user->login)) + { + dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING); return false; + } if ($user->socid > 0) + { + dol_syslog("Failed to authenticate to DAV, use is an external user", LOG_WARNING); return false; + } if ($user->login != $username) + { + dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING); return false; + } // Authentication mode - if (empty($dolibarr_main_authentication)) - $dolibarr_main_authentication='http,dolibarr'; + if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='dolibarr'; + $dolibarr_main_authentication = preg_replace('/twoauth/', 'dolibarr', $dolibarr_main_authentication); + $authmode = explode(',', $dolibarr_main_authentication); $entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'