2003-11-03 06:22:45 +00:00
/*
Unix SMB / CIFS implementation .
2005-01-09 08:34:05 +00:00
DCERPC client side interface structures
2003-11-03 06:22:45 +00:00
Copyright ( C ) Tim Potter 2003
2005-01-09 08:34:05 +00:00
Copyright ( C ) Andrew Tridgell 2003 - 2005
2003-11-03 06:22:45 +00:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2003-11-03 06:22:45 +00:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-11-03 06:22:45 +00:00
*/
2008-04-01 16:18:31 +02:00
/* This is a public header file that is installed as part of Samba.
* If you remove any functions or change their signature , update
* the so version number . */
2011-03-13 14:05:19 +01:00
# ifndef __S4_DCERPC_H__
# define __S4_DCERPC_H__
2006-01-03 13:41:17 +00:00
2008-10-11 21:05:38 +02:00
# include "../lib/util/data_blob.h"
2006-03-14 00:37:05 +00:00
# include "librpc/gen_ndr/dcerpc.h"
2008-10-31 16:15:08 +01:00
# include "../librpc/ndr/libndr.h"
2011-03-13 14:05:19 +01:00
# include "../librpc/rpc/rpc_common.h"
2006-03-14 00:37:05 +00:00
2010-03-08 12:29:52 +01:00
struct tevent_context ;
struct tevent_req ;
struct dcerpc_binding_handle ;
2010-08-12 15:49:32 +02:00
struct tstream_context ;
2013-12-04 14:28:11 +01:00
struct ndr_interface_table ;
2014-01-23 09:48:53 +01:00
struct resolve_context ;
2010-03-08 12:29:52 +01:00
2004-02-10 10:22:12 +00:00
/*
this defines a generic security context for signed / sealed dcerpc pipes .
2003-11-03 06:22:45 +00:00
*/
2011-03-11 08:27:00 +01:00
struct dcecli_connection ;
2008-11-02 02:05:48 +01:00
struct gensec_settings ;
2013-12-04 14:28:11 +01:00
struct cli_credentials ;
2011-03-13 13:49:41 +01:00
struct dcecli_security {
2004-06-07 12:30:22 +00:00
struct dcerpc_auth * auth_info ;
r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.
This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal). This causes
changes in all the existing gensec users.
Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.
Gensec has also taken over the role of auth/auth_ntlmssp.c
An important part of gensec, is the output of the 'session_info'
struct. This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.
The schannel code is reworked, to be in the same file for client and
server.
ntlm_auth is reworked to use gensec.
The major problem with this code is the way it relies on subsystem
auto-initialisation. The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.
There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.
Andrew Bartlett
(This used to be commit 07fd885fd488fd1051eacc905a2d4962f8a018ec)
2004-06-29 09:40:10 +00:00
struct gensec_security * generic_state ;
2004-09-11 15:11:36 +00:00
/* get the session key */
2011-03-11 08:27:00 +01:00
NTSTATUS ( * session_key ) ( struct dcecli_connection * , DATA_BLOB * ) ;
2004-02-10 10:22:12 +00:00
} ;
2004-01-20 06:07:09 +00:00
2005-01-09 08:34:05 +00:00
/*
this holds the information that is not specific to a particular rpc context_id
*/
2011-03-13 16:24:55 +01:00
struct rpc_request ;
2011-03-11 08:27:00 +01:00
struct dcecli_connection {
2004-05-25 16:24:13 +00:00
uint32_t call_id ;
uint32_t srv_max_xmit_frag ;
uint32_t srv_max_recv_frag ;
2006-01-03 13:41:17 +00:00
uint32_t flags ;
2011-03-13 13:49:41 +01:00
struct dcecli_security security_state ;
2004-01-20 06:07:09 +00:00
const char * binding_string ;
2008-12-29 20:24:57 +01:00
struct tevent_context * event_ctx ;
2004-07-09 12:26:34 +00:00
2012-03-14 14:57:32 +01:00
struct tevent_immediate * io_trigger ;
bool io_trigger_pending ;
2008-11-02 00:26:04 +01:00
/** Directory in which to save ndrdump-parseable files */
const char * packet_log_dir ;
2007-04-22 23:00:22 +00:00
bool dead ;
bool free_skipped ;
2003-11-24 11:45:33 +00:00
struct dcerpc_transport {
2004-01-20 06:07:09 +00:00
enum dcerpc_transport_t transport ;
2007-05-16 14:52:54 +00:00
void * private_data ;
2004-08-30 03:10:43 +00:00
2013-09-24 12:32:50 +02:00
struct tstream_context * stream ;
/** to serialize write events */
struct tevent_queue * write_queue ;
/** the current active read request if any */
struct tevent_req * read_subreq ;
/** number of read requests other than the current active */
uint32_t pending_reads ;
2003-11-24 11:45:33 +00:00
} transport ;
2003-11-27 04:02:15 +00:00
2013-09-23 13:54:38 +02:00
const char * server_name ;
2005-11-02 05:34:17 +00:00
/* Requests that have been sent, waiting for a reply */
2004-08-30 03:10:43 +00:00
struct rpc_request * pending ;
2005-11-02 05:34:17 +00:00
/* Sync requests waiting to be shipped */
struct rpc_request * request_queue ;
2005-01-09 11:32:12 +00:00
/* the next context_id to be assigned */
uint32_t next_context_id ;
2003-11-03 06:22:45 +00:00
} ;
2005-01-09 08:34:05 +00:00
/*
this encapsulates a full dcerpc client side pipe
*/
struct dcerpc_pipe {
2010-08-05 18:14:04 +02:00
struct dcerpc_binding_handle * binding_handle ;
2005-01-09 08:34:05 +00:00
uint32_t context_id ;
2007-08-18 06:57:49 +00:00
struct ndr_syntax_id syntax ;
struct ndr_syntax_id transfer_syntax ;
2005-01-09 08:34:05 +00:00
2011-03-11 08:27:00 +01:00
struct dcecli_connection * conn ;
2006-01-12 09:33:49 +00:00
struct dcerpc_binding * binding ;
2005-01-09 08:34:05 +00:00
2008-11-02 00:26:04 +01:00
/** the last fault code from a DCERPC fault */
2005-01-09 08:34:05 +00:00
uint32_t last_fault_code ;
2005-06-12 02:42:40 +00:00
2008-11-02 00:26:04 +01:00
/** timeout for individual rpc requests, in seconds */
2006-01-03 13:41:17 +00:00
uint32_t request_timeout ;
2012-07-09 14:37:28 +10:00
/*
* Set for the timeout in dcerpc_pipe_connect_b_send ( ) , to
* allow the timeout not to destory the stack during a nested
* event loop caused by gensec_update ( )
*/
bool inhibit_timeout_processing ;
bool timed_out ;
2005-01-09 08:34:05 +00:00
} ;
2005-06-12 02:42:40 +00:00
/* default timeout for all rpc requests, in seconds */
# define DCERPC_REQUEST_TIMEOUT 60
2006-01-03 17:27:33 +00:00
struct epm_tower ;
struct epm_floor ;
2006-03-14 15:22:36 +00:00
struct smbcli_tree ;
struct smb2_tree ;
2013-09-19 18:16:16 +02:00
struct smbXcli_conn ;
struct smbXcli_session ;
struct smbXcli_tcon ;
2006-03-14 15:22:36 +00:00
struct socket_address ;
2008-04-02 04:53:27 +02:00
NTSTATUS dcerpc_pipe_connect ( TALLOC_CTX * parent_ctx ,
struct dcerpc_pipe * * pp ,
const char * binding ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
2008-12-29 20:24:57 +01:00
struct tevent_context * ev ,
2008-04-02 04:53:27 +02:00
struct loadparm_context * lp_ctx ) ;
const char * dcerpc_server_name ( struct dcerpc_pipe * p ) ;
2010-05-09 17:20:01 +02:00
struct dcerpc_pipe * dcerpc_pipe_init ( TALLOC_CTX * mem_ctx , struct tevent_context * ev ) ;
2008-04-02 04:53:27 +02:00
NTSTATUS dcerpc_pipe_open_smb ( struct dcerpc_pipe * p ,
struct smbcli_tree * tree ,
const char * pipe_name ) ;
2013-09-19 18:50:27 +02:00
NTSTATUS dcerpc_pipe_open_smb2 ( struct dcerpc_pipe * p ,
struct smb2_tree * tree ,
const char * pipe_name ) ;
2008-04-02 04:53:27 +02:00
NTSTATUS dcerpc_bind_auth_none ( struct dcerpc_pipe * p ,
const struct ndr_interface_table * table ) ;
NTSTATUS dcerpc_fetch_session_key ( struct dcerpc_pipe * p ,
DATA_BLOB * session_key ) ;
struct composite_context ;
NTSTATUS dcerpc_secondary_connection_recv ( struct composite_context * c ,
struct dcerpc_pipe * * p2 ) ;
struct composite_context * dcerpc_pipe_connect_b_send ( TALLOC_CTX * parent_ctx ,
2014-02-12 12:11:51 +01:00
const struct dcerpc_binding * binding ,
2008-04-02 04:53:27 +02:00
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
2008-12-29 20:24:57 +01:00
struct tevent_context * ev ,
2008-04-02 04:53:27 +02:00
struct loadparm_context * lp_ctx ) ;
NTSTATUS dcerpc_pipe_connect_b_recv ( struct composite_context * c , TALLOC_CTX * mem_ctx ,
struct dcerpc_pipe * * p ) ;
NTSTATUS dcerpc_pipe_connect_b ( TALLOC_CTX * parent_ctx ,
struct dcerpc_pipe * * pp ,
2014-02-12 12:11:51 +01:00
const struct dcerpc_binding * binding ,
2008-04-02 04:53:27 +02:00
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
2008-12-29 20:24:57 +01:00
struct tevent_context * ev ,
2008-04-02 04:53:27 +02:00
struct loadparm_context * lp_ctx ) ;
NTSTATUS dcerpc_pipe_auth ( TALLOC_CTX * mem_ctx ,
struct dcerpc_pipe * * p ,
struct dcerpc_binding * binding ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
struct loadparm_context * lp_ctx ) ;
NTSTATUS dcerpc_secondary_connection ( struct dcerpc_pipe * p ,
struct dcerpc_pipe * * p2 ,
struct dcerpc_binding * b ) ;
NTSTATUS dcerpc_bind_auth_schannel ( TALLOC_CTX * tmp_ctx ,
struct dcerpc_pipe * p ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
struct loadparm_context * lp_ctx ,
uint8_t auth_level ) ;
2011-06-06 14:58:28 +10:00
NTSTATUS dcerpc_init ( void ) ;
2013-09-17 07:16:29 +02:00
struct composite_context * dcerpc_secondary_smb_send ( struct dcecli_connection * c1 ,
2013-09-19 18:36:19 +02:00
struct dcecli_connection * c2 ,
2013-09-17 07:16:29 +02:00
const char * pipe_name ) ;
NTSTATUS dcerpc_secondary_smb_recv ( struct composite_context * c ) ;
2008-04-02 04:53:27 +02:00
NTSTATUS dcerpc_secondary_context ( struct dcerpc_pipe * p ,
struct dcerpc_pipe * * pp2 ,
const struct ndr_interface_table * table ) ;
NTSTATUS dcerpc_alter_context ( struct dcerpc_pipe * p ,
TALLOC_CTX * mem_ctx ,
const struct ndr_syntax_id * syntax ,
const struct ndr_syntax_id * transfer_syntax ) ;
NTSTATUS dcerpc_bind_auth ( struct dcerpc_pipe * p ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
2008-11-02 02:05:48 +01:00
struct gensec_settings * gensec_settings ,
2008-04-02 04:53:27 +02:00
uint8_t auth_type , uint8_t auth_level ,
const char * service ) ;
struct composite_context * dcerpc_pipe_connect_send ( TALLOC_CTX * parent_ctx ,
const char * binding ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
2008-12-29 20:24:57 +01:00
struct tevent_context * ev , struct loadparm_context * lp_ctx ) ;
2008-04-02 04:53:27 +02:00
NTSTATUS dcerpc_pipe_connect_recv ( struct composite_context * c ,
TALLOC_CTX * mem_ctx ,
struct dcerpc_pipe * * pp ) ;
NTSTATUS dcerpc_epm_map_binding ( TALLOC_CTX * mem_ctx , struct dcerpc_binding * binding ,
2008-12-29 20:24:57 +01:00
const struct ndr_interface_table * table , struct tevent_context * ev ,
2008-04-02 04:53:27 +02:00
struct loadparm_context * lp_ctx ) ;
struct composite_context * dcerpc_secondary_auth_connection_send ( struct dcerpc_pipe * p ,
struct dcerpc_binding * binding ,
const struct ndr_interface_table * table ,
struct cli_credentials * credentials ,
struct loadparm_context * lp_ctx ) ;
NTSTATUS dcerpc_secondary_auth_connection_recv ( struct composite_context * c ,
TALLOC_CTX * mem_ctx ,
struct dcerpc_pipe * * p ) ;
struct composite_context * dcerpc_secondary_connection_send ( struct dcerpc_pipe * p ,
struct dcerpc_binding * b ) ;
2008-11-02 00:26:04 +01:00
void dcerpc_log_packet ( const char * lockdir ,
2010-08-10 15:11:02 +02:00
const struct ndr_interface_table * ndr ,
uint32_t opnum , uint32_t flags ,
const DATA_BLOB * pkt ) ;
2008-04-02 04:53:27 +02:00
2011-03-13 14:05:19 +01:00
# endif /* __S4_DCERPC_H__ */