| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 |
|
|---|
| 4 | DCERPC client side interface structures
|
|---|
| 5 |
|
|---|
| 6 | Copyright (C) 2008 Jelmer Vernooij
|
|---|
| 7 |
|
|---|
| 8 | This program is free software; you can redistribute it and/or modify
|
|---|
| 9 | it under the terms of the GNU General Public License as published by
|
|---|
| 10 | the Free Software Foundation; either version 3 of the License, or
|
|---|
| 11 | (at your option) any later version.
|
|---|
| 12 |
|
|---|
| 13 | This program is distributed in the hope that it will be useful,
|
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | GNU General Public License for more details.
|
|---|
| 17 |
|
|---|
| 18 | You should have received a copy of the GNU General Public License
|
|---|
| 19 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | /* This is a public header file that is installed as part of Samba.
|
|---|
| 23 | * If you remove any functions or change their signature, update
|
|---|
| 24 | * the so version number. */
|
|---|
| 25 |
|
|---|
| 26 | #ifndef __DCERPC_H__
|
|---|
| 27 | #define __DCERPC_H__
|
|---|
| 28 |
|
|---|
| 29 | #include "includes.h"
|
|---|
| 30 | #include "librpc/rpc/dcerpc.h"
|
|---|
| 31 | #include "librpc/gen_ndr/epmapper.h"
|
|---|
| 32 |
|
|---|
| 33 | struct loadparm_context;
|
|---|
| 34 | struct cli_credentials;
|
|---|
| 35 |
|
|---|
| 36 | /**
|
|---|
| 37 | * Connection to a particular DCE/RPC interface.
|
|---|
| 38 | */
|
|---|
| 39 | struct dcerpc_pipe {
|
|---|
| 40 | const struct ndr_interface_table *table;
|
|---|
| 41 |
|
|---|
| 42 | /** SMB context used when transport is ncacn_np. */
|
|---|
| 43 | struct cli_state *cli;
|
|---|
| 44 |
|
|---|
| 45 | /** Samba 3 DCE/RPC client context. */
|
|---|
| 46 | struct rpc_pipe_client *rpc_cli;
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | struct rpc_request {
|
|---|
| 50 | const struct ndr_interface_call *call;
|
|---|
| 51 | prs_struct q_ps;
|
|---|
| 52 | uint32_t opnum;
|
|---|
| 53 | struct dcerpc_pipe *pipe;
|
|---|
| 54 | void *r;
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | enum dcerpc_transport_t {
|
|---|
| 58 | NCA_UNKNOWN, NCACN_NP, NCACN_IP_TCP, NCACN_IP_UDP, NCACN_VNS_IPC,
|
|---|
| 59 | NCACN_VNS_SPP, NCACN_AT_DSP, NCADG_AT_DDP, NCALRPC, NCACN_UNIX_STREAM,
|
|---|
| 60 | NCADG_UNIX_DGRAM, NCACN_HTTP, NCADG_IPX, NCACN_SPX, NCACN_INTERNAL };
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 | /** this describes a binding to a particular transport/pipe */
|
|---|
| 64 | struct dcerpc_binding {
|
|---|
| 65 | enum dcerpc_transport_t transport;
|
|---|
| 66 | struct ndr_syntax_id object;
|
|---|
| 67 | const char *host;
|
|---|
| 68 | const char *target_hostname;
|
|---|
| 69 | const char *endpoint;
|
|---|
| 70 | const char **options;
|
|---|
| 71 | uint32_t flags;
|
|---|
| 72 | uint32_t assoc_group_id;
|
|---|
| 73 | };
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | /* dcerpc pipe flags */
|
|---|
| 77 | #define DCERPC_DEBUG_PRINT_IN (1<<0)
|
|---|
| 78 | #define DCERPC_DEBUG_PRINT_OUT (1<<1)
|
|---|
| 79 | #define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
|
|---|
| 80 |
|
|---|
| 81 | #define DCERPC_DEBUG_VALIDATE_IN (1<<2)
|
|---|
| 82 | #define DCERPC_DEBUG_VALIDATE_OUT (1<<3)
|
|---|
| 83 | #define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
|
|---|
| 84 |
|
|---|
| 85 | #define DCERPC_CONNECT (1<<4)
|
|---|
| 86 | #define DCERPC_SIGN (1<<5)
|
|---|
| 87 | #define DCERPC_SEAL (1<<6)
|
|---|
| 88 |
|
|---|
| 89 | #define DCERPC_PUSH_BIGENDIAN (1<<7)
|
|---|
| 90 | #define DCERPC_PULL_BIGENDIAN (1<<8)
|
|---|
| 91 |
|
|---|
| 92 | #define DCERPC_SCHANNEL (1<<9)
|
|---|
| 93 |
|
|---|
| 94 | /* use a 128 bit session key */
|
|---|
| 95 | #define DCERPC_SCHANNEL_128 (1<<12)
|
|---|
| 96 |
|
|---|
| 97 | /* check incoming pad bytes */
|
|---|
| 98 | #define DCERPC_DEBUG_PAD_CHECK (1<<13)
|
|---|
| 99 |
|
|---|
| 100 | /* set LIBNDR_FLAG_REF_ALLOC flag when decoding NDR */
|
|---|
| 101 | #define DCERPC_NDR_REF_ALLOC (1<<14)
|
|---|
| 102 |
|
|---|
| 103 | #define DCERPC_AUTH_OPTIONS (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL|DCERPC_AUTH_SPNEGO|DCERPC_AUTH_KRB5|DCERPC_AUTH_NTLM)
|
|---|
| 104 |
|
|---|
| 105 | /* select spnego auth */
|
|---|
| 106 | #define DCERPC_AUTH_SPNEGO (1<<15)
|
|---|
| 107 |
|
|---|
| 108 | /* select krb5 auth */
|
|---|
| 109 | #define DCERPC_AUTH_KRB5 (1<<16)
|
|---|
| 110 |
|
|---|
| 111 | #define DCERPC_SMB2 (1<<17)
|
|---|
| 112 |
|
|---|
| 113 | /* select NTLM auth */
|
|---|
| 114 | #define DCERPC_AUTH_NTLM (1<<18)
|
|---|
| 115 |
|
|---|
| 116 | /* this triggers the DCERPC_PFC_FLAG_CONC_MPX flag in the bind request */
|
|---|
| 117 | #define DCERPC_CONCURRENT_MULTIPLEX (1<<19)
|
|---|
| 118 |
|
|---|
| 119 | /* this triggers the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag in the bind request */
|
|---|
| 120 | #define DCERPC_HEADER_SIGNING (1<<20)
|
|---|
| 121 |
|
|---|
| 122 | /* use NDR64 transport */
|
|---|
| 123 | #define DCERPC_NDR64 (1<<21)
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 | #endif /* __DCERPC_H__ */
|
|---|