[Asterisk-code-review] res xmpp: Google OAuth 2.0 protocol support for XMPP / Motif (asterisk[13])

Andrey asteriskteam at digium.com
Wed Aug 9 15:02:43 CDT 2017


Andrey has posted comments on this change. ( https://gerrit.asterisk.org/6158 )

Change subject: res_xmpp: Google OAuth 2.0 protocol support for XMPP / Motif
......................................................................


Patch Set 4:

(13 comments)

Fixed a lot of remarks.

https://gerrit.asterisk.org/#/c/6158/3/configs/samples/xmpp.conf.sample
File configs/samples/xmpp.conf.sample:

https://gerrit.asterisk.org/#/c/6158/3/configs/samples/xmpp.conf.sample@24
PS3, Line 24: 					; for more details.
            : 					; For test reasons you can obtain one on the page
> I think we need a more complete guide on how to actually use this for users
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c
File res/res_xmpp.c:

https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@778
PS3, Line 778: ==
> Shouldn't this be '&&'?
No, it's XOR logic: if no password and no token -- it's an error; if password and token presents -- it's an error as well due to not clear what to use: token or password?


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@779
PS3, Line 779: either
> s/either/or/
No, _either_ is exactly what this means.


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3658
PS3, Line 3658: 		ast_log(LOG_DEBUG, "Obtaining OAuth access token for client %s\n" , client->name);
> I don't think this should be a notice but instead a debug message, and it's
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3904
PS3, Line 3904: 
> Should be on the following line
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3904
PS3, Line 3904: static void fetch_access_token(struct ast_xmpp_client_config *cfg)
> The { should be on the next line.
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3905
PS3, Line 3905: {
              : 	RAII_VAR(char *,
> I'd use ast_calloc or ast_asprintf to allocate these.  8K is a little big f
Left cBuf[1024] only, suppose it's satisfied.


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3912
PS3, Line 3912: 	ast_asprintf(&cmd, "CURL(%s,client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token)",
> ast_asprintf can be used here to produce the cmd, so that a 4k buffer doesn
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3915
PS3, Line 3915: 	ast_log(LOG_DEBUG, "Command %s\n" , cmd);
> This appears to be a debug message while developing this.
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3918
PS3, Line 3918: 	if (!ast_func_read(NULL, cmd, cBuf, sizeof(cBuf) - 1)) {
> This adds a dependency on CURL for this which isn't documented and should b
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3919
PS3, Line 3919: 		ast_log(LOG_ERROR, "CURL is disabled. Add 'load = func_curl.so' to modules.conf\n", cBuf);
> This appears to be a debug message while developing this.
Done


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3925
PS3, Line 3925: 	if (jobj != NULL) {
> Is the token guaranteed to be the same or less than the existing token? If 
>From time to time tokens have approximately the same length. If you aware about the problem, let me know how to be in this case?


https://gerrit.asterisk.org/#/c/6158/3/res/res_xmpp.c@3926
PS3, Line 3926: 		const char *token = ast_json_string_get(ast_json_object_get(jobj, "access_token"));
              : 		if (token != NULL) {
              : 			ast_string_field_set(cfg, password, token);
              : 			return;
              : 		}
              : 	}
> These log messages aren't useful to users for when something goes wrong. It
Done



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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I07f7052a502457ab55010a4d3686653b60f4c8db
Gerrit-Change-Number: 6158
Gerrit-PatchSet: 4
Gerrit-Owner: Andrey <andr06 at gmail.com>
Gerrit-Reviewer: Andrey <andr06 at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Comment-Date: Wed, 09 Aug 2017 20:02:43 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170809/d1baf0a6/attachment-0001.html>


More information about the asterisk-code-review mailing list