diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-08 04:07:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:20 -0500 |
commit | 5fa5eb1da002a64d48779d89e2fab0d53e9f15f7 (patch) | |
tree | 9af6fdb1d2f8f556171ed5e607bd47dae00aaff6 /source4 | |
parent | 7fded3c856735050e7d72972da8bc2cd19f01cd8 (diff) | |
download | samba-5fa5eb1da002a64d48779d89e2fab0d53e9f15f7.tar.gz samba-5fa5eb1da002a64d48779d89e2fab0d53e9f15f7.tar.bz2 samba-5fa5eb1da002a64d48779d89e2fab0d53e9f15f7.zip |
r8216: - handle union pull in ejs pidl generation
- added debugging calls for missing structure/union elements
(This used to be commit f3ff48204cb8edeb9f42afbbefe13f7d49305506)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/ejs.pm | 21 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.c | 9 |
2 files changed, 28 insertions, 2 deletions
diff --git a/source4/build/pidl/ejs.pm b/source4/build/pidl/ejs.pm index 1b5c34510c..3fe9579aba 100644 --- a/source4/build/pidl/ejs.pm +++ b/source4/build/pidl/ejs.pm @@ -193,10 +193,26 @@ sub EjsUnionPull($$) { my $name = shift; my $d = shift; + my $have_default = 0; my $env = GenerateStructEnv($d); pidl "\nstatic NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, union $name *r)\n{\n"; - pidl "return ejs_panic(ejs, \"union pull not handled\");\n"; - pidl "}\n\n"; + pidl "\tNDR_CHECK(ejs_pull_struct_start(ejs, &v, name));\n"; + pidl "switch (ejs->switch_var) {\n"; + foreach my $e (@{$d->{ELEMENTS}}) { + if ($e->{CASE} eq "default") { + $have_default = 1; + } + pidl "$e->{CASE}:"; + if ($e->{TYPE} ne "EMPTY") { + EjsPullElementTop($e, $env); + } + pidl "break;\n"; + } + if (! $have_default) { + pidl "default:"; + pidl "\treturn ejs_panic(ejs, \"Bad switch value\");"; + } + pidl "}\nreturn NT_STATUS_OK;\n}\n"; } ########################### @@ -368,6 +384,7 @@ sub EjsUnionPush($$) my $have_default = 0; my $env = GenerateStructEnv($d); pidl "\nstatic NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const union $name *r)\n{\n"; + pidl "\tNDR_CHECK(ejs_push_struct_start(ejs, &v, name));\n"; pidl "switch (ejs->switch_var) {\n"; foreach my $e (@{$d->{ELEMENTS}}) { if ($e->{CASE} eq "default") { diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c index 574c75b7de..19c1a2fc8d 100644 --- a/source4/scripting/ejs/ejsrpc.c +++ b/source4/scripting/ejs/ejsrpc.c @@ -100,6 +100,7 @@ static NTSTATUS mprSetVar(struct MprVar *v, const char *name, struct MprVar val) if (p == NULL) { v2 = mprSetProperty(v, name, &val); if (v2 == NULL) { + DEBUG(1,("mprSetVar unable to set '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } return NT_STATUS_OK; @@ -126,6 +127,7 @@ NTSTATUS ejs_pull_struct_start(struct ejs_rpc *ejs, struct MprVar **v, const cha { *v = mprGetProperty(*v, name, NULL); if (*v == NULL) { + DEBUG(1,("ejs_pull_struct_start: missing structure '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER; } return NT_STATUS_OK; @@ -140,6 +142,7 @@ NTSTATUS ejs_push_struct_start(struct ejs_rpc *ejs, struct MprVar **v, const cha struct MprVar s = mprCreateObjVar(name, MPR_DEFAULT_HASH_SIZE); *v = mprSetProperty(*v, name, &s); if (*v == NULL) { + DEBUG(1,("ejs_push_struct_start: unable to set structure '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER; } return NT_STATUS_OK; @@ -154,6 +157,7 @@ NTSTATUS ejs_pull_uint8(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_pull_uint8: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *r = mprVarToInteger(var); @@ -176,6 +180,7 @@ NTSTATUS ejs_pull_uint16(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_pull_uint16: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *r = mprVarToInteger(var); @@ -198,6 +203,7 @@ NTSTATUS ejs_pull_uint32(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_push_uint32: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *r = mprVarToInteger(var); @@ -216,6 +222,7 @@ NTSTATUS ejs_pull_hyper(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_pull_hyper: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *r = mprVarToInteger(var); @@ -239,6 +246,7 @@ NTSTATUS ejs_pull_enum(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_pull_enum: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *r = mprVarToInteger(var); @@ -262,6 +270,7 @@ NTSTATUS ejs_pull_string(struct ejs_rpc *ejs, struct MprVar *var; var = mprGetVar(v, name); if (var == NULL) { + DEBUG(1,("ejs_pull_string: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } *s = mprToString(var); |