summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/netlogon.idl52
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c87
-rw-r--r--source4/torture/rpc/netlogon.c121
3 files changed, 207 insertions, 53 deletions
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index 80d1026b0a..784c8d6655 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -896,7 +896,26 @@ interface netlogon
/*****************/
/* Function 0x14 */
- WERROR netr_DSRGETDCNAME() ;
+ typedef struct {
+ [string,charset(UTF16)] uint16 *dc_unc;
+ [string,charset(UTF16)] uint16 *dc_address;
+ int32 dc_address_type;
+ GUID domain_guid;
+ [string,charset(UTF16)] uint16 *domain_name;
+ [string,charset(UTF16)] uint16 *forest_name;
+ uint32 dc_flags;
+ [string,charset(UTF16)] uint16 *dc_site_name;
+ [string,charset(UTF16)] uint16 *client_site_name;
+ } netr_DsRGetDCNameInfo;
+
+ WERROR netr_DsRGetDCName(
+ [in] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 *domain_name,
+ [in] GUID *domain_guid,
+ [in] GUID *site_guid,
+ [in] uint32 flags,
+ [out] netr_DsRGetDCNameInfo *info
+ );
/*****************/
/* Function 0x15 */
@@ -932,11 +951,22 @@ interface netlogon
/****************/
/* Function 0x1b */
- WERROR netr_DSRGETDCNAMEX();
+
+ WERROR netr_DsRGetDCNameEx(
+ [in] [string,charset(UTF16)] uint16 *server_unc,
+ [in] [string,charset(UTF16)] uint16 *domain_name,
+ [in] GUID *domain_guid,
+ [in] [string,charset(UTF16)] uint16 *site_name,
+ [in] uint32 flags,
+ [out] netr_DsRGetDCNameInfo *info
+ );
/****************/
/* Function 0x1c */
- WERROR netr_DSRGETSITENAME();
+ WERROR netr_DsRGetSiteName(
+ [in] [string,charset(UTF16)] uint16 *computer_name,
+ [out] [string,charset(UTF16)] uint16 *site
+ );
/****************/
/* Function 0x1d */
@@ -1035,19 +1065,7 @@ interface netlogon
/****************/
/* Function 0x22 */
- typedef struct {
- [string,charset(UTF16)] uint16 *dc_unc;
- [string,charset(UTF16)] uint16 *dc_address;
- int32 dc_address_type;
- GUID domain_guid;
- [string,charset(UTF16)] uint16 *domain_name;
- [string,charset(UTF16)] uint16 *forest_name;
- uint32 dc_flags;
- [string,charset(UTF16)] uint16 *dc_site_name;
- [string,charset(UTF16)] uint16 *client_site_name;
- } netr_DrsGetDCNameEx2Info;
-
- WERROR netr_DrsGetDCNameEx2(
+ WERROR netr_DsRGetDCNameEx2(
[in] [string,charset(UTF16)] uint16 *server_unc,
[in] [string,charset(UTF16)] uint16 *client_account,
[in] uint32 mask,
@@ -1055,7 +1073,7 @@ interface netlogon
[in] GUID *domain_guid,
[in] [string,charset(UTF16)] uint16 *site_name,
[in] uint32 flags,
- [out] netr_DrsGetDCNameEx2Info *info
+ [out] netr_DsRGetDCNameInfo *info
);
/****************/
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 63c211baec..e482a229b7 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -720,16 +720,6 @@ static WERROR netr_NETRENUMERATETRUSTEDDOMAINS(struct dcesrv_call_state *dce_cal
/*
- netr_DSRGETDCNAME
-*/
-static WERROR netr_DSRGETDCNAME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct netr_DSRGETDCNAME *r)
-{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
-}
-
-
-/*
netr_NETRLOGONDUMMYROUTINE1
*/
static WERROR netr_NETRLOGONDUMMYROUTINE1(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
@@ -779,21 +769,12 @@ static WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST(struct dcesrv_call_state *dce_ca
}
-/*
- netr_DSRGETDCNAMEX
-*/
-static WERROR netr_DSRGETDCNAMEX(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct netr_DSRGETDCNAMEX *r)
-{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
-}
-
/*
- netr_DSRGETSITENAME
+ netr_DsRGetSiteName
*/
-static WERROR netr_DSRGETSITENAME(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct netr_DSRGETSITENAME *r)
+static WERROR netr_DsRGetSiteName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct netr_DsRGetSiteName *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
@@ -1016,10 +997,10 @@ static WERROR netr_DSRADDRESSTOSITENAMESW(struct dcesrv_call_state *dce_call, TA
/*
- netr_DrsGetDCNameEx2
+ netr_DsRGetDCNameEx2
*/
-static WERROR netr_DrsGetDCNameEx2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct netr_DrsGetDCNameEx2 *r)
+static WERROR netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct netr_DsRGetDCNameEx2 *r)
{
const char * const attrs[] = { "dnsDomain", "objectGUID", NULL };
void *sam_ctx;
@@ -1040,7 +1021,7 @@ static WERROR netr_DrsGetDCNameEx2(struct dcesrv_call_state *dce_call, TALLOC_CT
return WERR_NO_SUCH_DOMAIN;
}
- r->out.info = talloc(mem_ctx, struct netr_DrsGetDCNameEx2Info);
+ r->out.info = talloc(mem_ctx, struct netr_DsRGetDCNameInfo);
if (!r->out.info) {
return WERR_NOMEM;
}
@@ -1061,6 +1042,60 @@ static WERROR netr_DrsGetDCNameEx2(struct dcesrv_call_state *dce_call, TALLOC_CT
return WERR_OK;
}
+/*
+ netr_DsRGetDCNameEx
+*/
+static WERROR netr_DsRGetDCNameEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct netr_DsRGetDCNameEx *r)
+{
+ struct netr_DsRGetDCNameEx2 r2;
+ WERROR werr;
+
+ ZERO_STRUCT(r2);
+
+ r2.in.server_unc = r->in.server_unc;
+ r2.in.client_account = NULL;
+ r2.in.mask = 0;
+ r2.in.domain_guid = r->in.domain_guid;
+ r2.in.domain_name = r->in.domain_name;
+ r2.in.site_name = r->in.site_name;
+ r2.in.flags = r->in.flags;
+ r2.out.info = NULL;
+
+ werr = netr_DsRGetDCNameEx2(dce_call, mem_ctx, &r2);
+
+ r->out.info = r2.out.info;
+
+ return werr;
+}
+
+/*
+ netr_DsRGetDCName
+*/
+static WERROR netr_DsRGetDCName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct netr_DsRGetDCName *r)
+{
+ struct netr_DsRGetDCNameEx2 r2;
+ WERROR werr;
+
+ ZERO_STRUCT(r2);
+
+ r2.in.server_unc = r->in.server_unc;
+ r2.in.client_account = NULL;
+ r2.in.mask = 0;
+ r2.in.domain_name = r->in.domain_name;
+ r2.in.domain_guid = r->in.domain_guid;
+
+ r2.in.site_name = NULL; /* should fill in from site GUID */
+ r2.in.flags = r->in.flags;
+ r2.out.info = NULL;
+
+ werr = netr_DsRGetDCNameEx2(dce_call, mem_ctx, &r2);
+
+ r->out.info = r2.out.info;
+
+ return werr;
+}
/*
netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index d2aaba8cea..8993969098 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -702,6 +702,12 @@ static BOOL test_DatabaseDeltas(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
creds_client_authenticator(creds, &r.in.credential);
status = dcerpc_netr_DatabaseDeltas(p, mem_ctx, &r);
+ if (NT_STATUS_EQUAL(status,
+ NT_STATUS_SYNCHRONIZATION_REQUIRED)) {
+ printf("no considering %s to be an error\n",
+ nt_errstr(status));
+ return True;
+ }
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
printf("DatabaseDeltas - %s\n", nt_errstr(status));
@@ -1106,13 +1112,102 @@ static BOOL test_DsrEnumerateDomainTrusts(struct dcerpc_pipe *p, TALLOC_CTX *mem
return True;
}
+static BOOL test_netr_DsRGetSiteName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ const char *computer_name,
+ const char *expected_site)
+{
+ NTSTATUS status;
+ struct netr_DsRGetSiteName r;
+ BOOL ret = True;
+
+ r.in.computer_name = computer_name;
+ printf("Testing netr_DsRGetSiteName\n");
+
+ status = dcerpc_netr_DsRGetSiteName(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
+ printf("netr_DsRGetSiteName - %s/%s\n",
+ nt_errstr(status), win_errstr(r.out.result));
+ ret = False;
+ } else {
+ if (strcmp(expected_site, r.out.site) != 0) {
+ printf("netr_DsRGetSiteName - unexpected result: %s, expected %s\n",
+ r.out.site, expected_site);
+
+ ret = False;
+ }
+ }
+ return ret;
+}
+
/*
- try a netlogon netr_DrsGetDCNameEx2
+ try a netlogon netr_DsRGetDCName
*/
-static BOOL test_netr_DrsGetDCNameEx2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static BOOL test_netr_DsRGetDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
- struct netr_DrsGetDCNameEx2 r;
+ struct netr_DsRGetDCName r;
+ BOOL ret = True;
+
+ r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.domain_name = talloc_asprintf(mem_ctx, "%s", lp_realm());
+ r.in.domain_guid = NULL;
+ r.in.site_guid = NULL;
+ r.in.flags = 0x40000000;
+
+ printf("Testing netr_DsRGetDCName\n");
+
+ status = dcerpc_netr_DsRGetDCName(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
+ printf("netr_DsRGetDCName - %s/%s\n",
+ nt_errstr(status), win_errstr(r.out.result));
+ ret = False;
+ } else {
+ ret = test_netr_DsRGetSiteName(p, mem_ctx,
+ r.out.info->dc_unc,
+ r.out.info->dc_site_name);
+ }
+
+ return ret;
+}
+
+/*
+ try a netlogon netr_DsRGetDCNameEx
+*/
+static BOOL test_netr_DsRGetDCNameEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct netr_DsRGetDCNameEx r;
+ BOOL ret = True;
+
+ r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ r.in.domain_name = talloc_asprintf(mem_ctx, "%s", lp_realm());
+ r.in.domain_guid = NULL;
+ r.in.site_name = NULL;
+ r.in.flags = 0x40000000;
+
+ printf("Testing netr_DsRGetDCNameEx\n");
+
+ status = dcerpc_netr_DsRGetDCNameEx(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
+ printf("netr_DsRGetDCNameEx - %s/%s\n",
+ nt_errstr(status), win_errstr(r.out.result));
+ ret = False;
+ } else {
+ ret = test_netr_DsRGetSiteName(p, mem_ctx,
+ r.out.info->dc_unc,
+ r.out.info->dc_site_name);
+ }
+
+ return ret;
+}
+
+/*
+ try a netlogon netr_DsRGetDCNameEx2
+*/
+static BOOL test_netr_DsRGetDCNameEx2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct netr_DsRGetDCNameEx2 r;
BOOL ret = True;
r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
@@ -1123,25 +1218,29 @@ static BOOL test_netr_DrsGetDCNameEx2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx
r.in.site_name = NULL;
r.in.flags = 0x40000000;
- printf("Testing netr_DrsGetDCNameEx2 without client account\n");
+ printf("Testing netr_DsRGetDCNameEx2 without client account\n");
- status = dcerpc_netr_DrsGetDCNameEx2(p, mem_ctx, &r);
+ status = dcerpc_netr_DsRGetDCNameEx2(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("netr_DrsGetDCNameEx2 - %s/%s\n",
+ printf("netr_DsRGetDCNameEx2 - %s/%s\n",
nt_errstr(status), win_errstr(r.out.result));
ret = False;
}
- printf("Testing netr_DrsGetDCNameEx2 with client acount\n");
+ printf("Testing netr_DsRGetDCNameEx2 with client acount\n");
r.in.client_account = TEST_MACHINE_NAME"$";
r.in.mask = 0x00002000;
r.in.flags = 0x80000000;
- status = dcerpc_netr_DrsGetDCNameEx2(p, mem_ctx, &r);
+ status = dcerpc_netr_DsRGetDCNameEx2(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("netr_DrsGetDCNameEx2 - %s/%s\n",
+ printf("netr_DsRGetDCNameEx2 - %s/%s\n",
nt_errstr(status), win_errstr(r.out.result));
ret = False;
+ } else {
+ ret = test_netr_DsRGetSiteName(p, mem_ctx,
+ r.out.info->dc_unc,
+ r.out.info->dc_site_name);
}
return ret;
@@ -1442,7 +1541,9 @@ BOOL torture_rpc_netlogon(void)
ret &= test_LogonControl2Ex(p, mem_ctx);
ret &= test_DsrEnumerateDomainTrusts(p, mem_ctx);
ret &= test_GetDomainInfo_async(p, mem_ctx);
- ret &= test_netr_DrsGetDCNameEx2(p, mem_ctx);
+ ret &= test_netr_DsRGetDCName(p, mem_ctx);
+ ret &= test_netr_DsRGetDCNameEx(p, mem_ctx);
+ ret &= test_netr_DsRGetDCNameEx2(p, mem_ctx);
talloc_free(mem_ctx);