summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-26 13:40:17 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-26 13:40:17 +0200
commitec362bdbc06a83d4b4656e5c3dde90c49adb2a64 (patch)
tree204bd0e0ee66b16cc9288c552d98348ec1591cdc /source4
parentcbe439383a8f9322c3b0b51aca863cecd77cafcb (diff)
downloadsamba-ec362bdbc06a83d4b4656e5c3dde90c49adb2a64.tar.gz
samba-ec362bdbc06a83d4b4656e5c3dde90c49adb2a64.tar.bz2
samba-ec362bdbc06a83d4b4656e5c3dde90c49adb2a64.zip
Remove unused datablob and nbt ejs bindings.
(This used to be commit f758553ac50d374f64a8763055dc4f12ab9b0c68)
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/ejs/config.mk14
-rw-r--r--source4/scripting/ejs/smbcalls.c1
-rw-r--r--source4/scripting/ejs/smbcalls_data.c284
-rw-r--r--source4/scripting/ejs/smbcalls_nbt.c93
4 files changed, 0 insertions, 392 deletions
diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk
index 5022aba34d..d8068bebdd 100644
--- a/source4/scripting/ejs/config.mk
+++ b/source4/scripting/ejs/config.mk
@@ -13,13 +13,6 @@ PRIVATE_DEPENDENCIES = LIBLDB SAMDB LIBNDR
smbcalls_ldb_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_ldb.o
-[MODULE::smbcalls_nbt]
-SUBSYSTEM = smbcalls
-OUTPUT_TYPE = MERGED_OBJ
-INIT_FUNCTION = smb_setup_ejs_nbt
-
-smbcalls_nbt_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_nbt.o
-
[MODULE::smbcalls_rand]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
@@ -27,13 +20,6 @@ INIT_FUNCTION = smb_setup_ejs_random
smbcalls_rand_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_rand.o
-[MODULE::smbcalls_data]
-SUBSYSTEM = smbcalls
-OUTPUT_TYPE = MERGED_OBJ
-INIT_FUNCTION = smb_setup_ejs_datablob
-
-smbcalls_data_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_data.o
-
[MODULE::smbcalls_auth]
OUTPUT_TYPE = MERGED_OBJ
SUBSYSTEM = smbcalls
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c
index a90e1e62c8..d17f048887 100644
--- a/source4/scripting/ejs/smbcalls.c
+++ b/source4/scripting/ejs/smbcalls.c
@@ -191,7 +191,6 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
extern NTSTATUS smb_setup_ejs_system(void);
extern NTSTATUS smb_setup_ejs_ldb(void);
extern NTSTATUS ejs_init_svcctl(void);
- extern NTSTATUS smb_setup_ejs_nbt(void);
extern NTSTATUS smb_setup_ejs_net(void);
extern NTSTATUS ejs_init_srvsvc(void);
extern NTSTATUS ejs_init_netlogon(void);
diff --git a/source4/scripting/ejs/smbcalls_data.c b/source4/scripting/ejs/smbcalls_data.c
deleted file mode 100644
index 19e1e173d6..0000000000
--- a/source4/scripting/ejs/smbcalls_data.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- provide access to data blobs
-
- 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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "scripting/ejs/smbcalls.h"
-#include "lib/appweb/ejs/ejs.h"
-#include "librpc/gen_ndr/winreg.h"
-
-/*
- create a data blob object from a ejs array of integers
-*/
-static int ejs_blobFromArray(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct MprVar *array, *v;
- unsigned length, i;
- DATA_BLOB blob;
-
- if (argc != 1) {
- ejsSetErrorMsg(eid, "blobFromArray invalid arguments");
- return -1;
- }
- array = argv[0];
-
- v = mprGetProperty(array, "length", NULL);
- if (v == NULL) {
- goto failed;
- }
- length = mprToInt(v);
-
- blob = data_blob_talloc(mprMemCtx(), NULL, length);
- if (length != 0 && blob.data == NULL) {
- goto failed;
- }
-
- for (i=0;i<length;i++) {
- struct MprVar *vs;
- char idx[16];
- mprItoa(i, idx, sizeof(idx));
- vs = mprGetProperty(array, idx, NULL);
- if (vs == NULL) {
- goto failed;
- }
- blob.data[i] = mprVarToNumber(vs);
- }
-
- mpr_Return(eid, mprDataBlob(blob));
- return 0;
-
-failed:
- mpr_Return(eid, mprCreateUndefinedVar());
- return 0;
-}
-
-/*
- create a ejs array of integers from a data blob
-*/
-static int ejs_blobToArray(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- DATA_BLOB *blob;
- struct MprVar array;
- int i;
-
- if (argc != 1) {
- ejsSetErrorMsg(eid, "blobToArray invalid arguments");
- return -1;
- }
- blob = mprToDataBlob(argv[0]);
- if (blob == NULL) {
- goto failed;
- }
-
- array = mprArray("array");
-
- for (i=0;i<blob->length;i++) {
- mprAddArray(&array, i, mprCreateNumberVar(blob->data[i]));
- }
- mpr_Return(eid, array);
- return 0;
-
-failed:
- mpr_Return(eid, mprCreateUndefinedVar());
- return 0;
-}
-
-
-/*
- compare two data blobs
-*/
-static int ejs_blobCompare(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- DATA_BLOB *blob1, *blob2;
- bool ret = false;
-
- if (argc != 2) {
- ejsSetErrorMsg(eid, "blobCompare invalid arguments");
- return -1;
- }
-
- blob1 = mprToDataBlob(argv[0]);
- blob2 = mprToDataBlob(argv[1]);
-
- if (blob1 == blob2) {
- ret = true;
- goto done;
- }
- if (blob1 == NULL || blob2 == NULL) {
- ret = false;
- goto done;
- }
-
- if (blob1->length != blob2->length) {
- ret = false;
- goto done;
- }
-
- if (memcmp(blob1->data, blob2->data, blob1->length) != 0) {
- ret = false;
- goto done;
- }
- ret = true;
-
-done:
- mpr_Return(eid, mprCreateBoolVar(ret));
- return 0;
-}
-
-
-/*
- convert a blob in winreg format to a mpr variable
-
- usage:
- v = data.regToVar(blob, type);
-*/
-static int ejs_regToVar(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- DATA_BLOB *blob;
- enum winreg_Type type;
- struct MprVar v;
-
- if (argc != 2) {
- ejsSetErrorMsg(eid, "regToVar invalid arguments");
- return -1;
- }
-
- blob = mprToDataBlob(argv[0]);
- type = mprToInt(argv[1]);
-
- if (blob == NULL) {
- ejsSetErrorMsg(eid, "regToVar null data");
- return -1;
- }
-
- switch (type) {
- case REG_NONE:
- v = mprCreateUndefinedVar();
- break;
-
- case REG_SZ:
- case REG_EXPAND_SZ: {
- char *s;
- ssize_t len;
- len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(mprLpCtx()), CH_UTF16, CH_UNIX,
- blob->data, blob->length, (void **)&s);
- if (len == -1) {
- ejsSetErrorMsg(eid, "regToVar invalid REG_SZ string");
- return -1;
- }
- v = mprString(s);
- talloc_free(s);
- break;
- }
-
- case REG_DWORD: {
- if (blob->length != 4) {
- ejsSetErrorMsg(eid, "regToVar invalid REG_DWORD length %ld", (long)blob->length);
- return -1;
- }
- v = mprCreateNumberVar(IVAL(blob->data, 0));
- break;
- }
-
- case REG_DWORD_BIG_ENDIAN: {
- if (blob->length != 4) {
- ejsSetErrorMsg(eid, "regToVar invalid REG_DWORD_BIG_ENDIAN length %ld", (long)blob->length);
- return -1;
- }
- v = mprCreateNumberVar(RIVAL(blob->data, 0));
- break;
- }
-
- case REG_QWORD: {
- if (blob->length != 8) {
- ejsSetErrorMsg(eid, "regToVar invalid REG_QWORD length %ld", (long)blob->length);
- return -1;
- }
- v = mprCreateNumberVar(BVAL(blob->data, 0));
- break;
- }
-
- case REG_MULTI_SZ: {
- DATA_BLOB b = *blob;
- const char **list = NULL;
- while (b.length > 0) {
- char *s;
- ssize_t len;
- size_t slen = utf16_len_n(b.data, b.length);
- if (slen == 2 && b.length == 2 && SVAL(b.data, 0) == 0) {
- break;
- }
- len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(mprLpCtx()), CH_UTF16, CH_UNIX,
- b.data, slen, (void **)&s);
- if (len == -1) {
- ejsSetErrorMsg(eid, "regToVar invalid REG_MULTI_SZ string");
- return -1;
- }
- list = str_list_add(list, s);
- talloc_free(s);
- talloc_steal(mprMemCtx(), list);
- b.data += slen;
- b.length -= slen;
- }
- v = mprList("REG_MULTI_SZ", list);
- talloc_free(list);
- break;
- }
-
-
- case REG_FULL_RESOURCE_DESCRIPTOR:
- case REG_RESOURCE_LIST:
- case REG_BINARY:
- case REG_RESOURCE_REQUIREMENTS_LIST:
- case REG_LINK:
- return ejs_blobToArray(eid, 1, argv);
-
- default:
- ejsSetErrorMsg(eid, "regToVar invalid type %d", type);
- return -1;
- }
-
- mpr_Return(eid, v);
- return 0;
-}
-
-/*
- initialise datablob ejs subsystem
-*/
-static int ejs_datablob_init(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct MprVar *obj = mprInitObject(eid, "datablob", argc, argv);
-
- mprSetCFunction(obj, "blobFromArray", ejs_blobFromArray);
- mprSetCFunction(obj, "blobToArray", ejs_blobToArray);
- mprSetCFunction(obj, "blobCompare", ejs_blobCompare);
- mprSetCFunction(obj, "regToVar", ejs_regToVar);
-
- return 0;
-}
-
-/*
- setup C functions that be called from ejs
-*/
-NTSTATUS smb_setup_ejs_datablob(void)
-{
- ejsDefineCFunction(-1, "datablob_init", ejs_datablob_init, NULL, MPR_VAR_SCRIPT_HANDLE);
- return NT_STATUS_OK;
-}
diff --git a/source4/scripting/ejs/smbcalls_nbt.c b/source4/scripting/ejs/smbcalls_nbt.c
deleted file mode 100644
index 8c555bf821..0000000000
--- a/source4/scripting/ejs/smbcalls_nbt.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- provide hooks into smbd C calls from ejs scripts
-
- Copyright (C) Tim Potter 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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "scripting/ejs/smbcalls.h"
-#include "lib/appweb/ejs/ejs.h"
-#include "librpc/gen_ndr/nbt.h"
-#include "lib/events/events.h"
-#include "libcli/resolve/resolve.h"
-
-/*
- look up a netbios name
-
- syntax:
- resolveName(result, "frogurt");
- resolveName(result, "frogurt", 0x1c);
-*/
-
-static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- int result = -1;
- struct nbt_name name;
- TALLOC_CTX *tmp_ctx = talloc_new(mprMemCtx());
- NTSTATUS nt_status;
- const char *reply_addr;
-
- /* validate arguments */
- if (argc < 2 || argc > 3) {
- ejsSetErrorMsg(eid, "resolveName invalid arguments");
- goto done;
- }
-
- if (argv[0]->type != MPR_TYPE_OBJECT) {
- ejsSetErrorMsg(eid, "resolvename invalid arguments");
- goto done;
- }
-
- if (argv[1]->type != MPR_TYPE_STRING) {
- ejsSetErrorMsg(eid, "resolveName invalid arguments");
- goto done;
- }
-
- if (argc == 2) {
- make_nbt_name_client(&name, mprToString(argv[1]));
- } else {
- if (!mprVarIsNumber(argv[1]->type)) {
- ejsSetErrorMsg(eid, "resolveName invalid arguments");
- goto done;
- }
- make_nbt_name(&name, mprToString(argv[1]), mprToInt(argv[2]));
- }
-
- result = 0;
-
- nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, mprEventCtx());
-
- if (NT_STATUS_IS_OK(nt_status)) {
- mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
- }
-
- mpr_Return(eid, mprNTSTATUS(nt_status));
-
- done:
- talloc_free(tmp_ctx);
- return result;
-}
-
-/*
- setup C functions that be called from ejs
-*/
-NTSTATUS smb_setup_ejs_nbt(void)
-{
- ejsDefineCFunction(-1, "resolveName", ejs_resolve_name, NULL, MPR_VAR_SCRIPT_HANDLE);
- return NT_STATUS_OK;
-}