Author: abartlet
Date: 2006-01-12 06:44:28 +0000 (Thu, 12 Jan 2006)
New Revision: 12862

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12862

Log:
Need to trim spaces off the end of the node status reply.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/libcli/finddcs.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/finddcs.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/finddcs.c  2006-01-12 03:30:20 UTC (rev 
12861)
+++ branches/SAMBA_4_0/source/libcli/finddcs.c  2006-01-12 06:44:28 UTC (rev 
12862)
@@ -214,7 +214,16 @@
        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;
        }

Reply via email to