aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-08-28 09:55:12 +0200
committerIngela Anderton Andin <[email protected]>2013-08-28 09:55:12 +0200
commit6fc94ba0b93488e46429dd4e71d11ebfe3b62792 (patch)
tree68c0566898f55d3851d19187cb63f17c15126763 /lib/ssl
parentc47bcc2524a47753347bf9b4edd3df43235c58cb (diff)
parent8ce2f3f0cae692642dfd68e0d8bde3b039a658c6 (diff)
downloadotp-6fc94ba0b93488e46429dd4e71d11ebfe3b62792.tar.gz
otp-6fc94ba0b93488e46429dd4e71d11ebfe3b62792.tar.bz2
otp-6fc94ba0b93488e46429dd4e71d11ebfe3b62792.zip
Merge branch 'ia/ssl/concurrerr/OTP-11255' into maint
* ia/ssl/concurrerr/OTP-11255: ssl: Make the ssl manager name for erlang distribution over SSL/TLS relative to the module name of the ssl_manager.
Diffstat (limited to 'lib/ssl')
-rw-r--r--lib/ssl/src/ssl_manager.erl24
-rw-r--r--lib/ssl/src/tls_connection.erl4
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/ssl/src/ssl_manager.erl b/lib/ssl/src/ssl_manager.erl
index 7af4a68461..4d5eaeb607 100644
--- a/lib/ssl/src/ssl_manager.erl
+++ b/lib/ssl/src/ssl_manager.erl
@@ -30,7 +30,7 @@
lookup_trusted_cert/4,
new_session_id/1, clean_cert_db/2,
register_session/2, register_session/3, invalidate_session/2,
- invalidate_session/3, clear_pem_cache/0]).
+ invalidate_session/3, clear_pem_cache/0, manager_name/1]).
% Spawn export
-export([init_session_validator/1]).
@@ -64,6 +64,18 @@
%%====================================================================
%% API
%%====================================================================
+
+%%--------------------------------------------------------------------
+-spec manager_name(normal | dist) -> atom().
+%%
+%% Description: Returns the registered name of the ssl manager process
+%% in the operation modes 'normal' and 'dist'.
+%%--------------------------------------------------------------------
+manager_name(normal) ->
+ ?MODULE;
+manager_name(dist) ->
+ list_to_atom(atom_to_list(?MODULE) ++ "dist").
+
%%--------------------------------------------------------------------
-spec start_link(list()) -> {ok, pid()} | ignore | {error, term()}.
%%
@@ -71,7 +83,8 @@
%% and certificate caching.
%%--------------------------------------------------------------------
start_link(Opts) ->
- gen_server:start_link({local, ?MODULE}, ?MODULE, [?MODULE, Opts], []).
+ DistMangerName = manager_name(normal),
+ gen_server:start_link({local, DistMangerName}, ?MODULE, [DistMangerName, Opts], []).
%%--------------------------------------------------------------------
-spec start_link_dist(list()) -> {ok, pid()} | ignore | {error, term()}.
@@ -80,7 +93,8 @@ start_link(Opts) ->
%% be used by the erlang distribution. Note disables soft upgrade!
%%--------------------------------------------------------------------
start_link_dist(Opts) ->
- gen_server:start_link({local, ssl_manager_dist}, ?MODULE, [ssl_manager_dist, Opts], []).
+ DistMangerName = manager_name(dist),
+ gen_server:start_link({local, DistMangerName}, ?MODULE, [DistMangerName, Opts], []).
%%--------------------------------------------------------------------
-spec connection_init(binary()| {der, list()}, client | server) ->
@@ -100,7 +114,7 @@ connection_init(Trustedcerts, Role) ->
%%--------------------------------------------------------------------
-spec cache_pem_file(binary(), term()) -> {ok, term()} | {error, reason()}.
%%
-%% Description: Cach a pem file and return its content.
+%% Description: Cache a pem file and return its content.
%%--------------------------------------------------------------------
cache_pem_file(File, DbHandle) ->
MD5 = crypto:hash(md5, File),
@@ -120,7 +134,7 @@ cache_pem_file(File, DbHandle) ->
%%--------------------------------------------------------------------
clear_pem_cache() ->
%% Not supported for distribution at the moement, should it be?
- put(ssl_manager, ssl_manager),
+ put(ssl_manager, manager_name(normal)),
call(unconditionally_clear_pem_cache).
%%--------------------------------------------------------------------
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 159ba406d3..77f49c5d2a 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -1239,9 +1239,9 @@ ssl_init(SslOpts, Role) ->
{ok, CertDbRef, CertDbHandle, FileRefHandle, CacheHandle, OwnCert, PrivateKey, DHParams}.
init_manager_name(false) ->
- put(ssl_manager, ssl_manager);
+ put(ssl_manager, ssl_manager:manager_name(normal));
init_manager_name(true) ->
- put(ssl_manager, ssl_manager_dist).
+ put(ssl_manager, ssl_manager:manager_name(dist)).
init_certificates(#ssl_options{cacerts = CaCerts,
cacertfile = CACertFile,