|
|
167d4b |
From 389170e609310395cb77edafdd7298cdfdfdc235 Mon Sep 17 00:00:00 2001
|
|
|
167d4b |
From: Michael Adam <obnox@samba.org>
|
|
|
167d4b |
Date: Fri, 16 Jan 2015 16:18:45 +0100
|
|
|
167d4b |
Subject: [PATCH 1/2] cli_connect_nb_send: don't segfault on host == NULL.
|
|
|
167d4b |
|
|
|
167d4b |
The functions called futher down can cope with host == NULL.
|
|
|
167d4b |
|
|
|
167d4b |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058
|
|
|
167d4b |
|
|
|
167d4b |
This is part one of the bugfix:
|
|
|
167d4b |
This ensures that it is enough to pass one of host or address to the function.
|
|
|
167d4b |
|
|
|
167d4b |
Pair-Programmed-With: Andreas Schneider <asn@samba.org>
|
|
|
167d4b |
|
|
|
167d4b |
Signed-off-by: Michael Adam <obnox@samba.org>
|
|
|
167d4b |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
167d4b |
Reviewed-by: Jeremy Allison <jra@samba.org>
|
|
|
167d4b |
(cherry picked from commit a0a254f74234bed6c9a0c71a5bda8254fa6f633f)
|
|
|
167d4b |
---
|
|
|
167d4b |
source3/libsmb/cliconnect.c | 22 +++++++++++++++-------
|
|
|
167d4b |
1 file changed, 15 insertions(+), 7 deletions(-)
|
|
|
167d4b |
|
|
|
167d4b |
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
|
|
|
167d4b |
index 13e7704..5255e8a 100644
|
|
|
167d4b |
--- a/source3/libsmb/cliconnect.c
|
|
|
167d4b |
+++ b/source3/libsmb/cliconnect.c
|
|
|
167d4b |
@@ -2995,21 +2995,29 @@ static struct tevent_req *cli_connect_nb_send(
|
|
|
167d4b |
{
|
|
|
167d4b |
struct tevent_req *req, *subreq;
|
|
|
167d4b |
struct cli_connect_nb_state *state;
|
|
|
167d4b |
- char *p;
|
|
|
167d4b |
|
|
|
167d4b |
req = tevent_req_create(mem_ctx, &state, struct cli_connect_nb_state);
|
|
|
167d4b |
if (req == NULL) {
|
|
|
167d4b |
return NULL;
|
|
|
167d4b |
}
|
|
|
167d4b |
- state->desthost = host;
|
|
|
167d4b |
state->signing_state = signing_state;
|
|
|
167d4b |
state->flags = flags;
|
|
|
167d4b |
|
|
|
167d4b |
- p = strchr(host, '#');
|
|
|
167d4b |
- if (p != NULL) {
|
|
|
167d4b |
- name_type = strtol(p+1, NULL, 16);
|
|
|
167d4b |
- host = talloc_strndup(state, host, p - host);
|
|
|
167d4b |
- if (tevent_req_nomem(host, req)) {
|
|
|
167d4b |
+ if (host != NULL) {
|
|
|
167d4b |
+ char *p = strchr(host, '#');
|
|
|
167d4b |
+
|
|
|
167d4b |
+ if (p != NULL) {
|
|
|
167d4b |
+ name_type = strtol(p+1, NULL, 16);
|
|
|
167d4b |
+ host = talloc_strndup(state, host, p - host);
|
|
|
167d4b |
+ if (tevent_req_nomem(host, req)) {
|
|
|
167d4b |
+ return tevent_req_post(req, ev);
|
|
|
167d4b |
+ }
|
|
|
167d4b |
+ }
|
|
|
167d4b |
+
|
|
|
167d4b |
+ state->desthost = host;
|
|
|
167d4b |
+ } else {
|
|
|
167d4b |
+ state->desthost = print_canonical_sockaddr(state, dest_ss);
|
|
|
167d4b |
+ if (tevent_req_nomem(state->desthost, req)) {
|
|
|
167d4b |
return tevent_req_post(req, ev);
|
|
|
167d4b |
}
|
|
|
167d4b |
}
|
|
|
167d4b |
--
|
|
|
167d4b |
2.2.2
|
|
|
167d4b |
|
|
|
167d4b |
|
|
|
167d4b |
From ff6f3e175262d802fa64ef78e7047dbf136b2722 Mon Sep 17 00:00:00 2001
|
|
|
167d4b |
From: Andreas Schneider <asn@samba.org>
|
|
|
167d4b |
Date: Tue, 13 Jan 2015 17:04:26 +0100
|
|
|
167d4b |
Subject: [PATCH 2/2] utils: Fix 'net time' segfault.
|
|
|
167d4b |
|
|
|
167d4b |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058
|
|
|
167d4b |
|
|
|
167d4b |
This is part two of the bugfix. Make sure we pass the IP we found to
|
|
|
167d4b |
cli_servertime(). Hence we always pass at least one of name or IP.
|
|
|
167d4b |
|
|
|
167d4b |
Pair-Programmed-With: Michael Adam <obnox@samba.org>
|
|
|
167d4b |
|
|
|
167d4b |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
167d4b |
Signed-off-by: Michael Adam <obnox@samba.org>
|
|
|
167d4b |
Reviewed-by: Jeremy Allison <jra@samba.org>
|
|
|
167d4b |
(cherry picked from commit 45829800eb3f3a8aeccfe7c1114dcf9df60371d5)
|
|
|
167d4b |
---
|
|
|
167d4b |
source3/utils/net_time.c | 21 ++++++++++++++-------
|
|
|
167d4b |
1 file changed, 14 insertions(+), 7 deletions(-)
|
|
|
167d4b |
|
|
|
167d4b |
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
|
|
|
167d4b |
index 56ce8f7..595d903 100644
|
|
|
167d4b |
--- a/source3/utils/net_time.c
|
|
|
167d4b |
+++ b/source3/utils/net_time.c
|
|
|
167d4b |
@@ -226,16 +226,23 @@ int net_time(struct net_context *c, int argc, const char **argv)
|
|
|
167d4b |
return 0;
|
|
|
167d4b |
}
|
|
|
167d4b |
|
|
|
167d4b |
- if (!c->opt_host && !c->opt_have_ip &&
|
|
|
167d4b |
- !find_master_ip(c->opt_target_workgroup, &c->opt_dest_ip)) {
|
|
|
167d4b |
- d_fprintf(stderr, _("Could not locate a time server. Try "
|
|
|
167d4b |
- "specifying a target host.\n"));
|
|
|
167d4b |
- net_time_usage(c, argc,argv);
|
|
|
167d4b |
- return -1;
|
|
|
167d4b |
+ if (c->opt_host == NULL && !c->opt_have_ip) {
|
|
|
167d4b |
+ bool ok;
|
|
|
167d4b |
+
|
|
|
167d4b |
+ ok = find_master_ip(c->opt_target_workgroup, &c->opt_dest_ip);
|
|
|
167d4b |
+ if (!ok) {
|
|
|
167d4b |
+ d_fprintf(stderr,
|
|
|
167d4b |
+ _("Could not locate a time server. "
|
|
|
167d4b |
+ "Try specifying a target host.\n"));
|
|
|
167d4b |
+ net_time_usage(c, argc, argv);
|
|
|
167d4b |
+ return -1;
|
|
|
167d4b |
+ }
|
|
|
167d4b |
+ c->opt_have_ip = true;
|
|
|
167d4b |
}
|
|
|
167d4b |
|
|
|
167d4b |
/* default - print the time */
|
|
|
167d4b |
- t = cli_servertime(c->opt_host, c->opt_have_ip? &c->opt_dest_ip : NULL,
|
|
|
167d4b |
+ t = cli_servertime(c->opt_host,
|
|
|
167d4b |
+ c->opt_have_ip? &c->opt_dest_ip : NULL,
|
|
|
167d4b |
NULL);
|
|
|
167d4b |
if (t == 0) return -1;
|
|
|
167d4b |
|
|
|
167d4b |
--
|
|
|
167d4b |
2.2.2
|
|
|
167d4b |
|