svn commit: samba r10761 - in branches/SAMBA_4_0/source: libcli/nbt libcli/wrepl pidl/lib/Parse/Pidl

metze at samba.org metze at samba.org
Thu Oct 6 07:26:06 GMT 2005


Author: metze
Date: 2005-10-06 07:26:05 +0000 (Thu, 06 Oct 2005)
New Revision: 10761

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

Log:
we need to use a pointer to a nbt_name to fix compiler warnings, because we can
only use a pointers to unknown types in proto.h

metze
Modified:
   branches/SAMBA_4_0/source/libcli/nbt/nbtname.c
   branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/nbt/nbtname.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/nbtname.c	2005-10-06 07:04:36 UTC (rev 10760)
+++ branches/SAMBA_4_0/source/libcli/nbt/nbtname.c	2005-10-06 07:26:05 UTC (rev 10761)
@@ -474,8 +474,9 @@
 /*
   pull a nbt name, WINS Replication uses another on wire format for nbt name
 */
-NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r)
+NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r)
 {
+	struct nbt_name *r;
 	uint8_t *namebuf;
 	uint32_t namebuf_len;
 
@@ -491,6 +492,8 @@
 	NDR_PULL_ALLOC_N(ndr, namebuf, namebuf_len);
 	NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
 
+	NDR_PULL_ALLOC(ndr, r);	
+
 	/* oh wow, what a nasty bug in windows ... */
 	if (namebuf[0] == 0x1b && namebuf_len >= 16) {
 		namebuf[0] = namebuf[15];
@@ -500,12 +503,13 @@
 	if (namebuf_len < 17) {
 		r->type	= 0x00;
 
-		r->name	= talloc_strndup(ndr->current_mem_ctx, (char *)namebuf, namebuf_len);
+		r->name	= talloc_strndup(r, (char *)namebuf, namebuf_len);
 		if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
 
 		r->scope= NULL;
 
 		talloc_free(namebuf);
+		*_r = r;
 		return NT_STATUS_OK;
 	}
 
@@ -513,49 +517,52 @@
 
 	namebuf[15] = '\0';
 	trim_string((char *)namebuf, NULL, " ");
-	r->name = talloc_strdup(ndr->current_mem_ctx, (char *)namebuf);
+	r->name = talloc_strdup(r, (char *)namebuf);
 	if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
 
 	if (namebuf_len > 18) {
-		r->scope = talloc_strndup(ndr->current_mem_ctx, (char *)(namebuf+17), namebuf_len-17);
+		r->scope = talloc_strndup(r, (char *)(namebuf+17), namebuf_len-17);
 		if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
 	} else {
 		r->scope = NULL;
 	}
 
 	talloc_free(namebuf);
+	*_r = r;
 	return NT_STATUS_OK;
 }
 
 /*
   push a nbt name, WINS Replication uses another on wire format for nbt name
 */
-NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name r)
+NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
 {
 	uint8_t *namebuf;
 	uint32_t namebuf_len;
 	uint32_t name_len;
 	uint32_t scope_len = 0;
 
+	if (r == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+
 	if (!(ndr_flags & NDR_SCALARS)) {
 		return NT_STATUS_OK;
 	}
 
-	name_len = strlen(r.name);
+	name_len = strlen(r->name);
 	if (name_len > 15) {
 		return NT_STATUS_INVALID_PARAMETER_MIX;
 	}
 
-	if (r.scope) {
-		scope_len = strlen(r.scope);
+	if (r->scope) {
+		scope_len = strlen(r->scope);
 	}
 	if (scope_len > 238) {
 		return NT_STATUS_INVALID_PARAMETER_MIX;
 	}
 
 	namebuf = (uint8_t *)talloc_asprintf(ndr, "%-15s%c%s",
-					     r.name, 'X',
-					     (r.scope?r.scope:""));
+					     r->name, 'X',
+					     (r->scope?r->scope:""));
 	if (!namebuf) return ndr_push_error(ndr, NDR_ERR_ALLOC, "out of memory");
 
 	namebuf_len = strlen((char *)namebuf) + 1;
@@ -564,10 +571,10 @@
 	 * we need to set the type here, and use a place-holder in the talloc_asprintf()
 	 * as the type can be 0x00, and then the namebuf_len = strlen(namebuf); would give wrong results
 	 */
-	namebuf[15] = r.type;
+	namebuf[15] = r->type;
 
 	/* oh wow, what a nasty bug in windows ... */
-	if (r.type == 0x1b) {
+	if (r->type == 0x1b) {
 		namebuf[15] = namebuf[0];
 		namebuf[0] = 0x1b;
 	}
@@ -580,9 +587,9 @@
 	return NT_STATUS_OK;
 }
 
-void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name r)
+void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
 {
-	char *s = nbt_name_string(ndr, &r);
+	char *s = nbt_name_string(ndr, r);
 	ndr_print_string(ndr, name, s);
 	talloc_free(s);
 }

Modified: branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c	2005-10-06 07:04:36 UTC (rev 10760)
+++ branches/SAMBA_4_0/source/libcli/wrepl/winsrepl.c	2005-10-06 07:26:05 UTC (rev 10761)
@@ -745,9 +745,8 @@
 		struct wrepl_wins_name *wname = &packet->message.replication.info.reply.names[i];
 		struct wrepl_name *name = &io->out.names[i];
 
-		name->name	= wname->name;
-		talloc_steal(io->out.names, wname->name.name);
-		talloc_steal(io->out.names, wname->name.scope);
+		name->name	= *wname->name;
+		talloc_steal(io->out.names, wname->name);
 		name->type	= WREPL_NAME_TYPE(wname->flags);
 		name->state	= WREPL_NAME_STATE(wname->flags);
 		name->node	= WREPL_NAME_NODE(wname->flags);

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm	2005-10-06 07:04:36 UTC (rev 10760)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Typelist.pm	2005-10-06 07:26:05 UTC (rev 10761)
@@ -129,8 +129,8 @@
 				IS_REFERENCE	=> 1,
 			},
 	"wrepl_nbt_name"=> {
-				C_TYPE		=> "struct nbt_name",
-				IS_REFERENCE	=> 0,
+				C_TYPE		=> "struct nbt_name *",
+				IS_REFERENCE	=> 1,
 			},
 	"ipv4address"	=> {
 				C_TYPE		=> "const char *",



More information about the samba-cvs mailing list