1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

Fix SSL handshake when SNI-extension is empty.

While I'm here:

- Cleanup plist
- Unmute an install command

PR:		194214
Submitted by:	Dave Cottlehuber
This commit is contained in:
Jimmy Olgeni 2014-10-09 12:50:54 +00:00
parent 38bdb52017
commit ea300678eb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=370521
4 changed files with 47 additions and 22 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= erlang
PORTVERSION= 17.3
PORTREVISION= 1
PORTEPOCH= 3
CATEGORIES= lang parallel java
MASTER_SITES= http://www.erlang.org/download/:erlangorg \
@ -140,7 +141,6 @@ CONFIGURE_ARGS+=--without-odbc
ERLANG_MAN= otp_doc_man_${ERL_RELEASE}.tar.gz
ERLANG_DOCS= otp_doc_html_${ERL_RELEASE}.tar.gz
ERLANG_PLIST= ${WRKDIR}/pkg-plist
.if ${PORT_OPTIONS:MTHREADS}
CONFIGURE_ARGS+=--enable-threads
@ -188,7 +188,7 @@ post-install:
-C ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB} \
"man/man$${SECTION}/*.$${SECTION}" || ${TRUE}; \
done
@${RM} -rf ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/man/cat?
${RM} -rf ${STAGEDIR}${PREFIX}/lib/${ERLANG_LIB}/man/cat?
.if ${PORT_OPTIONS:MDOCS}
${TAR} --unlink -xzpf ${DISTDIR}/${DIST_SUBDIR}/${ERLANG_DOCS} \
@ -203,23 +203,11 @@ post-install:
@cd ${STAGEDIR}${PREFIX}; ${FIND} lib/${ERLANG_LIB}/* -type d -empty \
| ${SORT} \
| ${SED} -e 's#^#@exec ${MKDIR} %D/#g' \
> ${ERLANG_PLIST}
| ${SED} -e 's#^#@dir #g' \
>> ${TMPPLIST}
@cd ${STAGEDIR}${PREFIX}; ${FIND} lib/${ERLANG_LIB}/* -type f -o -type l \
| ${SORT} \
>> ${ERLANG_PLIST}
@cd ${STAGEDIR}${PREFIX}; ${FIND} lib/${ERLANG_LIB}/* -type d \
| ${SORT} -r \
| ${SED} -e 's/^/@dirrm /g' \
>> ${ERLANG_PLIST}
@${ECHO_CMD} "r ${TMPPLIST}" > ${WRKDIR}/ex.script
@${ECHO_CMD} "/Insert PLIST here" >> ${WRKDIR}/ex.script
@${ECHO_CMD} "d" >> ${WRKDIR}/ex.script
@${ECHO_CMD} "r ${ERLANG_PLIST}" >> ${WRKDIR}/ex.script
@${ECHO_CMD} "x!" >> ${WRKDIR}/ex.script
@cd ${WRKDIR}; ex < ex.script
>> ${TMPPLIST}
.include <bsd.port.mk>

View File

@ -0,0 +1,15 @@
$FreeBSD$
--- lib/ssl/src/ssl_handshake.erl.orig
+++ lib/ssl/src/ssl_handshake.erl
@@ -1732,6 +1732,9 @@
#ec_point_formats{ec_point_format_list =
ECPointFormats}});
+dec_hello_extensions(<<?UINT16(?SNI_EXT), ?UINT16(Len), Rest/binary>>, Acc) when Len == 0 ->
+ dec_hello_extensions(Rest, Acc#hello_extensions{sni = ""}); %% Server may send an empy SNI
+
dec_hello_extensions(<<?UINT16(?SNI_EXT), ?UINT16(Len),
ExtData:Len/binary, Rest/binary>>, Acc) ->
<<?UINT16(_), NameList/binary>> = ExtData,

View File

@ -0,0 +1,27 @@
$FreeBSD$
--- lib/ssl/test/ssl_handshake_SUITE.erl.orig
+++ lib/ssl/test/ssl_handshake_SUITE.erl
@@ -39,6 +39,7 @@
decode_unknown_hello_extension_correctly,
encode_single_hello_sni_extension_correctly,
decode_single_hello_sni_extension_correctly,
+ decode_empty_server_sni_correctly,
select_proper_tls_1_2_rsa_default_hashsign].
%%--------------------------------------------------------------------
@@ -106,6 +107,13 @@
Decoded = ssl_handshake:decode_hello_extensions(SNI),
Exts = Decoded.
+decode_empty_server_sni_correctly(_Config) ->
+ Exts = #hello_extensions{sni = ""},
+ SNI = <<?UINT16(?SNI_EXT),?UINT16(0)>>,
+ Decoded = ssl_handshake:decode_hello_extensions(SNI),
+ Exts = Decoded.
+
+
select_proper_tls_1_2_rsa_default_hashsign(_Config) ->
% RFC 5246 section 7.4.1.4.1 tells to use {sha1,rsa} as default signature_algorithm for RSA key exchanges
{sha, rsa} = ssl_handshake:select_hashsign_algs(undefined, ?rsaEncryption, {3,3}),

View File

@ -9,14 +9,9 @@ bin/run_erl
bin/to_erl
bin/typer
etc/man.d/erlang.conf
@comment Insert PLIST here
@comment -=[ begin PLIST.lib-erlang ]=-
@comment -=[ end PLIST.lib-erlang ]=-
@dirrmtry lib/%%ERLANG_LIB%%
%%PORTDOCS%%%%DOCSDIR%%/armstrong_thesis_2003.pdf
%%PORTDOCS%%%%DOCSDIR%%/bjarnelic.pdf
%%PORTDOCS%%%%DOCSDIR%%/erlang-book-part1.pdf
%%PORTDOCS%%%%DOCSDIR%%/master_thesis_patterns.pdf
%%PORTDOCS%%%%DOCSDIR%%/mnesia_overview.pdf
%%PORTDOCS%%%%DOCSDIR%%/programming_rules.pdf
%%PORTDOCS%%@dirrm %%DOCSDIR%%