From 3f8ee534bafa149c00f050abea8ae111fea61287 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 12 Jan 2006 06:44:28 +0000 Subject: r12862: Need to trim spaces off the end of the node status reply. Andrew Bartlett (This used to be commit 3e90e7edfa7d343a6b6bf073b8f4d018e3b463d0) --- source4/libcli/finddcs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 036b937f69..3b72cceba0 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -214,7 +214,16 @@ static void fallback_node_status_replied(struct nbt_name_request *name_req) if (!composite_is_ok(state->ctx)) return; if (state->node_status.out.status.num_names > 0) { - state->dcs[0].name = talloc_steal(state->dcs, state->node_status.out.status.names[0].name); + int i; + char *name = talloc_strndup(state->dcs, state->node_status.out.status.names[0].name, 15); + /* Strip space padding */ + if (name) { + i = MIN(strlen(name), 15); + for (; i > 0 && name[i - 1] == ' '; i--) { + name[i - 1] = '\0'; + } + } + state->dcs[0].name = name; composite_done(state->ctx); return; } -- cgit