From: Holger Weiss <holger@zedat.fu-berlin.de>
Date: Tue, 5 Aug 2014 12:10:32 +0000 (+0200)
Subject: Log auth method for incoming s2s connections
X-Git-Tag: 14.12~83^2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38c016a041205a8584b4bb442b945d3b5138b88a;p=ejabberd

Log auth method for incoming s2s connections

Generate an [info] message that logs whether an incoming s2s connection
is authenticated using the SASL EXTERNAL mechanism or via Server
Dialback.  While at it, also mention whether TLS is enabled.
---

diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl
index 4fde814fe..6c594185a 100644
--- a/src/ejabberd_s2s_in.erl
+++ b/src/ejabberd_s2s_in.erl
@@ -374,8 +374,8 @@ wait_for_feature_request({xmlstreamelement, El},
 				    #xmlel{name = <<"success">>,
 					   attrs = [{<<"xmlns">>, ?NS_SASL}],
 					   children = []}),
-		       ?DEBUG("(~w) Accepted s2s authentication for ~s",
-			      [StateData#state.socket, AuthDomain]),
+		       ?INFO_MSG("Accepted s2s EXTERNAL authentication for ~s (TLS=~p)",
+				 [AuthDomain, StateData#state.tls_enabled]),
 		       change_shaper(StateData, <<"">>,
 				     jlib:make_jid(<<"">>, AuthDomain, <<"">>)),
 		       {next_state, wait_for_stream,
@@ -515,6 +515,8 @@ stream_established({valid, From, To}, StateData) ->
 			    [{<<"from">>, To}, {<<"to">>, From},
 			     {<<"type">>, <<"valid">>}],
 			children = []}),
+    ?INFO_MSG("Accepted s2s dialback authentication for ~s (TLS=~p)",
+	      [From, StateData#state.tls_enabled]),
     LFrom = jlib:nameprep(From),
     LTo = jlib:nameprep(To),
     NSD = StateData#state{connections =