/* set if an object uuid will be present */
#define LIBNDR_FLAG_OBJECT_PRESENT (1<<30)
+/* set to avoid recursion in ndr_size_*() calculation */
+#define LIBNDR_FLAG_NO_NDR_SIZE (1<<31)
+
/* useful macro for debugging */
#define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
#define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_union_fn_t)ndr_print_ ##type, #p, level, p)
NTSTATUS status;
size_t ret;
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return 0;
- ndr->flags |= flags;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
return 0;
NTSTATUS status;
size_t ret;
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return 0;
- ndr->flags |= flags;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, level, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
return 0;