summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/swig.pm25
-rw-r--r--source4/scripting/swig/torture/spoolss.py10
2 files changed, 15 insertions, 20 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm
index b75891df17..df63548d41 100644
--- a/source4/build/pidl/swig.pm
+++ b/source4/build/pidl/swig.pm
@@ -468,7 +468,10 @@ sub ParseStruct($)
$result .= "/* Convert a Python string to a struct $s->{NAME} python dict */\n\n";
$result .= "NTSTATUS unmarshall_$s->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct $s->{NAME} *s)\n";
$result .= "{\n";
- $result .= "\treturn ndr_pull_struct_blob(blob, mem_ctx, s, ndr_pull_$s->{NAME});\n";
+ $result .= "\tstruct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx);\n";
+ $result .= "\tNTSTATUS result;\n\n";
+ $result .= "\tresult = ndr_pull_struct_blob(blob, mem_ctx, s, ndr_pull_$s->{NAME});\n";
+ $result .= "\treturn result;\n";
$result .= "}\n\n";
}
@@ -482,7 +485,7 @@ sub ParseStruct($)
$result .= "%typemap(argout) struct $s->{NAME} * {\n";
$result .= "\tTALLOC_CTX *mem_ctx = talloc_init(\"typemap(argout) $s->{NAME}\");\n\n";
- $result .= "\tresultobj = $s->{NAME}_ptr_to_python(mem_ctx, \$1);\n";
+ $result .= "\t\$result = $s->{NAME}_ptr_to_python(mem_ctx, \$1);\n";
$result .= "}\n\n";
$result .= "NTSTATUS unmarshall_$s->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct $s->{NAME} *EMPTY);\n\n";
@@ -574,7 +577,7 @@ sub ParseUnion($)
$result .= "\t\treturn;\n";
$result .= "\t}\n\n";
}
- $result .= "}\n";
+ $result .= "}\n\n";
# Generate function to convert union pointer to Python dict
@@ -604,21 +607,7 @@ sub ParseUnion($)
$result .= "}\n\n";
- # Generate function to convert DATA_BLOB to Python dict
-
- if (util::has_property($u->{DATA}, "public")) {
- $result .= "/* Convert a Python string to a struct $u->{NAME} python dict */\n\n";
- $result .= "NTSTATUS unmarshall_$u->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, union $u->{NAME} *u)\n";
- $result .= "{\n";
- $result .= "\treturn NT_STATUS_OK;\n";
- $result .= "}\n\n";
- }
-
- $result .= "\n%}\n\n";
-
- if (util::has_property($u->{DATA}, "public")) {
- $result .= "NTSTATUS unmarshall_$u->{NAME}(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, union $u->{NAME} *EMPTY);\n\n";
- }
+ $result .= "%}\n\n";
return $result;
}
diff --git a/source4/scripting/swig/torture/spoolss.py b/source4/scripting/swig/torture/spoolss.py
index e29178a0b6..d7a16917f9 100644
--- a/source4/scripting/swig/torture/spoolss.py
+++ b/source4/scripting/swig/torture/spoolss.py
@@ -6,11 +6,17 @@ def test_EnumPrinters(pipe):
r['flags'] = 0x02
r['server'] = None
r['level'] = 1
- r['buffer'] = 392 * '\x00'
- r['buf_size'] = 392
+ r['buffer'] = None
+ r['buf_size'] = 0
result = dcerpc.spoolss_EnumPrinters(pipe, r)
+ if result['result'] == dcerpc.WERR_INSUFFICIENT_BUFFER:
+ r['buffer'] = result['buf_size'] * '\x00'
+ r['buf_size'] = result['buf_size']
+
+ result = dcerpc.spoolss_EnumPrinters(pipe, r)
+
print dcerpc.unmarshall_spoolss_PrinterInfo1(result['buffer'])
def runtests(binding, domain, username, password):