~ubuntu-branches/ubuntu/precise/ejabberd/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/erlang-otp-r14-ssl.patch

  • Committer: Bazaar Package Importer
  • Author(s): Konstantin Khomoutov, Konstantin Khomoutov
  • Date: 2010-07-26 20:36:14 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20100726203614-s3asj0k5ym3bxhdw
Tags: 2.1.4-1
[ Konstantin Khomoutov ]
* Do not prevent ejabberd_debug from being installed and used
  as this was implemented upstream as the default behavior.
* Add build dependency on erlang-parsetools.
* Add 'sharedscripts' option to logrotate config.
* Update VCS references in control file to point to git.deb.at.
* Add group sticky bit to permissions on the log directory --
  this should make log files owned by the group "adm".
* Explicitly set umask to 027 before starting erl.
* Add patch with fix for EJAB-953 (closes: #590389).
* Fix call to setup_ejabberd in postinst.
* Fix owner/permissions for log files when upgrading.
* Minor fixes and clarifications in ejabberdctl.8 manual page.
* Refresh reopen-log.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: When building for Erlang/OTP R14, use public_key library
 
2
 This fixes configuration/compilation problems due ejabberd using
 
3
 private functions from Erlang/OTP ssl library which became
 
4
 deprecated in Erlang/OTP R14A.
 
5
 .
 
6
 The patch was slightly modified to incorporate certain changes
 
7
 directly to the configure script instead of aclocal.m4.
 
8
From: Badlop <badlop@process-one.net>
 
9
Origin: upstream, https://support.process-one.net/secure/attachment/16887/953-21-r14.diff
 
10
Bug: https://support.process-one.net/browse/EJAB-953
 
11
 
 
12
--- a/src/Makefile.in
 
13
+++ b/src/Makefile.in
 
14
@@ -30,7 +30,7 @@
 
15
   INIT_USER=$(INSTALLUSER)
 
16
 endif
 
17
 
 
18
-EFLAGS += @ERLANG_SSL39@ -pa .
 
19
+EFLAGS += @ERLANG_SSLVER@ -pa .
 
20
 
 
21
 # make debug=true to compile Erlang module with debug informations.
 
22
 ifdef debug
 
23
--- a/src/ejabberd_s2s_in.erl
 
24
+++ b/src/ejabberd_s2s_in.erl
 
25
@@ -48,6 +48,11 @@
 
26
 
 
27
 -include("ejabberd.hrl").
 
28
 -include("jlib.hrl").
 
29
+-ifdef(SSL40).
 
30
+-include_lib("public_key/include/public_key.hrl"). 
 
31
+-define(PKIXEXPLICIT, 'OTP-PUB-KEY').
 
32
+-define(PKIXIMPLICIT, 'OTP-PUB-KEY').
 
33
+-else.
 
34
 -ifdef(SSL39).
 
35
 -include_lib("ssl/include/ssl_pkix.hrl").
 
36
 -define(PKIXEXPLICIT, 'OTP-PKIX').
 
37
@@ -58,6 +63,7 @@
 
38
 -define(PKIXEXPLICIT, 'PKIX1Explicit88').
 
39
 -define(PKIXIMPLICIT, 'PKIX1Implicit88').
 
40
 -endif.
 
41
+-endif.
 
42
 -include("XmppAddr.hrl").
 
43
 
 
44
 -define(DICT, dict).
 
45
--- a/src/tls/Makefile.in
 
46
+++ b/src/tls/Makefile.in
 
47
@@ -21,6 +21,7 @@
 
48
     DYNAMIC_LIB_CFLAGS = -KPIC -G -z text
 
49
 endif
 
50
 
 
51
+EFLAGS += @ERLANG_SSLVER@
 
52
 EFLAGS += -I ..
 
53
 EFLAGS += -pz ..
 
54
 
 
55
--- a/src/tls/tls.erl
 
56
+++ b/src/tls/tls.erl
 
57
@@ -61,6 +61,13 @@
 
58
 -define(GET_VERIFY_RESULT,    8).
 
59
 -define(VERIFY_NONE, 16#10000).
 
60
 
 
61
+-ifdef(SSL40).
 
62
+-define(CERT_DECODE, {public_key, pkix_decode_cert, plain}).
 
63
+-else.
 
64
+-define(CERT_DECODE, {ssl_pkix, decode_cert, [pkix]}).
 
65
+-endif.
 
66
+
 
67
+
 
68
 -record(tlssock, {tcpsock, tlsport}).
 
69
 
 
70
 start() ->
 
71
@@ -232,7 +239,8 @@
 
72
 get_peer_certificate(#tlssock{tlsport = Port}) ->
 
73
     case port_control(Port, ?GET_PEER_CERTIFICATE, []) of
 
74
        <<0, BCert/binary>> ->
 
75
-           case catch ssl_pkix:decode_cert(BCert, [pkix]) of
 
76
+           {CertMod, CertFun, CertSecondArg} = ?CERT_DECODE,
 
77
+           case catch apply(CertMod, CertFun, [BCert, CertSecondArg]) of
 
78
                {ok, Cert} ->
 
79
                    {ok, Cert};
 
80
                _ ->
 
81
--- a/src/web/Makefile.in
 
82
+++ b/src/web/Makefile.in
 
83
@@ -9,7 +9,7 @@
 
84
 ERLANG_CFLAGS = @ERLANG_CFLAGS@
 
85
 ERLANG_LIBS = @ERLANG_LIBS@
 
86
 
 
87
-EFLAGS += @ERLANG_SSL39@
 
88
+EFLAGS += @ERLANG_SSLVER@
 
89
 EFLAGS += -I ..
 
90
 EFLAGS += -pz ..
 
91
 
 
92
--- a/src/web/mod_http_fileserver.erl
 
93
+++ b/src/web/mod_http_fileserver.erl
 
94
@@ -66,11 +66,15 @@
 
95
                  headers
 
96
                 }).
 
97
 
 
98
+-ifdef(SSL40).
 
99
+-define(STRING2LOWER, string).
 
100
+-else.
 
101
 -ifdef(SSL39).
 
102
 -define(STRING2LOWER, string).
 
103
 -else.
 
104
 -define(STRING2LOWER, httpd_util).
 
105
 -endif.
 
106
+-endif.
 
107
 
 
108
 -record(state, {host, docroot, accesslog, accesslogfd, directory_indices,
 
109
                 custom_headers, default_content_type, content_types = []}).
 
110
--- a/src/configure
 
111
+++ b/src/configure
 
112
@@ -644,7 +644,7 @@
 
113
 GREP
 
114
 CPP
 
115
 LIBICONV
 
116
-ERLANG_SSL39
 
117
+ERLANG_SSLVER
 
118
 ERLANG_LIBS
 
119
 ERLANG_CFLAGS
 
120
 ERL
 
121
@@ -3180,7 +3180,6 @@
 
122
 -author('alexey@sevcom.net').
 
123
 
 
124
 -export([start/0]).
 
125
--include_lib("ssl/include/ssl_pkix.hrl").
 
126
 
 
127
 start() ->
 
128
     EIDirS = code:lib_dir("erl_interface") ++ "\n",
 
129
@@ -3189,11 +3188,13 @@
 
130
     file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ ssldef() ++ RootDirS)),
 
131
     halt().
 
132
 
 
133
--ifdef('id-pkix').
 
134
-ssldef() -> "-DSSL39\n".
 
135
--else.
 
136
-ssldef() -> "\n".
 
137
--endif.
 
138
+ssldef() -> 
 
139
+   OTP = (catch erlang:system_info(otp_release)),
 
140
+   if
 
141
+       OTP >= "R14" -> "-DSSL40\n";
 
142
+       OTP >= "R12" -> "-DSSL39\n";
 
143
+        true -> ""
 
144
+   end.
 
145
 
 
146
 %% return physical architecture based on OS/Processor
 
147
 archname() ->
 
148
@@ -3243,7 +3244,7 @@
 
149
    # Second line
 
150
    ERLANG_EI_LIB=`cat conftest.out | head -n 2 | tail -n 1`
 
151
    # Third line
 
152
-   ERLANG_SSL39=`cat conftest.out | head -n 3 | tail -n 1`
 
153
+   ERLANG_SSLVER=`cat conftest.out | head -n 3 | tail -n 1`
 
154
    # End line
 
155
    ERLANG_DIR=`cat conftest.out | tail -n 1`
 
156