anchor.diff:              {fail, duplicate_common_name};
           _ ->
               case validate_common_name(CommonName,
  -                    app_helper:get_env(riak_repl, peer_common_name_acl, "*")) of
  +                    app_helper:get_env(App, peer_common_name_acl, "*")) of
                   {true, Filter} ->
                       lager:info("SSL connection from ~s granted by ACL ~s",
                           [CommonName, Filter]),
  
positive.code: verify_ssl(_, valid_peer, undefined) ->
      lager:error("Unable to determine local certificate's common name"),
      {fail, bad_local_common_name};
  verify_ssl(Cert, valid_peer, MyCommonName) ->
  
      CommonName = get_common_name(Cert),
  
      case string:to_lower(CommonName) == string:to_lower(MyCommonName) of
          true ->
              lager:error("Peer certificate's common name matches local "
  
negative.code:     end.
  
  
  validate_ssl_config(_App, false, _) ->
      %% ssl is disabled
      false;
  validate_ssl_config(_App, true, []) ->
      %% all options validated
      true;
  validate_ssl_config(App, true, [{certfile, CertFile}|Rest]) ->
      case filelib:is_regular(CertFile) of
          true ->
              validate_ssl_config(App, true, Rest);
          false ->
              {error, lists:flatten(io_lib:format("Certificate ~p is not a file",
                                                  [CertFile]))}
      end;
  validate_ssl_config(App, true, [{keyfile, KeyFile}|Rest]) ->
      case filelib:is_regular(KeyFile) of
          true ->
              validate_ssl_config(App, true, Rest);
          false ->
              {error, lists:flatten(io_lib:format("Key ~p is not a file",
                                                  [KeyFile]))}
      end;
  validate_ssl_config(App, true, [{cacerts, CACerts}|Rest]) ->
      case CACerts of
          undefined ->
              {error, lists:flatten(
                      io_lib:format("CA cert dir ~p is invalid",
                                    [app_helper:get_env(App, cacertdir,
                                                        undefined)]))};
          [] ->
              {error, lists:flatten(
                      io_lib:format("Unable to load any CA certificates from ~p",
                                    [app_helper:get_env(App, cacertdir,
                                                        undefined)]))};
          Certs when is_list(Certs) ->
              validate_ssl_config(App, true, Rest)
      end;
  validate_ssl_config(App, true, [_|Rest]) ->
      validate_ssl_config(App, true, Rest).
  
  upgrade_client_to_ssl(Socket, App) ->
      case maybe_use_ssl(App) of
  