diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-08 10:29:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:23 -0500 |
commit | 987e67df52ad906db5c80df736eea762d52814b6 (patch) | |
tree | 7862fade8c3332b5c0404451bff36899508ee8f2 /source4/scripting/ejs | |
parent | d1298d9c81979da73be30f4b38f592636c81607b (diff) | |
download | samba-987e67df52ad906db5c80df736eea762d52814b6.tar.gz samba-987e67df52ad906db5c80df736eea762d52814b6.tar.bz2 samba-987e67df52ad906db5c80df736eea762d52814b6.zip |
r8238: - fixed handling of NULL pointers from ejs
- added automatic creation of all constants in IDL as ejs variables
(This used to be commit 9398b02e4ba51145e447668e321ca927f44c0078)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r-- | source4/scripting/ejs/ejsrpc.c | 17 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.h | 2 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_rpc.c | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c index 94987d69e1..992defe8bb 100644 --- a/source4/scripting/ejs/ejsrpc.c +++ b/source4/scripting/ejs/ejsrpc.c @@ -406,3 +406,20 @@ NTSTATUS ejs_push_GUID(struct ejs_rpc *ejs, NT_STATUS_HAVE_NO_MEMORY(guid); return mprSetVar(v, name, mprCreateStringVar(guid, True)); } + +NTSTATUS ejs_push_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name) +{ + return mprSetVar(v, name, mprCreatePtrVar(NULL, name)); +} + +BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name) +{ + v = mprGetVar(v, name); + if (v == NULL) { + return True; + } + if (v->type == MPR_TYPE_PTR && v->ptr == NULL) { + return True; + } + return False; +} diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h index 624a5fad3d..d86c4eb71f 100644 --- a/source4/scripting/ejs/ejsrpc.h +++ b/source4/scripting/ejs/ejsrpc.h @@ -87,6 +87,8 @@ 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); +NTSTATUS ejs_push_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name); +BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name); #define EJS_ALLOC_SIZE(ejs, s, size) do { \ (s) = talloc_size(ejs, size); \ diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 17f1716b2e..e1d9c93be6 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -172,10 +172,14 @@ void smb_setup_ejs_rpc(void) void setup_ejs_rpcecho(void); void setup_ejs_samr(void); void setup_ejs_misc(void); + void setup_ejs_security(void); + ejsDefineCFunction(-1, "rpc_connect", ejs_rpc_connect, NULL, MPR_VAR_SCRIPT_HANDLE); + setup_ejs_rpcecho(); setup_ejs_samr(); setup_ejs_misc(); + setup_ejs_security(); } /* @@ -188,9 +192,12 @@ void smb_setup_ejs_rpc_constants(int eid) void setup_ejs_constants_rpcecho(int); void setup_ejs_constants_samr(int); void setup_ejs_constants_misc(int); + void setup_ejs_constants_security(int); + setup_ejs_constants_rpcecho(eid); setup_ejs_constants_samr(eid); setup_ejs_constants_misc(eid); + setup_ejs_constants_security(eid); v = mprCreatePtrVar(NULL, "NULL"); mprSetProperty(ejsGetGlobalObject(eid), "NULL", &v); |