Changes of Revision 19
kolab-autoconf.spec
Changed
x
1
2
%global _ap_sysconfdir %{_sysconfdir}/%{httpd_name}
3
4
Name: kolab-autoconf
5
-Version: 1.3.5
6
+Version: 1.3.5.5
7
Release: 1%{?dist}
8
Summary: Autodiscovery for clients of Kolab Groupware
9
10
debian.changelog
Changed
11
1
2
+kolab-autoconf (1.3.5.5-1) unstable; urgency=medium
3
+
4
+ * New Release
5
+
6
+ -- Christian Mollekopf <mollekopf@apheleia-it.ch> Thu, 9 Sep 2024 16:24:02 +0100
7
+
8
kolab-autoconf (1.3.5-1) unstable; urgency=medium
9
10
* PHP 8 fixes
11
kolab-autoconf-1.3.5.tar.gz/docs/kolab-autoconf.conf
Changed
9
1
2
Alias /autodiscover/autodiscover.xml /usr/share/kolab-autoconf/public_html/index.php
3
Alias /Autodiscover/Autodiscover.xml /usr/share/kolab-autoconf/public_html/index.php
4
Alias /AutoDiscover/AutoDiscover.xml /usr/share/kolab-autoconf/public_html/index.php
5
+Alias /autodiscover/autodiscover.json /usr/share/kolab-autoconf/public_html/index.php
6
# for http://autoconfig.domain.tld
7
Alias /mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html/index.php
8
# for http://domain.tld
9
kolab-autoconf-1.3.5.tar.gz/lib/AutodiscoverJson.php
Changed
125
1
2
class AutodiscoverJson extends Autodiscover
3
{
4
5
+ /**
6
+ * process incoming request
7
+ */
8
public function handle_request()
9
{
10
Log::debug('Request json: ' . $_SERVER'REQUEST_URI');
11
12
- $supportedProtocols = array('autodiscoverv1' => 'AutodiscoverV1');
13
- if ($this->conf->get('autodiscover', 'activesync')) {
14
- $supportedProtocols'activesync' = 'ActiveSync';
15
+ // check protocol (at this state we don't know if autodiscover is configured)
16
+ $allowedProtocols = 'activesync', 'autodiscoverv1';
17
+ if (empty($_GET'Protocol')) {
18
+ $this->error(
19
+ "A valid value must be provided for the query parameter 'Protocol'",
20
+ 'MandatoryParameterMissing'
21
+ );
22
}
23
-
24
- $protocol = isset($_GET'Protocol') ? $_GET'Protocol' : '';
25
-
26
- // Exit early on unsupported protocol
27
- if (empty($protocol) || !isset($supportedProtocolsstrtolower($protocol))) {
28
- $json = array(
29
- 'ErrorCode' => 'ProtocolNotSupported',
30
- 'ErrorMessage' => 'The given protocol value \u0027' . $protocol . '\u0027 is invalid.'
31
- . ' Supported values are \u0027' . implode(',', $supportedProtocols) . '\u0027'
32
+ elseif (!in_array(strtolower($_GET'Protocol'), $allowedProtocols)) {
33
+ $this->error(
34
+ sprintf(
35
+ "The given protocol value '%s' is invalid. Supported values are '%s'",
36
+ $_GET'Protocol',
37
+ implode(",", $allowedProtocols)
38
+ ),
39
+ 'InvalidProtocol'
40
);
41
-
42
- $response = json_encode($json, JSON_PRETTY_PRINT);
43
- Log::debug('Response json: ' . $response);
44
-
45
- http_response_code(400);
46
- header('Content-Type: application/json; charset=' . Autodiscover::CHARSET);
47
- echo $response;
48
- exit;
49
}
50
51
+ // check email
52
if (preg_match('|autodiscover.json/v1.0/(^\?+)|', $_SERVER'REQUEST_URI', $regs)) {
53
$this->email = $regs1;
54
}
55
- else if (!empty($_GET'Email')) {
56
+ elseif (!empty($_GET'Email')) {
57
$this->email = $_GET'Email';
58
}
59
+ elseif (!empty($_GET'email')) {
60
+ $this->email = $_GET'email';
61
+ }
62
+
63
+ if (empty($this->email) || !strpos($this->email, '@')) {
64
+ $this->error(
65
+ 'A valid smtp address must be provided',
66
+ 'MandatoryParameterMissing'
67
+ );
68
+ }
69
}
70
71
/**
72
73
*/
74
protected function handle_response()
75
{
76
- if (strtolower($_GET'Protocol') == 'activesync'
77
- && !empty($this->config'activesync')
78
- ) {
79
+ if (strtolower($_GET'Protocol') == 'activesync') {
80
+ // throw error if activesync is disabled
81
+ if (empty($this->config'activesync')) {
82
+ $this->error(
83
+ sprintf(
84
+ "The given protocol value '%s' is invalid. Supported values are '%s'",
85
+ $_GET'Protocol', 'autodiscoverv1'
86
+ ),
87
+ 'InvalidProtocol'
88
+ );
89
+ }
90
+
91
if (!preg_match('/^https?:/i', $this->config'activesync')) {
92
$this->config'activesync' = 'https://' . $this->config'activesync' . '/Microsoft-Server-ActiveSync';
93
}
94
95
);
96
}
97
98
- $response = json_encode($json, JSON_PRETTY_PRINT);
99
+ $response = json_encode($json, JSON_PRETTY_PRINT | JSON_HEX_APOS | JSON_HEX_QUOT);
100
Log::debug('Response json: ' . $response);
101
102
header('Content-Type: application/json; charset=' . Autodiscover::CHARSET);
103
echo $response;
104
exit;
105
}
106
+
107
+ /**
108
+ * Send error to the client and exit
109
+ */
110
+ protected function error($msg, $code="InternalServerError")
111
+ {
112
+ http_response_code(400);
113
+ $json = array(
114
+ 'ErrorCode' => $code,
115
+ 'ErrorMessage' => $msg
116
+ );
117
+ $response = json_encode($json, JSON_PRETTY_PRINT | JSON_HEX_APOS | JSON_HEX_QUOT);
118
+ Log::debug('Error json: ' . $response);
119
+ header('Content-Type: application/json; charset=' . Autodiscover::CHARSET);
120
+ echo $response;
121
+ exit;
122
+ }
123
+
124
}
125
kolab-autoconf-1.3.5.tar.gz/lib/AutodiscoverMicrosoft.php
Changed
44
1
2
}
3
4
/**
5
+ * Send error to the client and exit
6
+ */
7
+ protected function error($msg)
8
+ {
9
+ $xml = new DOMDocument('1.0', Autodiscover::CHARSET);
10
+ $doc = $xml->createElementNS(self::NS, 'Autodiscover');
11
+ $doc = $xml->appendChild($doc);
12
+
13
+ $response = $xml->createElement('Response');
14
+ $response = $doc->appendChild($response);
15
+
16
+ $error = $xml->createElement('Error');
17
+ list($usec, $sec) = explode(' ', microtime());
18
+ $error->setAttribute('Time',date('H:i:s',$sec).".".substr($usec, 2, 6));
19
+ $error->setAttribute('Id',sprintf("%u",crc32($_SERVER'HTTP_HOST')));
20
+ $response->appendChild($error);
21
+
22
+ $code = $xml->createElement('ErrorCode');
23
+ $code->appendChild($xml->createTextNode(600));
24
+ $error->appendChild($code);
25
+
26
+ $message = $xml->createElement('Message');
27
+ $message->appendChild($xml->createTextNode($msg));
28
+ $error->appendChild($message);
29
+
30
+ $response->appendChild($xml->createElement('DebugData'));
31
+
32
+ $xml->formatOutput = true;
33
+ Log::debug('Error microsoft: ' . $msg);
34
+
35
+ header('Content-type: text/xml; charset=' . Autodiscover::CHARSET);
36
+ echo $xml->saveXML();
37
+ exit;
38
+ }
39
+
40
+ /**
41
* Generates XML response for Activesync
42
*/
43
protected function mobilesync_response()
44
kolab-autoconf-1.3.5.tar.gz/lib/Conf.php
Changed
10
1
2
3
public function expand($str, $custom = false)
4
{
5
- if (preg_match_all('/%\((?P<variable>\w+)\)s/', $str, $matches)) {
6
+ if ($str && preg_match_all('/%\((?P<variable>\w+)\)s/', $str, $matches)) {
7
if (isset($matches'variable') && !empty($matches'variable')) {
8
if (is_array($matches'variable')) {
9
foreach ($matches'variable' as $key => $value) {
10
kolab-autoconf-1.3.5.tar.gz/lib/Log.php
Changed
14
1
2
return;
3
}
4
5
- if ($mode == self::ERROR) {
6
- // send error to PHPs error handler if write to file didn't succeed
7
- trigger_error($message, E_USER_ERROR);
8
- }
9
+ // send error to PHPs error handler if write to file didn't succeed
10
+ trigger_error($message, E_USER_ERROR);
11
}
12
13
/**
14
kolab-autoconf.dsc
Changed
10
1
2
Source: kolab-autoconf
3
Binary: kolab-autoconf
4
Architecture: all
5
-Version: 1.3.5-1
6
+Version: 1.3.5.5-1
7
Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>
8
Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com>
9
Homepage: http://www.kolab.org/
10
release.sh
Added
20
1
2
+#!/bin/bash
3
+
4
+set -e
5
+set -x
6
+
7
+./buildtarball.sh
8
+
9
+# Autobump the version
10
+CURRENT_VERSION=$(grep '^Version: ' kolab-autoconf.spec | sed 's/Version: //')
11
+NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '/0-9+\./{$NF++;print}' OFS=.)
12
+echo "Bumping from $CURRENT_VERSION to $NEW_VERSION"
13
+
14
+sed -i "1 s/(.*-1/($NEW_VERSION-1/" debian.changelog
15
+sed -i "s/^Version:.*/Version: $NEW_VERSION-1/" kolab-autoconf.dsc
16
+sed -i "s/^Version:.*/Version: $NEW_VERSION/" kolab-autoconf.spec
17
+
18
+osc ci -m "New release $NEW_VERSION"
19
+osc sr Kolab:16 -m "New release $NEW_VERSION"
20