00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _DCE_RPC_H
00024 #define _DCE_RPC_H
00025
00026
00027
00028 enum RPC_PKT_TYPE {
00029 RPC_REQUEST = 0x00,
00030 RPC_PING = 0x01,
00031 RPC_RESPONSE = 0x02,
00032 RPC_FAULT = 0x03,
00033 RPC_WORKING = 0x04,
00034 RPC_NOCALL = 0x05,
00035 RPC_REJECT = 0x06,
00036 RPC_ACK = 0x07,
00037 RPC_CL_CANCEL= 0x08,
00038 RPC_FACK = 0x09,
00039 RPC_CANCEL_ACK = 0x0A,
00040 RPC_BIND = 0x0B,
00041 RPC_BINDACK = 0x0C,
00042 RPC_BINDNACK = 0x0D,
00043 RPC_ALTCONT = 0x0E,
00044 RPC_ALTCONTRESP = 0x0F,
00045 RPC_AUTH3 = 0x10,
00046 RPC_SHUTDOWN = 0x11,
00047 RPC_CO_CANCEL= 0x12,
00048 RPC_ORPHANED = 0x13
00049
00050 };
00051
00052
00053 #define RPC_FLG_FIRST 0x01
00054 #define RPC_FLG_LAST 0x02
00055 #define RPC_FLG_NOCALL 0x20
00056
00057
00058 #define SMBD_NTLMSSP_NEG_FLAGS 0x000082b1
00059
00060
00061 #define NTLMSSP_SIGN_VERSION 0x01
00062
00063
00064 #define RPC_ANONYMOUS_AUTH_TYPE 0
00065 #define RPC_AUTH_TYPE_KRB5_1 1
00066 #define RPC_SPNEGO_AUTH_TYPE 9
00067 #define RPC_NTLMSSP_AUTH_TYPE 10
00068 #define RPC_KRB5_AUTH_TYPE 16
00069 #define RPC_SCHANNEL_AUTH_TYPE 68
00070
00071
00072
00073 #define RPC_AUTH_LEVEL_NONE 1
00074 #define RPC_AUTH_LEVEL_CONNECT 2
00075 #define RPC_AUTH_LEVEL_CALL 3
00076 #define RPC_AUTH_LEVEL_PACKET 4
00077 #define RPC_AUTH_LEVEL_INTEGRITY 5
00078 #define RPC_AUTH_LEVEL_PRIVACY 6
00079
00080 #if 0
00081 #define RPC_PIPE_AUTH_SIGN_LEVEL 0x5
00082 #define RPC_PIPE_AUTH_SEAL_LEVEL 0x6
00083 #endif
00084
00085 #define DCERPC_FAULT_OP_RNG_ERROR 0x1c010002
00086 #define DCERPC_FAULT_UNK_IF 0x1c010003
00087 #define DCERPC_FAULT_INVALID_TAG 0x1c000006
00088 #define DCERPC_FAULT_CONTEXT_MISMATCH 0x1c00001a
00089 #define DCERPC_FAULT_OTHER 0x00000001
00090 #define DCERPC_FAULT_ACCESS_DENIED 0x00000005
00091 #define DCERPC_FAULT_CANT_PERFORM 0x000006d8
00092 #define DCERPC_FAULT_NDR 0x000006f7
00093
00094
00095
00096 #define SCHANNEL_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }
00097 #define SCHANNEL_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 }
00098
00099 #define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 0x20
00100 #define RPC_AUTH_SCHANNEL_SIGN_ONLY_CHK_LEN 0x18
00101
00102
00103 #define NETLOGON_NEG_ARCFOUR 0x00000004
00104 #define NETLOGON_NEG_128BIT 0x00004000
00105 #define NETLOGON_NEG_SCHANNEL 0x40000000
00106
00107 #define NETLOGON_NEG_PASSWORD_SET2 0x00020000
00108
00109
00110
00111 #define NETLOGON_NEG_AUTH2_FLAGS 0x000701ff
00112 #define NETLOGON_NEG_DOMAIN_TRUST_ACCOUNT 0x2010b000
00113
00114
00115 #define NETLOGON_NEG_AUTH2_ADS_FLAGS 0x600fffff
00116
00117 enum schannel_direction {
00118 SENDER_IS_INITIATOR,
00119 SENDER_IS_ACCEPTOR
00120 };
00121
00122
00123 #define RPC_MAX_SIGN_SIZE 0x20
00124
00125
00126
00127 #define RPC_MAX_PDU_FRAG_LEN 0x10b8
00128
00129
00130 typedef struct rpc_iface_info {
00131 struct GUID uuid;
00132 uint32 version;
00133 } RPC_IFACE;
00134
00135 #define RPC_IFACE_LEN (UUID_SIZE + 4)
00136
00137 struct pipe_id_info {
00138
00139
00140 const char *client_pipe;
00141 RPC_IFACE abstr_syntax;
00142
00143 const char *server_pipe;
00144 RPC_IFACE trans_syntax;
00145 };
00146
00147
00148 typedef struct rpc_hdr_info {
00149 uint8 major;
00150 uint8 minor;
00151 uint8 pkt_type;
00152 uint8 flags;
00153 uint8 pack_type[4];
00154 uint16 frag_len;
00155 uint16 auth_len;
00156 uint32 call_id;
00157 } RPC_HDR;
00158
00159 #define RPC_HEADER_LEN 16
00160
00161
00162 typedef struct rpc_hdr_req_info {
00163 uint32 alloc_hint;
00164 uint16 context_id;
00165 uint16 opnum;
00166 } RPC_HDR_REQ;
00167
00168 #define RPC_HDR_REQ_LEN 8
00169
00170
00171 typedef struct rpc_hdr_resp_info {
00172 uint32 alloc_hint;
00173 uint16 context_id;
00174 uint8 cancel_count;
00175 uint8 reserved;
00176 } RPC_HDR_RESP;
00177
00178 #define RPC_HDR_RESP_LEN 8
00179
00180
00181 typedef struct rpc_hdr_fault_info {
00182 NTSTATUS status;
00183 uint32 reserved;
00184 } RPC_HDR_FAULT;
00185
00186 #define RPC_HDR_FAULT_LEN 8
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 typedef struct rpc_addr_info {
00197 uint16 len;
00198 fstring str;
00199 } RPC_ADDR_STR;
00200
00201
00202 typedef struct rpc_hdr_bba_info {
00203 uint16 max_tsize;
00204 uint16 max_rsize;
00205 uint32 assoc_gid;
00206 } RPC_HDR_BBA;
00207
00208 #define RPC_HDR_BBA_LEN 8
00209
00210
00211 typedef struct rpc_hdr_auth_info {
00212 uint8 auth_type;
00213 uint8 auth_level;
00214 uint8 auth_pad_len;
00215 uint8 auth_reserved;
00216 uint32 auth_context_id;
00217 } RPC_HDR_AUTH;
00218
00219 #define RPC_HDR_AUTH_LEN 8
00220
00221
00222
00223
00224 typedef struct rpc_auth_schannel_neg_info {
00225 uint32 type1;
00226 uint32 type2;
00227 fstring domain;
00228 fstring myname;
00229 } RPC_AUTH_SCHANNEL_NEG;
00230
00231
00232
00233 typedef struct rpc_auth_schannel_chk_info {
00234 uint8 sig [8];
00235 uint8 packet_digest[8];
00236 uint8 seq_num[8];
00237 uint8 confounder[8];
00238 } RPC_AUTH_SCHANNEL_CHK;
00239
00240 typedef struct rpc_context {
00241 uint16 context_id;
00242 uint8 num_transfer_syntaxes;
00243 RPC_IFACE abstract;
00244 RPC_IFACE *transfer;
00245 } RPC_CONTEXT;
00246
00247
00248 typedef struct rpc_bind_req_info {
00249 RPC_HDR_BBA bba;
00250 uint8 num_contexts;
00251 RPC_CONTEXT *rpc_context;
00252 } RPC_HDR_RB;
00253
00254
00255
00256
00257
00258
00259
00260
00261 #define RPC_HDR_RB_LEN(rpc_hdr_rb) (RPC_HDR_BBA_LEN + 4 + \
00262 ((rpc_hdr_rb)->num_contexts) * (4 + RPC_IFACE_LEN + (((rpc_hdr_rb)->rpc_context->num_transfer_syntaxes)*RPC_IFACE_LEN)))
00263
00264
00265 typedef struct rpc_results_info {
00266
00267
00268 uint8 num_results;
00269
00270
00271
00272 uint16 result;
00273 uint16 reason;
00274 } RPC_RESULTS;
00275
00276
00277 typedef struct rpc_hdr_ba_info {
00278 RPC_HDR_BBA bba;
00279
00280 RPC_ADDR_STR addr ;
00281 RPC_RESULTS res ;
00282 RPC_IFACE transfer;
00283 } RPC_HDR_BA;
00284
00285
00286 typedef struct rpc_auth_verif_info {
00287 fstring signature;
00288 uint32 msg_type;
00289 } RPC_AUTH_VERIFIER;
00290
00291 #endif