2004-08-25 13:22:47 +04:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Stefan Metzmacher 2004
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 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2004-08-25 13:22:47 +04: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 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2004-08-25 13:22:47 +04:00
*/
2005-07-02 18:28:15 +04:00
2006-07-13 02:10:17 +04:00
# include "librpc/rpc/dcerpc.h"
2005-07-02 18:28:15 +04:00
/*
2023-08-03 15:36:50 +03:00
* struct definition for connecting to a dcerpc interface
2005-07-02 18:28:15 +04:00
*/
enum libnet_RpcConnect_level {
2006-10-13 17:01:48 +04:00
LIBNET_RPC_CONNECT_SERVER , /* connect to a standalone rpc server */
LIBNET_RPC_CONNECT_SERVER_ADDRESS , /* connect to a standalone rpc server,
knowing both name and address */
LIBNET_RPC_CONNECT_PDC , /* connect to a domain pdc (resolves domain
name to a pdc address before connecting ) */
LIBNET_RPC_CONNECT_DC , /* connect to any DC (resolves domain
name to a DC address before connecting ) */
LIBNET_RPC_CONNECT_BINDING , /* specified binding string */
LIBNET_RPC_CONNECT_DC_INFO /* connect to a DC and provide basic domain
information ( name , realm , sid , guid ) */
2005-07-02 18:28:15 +04:00
} ;
struct libnet_RpcConnect {
enum libnet_RpcConnect_level level ;
struct {
r12858: This moves the libnet_LookupPdc code to use a GetDC request to find
the remote server's name, or in the absence of a local nbt_server to
communicate with (or without root access), a node status request.
The result is that we are in a better position to use kerberos, as well
as to remove the 'password server' mandatory parameter for the samsync
and samdump commands. (I need this to put these into SWAT).
The only problem I have is that I must create a messaging context, which
requires a server ID. As a client process, I don't expect to get
messages, but it is currently required for replies, so I generate a
random() number. We probably need the servers to accept connections on
streamed sockets too, for client-only tasks that want IRPC.
Because I wanted to test this code, I have put the NET-API-* tests into
our test scripts, to ensure they pass and keep passing. They are good
frontends onto the libnet system, and I see no reason not to test them.
In doing so the NET-API-RPCCONNECT test was simplified to take a
binding string on the command line, removing duplicate code, and
testing the combinations in the scripts instead.
(I have done a bit of work on the list shares code in libnet_share.c
to make it pass 'make test')
In the future, I would like to extend the libcli/findds.c code (based
off volker's winbind/wb_async_helpers.c, which is why it shows up a bit
odd in the patch) to handle getting multiple name replies, sending a
getdc request to each in turn.
(posted to samba-technical for review, and I'll happily update with
any comments)
Andrew Bartlett
(This used to be commit 7ccddfd3515fc2c0d6f447c768ccbf7a220c3380)
2006-01-12 06:02:00 +03:00
const char * name ;
2006-10-13 17:01:48 +04:00
const char * address ;
2005-09-25 16:26:07 +04:00
const char * binding ;
2007-08-20 00:46:45 +04:00
const struct ndr_interface_table * dcerpc_iface ;
2009-06-18 06:33:46 +04:00
int dcerpc_flags ;
2005-07-02 18:28:15 +04:00
} in ;
struct {
struct dcerpc_pipe * dcerpc_pipe ;
2006-05-04 18:52:03 +04:00
/* parameters provided in LIBNET_RPC_CONNECT_DC_INFO level, null otherwise */
const char * domain_name ;
struct dom_sid * domain_sid ;
2006-05-07 17:12:12 +04:00
const char * realm ; /* these parameters are only present if */
struct GUID * guid ; /* the remote server is known to be AD */
2006-01-14 04:29:38 +03:00
2006-01-13 15:52:56 +03:00
const char * error_string ;
} out ;
} ;
2006-07-13 02:10:17 +04:00
/*
* Monitor messages sent from libnet_rpc . c functions
*/
2007-07-19 01:24:37 +04:00
struct msg_net_rpc_connect {
2006-07-13 02:10:17 +04:00
const char * host ;
2007-07-19 01:24:37 +04:00
const char * domain_name ;
2006-07-13 02:10:17 +04:00
const char * endpoint ;
enum dcerpc_transport_t transport ;
} ;