Skip to content

Commit

Permalink
Fix -L url parsing.
Browse files Browse the repository at this point in the history
Closes #1248. Thanks to Andrew J Freyer.
  • Loading branch information
ralight committed Sep 17, 2019
1 parent ccded56 commit 127b6a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Broker:
`response-topic`. Closes #1244.
- Fix build for WITH_TLS=no. Closes #1250.

Client library:
Library:
- Fix crash after client has been unable to connect to a broker. This occurs
when the client is exiting and is part of the final library cleanup routine.
Closes #1246.

Clients:
- Fix -L url parsing. Closes #1248.


1.6.1 - 20190426
================
Expand Down
8 changes: 5 additions & 3 deletions client/client_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,13 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c

tmp = strchr(url, '@');
if(tmp) {
char *colon = strchr(url, ':');
*tmp++ = 0;
char *colon = strchr(url, ':');
if(colon) {
*colon = 0;
cfg->password = colon + 1;
cfg->password = strdup(colon + 1);
}
cfg->username = url;
cfg->username = strdup(url);
url = tmp;
}
cfg->host = url;
Expand All @@ -685,6 +685,8 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
*tmp++ = 0;
cfg->port = atoi(tmp);
}
/* Now we've removed the port, time to get the host on the heap */
cfg->host = strdup(cfg->host);
}
i++;
}else if(!strcmp(argv[i], "-l") || !strcmp(argv[i], "--stdin-line")){
Expand Down

0 comments on commit 127b6a3

Please sign in to comment.