Projects
Kolab:16:Enterprise
kolab-autoconf
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 19
View file
kolab-autoconf.spec
Changed
@@ -29,7 +29,7 @@ %global _ap_sysconfdir %{_sysconfdir}/%{httpd_name} Name: kolab-autoconf -Version: 1.3.5 +Version: 1.3.5.5 Release: 1%{?dist} Summary: Autodiscovery for clients of Kolab Groupware
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +kolab-autoconf (1.3.5.5-1) unstable; urgency=medium + + * New Release + + -- Christian Mollekopf <mollekopf@apheleia-it.ch> Thu, 9 Sep 2024 16:24:02 +0100 + kolab-autoconf (1.3.5-1) unstable; urgency=medium * PHP 8 fixes
View file
kolab-autoconf-1.3.5.tar.gz/docs/kolab-autoconf.conf
Changed
@@ -2,6 +2,7 @@ Alias /autodiscover/autodiscover.xml /usr/share/kolab-autoconf/public_html/index.php Alias /Autodiscover/Autodiscover.xml /usr/share/kolab-autoconf/public_html/index.php Alias /AutoDiscover/AutoDiscover.xml /usr/share/kolab-autoconf/public_html/index.php +Alias /autodiscover/autodiscover.json /usr/share/kolab-autoconf/public_html/index.php # for http://autoconfig.domain.tld Alias /mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html/index.php # for http://domain.tld
View file
kolab-autoconf-1.3.5.tar.gz/lib/AutodiscoverJson.php
Changed
@@ -29,40 +29,49 @@ class AutodiscoverJson extends Autodiscover { + /** + * process incoming request + */ public function handle_request() { Log::debug('Request json: ' . $_SERVER'REQUEST_URI'); - $supportedProtocols = array('autodiscoverv1' => 'AutodiscoverV1'); - if ($this->conf->get('autodiscover', 'activesync')) { - $supportedProtocols'activesync' = 'ActiveSync'; + // check protocol (at this state we don't know if autodiscover is configured) + $allowedProtocols = 'activesync', 'autodiscoverv1'; + if (empty($_GET'Protocol')) { + $this->error( + "A valid value must be provided for the query parameter 'Protocol'", + 'MandatoryParameterMissing' + ); } - - $protocol = isset($_GET'Protocol') ? $_GET'Protocol' : ''; - - // Exit early on unsupported protocol - if (empty($protocol) || !isset($supportedProtocolsstrtolower($protocol))) { - $json = array( - 'ErrorCode' => 'ProtocolNotSupported', - 'ErrorMessage' => 'The given protocol value \u0027' . $protocol . '\u0027 is invalid.' - . ' Supported values are \u0027' . implode(',', $supportedProtocols) . '\u0027' + elseif (!in_array(strtolower($_GET'Protocol'), $allowedProtocols)) { + $this->error( + sprintf( + "The given protocol value '%s' is invalid. Supported values are '%s'", + $_GET'Protocol', + implode(",", $allowedProtocols) + ), + 'InvalidProtocol' ); - - $response = json_encode($json, JSON_PRETTY_PRINT); - Log::debug('Response json: ' . $response); - - http_response_code(400); - header('Content-Type: application/json; charset=' . Autodiscover::CHARSET); - echo $response; - exit; } + // check email if (preg_match('|autodiscover.json/v1.0/(^\?+)|', $_SERVER'REQUEST_URI', $regs)) { $this->email = $regs1; } - else if (!empty($_GET'Email')) { + elseif (!empty($_GET'Email')) { $this->email = $_GET'Email'; } + elseif (!empty($_GET'email')) { + $this->email = $_GET'email'; + } + + if (empty($this->email) || !strpos($this->email, '@')) { + $this->error( + 'A valid smtp address must be provided', + 'MandatoryParameterMissing' + ); + } } /** @@ -70,9 +79,18 @@ */ protected function handle_response() { - if (strtolower($_GET'Protocol') == 'activesync' - && !empty($this->config'activesync') - ) { + if (strtolower($_GET'Protocol') == 'activesync') { + // throw error if activesync is disabled + if (empty($this->config'activesync')) { + $this->error( + sprintf( + "The given protocol value '%s' is invalid. Supported values are '%s'", + $_GET'Protocol', 'autodiscoverv1' + ), + 'InvalidProtocol' + ); + } + if (!preg_match('/^https?:/i', $this->config'activesync')) { $this->config'activesync' = 'https://' . $this->config'activesync' . '/Microsoft-Server-ActiveSync'; } @@ -88,11 +106,29 @@ ); } - $response = json_encode($json, JSON_PRETTY_PRINT); + $response = json_encode($json, JSON_PRETTY_PRINT | JSON_HEX_APOS | JSON_HEX_QUOT); Log::debug('Response json: ' . $response); header('Content-Type: application/json; charset=' . Autodiscover::CHARSET); echo $response; exit; } + + /** + * Send error to the client and exit + */ + protected function error($msg, $code="InternalServerError") + { + http_response_code(400); + $json = array( + 'ErrorCode' => $code, + 'ErrorMessage' => $msg + ); + $response = json_encode($json, JSON_PRETTY_PRINT | JSON_HEX_APOS | JSON_HEX_QUOT); + Log::debug('Error json: ' . $response); + header('Content-Type: application/json; charset=' . Autodiscover::CHARSET); + echo $response; + exit; + } + }
View file
kolab-autoconf-1.3.5.tar.gz/lib/AutodiscoverMicrosoft.php
Changed
@@ -122,6 +122,42 @@ } /** + * Send error to the client and exit + */ + protected function error($msg) + { + $xml = new DOMDocument('1.0', Autodiscover::CHARSET); + $doc = $xml->createElementNS(self::NS, 'Autodiscover'); + $doc = $xml->appendChild($doc); + + $response = $xml->createElement('Response'); + $response = $doc->appendChild($response); + + $error = $xml->createElement('Error'); + list($usec, $sec) = explode(' ', microtime()); + $error->setAttribute('Time',date('H:i:s',$sec).".".substr($usec, 2, 6)); + $error->setAttribute('Id',sprintf("%u",crc32($_SERVER'HTTP_HOST'))); + $response->appendChild($error); + + $code = $xml->createElement('ErrorCode'); + $code->appendChild($xml->createTextNode(600)); + $error->appendChild($code); + + $message = $xml->createElement('Message'); + $message->appendChild($xml->createTextNode($msg)); + $error->appendChild($message); + + $response->appendChild($xml->createElement('DebugData')); + + $xml->formatOutput = true; + Log::debug('Error microsoft: ' . $msg); + + header('Content-type: text/xml; charset=' . Autodiscover::CHARSET); + echo $xml->saveXML(); + exit; + } + + /** * Generates XML response for Activesync */ protected function mobilesync_response()
View file
kolab-autoconf-1.3.5.tar.gz/lib/Conf.php
Changed
@@ -158,7 +158,7 @@ public function expand($str, $custom = false) { - if (preg_match_all('/%\((?P<variable>\w+)\)s/', $str, $matches)) { + if ($str && preg_match_all('/%\((?P<variable>\w+)\)s/', $str, $matches)) { if (isset($matches'variable') && !empty($matches'variable')) { if (is_array($matches'variable')) { foreach ($matches'variable' as $key => $value) {
View file
kolab-autoconf-1.3.5.tar.gz/lib/Log.php
Changed
@@ -184,10 +184,8 @@ return; } - if ($mode == self::ERROR) { - // send error to PHPs error handler if write to file didn't succeed - trigger_error($message, E_USER_ERROR); - } + // send error to PHPs error handler if write to file didn't succeed + trigger_error($message, E_USER_ERROR); } /**
View file
kolab-autoconf.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-autoconf Binary: kolab-autoconf Architecture: all -Version: 1.3.5-1 +Version: 1.3.5.5-1 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Homepage: http://www.kolab.org/
View file
release.sh
Added
@@ -0,0 +1,18 @@ +#!/bin/bash + +set -e +set -x + +./buildtarball.sh + +# Autobump the version +CURRENT_VERSION=$(grep '^Version: ' kolab-autoconf.spec | sed 's/Version: //') +NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '/0-9+\./{$NF++;print}' OFS=.) +echo "Bumping from $CURRENT_VERSION to $NEW_VERSION" + +sed -i "1 s/(.*-1/($NEW_VERSION-1/" debian.changelog +sed -i "s/^Version:.*/Version: $NEW_VERSION-1/" kolab-autoconf.dsc +sed -i "s/^Version:.*/Version: $NEW_VERSION/" kolab-autoconf.spec + +osc ci -m "New release $NEW_VERSION" +osc sr Kolab:16 -m "New release $NEW_VERSION"
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.