summaryrefslogtreecommitdiffstats
path: root/source3/libsmb
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2015-01-16 16:18:45 +0100
committerMichael Adam <obnox@samba.org>2015-01-19 06:48:05 +0100
commita0a254f74234bed6c9a0c71a5bda8254fa6f633f (patch)
tree6b75fc44cbe68e596f741b95859d7e9a881d6bf0 /source3/libsmb
parent47155641cb48d39d3ee7d8b8962f5ed6b23617d4 (diff)
downloadsamba-a0a254f74234bed6c9a0c71a5bda8254fa6f633f.tar.gz
samba-a0a254f74234bed6c9a0c71a5bda8254fa6f633f.tar.xz
samba-a0a254f74234bed6c9a0c71a5bda8254fa6f633f.zip
cli_connect_nb_send: don't segfault on host == NULL.
The functions called futher down can cope with host == NULL. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058 This is part one of the bugfix: This ensures that it is enough to pass one of host or address to the function. Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 7a9e64834c..9cbf11f1cb 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3004,21 +3004,29 @@ static struct tevent_req *cli_connect_nb_send(
{
struct tevent_req *req, *subreq;
struct cli_connect_nb_state *state;
- char *p;
req = tevent_req_create(mem_ctx, &state, struct cli_connect_nb_state);
if (req == NULL) {
return NULL;
}
- state->desthost = host;
state->signing_state = signing_state;
state->flags = flags;
- p = strchr(host, '#');
- if (p != NULL) {
- name_type = strtol(p+1, NULL, 16);
- host = talloc_strndup(state, host, p - host);
- if (tevent_req_nomem(host, req)) {
+ if (host != NULL) {
+ char *p = strchr(host, '#');
+
+ if (p != NULL) {
+ name_type = strtol(p+1, NULL, 16);
+ host = talloc_strndup(state, host, p - host);
+ if (tevent_req_nomem(host, req)) {
+ return tevent_req_post(req, ev);
+ }
+ }
+
+ state->desthost = host;
+ } else {
+ state->desthost = print_canonical_sockaddr(state, dest_ss);
+ if (tevent_req_nomem(state->desthost, req)) {
return tevent_req_post(req, ev);
}
}