r9722: Initial attempt at converting samba3dump to EJS..
[sfrench/samba-autobuild/.git] / source4 / scripting / ejs / smbcalls.c
index 2da1e8c6693cd838db56b307f7cf70a46a3ff4bb..a73fbe52c38f9850260735ff96083fed87a809f3 100644 (file)
@@ -22,7 +22,7 @@
 */
 
 #include "includes.h"
-#include "lib/ejs/ejs.h"
+#include "lib/appweb/ejs/ejs.h"
 #include "scripting/ejs/smbcalls.h"
 
 /*
@@ -45,7 +45,7 @@ static int ejs_typeof(MprVarHandle eid, int argc, struct MprVar **argv)
                { MPR_TYPE_FUNCTION,         "function" },
                { MPR_TYPE_STRING,           "string" },
                { MPR_TYPE_STRING_CFUNCTION, "function" },
-               { MPR_TYPE_PTR,              "pointer" }
+               { MPR_TYPE_PTR,              "pointer" }
        };
        int i;
        const char *type = NULL;
@@ -64,21 +64,6 @@ static int ejs_typeof(MprVarHandle eid, int argc, struct MprVar **argv)
        return 0;
 }
 
-/*
-  return the list of configured network interfaces
-*/
-static int ejs_IfaceList(MprVarHandle eid, int argc, struct MprVar **argv)
-{
-       int i, count = iface_count();
-       struct MprVar ret = mprObject("interfaces");
-       for (i=0;i<count;i++) {
-               mprAddArray(&ret, i, mprString(iface_n_ip(i)));
-       }
-       mpr_Return(eid, ret);
-       return 0;       
-}
-
-
 /*
   libinclude() allows you to include js files using a search path specified
   in "js include =" in smb.conf. 
@@ -89,6 +74,7 @@ static int ejs_libinclude(int eid, int argc, char **argv)
        const char **js_include = lp_js_include();
 
        if (js_include == NULL || js_include[0] == NULL) {
+               ejsSetErrorMsg(eid, "js include path not set");
                return -1;
        }
 
@@ -139,16 +125,13 @@ void smb_setup_ejs_functions(void)
        smb_setup_ejs_options();
        smb_setup_ejs_nss();
        smb_setup_ejs_string();
+       smb_setup_ejs_random();
+       smb_setup_ejs_system();
+       smb_setup_ejs_credentials();
+       smb_setup_ejs_samba3();
+       smb_setup_ejs_datablob();
 
        ejsDefineCFunction(-1, "typeof", ejs_typeof, NULL, MPR_VAR_SCRIPT_HANDLE);
-       ejsDefineCFunction(-1, "IfaceList", ejs_IfaceList, NULL, MPR_VAR_SCRIPT_HANDLE);
        ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
 }
 
-/*
-  setup constants that can be used from ejs
-*/
-void smb_setup_ejs_constants(int eid)
-{
-       smb_setup_ejs_rpc_constants(eid);
-}