| 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 _S3_DCERPC_H__
|
|---|
| 27 | #define _S3_DCERPC_H__
|
|---|
| 28 |
|
|---|
| 29 | #include "librpc/gen_ndr/dcerpc.h"
|
|---|
| 30 | #include "../librpc/ndr/libndr.h"
|
|---|
| 31 | #include "../librpc/rpc/rpc_common.h"
|
|---|
| 32 |
|
|---|
| 33 | #define SMB_RPC_INTERFACE_VERSION 1
|
|---|
| 34 |
|
|---|
| 35 | struct NL_AUTH_MESSAGE;
|
|---|
| 36 |
|
|---|
| 37 | /* auth state for all bind types. */
|
|---|
| 38 |
|
|---|
| 39 | struct pipe_auth_data {
|
|---|
| 40 | enum dcerpc_AuthType auth_type;
|
|---|
| 41 | enum dcerpc_AuthLevel auth_level;
|
|---|
| 42 |
|
|---|
| 43 | void *auth_ctx;
|
|---|
| 44 |
|
|---|
| 45 | /* Only the client code uses these 3 for now */
|
|---|
| 46 | char *domain;
|
|---|
| 47 | char *user_name;
|
|---|
| 48 | DATA_BLOB user_session_key;
|
|---|
| 49 | };
|
|---|
| 50 |
|
|---|
| 51 | /* The following definitions come from librpc/rpc/dcerpc_helpers.c */
|
|---|
| 52 | NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
|
|---|
| 53 | enum dcerpc_pkt_type ptype,
|
|---|
| 54 | uint8_t pfc_flags,
|
|---|
| 55 | uint16_t auth_length,
|
|---|
| 56 | uint32_t call_id,
|
|---|
| 57 | union dcerpc_payload *u,
|
|---|
| 58 | DATA_BLOB *blob);
|
|---|
| 59 | NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
|
|---|
| 60 | const DATA_BLOB *blob,
|
|---|
| 61 | struct ncacn_packet *r,
|
|---|
| 62 | bool bigendian);
|
|---|
| 63 | NTSTATUS dcerpc_push_schannel_bind(TALLOC_CTX *mem_ctx,
|
|---|
| 64 | struct NL_AUTH_MESSAGE *r,
|
|---|
| 65 | DATA_BLOB *blob);
|
|---|
| 66 | NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
|
|---|
| 67 | enum dcerpc_AuthType auth_type,
|
|---|
| 68 | enum dcerpc_AuthLevel auth_level,
|
|---|
| 69 | uint8_t auth_pad_length,
|
|---|
| 70 | uint32_t auth_context_id,
|
|---|
| 71 | const DATA_BLOB *credentials,
|
|---|
| 72 | DATA_BLOB *blob);
|
|---|
| 73 | NTSTATUS dcerpc_pull_dcerpc_auth(TALLOC_CTX *mem_ctx,
|
|---|
| 74 | const DATA_BLOB *blob,
|
|---|
| 75 | struct dcerpc_auth *r,
|
|---|
| 76 | bool bigendian);
|
|---|
| 77 | NTSTATUS dcerpc_guess_sizes(struct pipe_auth_data *auth,
|
|---|
| 78 | size_t header_len, size_t data_left,
|
|---|
| 79 | size_t max_xmit_frag, size_t pad_alignment,
|
|---|
| 80 | size_t *data_to_send, size_t *frag_len,
|
|---|
| 81 | size_t *auth_len, size_t *pad_len);
|
|---|
| 82 | NTSTATUS dcerpc_add_auth_footer(struct pipe_auth_data *auth,
|
|---|
| 83 | size_t pad_len, DATA_BLOB *rpc_out);
|
|---|
| 84 | NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
|
|---|
| 85 | struct ncacn_packet *pkt,
|
|---|
| 86 | DATA_BLOB *pkt_trailer,
|
|---|
| 87 | size_t header_size,
|
|---|
| 88 | DATA_BLOB *raw_pkt,
|
|---|
| 89 | size_t *pad_len);
|
|---|
| 90 |
|
|---|
| 91 | /* The following definitions come from librpc/rpc/rpc_common.c */
|
|---|
| 92 |
|
|---|
| 93 | bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
|
|---|
| 94 | const struct ndr_interface_table *get_iface_from_syntax(
|
|---|
| 95 | const struct ndr_syntax_id *syntax);
|
|---|
| 96 | const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
|
|---|
| 97 | const struct ndr_syntax_id *syntax);
|
|---|
| 98 |
|
|---|
| 99 | #endif /* __S3_DCERPC_H__ */
|
|---|