From 449afe04f8f65c56883d81f3155a321c36dc4f02 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Wed, 14 Mar 2007 23:25:54 +0000 Subject: r21841: Rename the method and check parameters more strictly. rafal (This used to be commit 6824172940e175f2af6ab2c9c25a1495f024de42) --- services/samba/ejsnet.esp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/services/samba/ejsnet.esp b/services/samba/ejsnet.esp index 9584becac6..7ab0e02912 100644 --- a/services/samba/ejsnet.esp +++ b/services/samba/ejsnet.esp @@ -9,7 +9,7 @@ jsonrpc_include("resources.esp"); -function _init_ctx(params, error) +function _NetContext(params, error) { if (params.length < 1) { @@ -26,24 +26,27 @@ function _init_ctx(params, error) return error; } - if (creds.domain == undefined) + if (creds.domain == undefined || + typeof(creds.domain) != "string") { error.setError(jsonrpc.Constant.ServerError.ParameterMismatch, - "credentials.domain is undefined"); + "a valid string is expected in credentials.domain"); return error; } - if (creds.username == undefined) + if (creds.username == undefined || + typeof(creds.username) != "string") { error.setError(jsonrpc.Constant.ServerError.ParameterMismatch, - "credentials.username is undefined"); + "a valid string is expected in credentials.username"); return error; } - if (creds.password == undefined) + if (creds.password == undefined || + typeof(creds.username) != "string") { error.setError(jsonrpc.Constant.ServerError.ParameterMismatch, - "credentials.password is undefined"); + "a valid string is expected in credentials.password"); return error; } @@ -56,7 +59,7 @@ function _init_ctx(params, error) return session.resources.set(netCtx, "netCtx", error); } -jsonrpc.method.init_ctx = _init_ctx; +jsonrpc.method.NetContext = _NetContext; /* -- cgit