summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/samba/config.esp26
-rw-r--r--services/samba/ejsnet.esp68
2 files changed, 94 insertions, 0 deletions
diff --git a/services/samba/config.esp b/services/samba/config.esp
new file mode 100644
index 0000000000..bf4b789c13
--- /dev/null
+++ b/services/samba/config.esp
@@ -0,0 +1,26 @@
+<%
+
+/*
+ * Copyright (C) Rafal Szczesniak 2007
+ */
+
+/* Simple JSON-RPC access to the configuration parameters */
+
+function _lp_get(params, error)
+{
+ if (params.length < 1)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "no parameter specified");
+ return error;
+ }
+
+ var lp = loadparm_init();
+ var name = params[0];
+ var value = lp.get(name);
+
+ return value;
+}
+jsonrpc.method.lp_get = _lp_get;
+
+%>
diff --git a/services/samba/ejsnet.esp b/services/samba/ejsnet.esp
new file mode 100644
index 0000000000..9584becac6
--- /dev/null
+++ b/services/samba/ejsnet.esp
@@ -0,0 +1,68 @@
+<%
+
+/*
+ * Copyright (C) Rafal Szczesniak 2007
+ */
+
+/* JSON-RPC mappings to the libnet functions */
+
+jsonrpc_include("resources.esp");
+
+
+function _init_ctx(params, error)
+{
+ if (params.length < 1)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "too few parameters(usage: [ <credentials ])");
+ return error;
+ }
+
+ var creds = params[0];
+ if (creds == undefined)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "credentials parameter is undefined");
+ return error;
+ }
+
+ if (creds.domain == undefined)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "credentials.domain is undefined");
+ return error;
+ }
+
+ if (creds.username == undefined)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "credentials.username is undefined");
+ return error;
+ }
+
+ if (creds.password == undefined)
+ {
+ error.setError(jsonrpc.Constant.ServerError.ParameterMismatch,
+ "credentials.password is undefined");
+ return error;
+ }
+
+ var credentials = credentials_init();
+ credentials.set_domain(creds.domain);
+ credentials.set_username(creds.username);
+ credentials.set_password(creds.password);
+
+ var netCtx = NetContext(credentials);
+
+ return session.resources.set(netCtx, "netCtx", error);
+}
+jsonrpc.method.init_ctx = _init_ctx;
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * End:
+ */
+
+%>