diff options
author | Rafal Szczesniak <mimir@samba.org> | 2007-03-11 18:37:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:26 -0500 |
commit | 16779a9e5de9c9f8ec4c7a62657632eff56a2255 (patch) | |
tree | 5fcd45b120c983d59eb53e806b8b61236f47e4a6 /services | |
parent | 0816228a6290ab3ca442b47be77187ec709bc94b (diff) | |
download | samba-16779a9e5de9c9f8ec4c7a62657632eff56a2255.tar.gz samba-16779a9e5de9c9f8ec4c7a62657632eff56a2255.tar.bz2 samba-16779a9e5de9c9f8ec4c7a62657632eff56a2255.zip |
r21788: Add new JSON-RPC services.
rafal
(This used to be commit 78e123518cbc808424e776751f4112fbaa8b74eb)
Diffstat (limited to 'services')
-rw-r--r-- | services/samba/config.esp | 26 | ||||
-rw-r--r-- | services/samba/ejsnet.esp | 68 |
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: + */ + +%> |