From 50569114acdc64e7c7cae1498635d3f821517c30 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Mar 2016 15:53:16 +0100 Subject: Initial commit of the Faster IT roundcube_calendar plugin distribution This includes: * Kolab plugins 3.2.9 (calendar and libcalendaring) * CalDAV driver 3.2.8 * .htaccess files for at least some security * SabreDAV updated to 1.8.12 (Jan 2015 release) * Support for CURLOPT_SSL_* settings to allow self-signed certificates * Small fixes & improved documentation --- .../lib/OldSabre/DAV/Auth/Backend/File.php | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 calendar/lib/SabreDAV/lib/OldSabre/DAV/Auth/Backend/File.php (limited to 'calendar/lib/SabreDAV/lib/OldSabre/DAV/Auth/Backend/File.php') diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Auth/Backend/File.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Auth/Backend/File.php new file mode 100644 index 0000000..8710832 --- /dev/null +++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Auth/Backend/File.php @@ -0,0 +1,77 @@ +loadFile($filename); + + } + + /** + * Loads an htdigest-formatted file. This method can be called multiple times if + * more than 1 file is used. + * + * @param string $filename + * @return void + */ + public function loadFile($filename) { + + foreach(file($filename,FILE_IGNORE_NEW_LINES) as $line) { + + if (substr_count($line, ":") !== 2) + throw new DAV\Exception('Malformed htdigest file. Every line should contain 2 colons'); + + list($username,$realm,$A1) = explode(':',$line); + + if (!preg_match('/^[a-zA-Z0-9]{32}$/', $A1)) + throw new DAV\Exception('Malformed htdigest file. Invalid md5 hash'); + + $this->users[$realm . ':' . $username] = $A1; + + } + + } + + /** + * Returns a users' information + * + * @param string $realm + * @param string $username + * @return string + */ + public function getDigestHash($realm, $username) { + + return isset($this->users[$realm . ':' . $username])?$this->users[$realm . ':' . $username]:false; + + } + +} -- cgit v1.2.3