[Asterisk-code-review] res xmpp: Ensure the connection filter is available. (asterisk[15.1])

George Joseph asteriskteam at digium.com
Wed Oct 25 11:49:48 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/6915 )

Change subject: res_xmpp: Ensure the connection filter is available.
......................................................................

res_xmpp: Ensure the connection filter is available.

Users of the API that res_xmpp provides expect that a
filter be available on the client at all times. When
OAuth authentication support was added this requirement
was not maintained.

This change merely moves the OAuth authentication to
after the filter is created, ensuring users of res_xmpp
can add things to the filter as needed.

ASTERISK-27346

Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886
(cherry picked from commit 0efeb7885a080c92699d6d794c993d2f56e6e55a)
---
M res/res_xmpp.c
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Jenkins2: Verified
  Richard Mudgett: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index 444eacb..8a06a6c 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -3652,13 +3652,6 @@
 		return -1;
 	}
 
-	if (!ast_strlen_zero(clientcfg->refresh_token)) {
-		ast_debug(2, "Obtaining OAuth access token for client '%s'\n", client->name);
-		if (fetch_access_token(clientcfg)) {
-			return -1;
-		}
-	}
-
 	ast_xmpp_client_disconnect(client);
 
 	client->timeout = 50;
@@ -3669,6 +3662,13 @@
 		return -1;
 	}
 
+	if (!ast_strlen_zero(clientcfg->refresh_token)) {
+		ast_debug(2, "Obtaining OAuth access token for client '%s'\n", client->name);
+		if (fetch_access_token(clientcfg)) {
+			return -1;
+		}
+	}
+
 	/* If it's a component connect to user otherwise connect to server */
 	res = iks_connect_via(client->parser, S_OR(clientcfg->server, client->jid->server), clientcfg->port,
 			      ast_test_flag(&clientcfg->flags, XMPP_COMPONENT) ? clientcfg->user : client->jid->server);

-- 
To view, visit https://gerrit.asterisk.org/6915
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15.1
Gerrit-MessageType: merged
Gerrit-Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886
Gerrit-Change-Number: 6915
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171025/c783cde5/attachment.html>


More information about the asterisk-code-review mailing list