Projects
Kolab:16:Testing
guam
0007-do-a-full-OK-CAPABILITY-banner-for-all-cor...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0007-do-a-full-OK-CAPABILITY-banner-for-all-correct_hello.patch of Package guam (Revision 9)
Currently displaying revision
9
,
Show latest
From 75ce99f2226438cab4cf57cb8b7dbbe6e4d22885 Mon Sep 17 00:00:00 2001 From: Aaron Seigo <aseigo@kde.org> Date: Fri, 1 Jul 2016 12:44:09 +0200 Subject: [PATCH 7/8] do a full "* OK [CAPABILITY" banner for all correct_hello paths --- apps/kolab_guam/src/kolab_guam_session.erl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/apps/kolab_guam/src/kolab_guam_session.erl b/apps/kolab_guam/src/kolab_guam_session.erl index df195a1..fb9c72b 100644 --- a/apps/kolab_guam/src/kolab_guam_session.erl +++ b/apps/kolab_guam/src/kolab_guam_session.erl @@ -73,8 +73,10 @@ handle_info({ ssl, Socket, Data }, State) -> process_client_data(Socket, Data, State); handle_info({ server_hello, ServerHello }, #state{ imap_session = ImapSession, tls_config = TLSConfig, socket = Socket, client_implicit_tls = ImplicitTLS, client_tls_active = TLSActive, deflator = Deflator } = State) -> CorrectedHello = correct_hello(TLSActive, ImplicitTLS, TLSConfig, ServerHello), + ServerIdent = proplists:get_value(server_id, ServerHello, <<>>), + FullGreeting = <<"* OK [CAPABILITIES ", CorrectedHello/binary, "] ", ServerIdent/binary, "\r\n">>, eimap:start_passthrough(ImapSession, self()), - relay_response(Socket, postprocess_server_data(Deflator, <<CorrectedHello/binary, "\r\n">>), TLSActive), + relay_response(Socket, postprocess_server_data(Deflator, FullGreeting), TLSActive), { noreply, State }; handle_info({ { rule_data, Module, ResponseToken }, Data }, #state{ rules_active = ActiveRules } = State) -> %lager:debug("Got back data requested by rule ~p: ~p", [Module, Data]), @@ -276,24 +278,19 @@ set_socket_active(true, Socket) -> ssl:setopts(Socket, [{ active, once }]); set_socket_active(_, Socket) -> inet:setopts(Socket, [{ active, once }]). -spec correct_hello(TLSActive :: true | false, ImplicitTLS :: true | false, TlSConfig :: [] | list(), ServerHello :: binary()) -> CorrectedHello :: binary(). -correct_hello(true, true, _TLSConfig, ServerHello) -> +correct_hello(true, true, _TLSConfig, ServerResponse) -> % the connection is already secured, so don't advertise starttls to the client - build_hello_for_implicit_tls(ServerHello); -correct_hello(true, _ImplicitTLS, _TLSConfig, ServerHello) -> + ensure_hello_does_not_have_starttls(ServerResponse); +correct_hello(true, _ImplicitTLS, _TLSConfig, ServerResponse) -> % the connection is already secured, so don't advertise starttls to the client - ensure_hello_does_not_have_starttls(ServerHello); -correct_hello(_TLSActive, _ImplicitTLS, [], ServerHello) -> + ensure_hello_does_not_have_starttls(ServerResponse); +correct_hello(_TLSActive, _ImplicitTLS, [], ServerResponse) -> % guam does not have a TLS config and so can not provide TLS to the client - ensure_hello_does_not_have_starttls(ServerHello); -correct_hello(_TLSActive, _ImplicitTLS, _TLSConfig, ServerHello) -> + ensure_hello_does_not_have_starttls(ServerResponse); +correct_hello(_TLSActive, _ImplicitTLS, _TLSConfig, ServerResponse) -> % guam has a TLS config, and it is not currently active, so make sure to include % STARTTLS in our response regardless of what the backend says - ensure_hello_has_starttls(ServerHello). - -build_hello_for_implicit_tls(ServerResponse) -> - NoTLSCapabilities = ensure_hello_does_not_have_starttls(ServerResponse), - ServerIdent = proplists:get_value(server_id, ServerResponse, <<>>), - <<"* OK [CAPABILITIES ", NoTLSCapabilities/binary, "] ", ServerIdent/binary>>. + ensure_hello_has_starttls(ServerResponse). ensure_hello_has_starttls(ServerResponse) -> ServerHello = proplists:get_value(capabilities, ServerResponse, <<>>), -- 2.5.5
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
.