summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-27 10:34:53 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:46:25 +0100
commitfd461adfd017f5fe26ffd7340ccfd953363c28ab (patch)
treea925b27856c03149ceb9c050a8bce9171f42f4a4
parentb653bea814d4a738a0fc5082945b9d619e21ceb7 (diff)
downloadsamba-fd461adfd017f5fe26ffd7340ccfd953363c28ab.tar.gz
samba-fd461adfd017f5fe26ffd7340ccfd953363c28ab.tar.bz2
samba-fd461adfd017f5fe26ffd7340ccfd953363c28ab.zip
r26151: Add IDL and torture test for wkssvc_NetrValidateName() and
wkssvc_NetrValidateName2(). Guenther (This used to be commit 9f63ec388dab09ef3148635eefa58f2e32c5d151)
-rw-r--r--source4/librpc/idl/wkssvc.idl25
-rw-r--r--source4/rpc_server/wkssvc/dcesrv_wkssvc.c16
-rw-r--r--source4/torture/rpc/wkssvc.c64
3 files changed, 95 insertions, 10 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl
index cabd8a210d..f84c6329c8 100644
--- a/source4/librpc/idl/wkssvc.idl
+++ b/source4/librpc/idl/wkssvc.idl
@@ -404,7 +404,22 @@ import "srvsvc.idl";
/*****************************/
/* Function 0x13 */
- WERROR WKSSVC_NETRVALIDATENAME ();
+ typedef enum {
+ NetSetupUnknown = 0,
+ NetSetupMachine = 1,
+ NetSetupWorkgroup = 2,
+ NetSetupDomain = 3,
+ NetSetupNonExistentDomain = 4,
+ NetSetupDnsMachine = 5
+ } wkssvc_NetValidateNameType;
+
+ WERROR wkssvc_NetrValidateName(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in] [ref] [string,charset(UTF16)] uint16 *name,
+ [in] [string,charset(UTF16)] uint16 *Account,
+ [in] [string,charset(UTF16)] uint16 *Password,
+ [in] wkssvc_NetValidateNameType name_type
+ );
/*****************************/
/* Function 0x14 */
@@ -482,7 +497,13 @@ import "srvsvc.idl";
/*****************************/
/* Function 0x19 */
- WERROR WKSSVC_NETRVALIDATENAME2 ();
+ WERROR wkssvc_NetrValidateName2(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in] [ref] [string,charset(UTF16)] uint16 *name,
+ [in] [string,charset(UTF16)] uint16 *Account,
+ [in] wkssvc_PasswordBuffer *EncryptedPassword,
+ [in] wkssvc_NetValidateNameType name_type
+ );
/*****************************/
/* Function 0x1a */
diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
index 3ab02c1047..4123d9c9ce 100644
--- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
+++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c
@@ -292,11 +292,11 @@ static WERROR dcesrv_WKSSVC_NETRRENAMEMACHINEINDOMAIN(struct dcesrv_call_state *
}
-/*
- WKSSVC_NETRVALIDATENAME
+/*
+ wkssvc_NetrValidateName
*/
-static WERROR dcesrv_WKSSVC_NETRVALIDATENAME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct WKSSVC_NETRVALIDATENAME *r)
+static WERROR dcesrv_wkssvc_NetrValidateName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct wkssvc_NetrValidateName *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
@@ -352,11 +352,11 @@ static WERROR dcesrv_wkssvc_NetrRenameMachineInDomain2(struct dcesrv_call_state
}
-/*
- WKSSVC_NETRVALIDATENAME2
+/*
+ wkssvc_NetrValidateName2
*/
-static WERROR dcesrv_WKSSVC_NETRVALIDATENAME2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct WKSSVC_NETRVALIDATENAME2 *r)
+static WERROR dcesrv_wkssvc_NetrValidateName2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct wkssvc_NetrValidateName2 *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index f40af73538..d862e00d1d 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -504,6 +504,66 @@ static bool test_NetrLogonDomainNameDel(struct torture_context *tctx,
return true;
}
+static bool test_NetrValidateName(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetrValidateName r;
+ uint16_t levels[] = {0,1,2,3,4,5};
+ int i;
+
+ for (i=0; i<ARRAY_SIZE(levels); i++) {
+
+ r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.name = lp_workgroup(global_loadparm);
+ r.in.Account = NULL;
+ r.in.Password = NULL;
+ r.in.name_type = levels[i];
+
+ torture_comment(tctx, "testing NetrValidateName level %u\n",
+ r.in.name_type);
+
+ status = dcerpc_wkssvc_NetrValidateName(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrValidateName failed");
+ torture_assert_werr_equal(tctx, r.out.result,
+ WERR_NOT_SUPPORTED,
+ "NetrValidateName failed");
+ }
+
+ return true;
+}
+
+static bool test_NetrValidateName2(struct torture_context *tctx,
+ struct dcerpc_pipe *p)
+{
+ NTSTATUS status;
+ struct wkssvc_NetrValidateName2 r;
+ uint16_t levels[] = {0,1,2,3,4,5};
+ int i;
+
+ for (i=0; i<ARRAY_SIZE(levels); i++) {
+
+ r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.name = lp_workgroup(global_loadparm);
+ r.in.Account = NULL;
+ r.in.EncryptedPassword = NULL;
+ r.in.name_type = levels[i];
+
+ torture_comment(tctx, "testing NetrValidateName2 level %u\n",
+ r.in.name_type);
+
+ status = dcerpc_wkssvc_NetrValidateName2(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "NetrValidateName2 failed");
+ torture_assert_werr_equal(tctx, r.out.result,
+ WERR_RPC_E_REMOTE_DISABLED,
+ "NetrValidateName2 failed");
+ }
+
+ return true;
+}
+
struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
{
struct torture_suite *suite;
@@ -537,6 +597,10 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
torture_rpc_tcase_add_test(tcase, "NetrUseAdd",
test_NetrUseAdd);
+ torture_rpc_tcase_add_test(tcase, "NetrValidateName",
+ test_NetrValidateName);
+ torture_rpc_tcase_add_test(tcase, "NetrValidateName2",
+ test_NetrValidateName2);
torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameDel",
test_NetrLogonDomainNameDel);
torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameAdd",