apache 2.4
Hanno Böck

Hanno Böck commited on 2013-02-07 10:40:08
Zeige 4 geänderte Dateien mit 792 Einfügungen und 0 Löschungen.

... ...
@@ -1,12 +1,17 @@
1 1
 AUX 2.2.22-envvars-std.in 1071 SHA256 1721b424f2335640e49d71e671a4be15424d29fe90f55fe4f52bd241a998d3ee SHA512 c18fd461f02ab79fc456a1ad99bf91c8891ecdabd90f41437ebf87e20b3d28d2006a10d6726164c2f0333e7aee350bd125838abaff3a188d8ab2f5f34d3e5466 WHIRLPOOL 59cbee68fc8012df01229b8d5e38045eb974bab3f08ebf5b01097dabb5275bb83e28cd09a058ce71949ca4a2439811cff457d4c7df88d7b3fc5318c6b7ef0075
2 2
 AUX apache-2.2.14-staticdhparameters.diff 11745 SHA256 1fecd496f7df6438cf44b331a0b15d6ceaa0522fcb20d7246772f10f7c3c41df SHA512 5c7fa11b29efd430ddc7144ed8d656c82d9609c9da720cd5d217626505b2257c074bea1ef0f4f2c50b123be58d82fbefac3240b71c3b8c3b9b087c30b090bcf9 WHIRLPOOL ced66883bd7fc4ec868a5d6091cdc765424541c183e53283749d73d4f4b53d0c9221950df816625de9bd115f610931e91b1fac819530294fcb12a0a39b7f6f2c
3 3
 AUX apache-2.2.23-tls-compression-option.diff 4211 SHA256 6ccc0003f486734e660292ac2640d99af830443c09a2d5c9d6aaf371b636d9bd SHA512 915044023b10afca9a67ca90fa4d1175d4d3ef7274308df74c78b0972fd7ec54e3fdb3f4b03ecbfc543b64153b232a140cc8e095b2f74abfcfa0cb86e21fb612 WHIRLPOOL 028be436ac78adcb631b109a23ab7f4b5c2349a95202f8ed33a111b9b2048675892b160ac737875ebe7a73937f8868d665d016a61bdbaec301eacbbad0d1cc05
4
+AUX apache-2.4.3-dhparam.diff 12684 SHA256 5185da7eecf04f26cc496a25fabe420db065e59dd088eca51b8c08f0238d12ad SHA512 c49e4c6e607cf5bf11e59c929791d806b15ff30d11e8473e633f2ef406e5d926a2ced1910672e5263f8ea45de6f30eb37048065c1d9fbd11fb7c52603e93bd4b WHIRLPOOL 41e2ac7c8c0734e3132639db7222e488b8ffd18a6c2f2e76b401fdc0b71fc528f3d80eb3d95710084b9fa88e29ce916df215c79b47d80c3ae25188f4cea79e9c
4 5
 AUX apache-noip.diff 417 SHA256 c9ed84fec20e69f711600261a395a3d4b3ae2685318f6354c4d2ebd01c0ec4cc SHA512 fa684688e707f5fb511b228b8fa9b0f996dbf615f2f9b6478ab478e801f14c65a7381137cdbda648d68f7818891085c744da3a8249843e73bdf5ef247a90d3fe WHIRLPOOL d2636a34b0d48139adef125e76ef477d84bf7cd9785f094fe57c1d81b45e7392622d232bee5f53896d8b48eb9b3241cd48cbb585ea70d97a872c5cd3f6bfe420
6
+AUX apache-npn 9799 SHA256 6e41b59680832b074246dd24a41aec56f9bb35ab4f34674cd20e32f1289c21ab SHA512 60d9c6f750562f087b607edf7939195f31b7e0101b9c8d1c883e3b01da192d354fc291d45832757ab50c029f99ac4ad06fa9b7ce4e5928367d1f89278fa79fa3 WHIRLPOOL 162dba8354efeccbb100a86cb61e47c0a96be11a057cfffccc194abd31721b99f4ef3e5fc9b4a7e82a7495d1369af1be3f7b3d4339ec33af24858a0049474331
5 7
 AUX httpd-2.2.16-ecc.diff 8236 SHA256 e7fe97852875de06372d8413248fa20419946e2ab7de5198c93bffa6b5a68461 SHA512 8b54c30f9edc76bd8969ee894038f267d722d1ab8c7332a84fe21704bde0451e1a27503252fa87bd0f749dac3281eb266cda36aa7faec1a36ee6e67a8f9ae6c7 WHIRLPOOL 2d8ad3cd12b27937dcafef31df8c9fa048fb4e1ed06109e745fbe12dc869ceaa21fa2e62aa9bcb729d7fb426c1ee0a82171b5038cac56f8b8ebbc3cd3569daa9
6 8
 DIST gentoo-apache-2.2.22-20120213.tar.bz2 64507 SHA256 737730dabf1e1ccfe9d409067dc3c4d37d16f7fa1e792f5bf39268d904ce1c31 SHA512 f364bdbee967b3bc797d2053b9eb347af963f99275441093930d0057465e1a12567106f5c5ac21a45a4bbd4b353ce67553038d6146f469a7bf980a9148471170 WHIRLPOOL f5a3ab44fc14ddf67ccf0785006b1d9f5c49b915114f9d7e97858fba447a5ee872c741e73c17e121b61cc0aa678b42dc154616cd64054461c552d3a8c29f4f17
7 9
 DIST gentoo-apache-2.2.23-20121012.tar.bz2 64135 SHA256 711a88f26c58b10b082f7ff411366cd768f9450101da050438a2f77abeab7333 SHA512 92a49f954b82d4427862f41977625a60641731cc25ab3efdd666be8db839038e7b1c2ef2f878d5efed243eaa63237e88ee4993cd25cca1dfbb0f56a6b2093d57 WHIRLPOOL 221d9c0cf999430afc11a8e48ae67019c7f31daca827a5db7615aca24859788743e5da00e4c99b7b7b375e58fafd6c148339e5671be939dbc30735031e12c49f
10
+DIST gentoo-apache-2.4.3-20121012.tar.bz2 24541 SHA256 aeed23c716f05d7430a6d905fb75c192418c9ba90feb96fcc474138c4addfd69 SHA512 fe37c91328bf090aacd4012030845b2e4461a116b9b60d95108c4a4749729bef5ac526d4bd3570406f3d7afe41b0f634c2e9a167ee416a56f5f82f46eb27cc26 WHIRLPOOL 421efb4a7940b52cbc2e054c5ef2f79ff19c13a3140941ec659da3ff61a70491485c1c375db29b1fa6c4dc45761df1f0fc63bd3d867c8937d33f5b6c948bade0
8 11
 DIST httpd-2.2.22.tar.bz2 5378934 SHA256 dcdc9f1dc722f84798caf69d69dca78daa5e09a4269060045aeca7e4f44cb231 SHA512 b6901453aaef3cac31cf763f7748e06a2492e1f72e4158627f38e45423a9bcd9bea1f74ba1a1ec9a5c7fc554eb062ea61b944e2001f19825def2e530ce8a42bc WHIRLPOOL 32a03d638f82d791effdce888a02e66189d6fe87c2179ab9f3de034fbf5c8311d24835f28e9a18addb847aa6859ed817bf2e11833e315285474eefcea6f56891
9 12
 DIST httpd-2.2.23.tar.bz2 5485205 SHA256 14fe79bd6edd957c02cb41f4175e132c08e6ff74a7d08dc1858dd8224e351c34 SHA512 69b3bc942b2a91cdb57356a5c57078794db2d8404a23080a2621cdf33ae2d9bdbbacd0f6e95fd6e71fbfa87e94942be0a014c3e8709148f991e391d03aa6dee2 WHIRLPOOL 8d00184aff654b2d7f1c5ebd471f19ffcb57107ea37179fa05c424424d7b70ff0c9abf3be68ed9f0d091b3c057f1ba24cb989937e35087c3199f82e3dddbbd4f
13
+DIST httpd-2.4.3.tar.bz2 4559279 SHA256 d82102b9c111f1892fb20a2bccf4370de579c6521b2f172ed0b36f2759fb249e SHA512 d4501ae69aacb75d960bc8cb61c9e1ff52e6e42a37c37ca84c839262e183ca2f305794da28266aa2119d211ba0f4531705f66330079ab594c05e92ae8196d1ab WHIRLPOOL 4ffb7dc8057200f676557a70591d6938e92a8990d88dc88237d278f185290d260312dd8cfdd08994ffd7b7280502b3debea0f3e02acc718dd9db613222b6d2ae
10 14
 EBUILD apache-2.2.22-r1.ebuild 3206 SHA256 4c72b2164c32c34e85c6a8e99c68464e5505eeb79bf94eed7ad1d62ba2045c0e SHA512 bafab5ef6f8d8675614473c01ae71655b1cd94b75658353e8351df1cb8b9667b2164d501f98b4492810a2ec2d3415db6c5df416bc51aed4fc4ec6fc4a155288b WHIRLPOOL d6f4c9b06b3cfcad613084bb7902c7ba942848a8233b50ff48474e7407c3e1d4523f44a0ca9f0790510122719609ec767afbaf3fdd60b6dd7918fe409e9b08a2
11 15
 EBUILD apache-2.2.22.ebuild 3001 SHA256 cf930cea2f7e8a8bd2f7cabe7de9ecf56efb33d10bd3fe2d70acaa6e86cebb0c SHA512 1de2c503698334b00c3b44cad9680d8699e7ad21c80a746af4154d03433da4bcc072cf572d2ce9dbf478f6c97423ee2650521d877f2c62a27ec0189d5c66c045 WHIRLPOOL aadae0ae48a37cdd5ed3995c92fa5bf925fd2c12792cdcce08305191c09703a80bd7bc264c61165e8c26687bde97ad543722d04e090620cd7fe473c76688e233
12 16
 EBUILD apache-2.2.23.ebuild 3181 SHA256 b6502801683bcd8708e247fd11e8d7a639a7412f77d3a631827705f20e43c878 SHA512 860dce68ab969c4bacdedc3fec4d48937d7a331921e86fe02d6b1481a59cd8997d336b9c9bbc6cf9a69dd3719acc411abae1809e7770b42d31adb1cefd5dc560 WHIRLPOOL e2e128e74236c6a306d511cdc8d1e9799e9818fc842a1884eb48a8ef8683669ba321ca228ec780015e1c88044cff2904652c4a1c93a2f3af84e3552c8e7d3363
17
+EBUILD apache-2.4.3.ebuild 7203 SHA256 082ee4bc36fe78621a32ad8ae3f3117943b5572e1456618d1b547cf344c4d687 SHA512 56786dc2e5f835e1894760ad85bfba6ffd531b50e7e9f782240ac2deb7464a2aa222cd04495ab7bd81f0e30c91972f417857c9fd4ee53587ebc91ba6a542c41e WHIRLPOOL 4e8e22861a21d8defd9c8eb57fc5548ba38a911db640fc63b6a15fdcfcf86c8fbf50b09f78321ea784bf81340718242d5a7fa6c6ed1c4e0c31a4e79affc64d24
... ...
@@ -0,0 +1,214 @@
1
+# Copyright 1999-2012 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.4.3.ebuild,v 1.2 2012/10/13 03:13:09 mr_bones_ Exp $
4
+
5
+EAPI="2"
6
+
7
+# latest gentoo apache files
8
+GENTOO_PATCHSTAMP="20121012"
9
+GENTOO_DEVELOPER="patrick"
10
+#GENTOO_PATCHNAME="gentoo-apache-2.4.1"
11
+
12
+# IUSE/USE_EXPAND magic
13
+IUSE_MPMS_FORK="itk peruser prefork"
14
+IUSE_MPMS_THREAD="event worker"
15
+
16
+# << obsolete modules:
17
+# authn_default authz_default mem_cache
18
+# mem_cache is replaced by cache_disk
19
+# ?? buggy modules
20
+# proxy_scgi: startup error: undefined symbol "ap_proxy_release_connection", no fix found
21
+# >> added modules for reason:
22
+# compat: compatibility with 2.2 access control
23
+# authz_host: new module for access control
24
+# authn_core: functionality provided by authn_alias in previous versions
25
+# authz_core: new module, provides core authorization capabilities
26
+# cache_disk: replacement for mem_cache
27
+# lbmethod_byrequests: Split off from mod_proxy_balancer in 2.3
28
+# lbmethod_bytraffic: Split off from mod_proxy_balancer in 2.3
29
+# lbmethod_bybusyness: Split off from mod_proxy_balancer in 2.3
30
+# lbmethod_heartbeat: Split off from mod_proxy_balancer in 2.3
31
+# slotmem_shm: Slot-based shared memory provider (for lbmethod_byrequests).
32
+# socache_shmcb: shared object cache provider. Default config with ssl needs it
33
+# unixd: fixes startup error: Invalid command 'User'
34
+IUSE_MODULES="access_compat actions alias asis auth_basic auth_digest authn_alias authn_anon
35
+authn_core authn_dbd authn_dbm authn_file authz_core authz_dbm
36
+authz_groupfile authz_host authz_owner authz_user autoindex cache cache_disk cern_meta
37
+charset_lite cgi cgid dav dav_fs dav_lock dbd deflate dir dumpio
38
+env expires ext_filter file_cache filter headers ident imagemap include info
39
+lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat
40
+log_config log_forensic logio mime mime_magic negotiation proxy
41
+proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi rewrite
42
+reqtimeout setenvif slotmem_shm speling socache_shmcb status substitute unique_id userdir usertrack
43
+unixd version vhost_alias"
44
+# The following are also in the source as of this version, but are not available
45
+# for user selection:
46
+# bucketeer case_filter case_filter_in echo http isapi optional_fn_export
47
+# optional_fn_import optional_hook_export optional_hook_import
48
+
49
+# inter-module dependencies
50
+# TODO: this may still be incomplete
51
+MODULE_DEPENDS="
52
+	dav_fs:dav
53
+	dav_lock:dav
54
+	deflate:filter
55
+	cache_disk:cache
56
+	ext_filter:filter
57
+	file_cache:cache
58
+	lbmethod_byrequests:proxy_balancer
59
+	lbmethod_byrequests:slotmem_shm
60
+	lbmethod_bytraffic:proxy_balancer
61
+	lbmethod_bybusyness:proxy_balancer
62
+	lbmethod_heartbeat:proxy_balancer
63
+	log_forensic:log_config
64
+	logio:log_config
65
+	cache_disk:cache
66
+	mime_magic:mime
67
+	proxy_ajp:proxy
68
+	proxy_balancer:proxy
69
+	proxy_connect:proxy
70
+	proxy_ftp:proxy
71
+	proxy_http:proxy
72
+	proxy_scgi:proxy
73
+	substitute:filter
74
+"
75
+
76
+# module<->define mappings
77
+MODULE_DEFINES="
78
+	auth_digest:AUTH_DIGEST
79
+	authnz_ldap:AUTHNZ_LDAP
80
+	cache:CACHE
81
+	cache_disk:CACHE
82
+	dav:DAV
83
+	dav_fs:DAV
84
+	dav_lock:DAV
85
+	file_cache:CACHE
86
+	info:INFO
87
+	ldap:LDAP
88
+	proxy:PROXY
89
+	proxy_ajp:PROXY
90
+	proxy_balancer:PROXY
91
+	proxy_connect:PROXY
92
+	proxy_ftp:PROXY
93
+	proxy_http:PROXY
94
+	socache_shmcb:SSL
95
+	ssl:SSL
96
+	status:STATUS
97
+	suexec:SUEXEC
98
+	userdir:USERDIR
99
+"
100
+
101
+# critical modules for the default config
102
+MODULE_CRITICAL="
103
+	authn_core
104
+	authz_core
105
+	authz_host
106
+	dir
107
+	mime
108
+	unixd
109
+"
110
+# dependend criticals
111
+use ssl && MODULE_CRITICAL+=" socache_shmcb"
112
+use doc && MODULE_CRITICAL+=" alias negotiation setenvif"
113
+
114
+inherit eutils apache-2
115
+
116
+DESCRIPTION="The Apache Web Server."
117
+HOMEPAGE="http://httpd.apache.org/"
118
+
119
+# some helper scripts are Apache-1.1, thus both are here
120
+LICENSE="Apache-2.0 Apache-1.1"
121
+SLOT="2"
122
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
123
+IUSE=""
124
+
125
+DEPEND="${DEPEND}
126
+	>=dev-libs/openssl-0.9.8m
127
+	apache2_modules_deflate? ( sys-libs/zlib )"
128
+
129
+# dependency on >=dev-libs/apr-1.4.5 for bug #368651
130
+RDEPEND="${RDEPEND}
131
+	>=dev-libs/apr-1.4.5
132
+	>=dev-libs/openssl-0.9.8m
133
+	apache2_modules_mime? ( app-misc/mime-types )"
134
+
135
+# init script fixup - should be rolled into next tarball #389965
136
+src_prepare() {
137
+	epatch "${FILESDIR}"/apache-npn
138
+	epatch "${FILESDIR}"/apache-2.4.3-dhparam.diff
139
+	# the following patch can be removed once it is included in
140
+	# GENTOO_PATCHNAME="gentoo-apache-2.4.1" ...
141
+	if [ -f "${FILESDIR}/${GENTOO_PATCHNAME}-${GENTOO_DEVELOPER}-${GENTOO_PATCHSTAMP}-${PVR}.patch" ]; then
142
+		cd "${GENTOO_PATCHDIR}" || die "Failed to cd to ${GENTOO_PATCHDIR}"
143
+		epatch "${FILESDIR}/${GENTOO_PATCHNAME}-${GENTOO_DEVELOPER}-${GENTOO_PATCHSTAMP}-${PVR}.patch" \
144
+			|| die "epatch failed"
145
+		cd "${S}" || die "Failed to cd to ${S}"
146
+	fi
147
+	apache-2_src_prepare
148
+	sed -i -e 's/! test -f/test -f/' "${GENTOO_PATCHDIR}"/init/apache2.initd || die "Failed to fix init script"
149
+}
150
+
151
+src_install() {
152
+	apache-2_src_install
153
+	for i in /usr/bin/{htdigest,logresolve,htpasswd,htdbm,ab,httxt2dbm}; do
154
+		rm "${D}"/$i || die "Failed to prune apache-tools bits"
155
+	done
156
+	for i in /usr/share/man/man8/{rotatelogs.8,htcacheclean.8}; do
157
+		rm "${D}"/$i || die "Failed to prune apache-tools bits"
158
+	done
159
+	for i in /usr/share/man/man1/{logresolve.1,htdbm.1,htdigest.1,htpasswd.1,dbmmanage.1,ab.1}; do
160
+		rm "${D}"/$i || die "Failed to prune apache-tools bits"
161
+	done
162
+	for i in /usr/sbin/{checkgid,fcgistarter,htcacheclean,rotatelogs}; do
163
+		rm "${D}/"$i || die "Failed to prune apache-tools bits"
164
+	done
165
+
166
+	# well, actually installing things makes them more installed, I guess?
167
+	cp "${S}"/support/apxs "${D}"/usr/sbin/apxs || die "Failed to install apxs"
168
+	chmod 0755 "${D}"/usr/sbin/apxs
169
+
170
+	# create dir defined in 40_mod_ssl.conf
171
+	if use ssl; then
172
+		dodir /var/run/apache_ssl_mutex || die "Failed to mkdir ssl_mutex"
173
+	fi
174
+}
175
+
176
+pkg_postinst()
177
+{
178
+	apache-2_pkg_postinst || die "apache-2_pkg_postinst failed"
179
+	# warnings that default config might not work out of the box
180
+	for mod in $MODULE_CRITICAL; do
181
+		if ! use "apache2_modules_${mod}"; then
182
+			echo
183
+			ewarn "Warning: Critical module not installed!"
184
+			ewarn "Modules 'authn_core', 'authz_core' and 'unixd'"
185
+			ewarn "are highly recomended but might not be in the base profile yet."
186
+			ewarn "Default config for ssl needs module 'socache_shmcb'."
187
+			ewarn "Enabling the following flags is highly recommended:"
188
+			for cmod in $MODULE_CRITICAL; do
189
+				use "apache2_modules_${cmod}" || \
190
+					ewarn "+ apache2_modules_${cmod}"
191
+			done
192
+			echo
193
+			break
194
+		fi
195
+	done
196
+	# warning for proxy_balancer and missing load balancing scheduler
197
+	if use apache2_modules_proxy_balancer; then
198
+		local lbset=
199
+		for mod in lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat; do
200
+			if use "apache2_modules_${mod}"; then
201
+				lbset=1 && break
202
+			fi
203
+		done
204
+		if [ ! $lbset ]; then
205
+			echo
206
+			ewarn "Info: Missing load balancing scheduler algorithm module"
207
+			ewarn "(They were split off from proxy_balancer in 2.3)"
208
+			ewarn "In order to get the ability of load balancing, at least"
209
+			ewarn "one of these modules has to be present:"
210
+			ewarn "lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat"
211
+			echo
212
+		fi
213
+	fi
214
+}
... ...
@@ -0,0 +1,331 @@
1
+diff -Naur httpd-2.4.3/modules/ssl/mod_ssl.c httpd-2.4.3-dh/modules/ssl/mod_ssl.c
2
+--- httpd-2.4.3/modules/ssl/mod_ssl.c	2012-08-05 15:48:40.000000000 +0200
3
++++ httpd-2.4.3-dh/modules/ssl/mod_ssl.c	2012-10-23 16:10:39.905810300 +0200
4
+@@ -88,6 +88,9 @@
5
+     SSL_CMD_SRV(CertificateKeyFile, TAKE1,
6
+                 "SSL Server Private Key file "
7
+                 "('/path/to/file' - PEM or DER encoded)")
8
++    SSL_CMD_SRV(DHParametersFile, TAKE1,
9
++                "SSL Server Diffie-Hellman parameters file "
10
++                "(`/path/to/file' - PEM or DER encoded)")
11
+     SSL_CMD_SRV(CertificateChainFile, TAKE1,
12
+                 "SSL Server CA Certificate Chain file "
13
+                 "('/path/to/file' - PEM encoded)")
14
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_config.c httpd-2.4.3-dh/modules/ssl/ssl_engine_config.c
15
+--- httpd-2.4.3/modules/ssl/ssl_engine_config.c	2012-08-05 15:48:40.000000000 +0200
16
++++ httpd-2.4.3-dh/modules/ssl/ssl_engine_config.c	2012-10-23 16:10:39.907810276 +0200
17
+@@ -67,6 +67,7 @@
18
+     mc->tVHostKeys             = apr_hash_make(pool);
19
+     mc->tPrivateKey            = apr_hash_make(pool);
20
+     mc->tPublicCert            = apr_hash_make(pool);
21
++    mc->tDHParams              = apr_hash_make(pool);
22
+ #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
23
+     mc->szCryptoDevice         = NULL;
24
+ #endif
25
+@@ -182,6 +183,9 @@
26
+ 
27
+     /* mctx->pks->... certs/keys are set during module init */
28
+ 
29
++    mctx->pks->dhparams_file = NULL;
30
++    mctx->pks->dhparams     = NULL;
31
++
32
+ #ifdef HAVE_TLS_SESSION_TICKETS
33
+     mctx->ticket_key = apr_pcalloc(p, sizeof(*mctx->ticket_key));
34
+ #endif
35
+@@ -302,6 +306,7 @@
36
+ 
37
+     cfgMergeString(pks->ca_name_path);
38
+     cfgMergeString(pks->ca_name_file);
39
++    cfgMergeString(pks->dhparams_file);
40
+ 
41
+ #ifdef HAVE_TLS_SESSION_TICKETS
42
+     cfgMergeString(ticket_key->file_path);
43
+@@ -783,6 +788,22 @@
44
+ 
45
+     return NULL;
46
+ }
47
++
48
++const char *ssl_cmd_SSLDHParametersFile(cmd_parms *cmd,
49
++                                        void *dcfg,
50
++					const char *arg)
51
++{
52
++    SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
53
++    const char *err;
54
++
55
++    if ((err = ssl_cmd_check_file(cmd, &arg))) {
56
++        return err;
57
++    }
58
++
59
++    sc->server->pks->dhparams_file = arg;
60
++
61
++    return NULL;
62
++}
63
+ 
64
+ const char *ssl_cmd_SSLCertificateKeyFile(cmd_parms *cmd,
65
+                                           void *dcfg,
66
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_init.c httpd-2.4.3-dh/modules/ssl/ssl_engine_init.c
67
+--- httpd-2.4.3/modules/ssl/ssl_engine_init.c	2012-08-05 15:48:40.000000000 +0200
68
++++ httpd-2.4.3-dh/modules/ssl/ssl_engine_init.c	2012-10-23 16:11:28.481213388 +0200
69
+@@ -962,6 +962,42 @@
70
+     }
71
+ }
72
+ 
73
++static int ssl_server_import_dhparams(server_rec *s,
74
++                                      modssl_ctx_t *mctx,
75
++                                      const char *id)
76
++{
77
++    SSLModConfigRec *mc = myModConfig(s);
78
++    ssl_asn1_t *asn1;
79
++    MODSSL_D2I_DHparams_CONST unsigned char *ptr;
80
++    DH *dhparams = NULL;
81
++
82
++    if (!(asn1 = ssl_asn1_table_get(mc->tDHParams, id))) {
83
++        return FALSE;
84
++    }
85
++
86
++    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
87
++                 "Configuring server Diffie-Hellman parameters");
88
++
89
++    ptr = asn1->cpData;
90
++    if (!(dhparams = d2i_DHparams(NULL, &ptr, asn1->nData))) {
91
++        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
92
++                "Unable to import server Diffie-Hellman parameters");
93
++        ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
94
++        ssl_die(s);
95
++    }
96
++
97
++    if (SSL_CTX_set_tmp_dh(mctx->ssl_ctx, dhparams) <= 0) {
98
++        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
99
++                "Unable to configure server Diffie-Hellman parameters");
100
++        ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
101
++        ssl_die(s);
102
++    }
103
++
104
++    mctx->pks->dhparams = dhparams;
105
++
106
++    return TRUE;
107
++}
108
++
109
+ static int ssl_server_import_cert(server_rec *s,
110
+                                   modssl_ctx_t *mctx,
111
+                                   const char *id,
112
+@@ -1169,7 +1205,7 @@
113
+                                   apr_pool_t *ptemp,
114
+                                   modssl_ctx_t *mctx)
115
+ {
116
+-    const char *rsa_id, *dsa_id;
117
++    const char *rsa_id, *dsa_id, *dh_id;
118
+ #ifndef OPENSSL_NO_EC
119
+     const char *ecc_id;
120
+ #endif
121
+@@ -1182,12 +1218,14 @@
122
+ 
123
+     rsa_id = ssl_asn1_table_keyfmt(ptemp, vhost_id, SSL_AIDX_RSA);
124
+     dsa_id = ssl_asn1_table_keyfmt(ptemp, vhost_id, SSL_AIDX_DSA);
125
++    dh_id = apr_pstrcat(ptemp, vhost_id, ":", "DH", NULL);
126
+ #ifndef OPENSSL_NO_EC
127
+     ecc_id = ssl_asn1_table_keyfmt(ptemp, vhost_id, SSL_AIDX_ECC);
128
+ #endif
129
+ 
130
+     have_rsa = ssl_server_import_cert(s, mctx, rsa_id, SSL_AIDX_RSA);
131
+     have_dsa = ssl_server_import_cert(s, mctx, dsa_id, SSL_AIDX_DSA);
132
++    (void)ssl_server_import_dhparams(s, mctx, dh_id);
133
+ #ifndef OPENSSL_NO_EC
134
+     have_ecc = ssl_server_import_cert(s, mctx, ecc_id, SSL_AIDX_ECC);
135
+ #endif
136
+@@ -1723,6 +1761,7 @@
137
+         MODSSL_CFG_ITEM_FREE(EVP_PKEY_free,
138
+                              mctx->pks->keys[i]);
139
+     }
140
++    MODSSL_CFG_ITEM_FREE(DH_free, mctx->pks->dhparams);
141
+ }
142
+ 
143
+ apr_status_t ssl_init_ModuleKill(void *data)
144
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_pphrase.c httpd-2.4.3-dh/modules/ssl/ssl_engine_pphrase.c
145
+--- httpd-2.4.3/modules/ssl/ssl_engine_pphrase.c	2012-08-04 23:22:38.000000000 +0200
146
++++ httpd-2.4.3-dh/modules/ssl/ssl_engine_pphrase.c	2012-10-23 16:16:39.306422234 +0200
147
+@@ -147,6 +147,7 @@
148
+     unsigned char *ucp;
149
+     long int length;
150
+     X509 *pX509Cert;
151
++    DH *pDHParams;
152
+     BOOL bReadable;
153
+     apr_array_header_t *aPassPhrase;
154
+     int nPassPhrase;
155
+@@ -162,6 +163,7 @@
156
+     char *an;
157
+     apr_time_t pkey_mtime = 0;
158
+     apr_status_t rv;
159
++    const char *dhid;
160
+     /*
161
+      * Start with a fresh pass phrase array
162
+      */
163
+@@ -225,14 +227,14 @@
164
+                     ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(02201)
165
+                                  "Init: Can't open server certificate file %s",
166
+                                  szPath);
167
+-                    ssl_die(s);
168
++                    ssl_die(pServ);
169
+                 }
170
+                 if ((pX509Cert = SSL_read_X509(szPath, NULL, NULL)) == NULL) {
171
+                     ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02241)
172
+                                  "Init: Unable to read server certificate from"
173
+                                  " file %s", szPath);
174
+                     ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
175
+-                    ssl_die(s);
176
++                    ssl_die(pServ);
177
+                 }
178
+                 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02202)
179
+                              "Init: Read server certificate from '%s'",
180
+@@ -550,6 +552,43 @@
181
+              */
182
+             EVP_PKEY_free(pPrivateKey);
183
+         }
184
++	/*
185
++         * Read in Diffie-Hellman parameters file if such a file is
186
++         * specified.
187
++         */
188
++        if (sc->server->pks->dhparams_file) {
189
++            apr_cpystrn(szPath, sc->server->pks->dhparams_file, sizeof(szPath));
190
++            if ((rv = exists_and_readable(szPath, p, NULL)) != APR_SUCCESS) {
191
++                ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
192
++                             "Init: Can't open server Diffie-Hellman parameters file %s",
193
++                             szPath);
194
++                ssl_die(s);
195
++            }
196
++            if ((pDHParams = SSL_read_DHparams(szPath, NULL, NULL)) == NULL) {
197
++                ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
198
++                        "Init: Unable to read server Diffie-Hellman parameters from file %s", szPath);
199
++                ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
200
++                ssl_die(s);
201
++            }
202
++
203
++	    /*
204
++             * Insert the DH params into global module configuration
205
++             * to let it survive the processing between the 1st Apache
206
++             * API init round (where we operate here) and the 2nd
207
++             * Apache init round (where it will be actually used to
208
++             * configure mod_ssl's per-server configuration
209
++             * structures).
210
++             */
211
++            dhid = asn1_table_vhost_key(mc, p, cpVHostID, "DH");
212
++            length = i2d_DHparams(pDHParams, NULL);
213
++            ucp = ssl_asn1_table_set(mc->tDHParams, dhid, length);
214
++            (void)i2d_DHparams(pDHParams, &ucp); /* 2nd arg increments */
215
++
216
++            /*
217
++             * Free the DH structure
218
++             */
219
++            DH_free(pDHParams);
220
++        }
221
+     }
222
+ 
223
+     /*
224
+diff -Naur httpd-2.4.3/modules/ssl/ssl_private.h httpd-2.4.3-dh/modules/ssl/ssl_private.h
225
+--- httpd-2.4.3/modules/ssl/ssl_private.h	2012-08-05 15:48:40.000000000 +0200
226
++++ httpd-2.4.3-dh/modules/ssl/ssl_private.h	2012-10-23 16:10:39.911810230 +0200
227
+@@ -121,10 +121,12 @@
228
+ #define MODSSL_D2I_ASN1_type_bytes_CONST const
229
+ #define MODSSL_D2I_PrivateKey_CONST const
230
+ #define MODSSL_D2I_X509_CONST const
231
++#define MODSSL_D2I_DHparams_CONST const
232
+ #else
233
+ #define MODSSL_D2I_ASN1_type_bytes_CONST
234
+ #define MODSSL_D2I_PrivateKey_CONST
235
+ #define MODSSL_D2I_X509_CONST
236
++#define MODSSL_D2I_DHparams_CONST
237
+ #endif
238
+ 
239
+ #if OPENSSL_VERSION_NUMBER >= 0x00908080 && !defined(OPENSSL_NO_OCSP) \
240
+@@ -535,6 +537,7 @@
241
+      * example the string "vhost.example.com:443:RSA". */
242
+     apr_hash_t     *tPublicCert;
243
+     apr_hash_t     *tPrivateKey;
244
++    apr_hash_t     *tDHParams;
245
+ 
246
+ #if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_INIT)
247
+     const char     *szCryptoDevice;
248
+@@ -561,11 +564,13 @@
249
+      * unordered lists. */
250
+     const char  *cert_files[SSL_AIDX_MAX];
251
+     const char  *key_files[SSL_AIDX_MAX];
252
++    const char  *dhparams_file;
253
+     /* Loaded certs and keys; these arrays ARE indexed by the
254
+      * algorithm type, i.e.  keys[SSL_AIDX_RSA] maps to the RSA
255
+      * private key. */
256
+     X509        *certs[SSL_AIDX_MAX];
257
+     EVP_PKEY    *keys[SSL_AIDX_MAX];
258
++    DH          *dhparams;
259
+ 
260
+     /** Certificates which specify the set of CA names which should be
261
+      * sent in the CertificateRequest message: */
262
+@@ -723,6 +728,7 @@
263
+ const char  *ssl_cmd_SSLRandomSeed(cmd_parms *, void *, const char *, const char *, const char *);
264
+ const char  *ssl_cmd_SSLEngine(cmd_parms *, void *, const char *);
265
+ const char  *ssl_cmd_SSLCipherSuite(cmd_parms *, void *, const char *);
266
++const char  *ssl_cmd_SSLDHParametersFile(cmd_parms *, void *, const char *);
267
+ const char  *ssl_cmd_SSLCertificateFile(cmd_parms *, void *, const char *);
268
+ const char  *ssl_cmd_SSLCertificateKeyFile(cmd_parms *, void *, const char *);
269
+ const char  *ssl_cmd_SSLCertificateChainFile(cmd_parms *, void *, const char *);
270
+diff -Naur httpd-2.4.3/modules/ssl/ssl_util_ssl.c httpd-2.4.3-dh/modules/ssl/ssl_util_ssl.c
271
+--- httpd-2.4.3/modules/ssl/ssl_util_ssl.c	2012-02-28 13:07:31.000000000 +0100
272
++++ httpd-2.4.3-dh/modules/ssl/ssl_util_ssl.c	2012-10-23 16:10:39.911810230 +0200
273
+@@ -156,6 +156,47 @@
274
+     return rc;
275
+ }
276
+ 
277
++DH *SSL_read_DHparams(char* filename, DH **DHparams, void *cb)
278
++{
279
++    DH  *rc;
280
++    BIO *bioS;
281
++    BIO *bioF;
282
++
283
++    /* 1. try PEM (= DER+Base64+headers) */
284
++    if ((bioS=BIO_new_file(filename, "r")) == NULL)
285
++        return NULL;
286
++    rc = PEM_read_bio_DHparams(bioS, DHparams, cb, NULL);
287
++    BIO_free(bioS);
288
++
289
++    if (rc == NULL) {
290
++        /* 2. try DER+Base64 */
291
++        if ((bioS=BIO_new_file(filename, "r")) == NULL)
292
++            return NULL;
293
++
294
++        if ((bioF = BIO_new(BIO_f_base64())) == NULL) {
295
++            BIO_free(bioS);
296
++            return NULL;
297
++        }
298
++        bioS = BIO_push(bioF, bioS);
299
++        rc = d2i_DHparams_bio(bioS, NULL);
300
++        BIO_free_all(bioS);
301
++
302
++        if (rc == NULL) {
303
++            /* 3. try plain DER */
304
++            if ((bioS=BIO_new_file(filename, "r")) == NULL)
305
++                return NULL;
306
++            rc = d2i_DHparams_bio(bioS, NULL);
307
++            BIO_free(bioS);
308
++        }
309
++    }
310
++    if (rc != NULL && DHparams != NULL) {
311
++        if (*DHparams != NULL)
312
++            DH_free(*DHparams);
313
++        *DHparams = rc;
314
++    }
315
++    return rc;
316
++}
317
++
318
+ /*  _________________________________________________________________
319
+ **
320
+ **  Smart shutdown
321
+diff -Naur httpd-2.4.3/modules/ssl/ssl_util_ssl.h httpd-2.4.3-dh/modules/ssl/ssl_util_ssl.h
322
+--- httpd-2.4.3/modules/ssl/ssl_util_ssl.h	2012-01-08 11:12:18.000000000 +0100
323
++++ httpd-2.4.3-dh/modules/ssl/ssl_util_ssl.h	2012-10-23 16:10:39.912810219 +0200
324
+@@ -62,6 +62,7 @@
325
+ void        SSL_set_app_data2(SSL *, void *);
326
+ X509       *SSL_read_X509(char *, X509 **, pem_password_cb *);
327
+ EVP_PKEY   *SSL_read_PrivateKey(char *, EVP_PKEY **, pem_password_cb *, void *);
328
++DH         *SSL_read_DHparams(char* filename, DH **DHparams, void *cb);
329
+ int         SSL_smart_shutdown(SSL *ssl);
330
+ BOOL        SSL_X509_isSGC(X509 *);
331
+ BOOL        SSL_X509_getBC(X509 *, int *, int *);
... ...
@@ -0,0 +1,242 @@
1
+diff -Naur httpd-2.4.3/modules/ssl/mod_ssl.c httpd-2.4.3-1/modules/ssl/mod_ssl.c
2
+--- httpd-2.4.3/modules/ssl/mod_ssl.c	2012-08-05 15:48:40.000000000 +0200
3
++++ httpd-2.4.3-1/modules/ssl/mod_ssl.c	2012-10-23 15:53:15.014424913 +0200
4
+@@ -263,6 +263,18 @@
5
+     AP_END_CMD
6
+ };
7
+ 
8
++/* Implement 'modssl_run_npn_advertise_protos_hook'. */
9
++APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(
10
++    modssl, AP, int, npn_advertise_protos_hook,
11
++    (conn_rec *connection, apr_array_header_t *protos),
12
++    (connection, protos), OK, DECLINED);
13
++
14
++/* Implement 'modssl_run_npn_proto_negotiated_hook'. */
15
++APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(
16
++    modssl, AP, int, npn_proto_negotiated_hook,
17
++    (conn_rec *connection, const char *proto_name, apr_size_t proto_name_len),
18
++    (connection, proto_name, proto_name_len), OK, DECLINED);
19
++
20
+ /*
21
+  *  the various processing hooks
22
+  */
23
+diff -Naur httpd-2.4.3/modules/ssl/mod_ssl.h httpd-2.4.3-1/modules/ssl/mod_ssl.h
24
+--- httpd-2.4.3/modules/ssl/mod_ssl.h	2011-09-23 15:38:09.000000000 +0200
25
++++ httpd-2.4.3-1/modules/ssl/mod_ssl.h	2012-10-23 15:53:15.014424913 +0200
26
+@@ -63,5 +63,26 @@
27
+ 
28
+ APR_DECLARE_OPTIONAL_FN(int, ssl_engine_disable, (conn_rec *));
29
+ 
30
++/** The npn_advertise_protos optional hook allows other modules to add entries
31
++ * to the list of protocol names advertised by the server during the Next
32
++ * Protocol Negotiation (NPN) portion of the SSL handshake.  The hook callee is
33
++ * given the connection and an APR array; it should push one or more char*'s
34
++ * pointing to null-terminated strings (such as "http/1.1" or "spdy/2") onto
35
++ * the array and return OK, or do nothing and return DECLINED. */
36
++APR_DECLARE_EXTERNAL_HOOK(modssl, AP, int, npn_advertise_protos_hook,
37
++                          (conn_rec *connection, apr_array_header_t *protos));
38
++
39
++/** The npn_proto_negotiated optional hook allows other modules to discover the
40
++ * name of the protocol that was chosen during the Next Protocol Negotiation
41
++ * (NPN) portion of the SSL handshake.  Note that this may be the empty string
42
++ * (in which case modules should probably assume HTTP), or it may be a protocol
43
++ * that was never even advertised by the server.  The hook callee is given the
44
++ * connection, a non-null-terminated string containing the protocol name, and
45
++ * the length of the string; it should do something appropriate (i.e. insert or
46
++ * remove filters) and return OK, or do nothing and return DECLINED. */
47
++APR_DECLARE_EXTERNAL_HOOK(modssl, AP, int, npn_proto_negotiated_hook,
48
++                          (conn_rec *connection, const char *proto_name,
49
++                           apr_size_t proto_name_len));
50
++
51
+ #endif /* __MOD_SSL_H__ */
52
+ /** @} */
53
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_init.c httpd-2.4.3-1/modules/ssl/ssl_engine_init.c
54
+--- httpd-2.4.3/modules/ssl/ssl_engine_init.c	2012-08-05 15:48:40.000000000 +0200
55
++++ httpd-2.4.3-1/modules/ssl/ssl_engine_init.c	2012-10-23 15:53:15.030424726 +0200
56
+@@ -693,6 +693,11 @@
57
+ #endif
58
+ 
59
+     SSL_CTX_set_info_callback(ctx, ssl_callback_Info);
60
++
61
++#ifdef HAVE_TLS_NPN
62
++    SSL_CTX_set_next_protos_advertised_cb(
63
++        ctx, ssl_callback_AdvertiseNextProtos, NULL);
64
++#endif
65
+ }
66
+ 
67
+ static void ssl_init_ctx_verify(server_rec *s,
68
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_io.c httpd-2.4.3-1/modules/ssl/ssl_engine_io.c
69
+--- httpd-2.4.3/modules/ssl/ssl_engine_io.c	2012-05-05 10:44:19.000000000 +0200
70
++++ httpd-2.4.3-1/modules/ssl/ssl_engine_io.c	2012-10-23 15:53:15.030424726 +0200
71
+@@ -28,6 +28,7 @@
72
+                                   core keeps dumping.''
73
+                                             -- Unknown    */
74
+ #include "ssl_private.h"
75
++#include "mod_ssl.h"
76
+ #include "apr_date.h"
77
+ 
78
+ /*  _________________________________________________________________
79
+@@ -297,6 +298,7 @@
80
+     apr_pool_t *pool;
81
+     char buffer[AP_IOBUFSIZE];
82
+     ssl_filter_ctx_t *filter_ctx;
83
++    int npn_finished;  /* 1 if NPN has finished, 0 otherwise */
84
+ } bio_filter_in_ctx_t;
85
+ 
86
+ /*
87
+@@ -1374,6 +1376,26 @@
88
+         APR_BRIGADE_INSERT_TAIL(bb, bucket);
89
+     }
90
+ 
91
++#ifdef HAVE_TLS_NPN
92
++    /* By this point, Next Protocol Negotiation (NPN) should be completed (if
93
++     * our version of OpenSSL supports it).  If we haven't already, find out
94
++     * which protocol was decided upon and inform other modules by calling
95
++     * npn_proto_negotiated_hook. */
96
++    if (!inctx->npn_finished) {
97
++        const unsigned char *next_proto = NULL;
98
++        unsigned next_proto_len = 0;
99
++
100
++        SSL_get0_next_proto_negotiated(
101
++            inctx->ssl, &next_proto, &next_proto_len);
102
++        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, f->c,
103
++                      APLOGNO(02306) "SSL NPN negotiated protocol: '%*s'",
104
++                      next_proto_len, (const char*)next_proto);
105
++        modssl_run_npn_proto_negotiated_hook(
106
++            f->c, (const char*)next_proto, next_proto_len);
107
++        inctx->npn_finished = 1;
108
++    }
109
++#endif
110
++
111
+     return APR_SUCCESS;
112
+ }
113
+ 
114
+@@ -1855,6 +1877,7 @@
115
+     inctx->block = APR_BLOCK_READ;
116
+     inctx->pool = c->pool;
117
+     inctx->filter_ctx = filter_ctx;
118
++    inctx->npn_finished = 0;
119
+ }
120
+ 
121
+ /* The request_rec pointer is passed in here only to ensure that the
122
+diff -Naur httpd-2.4.3/modules/ssl/ssl_engine_kernel.c httpd-2.4.3-1/modules/ssl/ssl_engine_kernel.c
123
+--- httpd-2.4.3/modules/ssl/ssl_engine_kernel.c	2012-05-05 10:44:19.000000000 +0200
124
++++ httpd-2.4.3-1/modules/ssl/ssl_engine_kernel.c	2012-10-23 15:53:15.031424714 +0200
125
+@@ -29,6 +29,7 @@
126
+                                   time I was too famous.''
127
+                                             -- Unknown                */
128
+ #include "ssl_private.h"
129
++#include "mod_ssl.h"
130
+ #include "util_md5.h"
131
+ 
132
+ static void ssl_configure_env(request_rec *r, SSLConnRec *sslconn);
133
+@@ -2143,3 +2144,86 @@
134
+     return -1;
135
+ }
136
+ #endif
137
++
138
++#ifdef HAVE_TLS_NPN
139
++/*
140
++ * This callback function is executed when SSL needs to decide what protocols
141
++ * to advertise during Next Protocol Negotiation (NPN).  It must produce a
142
++ * string in wire format -- a sequence of length-prefixed strings -- indicating
143
++ * the advertised protocols.  Refer to SSL_CTX_set_next_protos_advertised_cb
144
++ * in OpenSSL for reference.
145
++ */
146
++int ssl_callback_AdvertiseNextProtos(SSL *ssl, const unsigned char **data_out,
147
++                                     unsigned int *size_out, void *arg)
148
++{
149
++    conn_rec *c = (conn_rec*)SSL_get_app_data(ssl);
150
++    apr_array_header_t *protos;
151
++    int num_protos;
152
++    unsigned int size;
153
++    int i;
154
++    unsigned char *data;
155
++    unsigned char *start;
156
++
157
++    *data_out = NULL;
158
++    *size_out = 0;
159
++
160
++    /* If the connection object is not available, then there's nothing for us
161
++     * to do. */
162
++    if (c == NULL) {
163
++        return SSL_TLSEXT_ERR_OK;
164
++    }
165
++
166
++    /* Invoke our npn_advertise_protos hook, giving other modules a chance to
167
++     * add alternate protocol names to advertise. */
168
++    protos = apr_array_make(c->pool, 0, sizeof(char*));
169
++    modssl_run_npn_advertise_protos_hook(c, protos);
170
++    num_protos = protos->nelts;
171
++
172
++    /* We now have a list of null-terminated strings; we need to concatenate
173
++     * them together into a single string, where each protocol name is prefixed
174
++     * by its length.  First, calculate how long that string will be. */
175
++    size = 0;
176
++    for (i = 0; i < num_protos; ++i) {
177
++        const char *string = APR_ARRAY_IDX(protos, i, const char*);
178
++        unsigned int length = strlen(string);
179
++        /* If the protocol name is too long (the length must fit in one byte),
180
++         * then log an error and skip it. */
181
++        if (length > 255) {
182
++            ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(02307)
183
++                          "SSL NPN protocol name too long (length=%u): %s",
184
++                          length, string);
185
++            continue;
186
++        }
187
++        /* Leave room for the length prefix (one byte) plus the protocol name
188
++         * itself. */
189
++        size += 1 + length;
190
++    }
191
++
192
++    /* If there is nothing to advertise (either because no modules added
193
++     * anything to the protos array, or because all strings added to the array
194
++     * were skipped), then we're done. */
195
++    if (size == 0) {
196
++        return SSL_TLSEXT_ERR_OK;
197
++    }
198
++
199
++    /* Now we can build the string.  Copy each protocol name string into the
200
++     * larger string, prefixed by its length. */
201
++    data = apr_palloc(c->pool, size * sizeof(unsigned char));
202
++    start = data;
203
++    for (i = 0; i < num_protos; ++i) {
204
++        const char *string = APR_ARRAY_IDX(protos, i, const char*);
205
++        apr_size_t length = strlen(string);
206
++        if (length > 255)
207
++            continue;
208
++        *start = (unsigned char)length;
209
++        ++start;
210
++        memcpy(start, string, length * sizeof(unsigned char));
211
++        start += length;
212
++    }
213
++
214
++    /* Success. */
215
++    *data_out = data;
216
++    *size_out = size;
217
++    return SSL_TLSEXT_ERR_OK;
218
++}
219
++#endif
220
+diff -Naur httpd-2.4.3/modules/ssl/ssl_private.h httpd-2.4.3-1/modules/ssl/ssl_private.h
221
+--- httpd-2.4.3/modules/ssl/ssl_private.h	2012-08-05 15:48:40.000000000 +0200
222
++++ httpd-2.4.3-1/modules/ssl/ssl_private.h	2012-10-23 15:53:15.031424714 +0200
223
+@@ -139,6 +139,11 @@
224
+ #define HAVE_FIPS
225
+ #endif
226
+ 
227
++#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_NEXTPROTONEG) \
228
++    && !defined(OPENSSL_NO_TLSEXT)
229
++#define HAVE_TLS_NPN
230
++#endif
231
++
232
+ #if (OPENSSL_VERSION_NUMBER >= 0x10000000)
233
+ #define MODSSL_SSL_CIPHER_CONST const
234
+ #define MODSSL_SSL_METHOD_CONST const
235
+@@ -820,6 +825,7 @@
236
+ int         ssl_callback_SessionTicket(SSL *, unsigned char *, unsigned char *,
237
+                                        EVP_CIPHER_CTX *, HMAC_CTX *, int);
238
+ #endif
239
++int ssl_callback_AdvertiseNextProtos(SSL *ssl, const unsigned char **data, unsigned int *len, void *arg);
240
+ 
241
+ /**  Session Cache Support  */
242
+ void         ssl_scache_init(server_rec *, apr_pool_t *);
0 243