removed two unneeded files after Richard backed out these changes.
[Samba.git] / source / libsmb / cli_srvsvc.c
blob9d33149540bba50fc9f9e136e7a2dbd9c6efea99
1 /*
2 Unix SMB/CIFS implementation.
3 NT Domain Authentication SMB / MSRPC client
4 Copyright (C) Andrew Tridgell 1994-2000
5 Copyright (C) Luke Kenneth Casson Leighton 1996-2000
6 Copyright (C) Tim Potter 2001
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 2 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
25 /* Opens a SMB connection to the svrsvc pipe */
27 struct cli_state *cli_svrsvc_initialise(struct cli_state *cli,
28 char *system_name,
29 struct ntuser_creds *creds)
31 return cli_pipe_initialise(cli, system_name, PIPE_SRVSVC, creds);
34 NTSTATUS cli_srvsvc_net_srv_get_info(struct cli_state *cli,
35 TALLOC_CTX *mem_ctx,
36 uint32 switch_value, SRV_INFO_CTR *ctr)
38 prs_struct qbuf, rbuf;
39 SRV_Q_NET_SRV_GET_INFO q;
40 SRV_R_NET_SRV_GET_INFO r;
41 NTSTATUS result;
43 ZERO_STRUCT(q);
44 ZERO_STRUCT(r);
46 /* Initialise parse structures */
48 prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
49 prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
51 /* Initialise input parameters */
53 init_srv_q_net_srv_get_info(&q, cli->srv_name_slash, switch_value);
55 /* Marshall data and send request */
57 if (!srv_io_q_net_srv_get_info("", &q, &qbuf, 0) ||
58 !rpc_api_pipe_req(cli, SRV_NET_SRV_GET_INFO, &qbuf, &rbuf)) {
59 result = NT_STATUS_UNSUCCESSFUL;
60 goto done;
63 /* Unmarshall response */
65 r.ctr = ctr;
67 if (!srv_io_r_net_srv_get_info("", &r, &rbuf, 0)) {
68 result = NT_STATUS_UNSUCCESSFUL;
69 goto done;
72 result = werror_to_ntstatus(r.status);
74 done:
75 prs_mem_free(&qbuf);
76 prs_mem_free(&rbuf);
78 return result;