2 Unix SMB/CIFS implementation.
4 Copyright (C) Tim Potter 2000-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 /* Query DFS support */
25 NTSTATUS
cli_dfs_exist(struct cli_state
*cli
, TALLOC_CTX
*mem_ctx
,
28 prs_struct qbuf
, rbuf
;
31 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
36 /* Initialise parse structures */
38 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
39 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
41 /* Marshall data and send request */
43 init_dfs_q_dfs_exist(&q
);
45 if (!dfs_io_q_dfs_exist("", &q
, &qbuf
, 0) ||
46 !rpc_api_pipe_req(cli
, DFS_EXIST
, &qbuf
, &rbuf
)) {
50 /* Unmarshall response */
52 if (!dfs_io_r_dfs_exist("", &r
, &rbuf
, 0)) {
58 *dfs_exists
= (r
.status
!= 0);
60 result
= NT_STATUS_OK
;
69 NTSTATUS
cli_dfs_add(struct cli_state
*cli
, TALLOC_CTX
*mem_ctx
,
70 const char *entrypath
, const char *servername
,
71 const char *sharename
, const char *comment
, uint32 flags
)
73 prs_struct qbuf
, rbuf
;
76 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
81 /* Initialise parse structures */
83 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
84 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
86 /* Marshall data and send request */
88 init_dfs_q_dfs_add(&q
, entrypath
, servername
, sharename
, comment
,
91 if (!dfs_io_q_dfs_add("", &q
, &qbuf
, 0) ||
92 !rpc_api_pipe_req(cli
, DFS_ADD
, &qbuf
, &rbuf
)) {
96 /* Unmarshall response */
98 if (!dfs_io_r_dfs_add("", &r
, &rbuf
, 0)) {
104 result
= werror_to_ntstatus(r
.status
);
113 NTSTATUS
cli_dfs_remove(struct cli_state
*cli
, TALLOC_CTX
*mem_ctx
,
114 const char *entrypath
, const char *servername
,
115 const char *sharename
)
117 prs_struct qbuf
, rbuf
;
120 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
125 /* Initialise parse structures */
127 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
128 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
130 /* Marshall data and send request */
132 init_dfs_q_dfs_remove(&q
, entrypath
, servername
, sharename
);
134 if (!dfs_io_q_dfs_remove("", &q
, &qbuf
, 0) ||
135 !rpc_api_pipe_req(cli
, DFS_REMOVE
, &qbuf
, &rbuf
)) {
139 /* Unmarshall response */
141 if (!dfs_io_r_dfs_remove("", &r
, &rbuf
, 0)) {
147 result
= werror_to_ntstatus(r
.status
);
156 NTSTATUS
cli_dfs_get_info(struct cli_state
*cli
, TALLOC_CTX
*mem_ctx
,
157 const char *entrypath
, const char *servername
,
158 const char *sharename
, uint32 info_level
,
162 prs_struct qbuf
, rbuf
;
163 DFS_Q_DFS_GET_INFO q
;
164 DFS_R_DFS_GET_INFO r
;
165 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
170 /* Initialise parse structures */
172 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
173 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
175 /* Marshall data and send request */
177 init_dfs_q_dfs_get_info(&q
, entrypath
, servername
, sharename
,
180 if (!dfs_io_q_dfs_get_info("", &q
, &qbuf
, 0) ||
181 !rpc_api_pipe_req(cli
, DFS_GET_INFO
, &qbuf
, &rbuf
)) {
185 /* Unmarshall response */
187 if (!dfs_io_r_dfs_get_info("", &r
, &rbuf
, 0)) {
193 result
= werror_to_ntstatus(r
.status
);
203 /* Enumerate dfs shares */
205 NTSTATUS
cli_dfs_enum(struct cli_state
*cli
, TALLOC_CTX
*mem_ctx
,
206 uint32 info_level
, DFS_INFO_CTR
*ctr
)
208 prs_struct qbuf
, rbuf
;
211 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
216 /* Initialise parse structures */
218 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
219 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
221 /* Marshall data and send request */
223 init_dfs_q_dfs_enum(&q
, info_level
, ctr
);
225 if (!dfs_io_q_dfs_enum("", &q
, &qbuf
, 0) ||
226 !rpc_api_pipe_req(cli
, DFS_ENUM
, &qbuf
, &rbuf
)) {
230 /* Unmarshall response */
234 if (!dfs_io_r_dfs_enum("", &r
, &rbuf
, 0)) {
240 result
= werror_to_ntstatus(r
.status
);