summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-17 00:27:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:56 -0500
commitc7a762bc748c63049d237de176167a13d1b8b0de (patch)
tree978b0fcbb1f1123afb2d2d96fb91732340f1ad1f /source4
parent71aaba4ea7e0e95c7a976e2a163e0ff25689dcd4 (diff)
downloadsamba-c7a762bc748c63049d237de176167a13d1b8b0de.tar.gz
samba-c7a762bc748c63049d237de176167a13d1b8b0de.tar.bz2
samba-c7a762bc748c63049d237de176167a13d1b8b0de.zip
r3009: Fix up unmarshall functions to return Python dict instead of a NTSTATUS.
We can now unmarshall a single printer returned from an EnumPrinters. (This used to be commit 89da7a9196d40699881f12c9a5fe62301aafd4cf)
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):