2 Unix SMB/Netbios implementation.
4 RPC pipe client utility functions
5 Copyright (C) Tim Potter 2001,
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* Opens a SMB connection to a named pipe */
26 struct cli_state
*cli_pipe_initialise(struct cli_state
*cli
, char *system_name
,
28 struct ntuser_creds
*creds
)
30 struct in_addr dest_ip
;
31 struct nmb_name calling
, called
;
33 extern pstring global_myname
;
34 struct ntuser_creds anon
;
36 /* Initialise cli_state information */
38 if (!cli_initialise(cli
)) {
44 anon
.pwd
.null_pwd
= 1;
48 cli_init_creds(cli
, creds
);
50 /* Establish a SMB connection */
52 if (!resolve_srv_name(system_name
, dest_host
, &dest_ip
)) {
56 make_nmb_name(&called
, dns_to_netbios_name(dest_host
), 0x20);
57 make_nmb_name(&calling
, dns_to_netbios_name(global_myname
), 0);
59 if (!cli_establish_connection(cli
, dest_host
, &dest_ip
, &calling
,
60 &called
, "IPC$", "IPC", False
, True
)) {
64 /* Open a NT session thingy */
66 if (!cli_nt_session_open(cli
, pipe_name
)) {
74 /* Shut down a SMB connection to the SAMR pipe */
76 void cli_pipe_shutdown(struct cli_state
*cli
)
78 if (cli
->fd
!= -1) cli_ulogoff(cli
);