r21841: Rename the method and check parameters more strictly.
authorRafal Szczesniak <mimir@samba.org>
Wed, 14 Mar 2007 23:25:54 +0000 (23:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:49:36 +0000 (14:49 -0500)
rafal
(This used to be commit 6824172940e175f2af6ab2c9c25a1495f024de42)

services/samba/ejsnet.esp

index 9584becac6b49f4e9921a3c9f59f8499456a6211..7ab0e02912968baaad0d3ecde61e104dca95703f 100644 (file)
@@ -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;
 
 
 /*