diff options
-rw-r--r-- | source4/librpc/idl/drsuapi.idl | 36 | ||||
-rw-r--r-- | source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 6 | ||||
-rw-r--r-- | source4/torture/rpc/dssync.c | 59 |
3 files changed, 97 insertions, 4 deletions
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index f4cef5affd..e815de1cca 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -742,7 +742,41 @@ interface drsuapi /*****************/ /* Function 0x0b */ - WERROR DRSUAPI_GET_NT4_CHANGELOG(); + typedef struct { + uint32 unknown1; + uint32 unknown2; + [range(0,0x00A00000)] uint32 length; + [size_is(length)] uint8 *data; + } drsuapi_DsGetNT4ChangeLogRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1; + } drsuapi_DsGetNT4ChangeLogRequest; + + typedef struct { + [range(0,0x00A00000)] uint32 length1; + [range(0,0x00A00000)] uint32 length2; + hyper unknown1; + NTTIME time2; + hyper unknown3; + NTTIME time4; + hyper unknown5; + NTTIME time6; + NTSTATUS status; + [size_is(length1)] uint8 *data1; + [size_is(length2)] uint8 *data2; + } drsuapi_DsGetNT4ChangeLogInfo1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1; + } drsuapi_DsGetNT4ChangeLogInfo; + + WERROR drsuapi_DsGetNT4ChangeLog( + [in] policy_handle *bind_handle, + [in,out] uint32 level, + [in] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest req, + [out] [switch_is(level)] drsuapi_DsGetNT4ChangeLogInfo info + ); /*****************/ /* Function 0x0c */ diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index e6113073ca..743abdde6f 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -192,10 +192,10 @@ static WERROR DRSUAPI_INTER_DOMAIN_MOVE(struct dcesrv_call_state *dce_call, TALL /* - DRSUAPI_GET_NT4_CHANGELOG + drsuapi_DsGetNT4ChangeLog */ -static WERROR DRSUAPI_GET_NT4_CHANGELOG(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct DRSUAPI_GET_NT4_CHANGELOG *r) +static WERROR drsuapi_DsGetNT4ChangeLog(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct drsuapi_DsGetNT4ChangeLog *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 972c2f1ecf..a4167b3dc3 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -563,6 +563,64 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) return ret; } +static BOOL test_FetchNT4Data(struct DsSyncTest *ctx) +{ + NTSTATUS status; + BOOL ret = True; + int i, y = 0; + uint64_t highest_usn = 0; + const char *partition = NULL; + struct drsuapi_DsGetNT4ChangeLog r; + int32_t out_level = 0; + struct GUID null_guid; + struct dom_sid null_sid; + DATA_BLOB cookie; + + ZERO_STRUCT(null_guid); + ZERO_STRUCT(null_sid); + ZERO_STRUCT(cookie); + + ZERO_STRUCT(r); + r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle; + r.in.level = 1; + + r.in.req.req1.unknown1 = lp_parm_int(-1, "dssync", "nt4-1", 3); + r.in.req.req1.unknown2 = lp_parm_int(-1, "dssync", "nt4-2", 0x00004000); + + while (1) { + r.in.req.req1.length = cookie.length; + r.in.req.req1.data = cookie.data; + + status = dcerpc_drsuapi_DsGetNT4ChangeLog(ctx->new_dc.drsuapi.pipe, ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code); + } + printf("dcerpc_drsuapi_DsGetNT4ChangeLog failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsGetNT4ChangeLog failed - %s\n", win_errstr(r.out.result)); + ret = False; + } else if (r.out.level != 1) { + printf("DsGetNT4ChangeLog unknown level - %u\n", r.out.level); + ret = False; + } else if (NT_STATUS_IS_OK(r.out.info.info1.status)) { + } else if (NT_STATUS_EQUAL(r.out.info.info1.status, STATUS_MORE_ENTRIES)) { + cookie.length = r.out.info.info1.length1; + cookie.data = r.out.info.info1.data1; + continue; + } else { + printf("DsGetNT4ChangeLog failed - %s\n", nt_errstr(r.out.info.info1.status)); + ret = False; + } + + break; + } + + return ret; +} + BOOL torture_rpc_dssync(struct torture_context *torture) { BOOL ret = True; @@ -577,6 +635,7 @@ BOOL torture_rpc_dssync(struct torture_context *torture) ret &= test_GetInfo(ctx); ret &= _test_DsBind(ctx, ctx->admin.credentials, &ctx->new_dc.drsuapi); ret &= test_FetchData(ctx); + ret &= test_FetchNT4Data(ctx); return ret; } |