1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00

r4461: finished the remaining information levels in the DSSETUP pipe. The pipe is now complete!

The only glitch is that I am returning DS_ROLE_MEMBER_SERVER when I
should be returning DS_ROLE_PRIMARY_DC. This is needed for the moment
or ACL editing doesn't work from w2k3. Once we have some more ADS
calls we should be able to fix this.
This commit is contained in:
Andrew Tridgell 2005-01-01 01:32:01 +00:00 committed by Gerald (Jerry) Carter
parent 14b650c85d
commit 6566dc2805
3 changed files with 98 additions and 28 deletions

View File

@ -15,6 +15,15 @@
/**********************************************/
/* Function 0x00 */
typedef enum {
DS_ROLE_STANDALONE_WORKSTATION = 0,
DS_ROLE_MEMBER_WORKSTATION = 1,
DS_ROLE_STANDALONE_SERVER = 2,
DS_ROLE_MEMBER_SERVER = 3,
DS_ROLE_BACKUP_DC = 4,
DS_ROLE_PRIMARY_DC = 5
} ds_Role;
typedef struct {
uint16 role;
uint32 flags;
@ -24,8 +33,42 @@
GUID domain_guid;
} ds_DomainBasicInformation;
typedef enum {
DS_NOT_UPGRADING = 0,
DS_UPGRADING = 1
} ds_UpgradeStatus;
typedef enum {
DS_PREVIOUS_UNKNOWN = 0,
DS_PREVIOUS_PRIMARY = 1,
DS_PREVIOUS_BACKUP = 2
} ds_PreviousStatus;
typedef struct {
uint32 upgrading;
uint16 previous_role;
} ds_DomainUpgradeStatus;
typedef enum {
DS_STATUS_IDLE = 0,
DS_STATUS_ACTIVE = 1,
DS_STATUS_NEEDS_REBOOT = 2
} ds_Status;
typedef struct {
uint16 status;
} ds_RoleOpStatus;
typedef enum {
DS_BASIC_INFORMATION = 1,
DS_UPGRADE_STATUS = 2,
DS_ROLE_OP_STATUS = 3
} ds_InformationLevel;
typedef union {
[case(1)] ds_DomainBasicInformation basic;
[case(DS_BASIC_INFORMATION)] ds_DomainBasicInformation basic;
[case(DS_UPGRADE_STATUS)] ds_DomainUpgradeStatus upgrade;
[case(DS_ROLE_OP_STATUS)] ds_RoleOpStatus status;
} ds_DomainInformation;
WERROR ds_RolerGetPrimaryDomainInformation(
@ -33,7 +76,11 @@
[out,switch_is(level)] ds_DomainInformation *info
);
/*
w2k3 has removed all the calls below from their implementation.
These stubs are left here only as a way of documenting the names
of the calls in case they ever turn up on the wire.
*/
WERROR ds_RolerDnsNameToFlatName();
WERROR ds_RolerDcAsDc();
WERROR ds_RolerDcAsReplica();

View File

@ -50,13 +50,15 @@ static WERROR ds_RolerGetPrimaryDomainInformation(struct dcesrv_call_state *dce_
return WERR_SERVER_UNAVAILABLE;
}
switch (r->in.level) {
case 1:
r->out.info = talloc_p(mem_ctx, union ds_DomainInformation);
if (r->out.info == NULL) {
return WERR_NOMEM;
}
r->out.info->basic.role = lp_server_role();
switch (r->in.level) {
case DS_BASIC_INFORMATION:
/* incorrect, but needed for the moment */
r->out.info->basic.role = DS_ROLE_MEMBER_SERVER;
r->out.info->basic.flags = 0x01000003;
r->out.info->basic.domain = samdb_result_string(res[0], "name", NULL);
r->out.info->basic.dns_domain = samdb_result_string(res[0], "dnsDomain", NULL);
@ -64,6 +66,15 @@ static WERROR ds_RolerGetPrimaryDomainInformation(struct dcesrv_call_state *dce_
r->out.info->basic.domain_guid = samdb_result_guid(res[0], "objectGUID");
break;
case DS_UPGRADE_STATUS:
r->out.info->upgrade.upgrading = DS_NOT_UPGRADING;
r->out.info->upgrade.previous_role = DS_PREVIOUS_UNKNOWN;
break;
case DS_ROLE_OP_STATUS:
r->out.info->status.status = DS_STATUS_IDLE;
break;
default:
err = WERR_INVALID_PARAM;
break;
@ -73,6 +84,13 @@ static WERROR ds_RolerGetPrimaryDomainInformation(struct dcesrv_call_state *dce_
}
/*****************************************
NOTE! The remaining calls below were
removed in w2k3, so the DCESRV_FAULT()
replies are the correct implementation. Do
not try and fill these in with anything else
******************************************/
/*
ds_RolerDnsNameToFlatName
*/

View File

@ -28,18 +28,23 @@ static BOOL test_RolerGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_
{
struct ds_RolerGetPrimaryDomainInformation r;
NTSTATUS status;
BOOL ret = True;
int i;
printf("\ntesting RolerGetPrimaryDomainInformation\n");
r.in.level = 1;
for (i=DS_BASIC_INFORMATION;i<=DS_ROLE_OP_STATUS;i++) {
r.in.level = i;
status = dcerpc_ds_RolerGetPrimaryDomainInformation(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("RolerGetPrimaryDomainInformation failed - %s\n", nt_errstr(status));
return False;
printf("RolerGetPrimaryDomainInformation level %d failed - %s\n",
i, nt_errstr(status));
ret = False;
}
}
return True;
return ret;
}
BOOL torture_rpc_dssetup(void)