1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _DSSETUP_NDL_
  27 #define _DSSETUP_NDL_
  28 
  29 /*
  30  * Active Directory Service Setup
  31  *
  32  * Originally this interface contained a number of operations, as listed
  33  * below, but due to a buffer overflow security issue, all operations
  34  * except DsRoleGetPrimaryDomainInfo have been deprecated (MS04-011).
  35  */
  36 
  37 #include "ndrtypes.ndl"
  38 
  39 
  40 #define DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo        0x00
  41 #define DSSETUP_OPNUM_DsRoleDnsNameToFlatName           0x01
  42 #define DSSETUP_OPNUM_DsRoleDcAsDc                      0x02
  43 #define DSSETUP_OPNUM_DsRoleDcAsReplica                 0x03
  44 #define DSSETUP_OPNUM_DsRoleDemoteDc                    0x04
  45 #define DSSETUP_OPNUM_DsRoleGetDcOperationProgress      0x05
  46 #define DSSETUP_OPNUM_DsRoleGetDcOperationResults       0x06
  47 #define DSSETUP_OPNUM_DsRoleCancel                      0x07
  48 #define DSSETUP_OPNUM_DsRoleServerSaveStateForUpgrade   0x08
  49 #define DSSETUP_OPNUM_DsRoleUpgradeDownlevelServer      0x09
  50 #define DSSETUP_OPNUM_DsRoleAbortDownlevelServerUpgrade 0x0a
  51 
  52 /*
  53  * DS roles
  54  */
  55 #define DS_ROLE_STANDALONE_WORKSTATION  0
  56 #define DS_ROLE_MEMBER_WORKSTATION      1
  57 #define DS_ROLE_STANDALONE_SERVER       2
  58 #define DS_ROLE_MEMBER_SERVER           3
  59 #define DS_ROLE_BACKUP_DC               4
  60 #define DS_ROLE_PRIMARY_DC              5
  61 
  62 /*
  63  * DS role flags
  64  */
  65 #define DS_ROLE_PRIMARY_DS_RUNNING              0x00000001
  66 #define DS_ROLE_PRIMARY_DS_MIXED_MODE           0x00000002
  67 #define DS_ROLE_UPGRADE_IN_PROGRESS             0x00000004
  68 #define DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT     0x01000000
  69 
  70 /*
  71  * DS role upgrade
  72  */
  73 #define DS_ROLE_NOT_UPGRADING           0
  74 #define DS_ROLE_UPGRADING               1
  75 
  76 /*
  77  * DS role previous
  78  */
  79 #define DS_ROLE_PREVIOUS_UNKNOWN        0
  80 #define DS_ROLE_PREVIOUS_PRIMARY        1
  81 #define DS_ROLE_PREVIOUS_BACKUP         2
  82 
  83 /*
  84  * DS role state
  85  */
  86 #define DS_ROLE_OP_IDLE                 0
  87 #define DS_ROLE_OP_ACTIVE               1
  88 #define DS_ROLE_OP_NEEDS_REBOOT         2
  89 
  90 /*
  91  * DS role information levels
  92  */
  93 #define DS_ROLE_BASIC_INFORMATION       1
  94 #define DS_ROLE_UPGRADE_STATUS          2
  95 #define DS_ROLE_OP_STATUS               3
  96 
  97 struct dssetup_uuid {
  98         DWORD   data1;
  99         WORD    data2;
 100         WORD    data3;
 101         BYTE    data4[8];
 102 };
 103 typedef struct dssetup_uuid dssetup_uuid_t;
 104 
 105 /*
 106  * DS_ROLE_BASIC_INFORMATION
 107  */
 108 struct dssetup_DsRolePrimaryDomInfo1 {
 109         DWORD role;
 110         DWORD flags;
 111         LPTSTR nt_domain;
 112         LPTSTR dns_domain;
 113         LPTSTR forest;
 114         dssetup_uuid_t domain_guid;
 115 };
 116 typedef struct dssetup_DsRolePrimaryDomInfo1 ds_primary_domain_info_t;
 117 
 118 /*
 119  * DS_ROLE_UPGRADE_STATUS
 120  */
 121 struct dssetup_DsRolePrimaryDomInfo2 {
 122         DWORD upgrade_state;
 123         DWORD previous_role;
 124 };
 125 
 126 /*
 127  * DS_ROLE_OP_STATUS
 128  */
 129 struct dssetup_DsRolePrimaryDomInfo3 {
 130         DWORD status;
 131 };
 132 
 133 union dssetup_GetPrimaryDomainInfo_ru {
 134         UNION_INFO_ENT(1,dssetup_DsRolePrimaryDomInfo);
 135         UNION_INFO_ENT(2,dssetup_DsRolePrimaryDomInfo);
 136         UNION_INFO_ENT(3,dssetup_DsRolePrimaryDomInfo);
 137         DEFAULT char *nullptr;
 138 };
 139 
 140 struct dssetup_GetPrimaryDomainInfo {
 141         WORD switch_value;
 142     SWITCH(switch_value)
 143         union dssetup_GetPrimaryDomainInfo_ru ru;
 144 };
 145 typedef struct dssetup_GetPrimaryDomainInfo dssetup_GetPrimaryDomainInfo_t;
 146 
 147 OPERATION(DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo)
 148 struct dssetup_DsRoleGetPrimaryDomainInfo {
 149         IN      WORD level;
 150         OUT     struct dssetup_GetPrimaryDomainInfo *info;
 151         OUT     DWORD status;
 152 };
 153 typedef struct dssetup_DsRoleGetPrimaryDomainInfo
 154     dssetup_DsRoleGetPrimaryDomainInfo_t;
 155 
 156 
 157 /*
 158  ***********************************************************************
 159  * DSSETUP interface definiton.
 160  ***********************************************************************
 161  */
 162 INTERFACE(0)
 163 union dssetup_interface {
 164         CASE(DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo)
 165                 struct dssetup_DsRoleGetPrimaryDomainInfo GetPrimaryDomainInfo;
 166 };
 167 typedef union dssetup_interface dssetup_interface_t;
 168 EXTERNTYPEINFO(dssetup_interface)
 169 
 170 #endif /* _DSSETUP_NDL_ */