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