The Samba-Bugzilla – Attachment 10629 Details for
Bug 11058
'net time' segfaults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
v4-2-test patch
look (text/plain), 3.77 KB, created by
Andreas Schneider
on 2015-01-19 13:00:59 UTC
(
hide
)
Description:
v4-2-test patch
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2015-01-19 13:00:59 UTC
Size:
3.77 KB
patch
obsolete
>From 707103ac38c28ff2506effbb8b4a95e2b23481c7 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Fri, 16 Jan 2015 16:18:45 +0100 >Subject: [PATCH 1/2] 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> >(cherry picked from commit a0a254f74234bed6c9a0c71a5bda8254fa6f633f) >--- > source3/libsmb/cliconnect.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > >diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c >index 9508651..7292805 100644 >--- a/source3/libsmb/cliconnect.c >+++ b/source3/libsmb/cliconnect.c >@@ -3013,21 +3013,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); > } > } >-- >2.2.2 > > >From 54259abd8311aa57796ec3478a148d04bfa3670b Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 13 Jan 2015 17:04:26 +0100 >Subject: [PATCH 2/2] utils: Fix 'net time' segfault. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058 > >This is part two of the bugfix. Make sure we pass the IP we found to >cli_servertime(). Hence we always pass at least one of name or IP. > >Pair-Programmed-With: Michael Adam <obnox@samba.org> > >Signed-off-by: Andreas Schneider <asn@samba.org> >Signed-off-by: Michael Adam <obnox@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 45829800eb3f3a8aeccfe7c1114dcf9df60371d5) >--- > source3/utils/net_time.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > >diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c >index 56ce8f7..595d903 100644 >--- a/source3/utils/net_time.c >+++ b/source3/utils/net_time.c >@@ -226,16 +226,23 @@ int net_time(struct net_context *c, int argc, const char **argv) > return 0; > } > >- if (!c->opt_host && !c->opt_have_ip && >- !find_master_ip(c->opt_target_workgroup, &c->opt_dest_ip)) { >- d_fprintf(stderr, _("Could not locate a time server. Try " >- "specifying a target host.\n")); >- net_time_usage(c, argc,argv); >- return -1; >+ if (c->opt_host == NULL && !c->opt_have_ip) { >+ bool ok; >+ >+ ok = find_master_ip(c->opt_target_workgroup, &c->opt_dest_ip); >+ if (!ok) { >+ d_fprintf(stderr, >+ _("Could not locate a time server. " >+ "Try specifying a target host.\n")); >+ net_time_usage(c, argc, argv); >+ return -1; >+ } >+ c->opt_have_ip = true; > } > > /* default - print the time */ >- t = cli_servertime(c->opt_host, c->opt_have_ip? &c->opt_dest_ip : NULL, >+ t = cli_servertime(c->opt_host, >+ c->opt_have_ip? &c->opt_dest_ip : NULL, > NULL); > if (t == 0) return -1; > >-- >2.2.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
obnox
:
review+
Actions:
View
Attachments on
bug 11058
: 10629 |
10630