From b1e93b296ea8f62ce0f15ccef5f6ae5339f4929f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Jul 2005 02:34:49 +0000 Subject: r8337: - use 64 bit access functions in ejs calls - added access to smbd random functions - fixed ordering in join() - added sys_interfaces(), sys_hostname(), sys_nttime() and sys_ldaptime() (This used to be commit 28c1a1f3c0cd2f8228fd8c3c695ab6f45226fa3f) --- source4/scripting/ejs/smbcalls_sys.c | 95 ++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 source4/scripting/ejs/smbcalls_sys.c (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c new file mode 100644 index 0000000000..a76690b597 --- /dev/null +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -0,0 +1,95 @@ +/* + Unix SMB/CIFS implementation. + + provide access to system functions + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "scripting/ejs/smbcalls.h" +#include "lib/ejs/ejs.h" + +/* + return the list of configured network interfaces +*/ +static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) +{ + int i, count = iface_count(); + struct MprVar ret = mprObject("interfaces"); + for (i=0;itype)) { + ejsSetErrorMsg(eid, "sys_ldaptime invalid arguments"); + return -1; + } + t = nt_time_to_unix(mprVarToNumber(argv[0])); + s = ldap_timestring(mprMemCtx(), t); + mpr_Return(eid, mprString(s)); + talloc_free(s); + return 0; +} + + +/* + setup C functions that be called from ejs +*/ +void smb_setup_ejs_system(void) +{ + ejsDefineCFunction(-1, "sys_interfaces", ejs_sys_interfaces, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineCFunction(-1, "sys_hostname", ejs_sys_hostname, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineCFunction(-1, "sys_nttime", ejs_sys_nttime, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineCFunction(-1, "sys_ldaptime", ejs_sys_ldaptime, NULL, MPR_VAR_SCRIPT_HANDLE); +} -- cgit From 9f86e202865807ed898eff684d7cf3be7daae0fc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Jul 2005 05:53:51 +0000 Subject: r8340: - added sys_gmtime() - added sys_unlink() - added sys_file_load() and sys_file_save() - use mprString() instead of mprCreateStringVar() to cope with NULL strings - removed smbcalls_irpc.c as its not needed any more - allow ldbAdd() and ldbModify() to take multiple ldif records - added a sprintf() function to ejs. Quite complex, but very useful! (This used to be commit 625628a3f6e78349d2240ebcc79081f350672070) --- source4/scripting/ejs/smbcalls_sys.c | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index a76690b597..f098f884bb 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -23,6 +23,7 @@ #include "includes.h" #include "scripting/ejs/smbcalls.h" #include "lib/ejs/ejs.h" +#include "system/time.h" /* return the list of configured network interfaces @@ -64,6 +65,40 @@ static int ejs_sys_nttime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return the given time as a gmtime structure +*/ +static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv) +{ + time_t t; + struct MprVar ret; + struct tm *tm; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_gmtime invalid arguments"); + return -1; + } + t = nt_time_to_unix(mprVarToNumber(argv[0])); + tm = gmtime(&t); + if (tm == NULL) { + mpr_Return(eid, mprCreateUndefinedVar()); + return 0; + } + ret = mprObject("gmtime"); +#define TM_EL(n) mprSetVar(&ret, #n, mprCreateIntegerVar(tm->n)) + TM_EL(tm_sec); + TM_EL(tm_min); + TM_EL(tm_hour); + TM_EL(tm_mday); + TM_EL(tm_mon); + TM_EL(tm_year); + TM_EL(tm_wday); + TM_EL(tm_yday); + TM_EL(tm_isdst); + + mpr_Return(eid, ret); + return 0; +} + /* return a ldap time string from a nttime */ @@ -82,6 +117,58 @@ static int ejs_sys_ldaptime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + unlink a file + ok = unlink(fname); +*/ +static int ejs_sys_unlink(MprVarHandle eid, int argc, char **argv) +{ + int ret; + if (argc != 1) { + ejsSetErrorMsg(eid, "sys_unlink invalid arguments"); + return -1; + } + ret = unlink(argv[0]); + mpr_Return(eid, mprCreateBoolVar(ret == 0)); + return 0; +} + +/* + load a file as a string + usage: + string = sys_file_load(filename); +*/ +static int ejs_sys_file_load(MprVarHandle eid, int argc, char **argv) +{ + char *s; + if (argc != 1) { + ejsSetErrorMsg(eid, "sys_file_load invalid arguments"); + return -1; + } + + s = file_load(argv[0], NULL, mprMemCtx()); + mpr_Return(eid, mprString(s)); + talloc_free(s); + return 0; +} + +/* + save a file from a string + usage: + ok = sys_file_save(filename, str); +*/ +static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) +{ + BOOL ret; + if (argc != 2) { + ejsSetErrorMsg(eid, "sys_file_save invalid arguments"); + return -1; + } + ret = file_save(argv[0], argv[1], strlen(argv[1])); + mpr_Return(eid, mprCreateBoolVar(ret)); + return 0; +} + /* setup C functions that be called from ejs @@ -91,5 +178,9 @@ void smb_setup_ejs_system(void) ejsDefineCFunction(-1, "sys_interfaces", ejs_sys_interfaces, NULL, MPR_VAR_SCRIPT_HANDLE); ejsDefineCFunction(-1, "sys_hostname", ejs_sys_hostname, NULL, MPR_VAR_SCRIPT_HANDLE); ejsDefineCFunction(-1, "sys_nttime", ejs_sys_nttime, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineCFunction(-1, "sys_gmtime", ejs_sys_gmtime, NULL, MPR_VAR_SCRIPT_HANDLE); ejsDefineCFunction(-1, "sys_ldaptime", ejs_sys_ldaptime, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineStringCFunction(-1, "sys_unlink", ejs_sys_unlink, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineStringCFunction(-1, "sys_file_load", ejs_sys_file_load, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineStringCFunction(-1, "sys_file_save", ejs_sys_file_save, NULL, MPR_VAR_SCRIPT_HANDLE); } -- cgit From adbb1612c12d03fa94e4ee23fbc2fa96c09d9dcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Jul 2005 00:06:38 +0000 Subject: r8399: move the ejs and esp code closer to the directory layout used by the upstream sources. This makes it much easier to keep it up to date. I will separate out the mpr code into lib/appweb/mpr next (This used to be commit 52db7a052baeb0f11361ed69b71cb790039e3cc9) --- source4/scripting/ejs/smbcalls_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index f098f884bb..4dc5045ff6 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -22,7 +22,7 @@ #include "includes.h" #include "scripting/ejs/smbcalls.h" -#include "lib/ejs/ejs.h" +#include "lib/appweb/ejs/ejs.h" #include "system/time.h" /* -- cgit From 7913cbbe11075c75770d37cf2e0da8f7af51a7fc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Jul 2005 07:45:40 +0000 Subject: r8484: switched the sys_*() calls to the OO interface tim, do you want to do the cli_*() calls now? (This used to be commit 9991e924e9dacec663a5d040ccfc878927fc3afa) --- source4/scripting/ejs/smbcalls_sys.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 4dc5045ff6..af51c815dc 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -170,17 +170,31 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) } +/* + initialise sys ejs subsystem +*/ +static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) +{ + struct MprVar obj = mprObject("sys"); + + mprSetCFunction(&obj, "interfaces", ejs_sys_interfaces); + mprSetCFunction(&obj, "hostname", ejs_sys_hostname); + mprSetCFunction(&obj, "nttime", ejs_sys_nttime); + mprSetCFunction(&obj, "gmtime", ejs_sys_gmtime); + mprSetCFunction(&obj, "ldaptime", ejs_sys_ldaptime); + mprSetStringCFunction(&obj, "unlink", ejs_sys_unlink); + mprSetStringCFunction(&obj, "file_load", ejs_sys_file_load); + mprSetStringCFunction(&obj, "file_save", ejs_sys_file_save); + + mpr_Return(eid, obj); + return 0; +} + + /* setup C functions that be called from ejs */ void smb_setup_ejs_system(void) { - ejsDefineCFunction(-1, "sys_interfaces", ejs_sys_interfaces, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineCFunction(-1, "sys_hostname", ejs_sys_hostname, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineCFunction(-1, "sys_nttime", ejs_sys_nttime, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineCFunction(-1, "sys_gmtime", ejs_sys_gmtime, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineCFunction(-1, "sys_ldaptime", ejs_sys_ldaptime, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineStringCFunction(-1, "sys_unlink", ejs_sys_unlink, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineStringCFunction(-1, "sys_file_load", ejs_sys_file_load, NULL, MPR_VAR_SCRIPT_HANDLE); - ejsDefineStringCFunction(-1, "sys_file_save", ejs_sys_file_save, NULL, MPR_VAR_SCRIPT_HANDLE); + ejsDefineCFunction(-1, "sys_init", ejs_sys_init, NULL, MPR_VAR_SCRIPT_HANDLE); } -- cgit From afe0fffc443861f39a9aca9bd1cb0ed73d4fc994 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 19 Jul 2005 06:07:34 +0000 Subject: r8582: added sys.httptime() call, to display a NTTIME as a http time string (This used to be commit 632f7bbe3e81af1ee89301765f8bfb72d4c9f3d7) --- source4/scripting/ejs/smbcalls_sys.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index af51c815dc..b1fb854dfb 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -117,6 +117,24 @@ static int ejs_sys_ldaptime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return a http time string from a nttime +*/ +static int ejs_sys_httptime(MprVarHandle eid, int argc, struct MprVar **argv) +{ + char *s; + time_t t; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_httptime invalid arguments"); + return -1; + } + t = nt_time_to_unix(mprVarToNumber(argv[0])); + s = http_timestring(mprMemCtx(), t); + mpr_Return(eid, mprString(s)); + talloc_free(s); + return 0; +} + /* unlink a file ok = unlink(fname); @@ -182,6 +200,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(&obj, "nttime", ejs_sys_nttime); mprSetCFunction(&obj, "gmtime", ejs_sys_gmtime); mprSetCFunction(&obj, "ldaptime", ejs_sys_ldaptime); + mprSetCFunction(&obj, "httptime", ejs_sys_httptime); mprSetStringCFunction(&obj, "unlink", ejs_sys_unlink); mprSetStringCFunction(&obj, "file_load", ejs_sys_file_load); mprSetStringCFunction(&obj, "file_save", ejs_sys_file_save); -- cgit From 240ca36cf2a3ceb89e46b73486865a4a57339c89 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Jul 2005 06:20:36 +0000 Subject: r8635: make object inheritance with the builtin objects easy by allowing callers to optionally supply an existing object to add the properties to. So you can do: var rpc = samr_init(); lsa_init(rpc); and you end up with 'rpc' having both the samr and lsa functions and constants available. (This used to be commit 6a1ed328e27769bd52899fc2437a43fc17104eff) --- source4/scripting/ejs/smbcalls_sys.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index b1fb854dfb..61b89843dc 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -193,19 +193,18 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) */ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) { - struct MprVar obj = mprObject("sys"); - - mprSetCFunction(&obj, "interfaces", ejs_sys_interfaces); - mprSetCFunction(&obj, "hostname", ejs_sys_hostname); - mprSetCFunction(&obj, "nttime", ejs_sys_nttime); - mprSetCFunction(&obj, "gmtime", ejs_sys_gmtime); - mprSetCFunction(&obj, "ldaptime", ejs_sys_ldaptime); - mprSetCFunction(&obj, "httptime", ejs_sys_httptime); - mprSetStringCFunction(&obj, "unlink", ejs_sys_unlink); - mprSetStringCFunction(&obj, "file_load", ejs_sys_file_load); - mprSetStringCFunction(&obj, "file_save", ejs_sys_file_save); - - mpr_Return(eid, obj); + struct MprVar *obj = mprInitObject(eid, "sys", argc, argv); + + mprSetCFunction(obj, "interfaces", ejs_sys_interfaces); + mprSetCFunction(obj, "hostname", ejs_sys_hostname); + mprSetCFunction(obj, "nttime", ejs_sys_nttime); + mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); + mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); + mprSetCFunction(obj, "httptime", ejs_sys_httptime); + mprSetStringCFunction(obj, "unlink", ejs_sys_unlink); + mprSetStringCFunction(obj, "file_load", ejs_sys_file_load); + mprSetStringCFunction(obj, "file_save", ejs_sys_file_save); + return 0; } -- cgit From 3d59490a4010c00a35113d36c60737001e5c77bb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Jul 2005 07:01:09 +0000 Subject: r8637: added sys.stat() and sys.lstat() calls (This used to be commit 5dbdf4fb3317964541339615b7ecbf174a2dc00b) --- source4/scripting/ejs/smbcalls_sys.c | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 61b89843dc..3f1f4b0734 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -188,6 +188,75 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) } +/* + return fields of a stat() call +*/ +static struct MprVar mpr_stat(struct stat *st) +{ + struct MprVar ret; + ret = mprObject("stat"); + +#define ST_EL(n) mprSetVar(&ret, #n, mprCreateNumberVar(st->n)) + ST_EL(st_dev); + ST_EL(st_ino); + ST_EL(st_mode); + ST_EL(st_nlink); + ST_EL(st_uid); + ST_EL(st_gid); + ST_EL(st_rdev); + ST_EL(st_size); + ST_EL(st_blksize); + ST_EL(st_blocks); + ST_EL(st_atime); + ST_EL(st_mtime); + ST_EL(st_ctime); + + return ret; +} + +/* + usage: + var st = sys.stat(filename); + returns an object containing struct stat elements +*/ +static int ejs_sys_stat(MprVarHandle eid, int argc, char **argv) +{ + struct stat st; + /* validate arguments */ + if (argc != 1) { + ejsSetErrorMsg(eid, "sys.stat invalid arguments"); + return -1; + } + if (stat(argv[0], &st) != 0) { + mpr_Return(eid, mprCreateUndefinedVar()); + } else { + mpr_Return(eid, mpr_stat(&st)); + } + return 0; +} + +/* + usage: + var st = sys.lstat(filename); + returns an object containing struct stat elements +*/ +static int ejs_sys_lstat(MprVarHandle eid, int argc, char **argv) +{ + struct stat st; + /* validate arguments */ + if (argc != 1) { + ejsSetErrorMsg(eid, "sys.stat invalid arguments"); + return -1; + } + if (lstat(argv[0], &st) != 0) { + mpr_Return(eid, mprCreateUndefinedVar()); + } else { + mpr_Return(eid, mpr_stat(&st)); + } + return 0; +} + + /* initialise sys ejs subsystem */ @@ -204,6 +273,8 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetStringCFunction(obj, "unlink", ejs_sys_unlink); mprSetStringCFunction(obj, "file_load", ejs_sys_file_load); mprSetStringCFunction(obj, "file_save", ejs_sys_file_save); + mprSetStringCFunction(obj, "stat", ejs_sys_stat); + mprSetStringCFunction(obj, "lstat", ejs_sys_lstat); return 0; } -- cgit From 40f85ace04abad7460d0f0afe9211c4280482c6c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 30 Aug 2005 22:38:34 +0000 Subject: r9813: Conver testsuite for samba3sam module to EJS (This used to be commit 77f24ed131bf57c30bb500e1d8d387bd4b403ddc) --- source4/scripting/ejs/smbcalls_sys.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 3f1f4b0734..f32605c3d5 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -137,7 +137,7 @@ static int ejs_sys_httptime(MprVarHandle eid, int argc, struct MprVar **argv) /* unlink a file - ok = unlink(fname); + ok = sys.unlink(fname); */ static int ejs_sys_unlink(MprVarHandle eid, int argc, char **argv) { @@ -154,7 +154,7 @@ static int ejs_sys_unlink(MprVarHandle eid, int argc, char **argv) /* load a file as a string usage: - string = sys_file_load(filename); + string = sys.file_load(filename); */ static int ejs_sys_file_load(MprVarHandle eid, int argc, char **argv) { @@ -173,7 +173,7 @@ static int ejs_sys_file_load(MprVarHandle eid, int argc, char **argv) /* save a file from a string usage: - ok = sys_file_save(filename, str); + ok = sys.file_save(filename, str); */ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) { -- cgit From 33da2fabe6c3b1e20a955d72e1ebd0e850751df0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Oct 2005 06:30:47 +0000 Subject: r10914: moved the ldap time string functions into ldb so they can be used by the time attribute handling functions (This used to be commit 93c296d52718e77f8b702e1721b548eaadc56c76) --- source4/scripting/ejs/smbcalls_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index f32605c3d5..340671cf0b 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -23,6 +23,7 @@ #include "includes.h" #include "scripting/ejs/smbcalls.h" #include "lib/appweb/ejs/ejs.h" +#include "lib/ldb/include/ldb.h" #include "system/time.h" /* @@ -111,7 +112,7 @@ static int ejs_sys_ldaptime(MprVarHandle eid, int argc, struct MprVar **argv) return -1; } t = nt_time_to_unix(mprVarToNumber(argv[0])); - s = ldap_timestring(mprMemCtx(), t); + s = ldb_timestring(mprMemCtx(), t); mpr_Return(eid, mprString(s)); talloc_free(s); return 0; -- cgit From a8504e1061d248a54be93716ead545b2f066f2cf Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 15 Oct 2005 09:32:04 +0000 Subject: r11085: as ejs doesn't support '&' '|' bitwise AND and OR, we need some helper functions for this metze (This used to be commit e27e36909d367748fc653ddc0fd1c699b77780e9) --- source4/scripting/ejs/smbcalls_sys.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 340671cf0b..5f6a756f8f 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -257,6 +257,51 @@ static int ejs_sys_lstat(MprVarHandle eid, int argc, char **argv) return 0; } +/* + bitwise AND + usage: + var z = sys.bitAND(x, 0x70); +*/ +static int ejs_sys_bitAND(MprVarHandle eid, int argc, struct MprVar **argv) +{ + int x, y, z; + + if (argc != 2 || + !mprVarIsNumber(argv[0]->type) || + !mprVarIsNumber(argv[1]->type)) { + ejsSetErrorMsg(eid, "bitand invalid arguments"); + return -1; + } + x = mprToInt(argv[0]); + y = mprToInt(argv[1]); + z = x & y; + + mpr_Return(eid, mprCreateIntegerVar(z)); + return 0; +} + +/* + bitwise OR + usage: + var z = sys.bitOR(x, 0x70); +*/ +static int ejs_sys_bitOR(MprVarHandle eid, int argc, struct MprVar **argv) +{ + int x, y, z; + + if (argc != 2 || + !mprVarIsNumber(argv[0]->type) || + !mprVarIsNumber(argv[1]->type)) { + ejsSetErrorMsg(eid, "bitand invalid arguments"); + return -1; + } + x = mprToInt(argv[0]); + y = mprToInt(argv[1]); + z = x | y; + + mpr_Return(eid, mprCreateIntegerVar(z)); + return 0; +} /* initialise sys ejs subsystem @@ -276,6 +321,8 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetStringCFunction(obj, "file_save", ejs_sys_file_save); mprSetStringCFunction(obj, "stat", ejs_sys_stat); mprSetStringCFunction(obj, "lstat", ejs_sys_lstat); + mprSetCFunction(obj, "bitAND", ejs_sys_bitAND); + mprSetCFunction(obj, "bitOR", ejs_sys_bitOR); return 0; } -- cgit From dab2b6858315909cd26fa5ce5aba84b6b4c3e62e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 15 Oct 2005 10:04:33 +0000 Subject: r11086: add sys.unix2nttime() function metze (This used to be commit a3abf10d431f82b12b0795d5bc217c8ec3ce89f7) --- source4/scripting/ejs/smbcalls_sys.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 5f6a756f8f..c4ad668112 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -66,6 +66,22 @@ static int ejs_sys_nttime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return time as a 64 bit nttime value from a 32 bit time_t value +*/ +static int ejs_sys_unix2nttime(MprVarHandle eid, int argc, struct MprVar **argv) +{ + NTTIME nt; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_unix2nttime invalid arguments"); + return -1; + } + unix_to_nt_time(&nt, mprVarToNumber(argv[0])); + struct MprVar v = mprCreateNumberVar(nt); + mpr_Return(eid, v); + return 0; +} + /* return the given time as a gmtime structure */ @@ -313,6 +329,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "interfaces", ejs_sys_interfaces); mprSetCFunction(obj, "hostname", ejs_sys_hostname); mprSetCFunction(obj, "nttime", ejs_sys_nttime); + mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime); mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); mprSetCFunction(obj, "httptime", ejs_sys_httptime); -- cgit From e627a90362ca4fd4d00b1aa78b9743a047ba0498 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 19 Oct 2005 06:09:14 +0000 Subject: r11171: fix the build metze (This used to be commit 0d948cf430f34757a17170cdd26ac6b87341a75f) --- source4/scripting/ejs/smbcalls_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index c4ad668112..f39d5cbddc 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -72,12 +72,13 @@ static int ejs_sys_nttime(MprVarHandle eid, int argc, struct MprVar **argv) static int ejs_sys_unix2nttime(MprVarHandle eid, int argc, struct MprVar **argv) { NTTIME nt; + struct MprVar v; if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { ejsSetErrorMsg(eid, "sys_unix2nttime invalid arguments"); return -1; } unix_to_nt_time(&nt, mprVarToNumber(argv[0])); - struct MprVar v = mprCreateNumberVar(nt); + v = mprCreateNumberVar(nt); mpr_Return(eid, v); return 0; } -- cgit From 783851099b43236666b2fc0cc866834773d6e7b7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2005 01:04:00 +0000 Subject: r11458: fixed our ejs smbscript interfaces to use arrays where appropriate. In js arrays are a special type of object where the length property is automatic, and cannot be modified manually. Our code was manually setting length, which made it abort when someone passed in a real ejs array. To fix this we need to create real arrays instead of objects, and remove the code that manually sets the length (This used to be commit ebdd1393fde44a0a35446d1a922d29a7c1769ba7) --- source4/scripting/ejs/smbcalls_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index f39d5cbddc..1a876c9e87 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -32,7 +32,7 @@ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) { int i, count = iface_count(); - struct MprVar ret = mprObject("interfaces"); + struct MprVar ret = mprArray("interfaces"); for (i=0;i Date: Tue, 7 Mar 2006 11:07:23 +0000 Subject: r13924: Split more prototypes out of include/proto.h + initial work on header file dependencies (This used to be commit 122835876748a3eaf5e8d31ad1abddab9acb8781) --- source4/scripting/ejs/smbcalls_sys.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 1a876c9e87..b8382db296 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -25,6 +25,8 @@ #include "lib/appweb/ejs/ejs.h" #include "lib/ldb/include/ldb.h" #include "system/time.h" +#include "system/network.h" +#include "netif/netif.h" /* return the list of configured network interfaces -- cgit From 0dcecc314899b6f36e9215e0b3881220062ba4f9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 20 May 2006 03:08:44 +0000 Subject: r15731: module init functions should return NTSTATUS, not void (This used to be commit c6d20c22454b87b4dea3527f0efcecd373679848) --- source4/scripting/ejs/smbcalls_sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index b8382db296..860002e1d7 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -351,7 +351,8 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) /* setup C functions that be called from ejs */ -void smb_setup_ejs_system(void) +NTSTATUS smb_setup_ejs_system(void) { ejsDefineCFunction(-1, "sys_init", ejs_sys_init, NULL, MPR_VAR_SCRIPT_HANDLE); + return NT_STATUS_OK; } -- cgit From a2eca9174c7803732658a1e6f7e8ed873c4fb6fd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Aug 2006 13:37:04 +0000 Subject: r17586: merge lib/netif into lib/socket and use -lnsl -lsocket on the configure check for the interfaces. should fix the build on some old sun boxes metze (This used to be commit f20e251bfd9f1eb7ce5c00739631b1625a2aa467) --- source4/scripting/ejs/smbcalls_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 860002e1d7..d8aaf3898a 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -26,7 +26,7 @@ #include "lib/ldb/include/ldb.h" #include "system/time.h" #include "system/network.h" -#include "netif/netif.h" +#include "lib/socket/netif.h" /* return the list of configured network interfaces -- cgit From c5718959e6a6d0454a870cbd311e707e69c98e85 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Mon, 25 Sep 2006 02:49:56 +0000 Subject: r18880: JSON-RPC work in progress (This used to be commit 34bffbaebf50c2a75c91285d5ec82e8f377981cc) --- source4/scripting/ejs/smbcalls_sys.c | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index d8aaf3898a..42990f49c0 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -57,6 +57,22 @@ static int ejs_sys_hostname(MprVarHandle eid, int argc, struct MprVar **argv) } +/* + return current time as seconds and microseconds +*/ +static int ejs_sys_gettimeofday(MprVarHandle eid, int argc, struct MprVar **argv) +{ + struct timeval tv = timeval_current(); + struct MprVar v = mprObject("timeval"); + struct MprVar sec = mprCreateIntegerVar(tv.tv_sec); + struct MprVar usec = mprCreateIntegerVar(tv.tv_usec); + + mprCreateProperty(&v, "sec", &sec); + mprCreateProperty(&v, "usec", &usec); + mpr_Return(eid, v); + return 0; +} + /* return current time as a 64 bit nttime value */ @@ -85,6 +101,35 @@ static int ejs_sys_unix2nttime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return the GMT time represented by the struct tm argument, as a time_t value +*/ +static int ejs_sys_gmmktime(MprVarHandle eid, int argc, struct MprVar **argv) +{ + struct MprVar *o; + struct tm tm; + if (argc != 1 || !mprVarIsObject(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_gmmktime invalid arguments"); + return -1; + } + + o = argv[0]; +#define TM_EL(n) tm.n = mprVarToNumber(mprGetProperty(o, #n, NULL)) + TM_EL(tm_sec); + TM_EL(tm_min); + TM_EL(tm_hour); + TM_EL(tm_mday); + TM_EL(tm_mon); + TM_EL(tm_year); + TM_EL(tm_wday); + TM_EL(tm_yday); + TM_EL(tm_isdst); +#undef TM_EL + + mpr_Return(eid, mprCreateIntegerVar(mktime(&tm))); + return 0; +} + /* return the given time as a gmtime structure */ @@ -97,6 +142,41 @@ static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv) ejsSetErrorMsg(eid, "sys_gmtime invalid arguments"); return -1; } + t = (time_t) mprVarToNumber(argv[0]); + tm = gmtime(&t); + if (tm == NULL) { + mpr_Return(eid, mprCreateUndefinedVar()); + return 0; + } + ret = mprObject("gmtime"); +#define TM_EL(n) mprSetVar(&ret, #n, mprCreateIntegerVar(tm->n)) + TM_EL(tm_sec); + TM_EL(tm_min); + TM_EL(tm_hour); + TM_EL(tm_mday); + TM_EL(tm_mon); + TM_EL(tm_year); + TM_EL(tm_wday); + TM_EL(tm_yday); + TM_EL(tm_isdst); +#undef TM_EL + + mpr_Return(eid, ret); + return 0; +} + +/* + return the given NT time as a gmtime structure +*/ +static int ejs_sys_ntgmtime(MprVarHandle eid, int argc, struct MprVar **argv) +{ + time_t t; + struct MprVar ret; + struct tm *tm; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_ntgmtime invalid arguments"); + return -1; + } t = nt_time_to_unix(mprVarToNumber(argv[0])); tm = gmtime(&t); if (tm == NULL) { @@ -114,6 +194,7 @@ static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv) TM_EL(tm_wday); TM_EL(tm_yday); TM_EL(tm_isdst); +#undef TM_EL mpr_Return(eid, ret); return 0; @@ -332,8 +413,11 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "interfaces", ejs_sys_interfaces); mprSetCFunction(obj, "hostname", ejs_sys_hostname); mprSetCFunction(obj, "nttime", ejs_sys_nttime); + mprSetCFunction(obj, "getTimeOfDay", ejs_sys_gettimeofday); mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime); + mprSetCFunction(obj, "gmmktime", ejs_sys_gmmktime); mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); + mprSetCFunction(obj, "ntgmtime", ejs_sys_ntgmtime); mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); mprSetCFunction(obj, "httptime", ejs_sys_httptime); mprSetStringCFunction(obj, "unlink", ejs_sys_unlink); -- cgit From 882d352151bd05c37e18de8f8f619787f831a311 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Mon, 2 Oct 2006 20:39:31 +0000 Subject: r19051: JSON-RPC server work-in-progress. It's almost working. (This used to be commit 6e9cb2ed1cf87aed322fd7821237d088c2fef340) --- source4/scripting/ejs/smbcalls_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 42990f49c0..97fcc19cd1 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -413,7 +413,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "interfaces", ejs_sys_interfaces); mprSetCFunction(obj, "hostname", ejs_sys_hostname); mprSetCFunction(obj, "nttime", ejs_sys_nttime); - mprSetCFunction(obj, "getTimeOfDay", ejs_sys_gettimeofday); + mprSetCFunction(obj, "gettimeofday", ejs_sys_gettimeofday); mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime); mprSetCFunction(obj, "gmmktime", ejs_sys_gmmktime); mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); -- cgit From 2d132edbab902c59ca6ca39b0bb42ab12693cee5 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 27 Dec 2006 21:22:01 +0000 Subject: r20364: SWAT updates, part 1 These next few check-ins will add a working Statistics module to SWAT, and add an API Documentation module as well. Next step will be to modify the LDB browser to work with this new module and fsm structure. Derrell (This used to be commit 29db71587f1332a9c44d5993a2be389f3a392ce4) --- source4/scripting/ejs/smbcalls_sys.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 97fcc19cd1..ce3f3f5a98 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -165,6 +165,23 @@ static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv) return 0; } +/* + return the given NT time as a time_t value +*/ +static int ejs_sys_nttime2unix(MprVarHandle eid, int argc, struct MprVar **argv) +{ + time_t t; + struct MprVar v; + if (argc != 1 || !mprVarIsNumber(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_ntgmtime invalid arguments"); + return -1; + } + t = nt_time_to_unix(mprVarToNumber(argv[0])); + v = mprCreateNumberVar(t); + mpr_Return(eid, v); + return 0; +} + /* return the given NT time as a gmtime structure */ @@ -417,6 +434,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime); mprSetCFunction(obj, "gmmktime", ejs_sys_gmmktime); mprSetCFunction(obj, "gmtime", ejs_sys_gmtime); + mprSetCFunction(obj, "nttime2unix", ejs_sys_nttime2unix); mprSetCFunction(obj, "ntgmtime", ejs_sys_ntgmtime); mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); mprSetCFunction(obj, "httptime", ejs_sys_httptime); -- cgit From 5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 29 May 2007 01:20:47 +0000 Subject: r23177: Add in a new provision-backend script. This helps set up the OpenLDAP or Fedora DS backend. This required a new mkdir() call in ejs. We can now provision just the schema for ad2oLschema to operate on (with provision_schema(), without performing the whole provision, just to wipe it again (adjustments to 'make test' to come soon). Andrew Bartlett (This used to be commit 01d54d13dc66ef2127ac52c64ede53d0790738ec) --- source4/scripting/ejs/smbcalls_sys.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index ce3f3f5a98..1b1affc80d 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -305,6 +305,33 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) return 0; } +/* + mkdir() + usage: + ok = sys.mkdir(dirname, mode); +*/ +static int ejs_sys_mkdir(MprVarHandle eid, int argc, struct MprVar **argv) +{ + BOOL ret; + char *name; + if (argc != 2) { + ejsSetErrorMsg(eid, "sys_mkdir invalid arguments, need mkdir(dirname, mode)"); + return -1; + } + if (!mprVarIsString(argv[0]->type)) { + ejsSetErrorMsg(eid, "sys_mkdir dirname not a string"); + return -1; + } + if (!mprVarIsNumber(argv[1]->type)) { + ejsSetErrorMsg(eid, "sys_mkdir mode not a number"); + return -1; + } + mprVarToString(&name, 0, NULL, argv[0]); + ret = mkdir(name, mprVarToNumber(argv[1])); + mpr_Return(eid, mprCreateBoolVar(ret == 0)); + return 0; +} + /* return fields of a stat() call @@ -438,6 +465,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) mprSetCFunction(obj, "ntgmtime", ejs_sys_ntgmtime); mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime); mprSetCFunction(obj, "httptime", ejs_sys_httptime); + mprSetCFunction(obj, "mkdir", ejs_sys_mkdir); mprSetStringCFunction(obj, "unlink", ejs_sys_unlink); mprSetStringCFunction(obj, "file_load", ejs_sys_file_load); mprSetStringCFunction(obj, "file_save", ejs_sys_file_save); -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/scripting/ejs/smbcalls_sys.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 1b1affc80d..96e665ab3a 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/scripting/ejs/smbcalls_sys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 96e665ab3a..10de8e162e 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -294,7 +294,7 @@ static int ejs_sys_file_load(MprVarHandle eid, int argc, char **argv) */ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) { - BOOL ret; + bool ret; if (argc != 2) { ejsSetErrorMsg(eid, "sys_file_save invalid arguments"); return -1; @@ -311,7 +311,7 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) */ static int ejs_sys_mkdir(MprVarHandle eid, int argc, struct MprVar **argv) { - BOOL ret; + bool ret; char *name; if (argc != 2) { ejsSetErrorMsg(eid, "sys_mkdir invalid arguments, need mkdir(dirname, mode)"); -- cgit From c5bf20c5fe7eaa04cd11a7ce4f365aa6ffd7b124 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 23:57:22 +0100 Subject: r26325: Remove use of global_loadparm in netif. (This used to be commit e452cb28594f23add7c00247ed39e8323aea78a6) --- source4/scripting/ejs/smbcalls_sys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 10de8e162e..86e0873e09 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -32,10 +32,10 @@ */ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) { - int i, count = iface_count(); + int i, count = iface_count(global_loadparm); struct MprVar ret = mprArray("interfaces"); for (i=0;i Date: Tue, 11 Dec 2007 22:23:14 +0100 Subject: r26401: Don't cache interfaces context in libnetif. (This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153) --- source4/scripting/ejs/smbcalls_sys.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 86e0873e09..cc1c3b4e32 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -32,10 +32,15 @@ */ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) { - int i, count = iface_count(global_loadparm); + int i, count; struct MprVar ret = mprArray("interfaces"); + struct interface *ifaces; + + load_interfaces(lp_interfaces(global_loadparm), &ifaces); + + count = iface_count(ifaces); for (i=0;i Date: Tue, 11 Dec 2007 22:23:20 +0100 Subject: r26402: Require a talloc context in libnetif. (This used to be commit a35e51871bbf1ab33fc316fa59e597b722769c50) --- source4/scripting/ejs/smbcalls_sys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index cc1c3b4e32..72ddf90231 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -36,12 +36,14 @@ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) struct MprVar ret = mprArray("interfaces"); struct interface *ifaces; - load_interfaces(lp_interfaces(global_loadparm), &ifaces); + load_interfaces(NULL, lp_interfaces(global_loadparm), &ifaces); count = iface_count(ifaces); for (i=0;i Date: Thu, 21 Feb 2008 18:21:44 +0100 Subject: Introduce mprLpCtx() similar to mprMemCtx() for loadparm_context used by all EJS code. (This used to be commit 184988866fe8e740f58e3683eefcaa70f8b51d11) --- source4/scripting/ejs/smbcalls_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_sys.c') diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 72ddf90231..00599a55bc 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -36,7 +36,7 @@ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv) struct MprVar ret = mprArray("interfaces"); struct interface *ifaces; - load_interfaces(NULL, lp_interfaces(global_loadparm), &ifaces); + load_interfaces(NULL, lp_interfaces(mprLpCtx()), &ifaces); count = iface_count(ifaces); for (i=0;i