diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/ejs.pm | 86 | ||||
-rw-r--r-- | source4/build/pidl/ejs_header.pm | 75 | ||||
-rwxr-xr-x | source4/build/pidl/pidl.pl | 5 | ||||
-rw-r--r-- | source4/build/pidl/validator.pm | 1 | ||||
-rw-r--r-- | source4/librpc/config.mk | 20 | ||||
-rw-r--r-- | source4/librpc/idl/misc.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/security.idl | 2 | ||||
-rw-r--r-- | source4/scripting/ejs/config.mk | 2 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.c | 108 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.h | 25 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_rpc.c | 13 |
11 files changed, 314 insertions, 25 deletions
diff --git a/source4/build/pidl/ejs.pm b/source4/build/pidl/ejs.pm index 24204b79b3..751f7f326e 100644 --- a/source4/build/pidl/ejs.pm +++ b/source4/build/pidl/ejs.pm @@ -88,6 +88,15 @@ sub get_value_of($) } } +##################################################################### +# work out is a parse function should be declared static or not +sub fn_prefix($) +{ + my $fn = shift; + + return "" if (util::has_property($fn, "public")); + return "static "; +} ########################### # pull a scalar element @@ -95,6 +104,10 @@ sub EjsPullScalar($$$$$) { my ($e, $l, $var, $name, $env) = @_; $var = get_pointer_to($var); + # have to handle strings specially :( + if ($e->{TYPE} eq "string") { + $var = get_pointer_to($var); + } pidl "\tNDR_CHECK(ejs_pull_$e->{TYPE}(ejs, v, $name, $var));\n"; } @@ -103,7 +116,7 @@ sub EjsPullScalar($$$$$) sub EjsPullPointer($$$$$) { my ($e, $l, $var, $name, $env) = @_; - pidl "EJS_ALLOC(ejs, $var);\n"; + pidl "\tEJS_ALLOC(ejs, $var);\n"; $var = get_value_of($var); EjsPullElement($e, Ndr::GetNextLevel($e, $l), $var, $name, $env); } @@ -124,10 +137,20 @@ sub EjsPullArray($$$$$) { my ($e, $l, $var, $name, $env) = @_; my $length = util::ParseExpr($l->{LENGTH_IS}, $env); - pidl "{ uint32_t i; EJS_ALLOC_N(ejs, $var, $length); for (i=0;i<$length;i++) {\n"; - pidl "\tconst char *id = talloc_asprintf(ejs, \"%s.%u\", $name, i);\n"; - EjsPullElement($e, Ndr::GetNextLevel($e, $l), $var . "[i]", "id", $env); - pidl "}\nejs_push_uint32(ejs, v, $name \".length\", &i); }\n"; + my $pl = Ndr::GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { + $var = get_pointer_to($var); + } + my $avar = $var . "[i]"; + pidl "\t{ uint32_t i;\n"; + if (!$l->{IS_FIXED}) { + pidl "\tEJS_ALLOC_N(ejs, $var, $length);\n"; + } + pidl "\tfor (i=0;i<$length;i++) {\n"; + pidl "\tchar *id = talloc_asprintf(ejs, \"%s.%u\", $name, i);\n"; + EjsPullElement($e, Ndr::GetNextLevel($e, $l), $avar, "id", $env); + pidl "\ttalloc_free(id);\n"; + pidl "\t}\nejs_push_uint32(ejs, v, $name \".length\", &i); }\n"; } ########################### @@ -179,7 +202,8 @@ sub EjsStructPull($$) my $name = shift; my $d = shift; my $env = GenerateStructEnv($d); - pidl "\nstatic NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, struct $name *r)\n{\n"; + pidl fn_prefix($d); + pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, struct $name *r)\n{\n"; pidl "\tNDR_CHECK(ejs_pull_struct_start(ejs, &v, name));\n"; foreach my $e (@{$d->{ELEMENTS}}) { EjsPullElementTop($e, $env); @@ -196,7 +220,8 @@ sub EjsUnionPull($$) 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 fn_prefix($d); + pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, union $name *r)\n{\n"; pidl "\tNDR_CHECK(ejs_pull_struct_start(ejs, &v, name));\n"; pidl "switch (ejs->switch_var) {\n"; foreach my $e (@{$d->{ELEMENTS}}) { @@ -222,7 +247,8 @@ sub EjsEnumPull($$) { my $name = shift; my $d = shift; - pidl "\nstatic NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, enum $name *r)\n{\n"; + pidl fn_prefix($d); + pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, enum $name *r)\n{\n"; pidl "\tunsigned e;\n"; pidl "\tNDR_CHECK(ejs_pull_enum(ejs, v, name, &e));\n"; pidl "\t*r = e;\n"; @@ -234,7 +260,14 @@ sub EjsEnumPull($$) # pull a bitmap sub EjsBitmapPull($$) { -# ignored for now + my $name = shift; + my $d = shift; + my $type_fn = $d->{BASE_TYPE}; + my($type_decl) = typelist::mapType($d->{BASE_TYPE}); + pidl fn_prefix($d); + pidl "NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, $type_decl *r)\n{\n"; + pidl "return ejs_pull_$type_fn(ejs, v, name, r);\n"; + pidl "}\n"; } @@ -243,6 +276,7 @@ sub EjsBitmapPull($$) sub EjsTypedefPull($) { my $d = shift; + return if (util::has_property($d, "noejs")); if ($d->{DATA}->{TYPE} eq 'STRUCT') { EjsStructPull($d->{NAME}, $d->{DATA}); } elsif ($d->{DATA}->{TYPE} eq 'UNION') { @@ -322,9 +356,14 @@ sub EjsPushArray($$$$$) { my ($e, $l, $var, $name, $env) = @_; my $length = util::ParseExpr($l->{LENGTH_IS}, $env); + my $pl = Ndr::GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { + $var = get_pointer_to($var); + } + my $avar = $var . "[i]"; pidl "{ uint32_t i; for (i=0;i<$length;i++) {\n"; pidl "\tconst char *id = talloc_asprintf(ejs, \"%s.%u\", $name, i);\n"; - EjsPushElement($e, Ndr::GetNextLevel($e, $l), $var . "[i]", "id", $env); + EjsPushElement($e, Ndr::GetNextLevel($e, $l), $avar, "id", $env); pidl "}\nejs_push_uint32(ejs, v, $name \".length\", &i); }\n"; } @@ -367,7 +406,8 @@ sub EjsStructPush($$) my $name = shift; my $d = shift; my $env = GenerateStructEnv($d); - pidl "\nstatic NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const struct $name *r)\n{\n"; + pidl fn_prefix($d); + pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const struct $name *r)\n{\n"; pidl "\tNDR_CHECK(ejs_push_struct_start(ejs, &v, name));\n"; foreach my $e (@{$d->{ELEMENTS}}) { EjsPushElementTop($e, $env); @@ -384,7 +424,8 @@ sub EjsUnionPush($$) my $d = shift; 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 fn_prefix($d); + pidl "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}}) { @@ -421,7 +462,8 @@ sub EjsEnumPush($$) $constants{$e} = $v; $v++; } - pidl "\nstatic NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)\n{\n"; + pidl fn_prefix($d); + pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const enum $name *r)\n{\n"; pidl "\tunsigned e = *r;\n"; pidl "\tNDR_CHECK(ejs_push_enum(ejs, v, name, &e));\n"; pidl "\treturn NT_STATUS_OK;\n"; @@ -433,8 +475,13 @@ sub EjsEnumPush($$) sub EjsBitmapPush($$) { my $name = shift; - my $e = shift; -# print util::MyDumper($e); + my $d = shift; + my $type_fn = $d->{BASE_TYPE}; + my($type_decl) = typelist::mapType($d->{BASE_TYPE}); + pidl fn_prefix($d); + pidl "NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const $type_decl *r)\n{\n"; + pidl "return ejs_push_$type_fn(ejs, v, name, r);\n"; + pidl "}\n"; } @@ -443,6 +490,7 @@ sub EjsBitmapPush($$) sub EjsTypedefPush($) { my $d = shift; + return if (util::has_property($d, "noejs")); if ($d->{DATA}->{TYPE} eq 'STRUCT') { EjsStructPush($d->{NAME}, $d->{DATA}); } elsif ($d->{DATA}->{TYPE} eq 'UNION') { @@ -542,14 +590,18 @@ sub EjsInterface($) sub Parse($$) { my($ndr,$hdr) = @_; - + + my $ejs_hdr = $hdr; + $ejs_hdr =~ s/.h$/_ejs.h/; $res = ""; pidl " /* EJS wrapper functions auto-generated by pidl */ #include \"includes.h\" #include \"lib/ejs/ejs.h\" -#include \"$hdr\" #include \"scripting/ejs/ejsrpc.h\" +#include \"librpc/gen_ndr/ndr_misc_ejs.h\" +#include \"$hdr\" +#include \"$ejs_hdr\" "; foreach my $x (@{$ndr}) { diff --git a/source4/build/pidl/ejs_header.pm b/source4/build/pidl/ejs_header.pm new file mode 100644 index 0000000000..af6b4d426d --- /dev/null +++ b/source4/build/pidl/ejs_header.pm @@ -0,0 +1,75 @@ +################################################### +# create C header files for an EJS mapping functions +# Copyright tridge@samba.org 2005 +# released under the GNU GPL + +package EjsHeader; + +use strict; +use pidl::typelist; + +my($res); + +sub pidl ($) +{ + $res .= shift; +} + +##################################################################### +# prototype a typedef +sub HeaderTypedefProto($) +{ + my $d = shift; + my $name = $d->{NAME}; + + return unless util::has_property($d, "public"); + + my $type_decl = typelist::mapType($name); + + pidl "NTSTATUS ejs_push_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const $type_decl *);\n"; + pidl "NTSTATUS ejs_pull_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, $type_decl *);\n"; +} + +##################################################################### +# parse the interface definitions +sub HeaderInterface($) +{ + my($interface) = shift; + + my $count = 0; + + pidl "#ifndef _HEADER_EJS_$interface->{NAME}\n"; + pidl "#define _HEADER_EJS_$interface->{NAME}\n\n"; + + if (defined $interface->{PROPERTIES}->{depends}) { + my @d = split / /, $interface->{PROPERTIES}->{depends}; + foreach my $i (@d) { + pidl "#include \"librpc/gen_ndr/ndr_$i\_ejs\.h\"\n"; + } + } + + pidl "\n"; + + foreach my $d (@{$interface->{TYPEDEFS}}) { + HeaderTypedefProto($d); + } + + pidl "\n"; + pidl "#endif /* _HEADER_EJS_$interface->{NAME} */\n"; +} + +##################################################################### +# parse a parsed IDL into a C header +sub Parse($) +{ + my($idl) = shift; + + $res = ""; + pidl "/* header auto-generated by pidl */\n\n"; + foreach my $x (@{$idl}) { + ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x); + } + return $res; +} + +1; diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index daf404d38f..9f37f7e795 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -32,6 +32,7 @@ use pidl::template; use pidl::swig; use pidl::compat; use pidl::ejs; +use pidl::ejs_header; my($opt_help) = 0; my($opt_parse) = 0; @@ -209,7 +210,6 @@ sub process_file($) defined($opt_server) or defined($opt_parser) or defined($opt_ejs)) { $ndr = Ndr::Parse($pidl); -# print util::MyDumper($ndr); } if (defined($opt_header)) { @@ -242,6 +242,9 @@ sub process_file($) if (defined($opt_ejs)) { my $ejs = ($opt_ejs or util::ChangeExtension($output, "_ejs.c")); util::FileSave($ejs, EjsClient::Parse($ndr, $h_filename)); + + $ejs = ($opt_ejs or util::ChangeExtension($output, "_ejs.h")); + util::FileSave($ejs, EjsHeader::Parse($ndr)); } if (defined($opt_server)) { diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm index fe4dc03c4d..37dc916ffd 100644 --- a/source4/build/pidl/validator.pm +++ b/source4/build/pidl/validator.pm @@ -98,6 +98,7 @@ my %property_list = ( "nopush" => ["FUNCTION", "TYPEDEF"], "nopull" => ["FUNCTION", "TYPEDEF"], "noprint" => ["FUNCTION", "TYPEDEF"], + "noejs" => ["FUNCTION", "TYPEDEF"], # union "switch_is" => ["ELEMENT"], diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index bd7b788178..c7d45bcf4b 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -555,3 +555,23 @@ REQUIRED_SUBSYSTEMS = NDR_RAW RPC_RAW LIBSMB NDR_MISC NDR_DCERPC NDR_SCHANNEL ND OBJ_FILES = librpc/gen_ndr/ndr_echo_ejs.o REQUIRED_SUBSYSTEMS = RPC NDR_ECHO NOPROTO = YES + +[SUBSYSTEM::RPC_EJS_MISC] +OBJ_FILES = librpc/gen_ndr/ndr_misc_ejs.o +REQUIRED_SUBSYSTEMS = RPC NDR_MISC +NOPROTO = YES + +[SUBSYSTEM::RPC_EJS_SAMR] +OBJ_FILES = librpc/gen_ndr/ndr_samr_ejs.o +REQUIRED_SUBSYSTEMS = RPC NDR_SAMR +NOPROTO = YES + +[SUBSYSTEM::RPC_EJS_SECURITY] +OBJ_FILES = librpc/gen_ndr/ndr_security_ejs.o +REQUIRED_SUBSYSTEMS = RPC LIB_SECURITY_NDR +NOPROTO = YES + +[SUBSYSTEM::RPC_EJS_LSA] +OBJ_FILES = librpc/gen_ndr/ndr_lsa_ejs.o +REQUIRED_SUBSYSTEMS = RPC NDR_LSA +NOPROTO = YES diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl index 45f4e25602..745a7652c2 100644 --- a/source4/librpc/idl/misc.idl +++ b/source4/librpc/idl/misc.idl @@ -10,7 +10,7 @@ ] interface misc { - typedef [public,noprint,gensize] struct { + typedef [public,noprint,gensize,noejs] struct { uint32 time_low; uint16 time_mid; uint16 time_hi_and_version; diff --git a/source4/librpc/idl/security.idl b/source4/librpc/idl/security.idl index 9a18189993..c183f88724 100644 --- a/source4/librpc/idl/security.idl +++ b/source4/librpc/idl/security.idl @@ -184,7 +184,7 @@ interface security /* a domain SID. Note that unlike Samba3 this contains a pointer, so you can't copy them using assignment */ - typedef [public,noprint] struct { + typedef [public,noprint,noejs] struct { uint8 sid_rev_num; /**< SID revision number */ [range(0,15)] int8 num_auths; /**< Number of sub-authorities */ uint8 id_auth[6]; /**< Identifier Authority */ diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index 0c0caa9ef0..f56b75e537 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -3,7 +3,7 @@ [SUBSYSTEM::EJSRPC] OBJ_FILES = \ scripting/ejs/ejsrpc.o -REQUIRED_SUBSYSTEMS = RPC_EJS_ECHO +REQUIRED_SUBSYSTEMS = RPC_EJS_ECHO RPC_EJS_SAMR RPC_EJS_MISC RPC_EJS_SECURITY RPC_EJS_LSA NOPROTO = YES # End SUBSYSTEM EJSRPC ####################### diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c index 6536b94ca4..ab0f64d5aa 100644 --- a/source4/scripting/ejs/ejsrpc.c +++ b/source4/scripting/ejs/ejsrpc.c @@ -23,6 +23,7 @@ #include "includes.h" #include "lib/ejs/ejs.h" #include "scripting/ejs/ejsrpc.h" +#include "librpc/gen_ndr/ndr_security.h" NTSTATUS ejs_pull_rpc(int eid, const char *callname, struct MprVar *v, void *ptr, ejs_pull_function_t ejs_pull) @@ -235,6 +236,63 @@ NTSTATUS ejs_push_hyper(struct ejs_rpc *ejs, return mprSetVar(v, name, mprCreateIntegerVar(*r)); } +NTSTATUS ejs_pull_dlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r) +{ + struct MprVar *var; + var = mprGetVar(v, name); + if (var == NULL) { + DEBUG(1,("ejs_pull_dlong: unable to find '%s'\n", name)); + return NT_STATUS_INVALID_PARAMETER_MIX; + } + *r = mprVarToInteger(var); + return NT_STATUS_OK; +} + +NTSTATUS ejs_push_dlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r) +{ + return mprSetVar(v, name, mprCreateIntegerVar(*r)); +} + +NTSTATUS ejs_pull_udlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r) +{ + struct MprVar *var; + var = mprGetVar(v, name); + if (var == NULL) { + DEBUG(1,("ejs_pull_udlong: unable to find '%s'\n", name)); + return NT_STATUS_INVALID_PARAMETER_MIX; + } + *r = mprVarToInteger(var); + return NT_STATUS_OK; +} + +NTSTATUS ejs_push_udlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r) +{ + return mprSetVar(v, name, mprCreateIntegerVar(*r)); +} + +NTSTATUS ejs_pull_NTTIME(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r) +{ + struct MprVar *var; + var = mprGetVar(v, name); + if (var == NULL) { + DEBUG(1,("ejs_pull_NTTIME: unable to find '%s'\n", name)); + return NT_STATUS_INVALID_PARAMETER_MIX; + } + *r = mprVarToInteger(var); + return NT_STATUS_OK; +} + +NTSTATUS ejs_push_NTTIME(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r) +{ + return mprSetVar(v, name, mprCreateIntegerVar(*r)); +} + /* pull a enum from a mpr variable to a C element @@ -265,7 +323,7 @@ NTSTATUS ejs_push_enum(struct ejs_rpc *ejs, pull a string */ NTSTATUS ejs_pull_string(struct ejs_rpc *ejs, - struct MprVar *v, const char *name, char **s) + struct MprVar *v, const char *name, const char **s) { struct MprVar *var; var = mprGetVar(v, name); @@ -273,8 +331,7 @@ NTSTATUS ejs_pull_string(struct ejs_rpc *ejs, DEBUG(1,("ejs_pull_string: unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER_MIX; } - *s = talloc_strdup(ejs, mprToString(var)); - NT_STATUS_HAVE_NO_MEMORY(*s); + *s = mprToString(var); return NT_STATUS_OK; } @@ -304,3 +361,48 @@ void ejs_set_constant_string(int eid, const char *name, const char *value) struct MprVar *v = ejsGetGlobalObject(eid); mprSetVar(v, name, mprCreateStringVar(value, False)); } + + +NTSTATUS ejs_pull_dom_sid(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, struct dom_sid *r) +{ + struct MprVar *var; + struct dom_sid *sid; + var = mprGetVar(v, name); + if (var == NULL) { + DEBUG(1,("ejs_pull_dom_sid: unable to find '%s'\n", name)); + return NT_STATUS_INVALID_PARAMETER_MIX; + } + sid = dom_sid_parse_talloc(ejs, mprToString(var)); + NT_STATUS_HAVE_NO_MEMORY(sid); + *r = *sid; + return NT_STATUS_OK; +} + +NTSTATUS ejs_push_dom_sid(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const struct dom_sid *r) +{ + char *sidstr = dom_sid_string(ejs, r); + NT_STATUS_HAVE_NO_MEMORY(sidstr); + return mprSetVar(v, name, mprCreateStringVar(sidstr, True)); +} + +NTSTATUS ejs_pull_GUID(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, struct GUID *r) +{ + struct MprVar *var; + var = mprGetVar(v, name); + if (var == NULL) { + DEBUG(1,("ejs_pull_GUID: unable to find '%s'\n", name)); + return NT_STATUS_INVALID_PARAMETER_MIX; + } + return GUID_from_string(mprToString(var), r); +} + +NTSTATUS ejs_push_GUID(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const struct GUID *r) +{ + char *guid = GUID_string(ejs, r); + NT_STATUS_HAVE_NO_MEMORY(guid); + return mprSetVar(v, name, mprCreateStringVar(guid, True)); +} diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h index 0435b52365..624a5fad3d 100644 --- a/source4/scripting/ejs/ejsrpc.h +++ b/source4/scripting/ejs/ejsrpc.h @@ -60,17 +60,34 @@ NTSTATUS ejs_pull_hyper(struct ejs_rpc *ejs, struct MprVar *v, const char *name, uint64_t *r); NTSTATUS ejs_push_hyper(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const uint64_t *r); +NTSTATUS ejs_pull_dlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r); +NTSTATUS ejs_push_dlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r); +NTSTATUS ejs_pull_udlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r); +NTSTATUS ejs_push_udlong(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r); +NTSTATUS ejs_pull_NTTIME(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, uint64_t *r); +NTSTATUS ejs_push_NTTIME(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const uint64_t *r); NTSTATUS ejs_pull_enum(struct ejs_rpc *ejs, struct MprVar *v, const char *name, unsigned *r); NTSTATUS ejs_push_enum(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const unsigned *r); NTSTATUS ejs_pull_string(struct ejs_rpc *ejs, - struct MprVar *v, const char *name, char **s); + struct MprVar *v, const char *name, const char **s); NTSTATUS ejs_push_string(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const char *s); void ejs_set_constant_int(int eid, const char *name, int value); void ejs_set_constant_string(int eid, const char *name, const char *value); +NTSTATUS ejs_pull_dom_sid(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, struct dom_sid *r); +NTSTATUS ejs_push_dom_sid(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const struct dom_sid *r); + #define EJS_ALLOC_SIZE(ejs, s, size) do { \ (s) = talloc_size(ejs, size); \ if (!(s)) return ejs_panic(ejs, "out of memory"); \ @@ -84,3 +101,9 @@ void ejs_set_constant_string(int eid, const char *name, const char *value); } while (0) #define EJS_ALLOC_N(ejs, s, n) EJS_ALLOC_N_SIZE(ejs, s, n, sizeof(*(s))) + +/* some types are equivalent for ejs */ +#define ejs_pull_dom_sid2 ejs_pull_dom_sid +#define ejs_push_dom_sid2 ejs_push_dom_sid +#define ejs_pull_NTTIME_hyper ejs_pull_NTTIME +#define ejs_push_NTTIME_hyper ejs_push_NTTIME diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index f8ea37b754..17f1716b2e 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -170,8 +170,12 @@ done: void smb_setup_ejs_rpc(void) { void setup_ejs_rpcecho(void); + void setup_ejs_samr(void); + void setup_ejs_misc(void); ejsDefineCFunction(-1, "rpc_connect", ejs_rpc_connect, NULL, MPR_VAR_SCRIPT_HANDLE); setup_ejs_rpcecho(); + setup_ejs_samr(); + setup_ejs_misc(); } /* @@ -179,6 +183,15 @@ void smb_setup_ejs_rpc(void) */ void smb_setup_ejs_rpc_constants(int eid) { + struct MprVar v; + void setup_ejs_constants_rpcecho(int); + void setup_ejs_constants_samr(int); + void setup_ejs_constants_misc(int); setup_ejs_constants_rpcecho(eid); + setup_ejs_constants_samr(eid); + setup_ejs_constants_misc(eid); + + v = mprCreatePtrVar(NULL, "NULL"); + mprSetProperty(ejsGetGlobalObject(eid), "NULL", &v); } |