1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

idl:drsuapi: Manage all possible lengths of drsuapi_DsBindInfo

Signed-off-by: Samuel Cabrero <scabrero@zentyal.com>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
This commit is contained in:
Samuel Cabrero 2014-07-04 12:45:59 +02:00 committed by Andrew Bartlett
parent 331fb7fc64
commit d747372d28
9 changed files with 179 additions and 7 deletions

View File

@ -129,6 +129,14 @@ interface drsuapi
uint32 repl_epoch;
} drsuapi_DsBindInfo28;
typedef [public] struct {
drsuapi_SupportedExtensions supported_extensions;
GUID site_guid;
uint32 pid;
uint32 repl_epoch;
drsuapi_SupportedExtensionsExt supported_extensions_ext;
} drsuapi_DsBindInfo32;
/* this is used by w2k8 */
typedef [public] struct {
drsuapi_SupportedExtensions supported_extensions;
@ -139,6 +147,17 @@ interface drsuapi
GUID config_dn_guid;
} drsuapi_DsBindInfo48;
/* this is used by w2k12 R2 [MS-DRSR] Section 5.39 */
typedef [public] struct {
drsuapi_SupportedExtensions supported_extensions;
GUID site_guid;
uint32 pid;
uint32 repl_epoch;
drsuapi_SupportedExtensionsExt supported_extensions_ext;
GUID config_dn_guid;
drsuapi_SupportedExtensionsExt supported_capabilities_ext;
} drsuapi_DsBindInfo52;
typedef [public] struct {
[flag(NDR_REMAINING)] DATA_BLOB info;
} drsuapi_DsBindInfoFallBack;
@ -146,7 +165,9 @@ interface drsuapi
typedef [nopull, nopush, noprint] [nodiscriminant] union {
[case(24)][subcontext(0), subcontext_size(24)] drsuapi_DsBindInfo24 info24;
[case(28)][subcontext(0), subcontext_size(28)] drsuapi_DsBindInfo28 info28;
[case(32)][subcontext(0), subcontext_size(32)] drsuapi_DsBindInfo32 info32;
[case(48)][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfo48 info48;
[case(52)][subcontext(0), subcontext_size(52)] drsuapi_DsBindInfo52 info52;
/*
* The size for the defaut case is a bit arbitrary it in fact the value
* of the switch but we can't reference it.

View File

@ -195,9 +195,19 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx,
ctx->remote_info28.repl_epoch = 0;
break;
}
case 28:
case 28: {
ctx->remote_info28 = bind_info.info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &bind_info.info.info32;
ctx->remote_info28.site_guid = info32->site_guid;
ctx->remote_info28.supported_extensions = info32->supported_extensions;
ctx->remote_info28.pid = info32->pid;
ctx->remote_info28.repl_epoch = info32->repl_epoch;
break;
}
case 48: {
struct drsuapi_DsBindInfo48 *info48;
info48 = &bind_info.info.info48;
@ -207,6 +217,15 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx,
ctx->remote_info28.repl_epoch = info48->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &bind_info.info.info52;
ctx->remote_info28.site_guid = info52->site_guid;
ctx->remote_info28.supported_extensions = info52->supported_extensions;
ctx->remote_info28.pid = info52->pid;
ctx->remote_info28.repl_epoch = info52->repl_epoch;
break;
}
default:
DEBUG(1, ("Warning: invalid info length in bind info: %d\n",
bind_info.length));

View File

@ -420,8 +420,12 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
supported_extensions = bind_info.info.info24.supported_extensions;
} else if (bind_info.length == 28) {
supported_extensions = bind_info.info.info28.supported_extensions;
} else if (bind_info.length == 32) {
supported_extensions = bind_info.info.info32.supported_extensions;
} else if (bind_info.length == 48) {
supported_extensions = bind_info.info.info48.supported_extensions;
} else if (bind_info.length == 52) {
supported_extensions = bind_info.info.info52.supported_extensions;
}
if (!nc_dn) {

View File

@ -186,10 +186,35 @@ static void dreplsrv_out_drsuapi_bind_done(struct tevent_req *subreq)
info28->repl_epoch = info48->repl_epoch;
break;
}
case 28:
case 28: {
*info28 = state->bind_r.out.bind_info->info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &state->bind_r.out.bind_info->info.info32;
info28->supported_extensions = info32->supported_extensions;
info28->site_guid = info32->site_guid;
info28->pid = info32->pid;
info28->repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &state->bind_r.out.bind_info->info.info52;
info28->supported_extensions = info52->supported_extensions;
info28->site_guid = info52->site_guid;
info28->pid = info52->pid;
info28->repl_epoch = info52->repl_epoch;
break;
}
default:
DEBUG(1, ("Warning: invalid info length in bind info: %d\n",
state->bind_r.out.bind_info->length));
break;
}
}
tevent_req_done(req);

View File

@ -1712,10 +1712,33 @@ static WERROR becomeDC_drsuapi_bind_recv(struct libnet_BecomeDC_state *s,
drsuapi->remote_info28.repl_epoch = info48->repl_epoch;
break;
}
case 28:
case 28: {
drsuapi->remote_info28 = drsuapi->bind_r.out.bind_info->info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &drsuapi->bind_r.out.bind_info->info.info32;
drsuapi->remote_info28.supported_extensions = info32->supported_extensions;
drsuapi->remote_info28.site_guid = info32->site_guid;
drsuapi->remote_info28.pid = info32->pid;
drsuapi->remote_info28.repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &drsuapi->bind_r.out.bind_info->info.info52;
drsuapi->remote_info28.supported_extensions = info52->supported_extensions;
drsuapi->remote_info28.site_guid = info52->site_guid;
drsuapi->remote_info28.pid = info52->pid;
drsuapi->remote_info28.repl_epoch = info52->repl_epoch;
break;
}
default:
DEBUG(1, ("Warning: invalid info length in bind info: %d\n",
drsuapi->bind_r.out.bind_info->length));
break;
}
}
return WERR_OK;

View File

@ -649,10 +649,33 @@ static void unbecomeDC_drsuapi_bind_recv(struct tevent_req *subreq)
s->drsuapi.remote_info28.repl_epoch = info48->repl_epoch;
break;
}
case 28:
case 28: {
s->drsuapi.remote_info28 = s->drsuapi.bind_r.out.bind_info->info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &s->drsuapi.bind_r.out.bind_info->info.info32;
s->drsuapi.remote_info28.supported_extensions = info32->supported_extensions;
s->drsuapi.remote_info28.site_guid = info32->site_guid;
s->drsuapi.remote_info28.pid = info32->pid;
s->drsuapi.remote_info28.repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &s->drsuapi.bind_r.out.bind_info->info.info52;
s->drsuapi.remote_info28.supported_extensions = info52->supported_extensions;
s->drsuapi.remote_info28.site_guid = info52->site_guid;
s->drsuapi.remote_info28.pid = info52->pid;
s->drsuapi.remote_info28.repl_epoch = info52->repl_epoch;
break;
}
default:
DEBUG(1, ("Warning: invalid info length in bind info: %d\n",
s->drsuapi.bind_r.out.bind_info->length));
break;
}
}
unbecomeDC_drsuapi_remove_ds_server_send(s);

View File

@ -246,9 +246,28 @@ static bool _test_DsBind(struct torture_context *tctx,
b->peer_bind_info28.repl_epoch = info48->repl_epoch;
break;
}
case 28:
case 28: {
b->peer_bind_info28 = b->req.out.bind_info->info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &b->req.out.bind_info->info.info32;
b->peer_bind_info28.supported_extensions= info32->supported_extensions;
b->peer_bind_info28.site_guid = info32->site_guid;
b->peer_bind_info28.pid = info32->pid;
b->peer_bind_info28.repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &b->req.out.bind_info->info.info52;
b->peer_bind_info28.supported_extensions= info52->supported_extensions;
b->peer_bind_info28.site_guid = info52->site_guid;
b->peer_bind_info28.pid = info52->pid;
b->peer_bind_info28.repl_epoch = info52->repl_epoch;
break;
}
default:
printf("DsBind - warning: unknown BindInfo length: %u\n",
b->req.out.bind_info->length);

View File

@ -244,9 +244,28 @@ static bool _test_DsaBind(struct torture_context *tctx,
bi->srv_info48.repl_epoch = info28->repl_epoch;
break;
}
case 48:
case 48: {
bi->srv_info48 = r.out.bind_info->info.info48;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &r.out.bind_info->info.info32;
bi->srv_info48.supported_extensions = info32->supported_extensions;
bi->srv_info48.site_guid = info32->site_guid;
bi->srv_info48.pid = info32->pid;
bi->srv_info48.repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &r.out.bind_info->info.info52;
bi->srv_info48.supported_extensions = info52->supported_extensions;
bi->srv_info48.site_guid = info52->site_guid;
bi->srv_info48.pid = info52->pid;
bi->srv_info48.repl_epoch = info52->repl_epoch;
break;
}
default:
torture_result(tctx, TORTURE_FAIL,
"DsBind: unknown BindInfo length: %u",

View File

@ -204,9 +204,28 @@ static bool _test_DsBind(struct torture_context *tctx,
b->peer_bind_info28.repl_epoch = info48->repl_epoch;
break;
}
case 28:
case 28: {
b->peer_bind_info28 = b->req.out.bind_info->info.info28;
break;
}
case 32: {
struct drsuapi_DsBindInfo32 *info32;
info32 = &b->req.out.bind_info->info.info32;
b->peer_bind_info28.supported_extensions= info32->supported_extensions;
b->peer_bind_info28.site_guid = info32->site_guid;
b->peer_bind_info28.pid = info32->pid;
b->peer_bind_info28.repl_epoch = info32->repl_epoch;
break;
}
case 52: {
struct drsuapi_DsBindInfo52 *info52;
info52 = &b->req.out.bind_info->info.info52;
b->peer_bind_info28.supported_extensions= info52->supported_extensions;
b->peer_bind_info28.site_guid = info52->site_guid;
b->peer_bind_info28.pid = info52->pid;
b->peer_bind_info28.repl_epoch = info52->repl_epoch;
break;
}
default:
printf("DsBind - warning: unknown BindInfo length: %u\n",
b->req.out.bind_info->length);