mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
r26151: Add IDL and torture test for wkssvc_NetrValidateName() and
wkssvc_NetrValidateName2(). Guenther (This used to be commit 9f63ec388dab09ef3148635eefa58f2e32c5d151)
This commit is contained in:
parent
b653bea814
commit
fd461adfd0
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user