/* 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); }