svn commit: samba r2206 - in branches/SAMBA_4_0/source/librpc/ndr: .

tridge at samba.org tridge at samba.org
Fri Sep 3 12:58:19 GMT 2004


Author: tridge
Date: 2004-09-03 12:58:19 +0000 (Fri, 03 Sep 2004)
New Revision: 2206

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/librpc/ndr&rev=2206&nolog=1

Log:
another (untested) attempt to make RELATIVE_CURRENT work for volker,
plus removed unused ndr_pull_relative() function

once volker commits a test for this I'll be able to ensure it really works as expected

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2004-09-03 12:52:04 UTC (rev 2205)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2004-09-03 12:58:19 UTC (rev 2206)
@@ -620,46 +620,7 @@
 {
 }
 
-
 /*
-  pull a relative structure
-*/
-NTSTATUS ndr_pull_relative(struct ndr_pull *ndr, const void **buf, size_t size, 
-			   NTSTATUS (*fn)(struct ndr_pull *, int ndr_flags, void *))
-{
-	struct ndr_pull *ndr2;
-	uint32_t ofs;
-	struct ndr_pull_save save;
-	void *p;
-
-	NDR_ALLOC(ndr, ndr2);
-	NDR_CHECK(ndr_pull_uint32(ndr, &ofs));
-	if (ofs == 0) {
-		(*buf) = NULL;
-		return NT_STATUS_OK;
-	}
-	ndr_pull_save(ndr, &save);
-	if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) {
-		NDR_CHECK(ndr_pull_set_offset(ndr, ofs + ndr->offset - 4));
-	} else {
-		NDR_CHECK(ndr_pull_set_offset(ndr, ofs));
-	}
-	NDR_CHECK(ndr_pull_subcontext(ndr, ndr2, ndr->data_size - ndr->offset));
-	/* strings must be allocated by the backend functions */
-	if (ndr->flags & LIBNDR_STRING_FLAGS) {
-		NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, &p));
-	} else {
-		NDR_ALLOC_SIZE(ndr, p, size);
-		NDR_CHECK(fn(ndr2, NDR_SCALARS|NDR_BUFFERS, p));
-	}
-	(*buf) = p;
-	ndr_pull_restore(ndr, &save);
-	talloc_free(ndr2);
-	return NT_STATUS_OK;
-}
-
-
-/*
   store a token in the ndr context, for later retrieval
 */
 static NTSTATUS ndr_token_store(TALLOC_CTX *mem_ctx, 
@@ -700,7 +661,12 @@
 */
 NTSTATUS ndr_pull_relative1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset)
 {
-	return ndr_token_store(ndr, &ndr->relative_list, p, rel_offset);
+	if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) {
+		return ndr_token_store(ndr, &ndr->relative_list, p, 
+				       rel_offset + ndr->offset);
+	} else {
+		return ndr_token_store(ndr, &ndr->relative_list, p, rel_offset);
+	}
 }
 
 /*



More information about the samba-cvs mailing list