Introduce mprLpCtx() similar to mprMemCtx() for loadparm_context used by
[jelmer/samba4-debian.git] / source / scripting / ejs / smbcalls.c
index 08b9eac5c1a37b3e6177ea59b535276f67b28e82..63a80e17db65a85fce6a17bba418f1f66538f5ee 100644 (file)
@@ -111,7 +111,7 @@ static int ejs_typeof_native(MprVarHandle eid, int argc, struct MprVar **argv)
 static int ejs_libinclude(int eid, int argc, char **argv)
 {
        int i, j;
-       const char **js_include = lp_js_include();
+       const char **js_include = lp_js_include(mprLpCtx());
 
        if (js_include == NULL || js_include[0] == NULL) {
                ejsSetErrorMsg(eid, "js include path not set");
@@ -161,51 +161,6 @@ static int ejs_version(MprVarHandle eid, int argc, struct MprVar **argv)
 }
 
 
-/*
- * jsonrpc_include() allows you to include jsonrpc files from a path based at
- * "jsonrpc services directory =" in smb.conf.
- */
-static int jsonrpc_include(int eid, int argc, char **argv)
-{
-        int ret = -1;
-        char *path;
-        char *emsg;
-       const char *jsonrpc_services_dir = lp_jsonrpc_services_dir();
-        struct MprVar result;
-
-
-       if (jsonrpc_services_dir == NULL || jsonrpc_services_dir == NULL) {
-               ejsSetErrorMsg(eid, "'jsonrpc services directory' not set");
-               return -1;
-       }
-
-        if (argc != 1) {
-                mpr_Return(eid, mprCreateIntegerVar(-1));
-               return 0;
-        }
-
-        path = talloc_asprintf(mprMemCtx(), "%s/%s",
-                               jsonrpc_services_dir,
-                               argv[0]);
-        if (path == NULL) {
-                mpr_Return(eid, mprCreateIntegerVar(-1));
-                return 0;
-        }
-
-        if (file_exist(path)) {
-                ret = ejsEvalFile(eid, path, &result, &emsg);
-                if (ret < 0) {
-                        ejsSetErrorMsg(eid, "Could not eval file");
-                        printf("file found; ret=%d (%s)\n", ret, emsg);
-                }
-        }
-        
-        mpr_Return(eid, mprCreateIntegerVar(ret));
-        talloc_free(path);
-       return 0;
-}
-
-
 static void (*ejs_exception_handler) (const char *) = NULL;
 
 _PUBLIC_ void ejs_exception(const char *reason)
@@ -218,7 +173,7 @@ _PUBLIC_ void ejs_exception(const char *reason)
 */
 void smb_setup_ejs_functions(void (*exception_handler)(const char *))
 {
-       init_module_fn static_init[] = STATIC_smbcalls_MODULES;
+       init_module_fn static_init[] = { STATIC_smbcalls_MODULES };
        init_module_fn *shared_init;
 
        ejs_exception_handler = exception_handler;
@@ -229,7 +184,7 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
        smb_setup_ejs_param();
         smb_setup_ejs_literal();
        
-       shared_init = load_samba_modules(NULL, "smbcalls");
+       shared_init = load_samba_modules(NULL, mprLpCtx(), "smbcalls");
        
        run_init_functions(static_init);
        run_init_functions(shared_init);
@@ -240,6 +195,5 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
        ejsDefineCFunction(-1, "nativeTypeOf", ejs_typeof_native, NULL, MPR_VAR_SCRIPT_HANDLE);
        ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
        ejsDefineCFunction(-1, "version", ejs_version, NULL, MPR_VAR_SCRIPT_HANDLE);
-       ejsDefineStringCFunction(-1, "jsonrpc_include", jsonrpc_include, NULL, MPR_VAR_SCRIPT_HANDLE);
 }