svn commit: samba r21788 - in branches/SAMBA_4_0/services/samba: .
mimir at samba.org
mimir at samba.org
Sun Mar 11 18:37:47 GMT 2007
Author: mimir
Date: 2007-03-11 18:37:45 +0000 (Sun, 11 Mar 2007)
New Revision: 21788
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21788
Log:
Add new JSON-RPC services.
rafal
Added:
branches/SAMBA_4_0/services/samba/config.esp
branches/SAMBA_4_0/services/samba/ejsnet.esp
Changeset:
Added: branches/SAMBA_4_0/services/samba/config.esp
===================================================================
--- branches/SAMBA_4_0/services/samba/config.esp 2007-03-11 18:36:36 UTC (rev 21787)
+++ branches/SAMBA_4_0/services/samba/config.esp 2007-03-11 18:37:45 UTC (rev 21788)
@@ -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;
+
+%>
Added: branches/SAMBA_4_0/services/samba/ejsnet.esp
===================================================================
--- branches/SAMBA_4_0/services/samba/ejsnet.esp 2007-03-11 18:36:36 UTC (rev 21787)
+++ branches/SAMBA_4_0/services/samba/ejsnet.esp 2007-03-11 18:37:45 UTC (rev 21788)
@@ -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:
+ */
+
+%>
More information about the samba-cvs
mailing list