diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-09-13 13:42:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:51:43 -0500 |
commit | 8be112a81bf7d7fb48ee82fd38c1f8d0f85bbc75 (patch) | |
tree | 3d95c370e0c53f02e0fa44dd53993badfa6d0c6c | |
parent | dc14e67a6ba07946b5b98644d950a6b29b1c11c6 (diff) | |
download | samba-8be112a81bf7d7fb48ee82fd38c1f8d0f85bbc75.tar.gz samba-8be112a81bf7d7fb48ee82fd38c1f8d0f85bbc75.tar.bz2 samba-8be112a81bf7d7fb48ee82fd38c1f8d0f85bbc75.zip |
r18469: Use new pidl-generated DFS client code.
(This used to be commit e277fb067b1a12d816c8a066839751c1824d27bb)
-rw-r--r-- | source3/Makefile.in | 3 | ||||
-rw-r--r-- | source3/include/rpc_client.h | 1 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_dfs.c | 9 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_dfs.h | 2 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/dfs.h | 10 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_dfs.c | 116 | ||||
-rw-r--r-- | source3/rpc_client/cli_dfs.c | 632 | ||||
-rw-r--r-- | source3/rpcclient/cmd_dfs.c | 128 |
8 files changed, 211 insertions, 690 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 18f04b9333..9c4ca01d93 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -290,7 +290,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \ LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \ rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o \ - rpc_client/cli_wkssvc.o rpc_client/cli_dfs.o \ + rpc_client/cli_wkssvc.o \ rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \ rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o \ rpc_client/cli_ds.o rpc_client/cli_echo.o \ @@ -298,6 +298,7 @@ LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \ rpc_client/ndr.o LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_unixinfo.o librpc/gen_ndr/cli_lsa.o \ + librpc/gen_ndr/cli_dfs.o \ $(LIBMSRPC_GEN_OBJ1) $(LIBNDR_GEN_OBJ) $(LIBNDR_OBJ) REGOBJS_OBJ = registry/reg_objects.o diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 0b3bd0505a..407d5d97a7 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -24,6 +24,7 @@ /* autogenerated client stubs */ #include "librpc/gen_ndr/cli_unixinfo.h" +#include "librpc/gen_ndr/cli_dfs.h" #include "librpc/gen_ndr/cli_lsa.h" /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ diff --git a/source3/librpc/gen_ndr/cli_dfs.c b/source3/librpc/gen_ndr/cli_dfs.c index 5ade9f74a1..5de9117eaa 100644 --- a/source3/librpc/gen_ndr/cli_dfs.c +++ b/source3/librpc/gen_ndr/cli_dfs.c @@ -384,18 +384,25 @@ NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total) { struct dfs_EnumEx r; NTSTATUS status; /* In parameters */ + r.in.name = name; + r.in.level = level; + r.in.bufsize = bufsize; + r.in.info = info; + r.in.total = total; status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, DCERPC_DFS_ENUMEX, &r, (ndr_pull_flags_fn_t)ndr_pull_dfs_EnumEx, (ndr_push_flags_fn_t)ndr_push_dfs_EnumEx); if (NT_STATUS_IS_ERR(status)) { return status; } /* Return variables */ + *info = *r.out.info; + *total = *r.out.total; /* Return result */ return werror_to_ntstatus(r.out.result); diff --git a/source3/librpc/gen_ndr/cli_dfs.h b/source3/librpc/gen_ndr/cli_dfs.h index fd5a52fb2c..9f310741d5 100644 --- a/source3/librpc/gen_ndr/cli_dfs.h +++ b/source3/librpc/gen_ndr/cli_dfs.h @@ -22,6 +22,6 @@ NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total); NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); #endif /* __CLI_NETDFS__ */ diff --git a/source3/librpc/gen_ndr/dfs.h b/source3/librpc/gen_ndr/dfs.h index 1909b938ef..4bd4f2d7f0 100644 --- a/source3/librpc/gen_ndr/dfs.h +++ b/source3/librpc/gen_ndr/dfs.h @@ -321,6 +321,16 @@ struct dfs_Remove2 { struct dfs_EnumEx { struct { + const char *name;/* [keepref,ref,charset(UTF16)] */ + uint32_t level;/* [keepref] */ + uint32_t bufsize;/* [keepref] */ + struct dfs_EnumStruct *info;/* [unique,keepref] */ + uint32_t *total;/* [unique,keepref] */ + } in; + + struct { + struct dfs_EnumStruct *info;/* [unique,keepref] */ + uint32_t *total;/* [unique,keepref] */ WERROR result; } out; diff --git a/source3/librpc/gen_ndr/ndr_dfs.c b/source3/librpc/gen_ndr/ndr_dfs.c index f7151050ae..a3af989caf 100644 --- a/source3/librpc/gen_ndr/ndr_dfs.c +++ b/source3/librpc/gen_ndr/ndr_dfs.c @@ -3356,8 +3356,31 @@ _PUBLIC_ void ndr_print_dfs_Remove2(struct ndr_print *ndr, const char *name, int NTSTATUS ndr_push_dfs_EnumEx(struct ndr_push *ndr, int flags, const struct dfs_EnumEx *r) { if (flags & NDR_IN) { + if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.name, ndr_charset_length(r->in.name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bufsize)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.info)); + if (r->in.info) { + NDR_CHECK(ndr_push_dfs_EnumStruct(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.total)); + if (r->in.total) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.total)); + } } if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); + if (r->out.info) { + NDR_CHECK(ndr_push_dfs_EnumStruct(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.total)); + if (r->out.total) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total)); + } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NT_STATUS_OK; @@ -3365,9 +3388,72 @@ NTSTATUS ndr_push_dfs_EnumEx(struct ndr_push *ndr, int flags, const struct dfs_E NTSTATUS ndr_pull_dfs_EnumEx(struct ndr_pull *ndr, int flags, struct dfs_EnumEx *r) { + uint32_t _ptr_info; + uint32_t _ptr_total; + TALLOC_CTX *_mem_save_info_0; + TALLOC_CTX *_mem_save_total_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.name)); + if (ndr_get_array_length(ndr, &r->in.name) > ndr_get_array_size(ndr, &r->in.name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.name), ndr_get_array_length(ndr, &r->in.name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.name, ndr_get_array_length(ndr, &r->in.name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.bufsize)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_PULL_ALLOC(ndr, r->in.info); + } else { + r->in.info = NULL; + } + if (r->in.info) { + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, 0); + NDR_CHECK(ndr_pull_dfs_EnumStruct(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_total)); + if (_ptr_total) { + NDR_PULL_ALLOC(ndr, r->in.total); + } else { + r->in.total = NULL; + } + if (r->in.total) { + _mem_save_total_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.total, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.total)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_0, 0); + } } if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_PULL_ALLOC(ndr, r->out.info); + } else { + r->out.info = NULL; + } + if (r->out.info) { + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); + NDR_CHECK(ndr_pull_dfs_EnumStruct(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_total)); + if (_ptr_total) { + NDR_PULL_ALLOC(ndr, r->out.total); + } else { + r->out.total = NULL; + } + if (r->out.total) { + _mem_save_total_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.total, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_0, 0); + } NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NT_STATUS_OK; @@ -3383,11 +3469,41 @@ _PUBLIC_ void ndr_print_dfs_EnumEx(struct ndr_print *ndr, const char *name, int if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "dfs_EnumEx"); ndr->depth++; + ndr_print_ptr(ndr, "name", r->in.name); + ndr->depth++; + ndr_print_string(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_uint32(ndr, "level", r->in.level); + ndr_print_uint32(ndr, "bufsize", r->in.bufsize); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + if (r->in.info) { + ndr_print_dfs_EnumStruct(ndr, "info", r->in.info); + } + ndr->depth--; + ndr_print_ptr(ndr, "total", r->in.total); + ndr->depth++; + if (r->in.total) { + ndr_print_uint32(ndr, "total", *r->in.total); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "dfs_EnumEx"); ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + if (r->out.info) { + ndr_print_dfs_EnumStruct(ndr, "info", r->out.info); + } + ndr->depth--; + ndr_print_ptr(ndr, "total", r->out.total); + ndr->depth++; + if (r->out.total) { + ndr_print_uint32(ndr, "total", *r->out.total); + } + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } diff --git a/source3/rpc_client/cli_dfs.c b/source3/rpc_client/cli_dfs.c deleted file mode 100644 index 5a4ce237a7..0000000000 --- a/source3/rpc_client/cli_dfs.c +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * client auto-generated by pidl. DO NOT MODIFY! - */ - -#include "includes.h" - -NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 *exist_flag) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_GETMANAGERVERSION q; - NETDFS_R_DFS_GETMANAGERVERSION r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_GetManagerVersion(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETMANAGERVERSION, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_GetManagerVersion, - netdfs_io_r_dfs_GetManagerVersion, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - *exist_flag = r.exist_flag; - - /* Return result */ - return NT_STATUS_OK; -} - -NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32 flags) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ADD q; - NETDFS_R_DFS_ADD r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Add(&q, path, server, share, comment, flags)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADD, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Add, - netdfs_io_r_dfs_Add, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_REMOVE q; - NETDFS_R_DFS_REMOVE r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Remove(&q, path, server, share)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVE, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Remove, - netdfs_io_r_dfs_Remove, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_SETINFO q; - NETDFS_R_DFS_SETINFO r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_SetInfo(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETINFO, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_SetInfo, - netdfs_io_r_dfs_SetInfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, uint32 level, NETDFS_DFS_INFO_CTR *info) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_GETINFO q; - NETDFS_R_DFS_GETINFO r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_GetInfo(&q, path, server, share, level)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETINFO, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_GetInfo, - netdfs_io_r_dfs_GetInfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - *info = r.info; - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ENUM q; - NETDFS_R_DFS_ENUM r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Enum(&q, level, bufsize, info, total)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ENUM, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Enum, - netdfs_io_r_dfs_Enum, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - *info = r.info; - *total = r.total; - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_RENAME q; - NETDFS_R_DFS_RENAME r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Rename(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_RENAME, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Rename, - netdfs_io_r_dfs_Rename, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_MOVE q; - NETDFS_R_DFS_MOVE r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Move(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MOVE, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Move, - netdfs_io_r_dfs_Move, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_MANAGERGETCONFIGINFO q; - NETDFS_R_DFS_MANAGERGETCONFIGINFO r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_ManagerGetConfigInfo(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERGETCONFIGINFO, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_ManagerGetConfigInfo, - netdfs_io_r_dfs_ManagerGetConfigInfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_MANAGERSENDSITEINFO q; - NETDFS_R_DFS_MANAGERSENDSITEINFO r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_ManagerSendSiteInfo(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERSENDSITEINFO, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_ManagerSendSiteInfo, - netdfs_io_r_dfs_ManagerSendSiteInfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ADDFTROOT q; - NETDFS_R_DFS_ADDFTROOT r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_AddFtRoot(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDFTROOT, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_AddFtRoot, - netdfs_io_r_dfs_AddFtRoot, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_REMOVEFTROOT q; - NETDFS_R_DFS_REMOVEFTROOT r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_RemoveFtRoot(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVEFTROOT, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_RemoveFtRoot, - netdfs_io_r_dfs_RemoveFtRoot, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ADDSTDROOT q; - NETDFS_R_DFS_ADDSTDROOT r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_AddStdRoot(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDSTDROOT, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_AddStdRoot, - netdfs_io_r_dfs_AddStdRoot, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_REMOVESTDROOT q; - NETDFS_R_DFS_REMOVESTDROOT r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_RemoveStdRoot(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVESTDROOT, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_RemoveStdRoot, - netdfs_io_r_dfs_RemoveStdRoot, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_MANAGERINITIALIZE q; - NETDFS_R_DFS_MANAGERINITIALIZE r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_ManagerInitialize(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_MANAGERINITIALIZE, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_ManagerInitialize, - netdfs_io_r_dfs_ManagerInitialize, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ADDSTDROOTFORCED q; - NETDFS_R_DFS_ADDSTDROOTFORCED r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_AddStdRootForced(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADDSTDROOTFORCED, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_AddStdRootForced, - netdfs_io_r_dfs_AddStdRootForced, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_GETDCADDRESS q; - NETDFS_R_DFS_GETDCADDRESS r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_GetDcAddress(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_GETDCADDRESS, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_GetDcAddress, - netdfs_io_r_dfs_GetDcAddress, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_SETDCADDRESS q; - NETDFS_R_DFS_SETDCADDRESS r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_SetDcAddress(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETDCADDRESS, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_SetDcAddress, - netdfs_io_r_dfs_SetDcAddress, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_FLUSHFTTABLE q; - NETDFS_R_DFS_FLUSHFTTABLE r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_FlushFtTable(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_FLUSHFTTABLE, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_FlushFtTable, - netdfs_io_r_dfs_FlushFtTable, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ADD2 q; - NETDFS_R_DFS_ADD2 r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Add2(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ADD2, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Add2, - netdfs_io_r_dfs_Add2, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_REMOVE2 q; - NETDFS_R_DFS_REMOVE2 r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_Remove2(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_REMOVE2, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_Remove2, - netdfs_io_r_dfs_Remove2, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total, const char *dfs_name) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_ENUMEX q; - NETDFS_R_DFS_ENUMEX r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_EnumEx(&q, level, bufsize, info, total, dfs_name)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_ENUMEX, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_EnumEx, - netdfs_io_r_dfs_EnumEx, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - -NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) -{ - prs_struct qbuf, rbuf; - NETDFS_Q_DFS_SETINFO2 q; - NETDFS_R_DFS_SETINFO2 r; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - if (!init_netdfs_q_dfs_SetInfo2(&q)) - return NT_STATUS_INVALID_PARAMETER; - - CLI_DO_RPC(cli, mem_ctx, PI_NETDFS, DFS_SETINFO2, - q, r, - qbuf, rbuf, - netdfs_io_q_dfs_SetInfo2, - netdfs_io_r_dfs_SetInfo2, - NT_STATUS_UNSUCCESSFUL); - - /* Return variables */ - - /* Return result */ - return werror_to_ntstatus(r.status); -} - diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c index e95b8f7ca0..bdc94c3c20 100644 --- a/source3/rpcclient/cmd_dfs.c +++ b/source3/rpcclient/cmd_dfs.c @@ -91,25 +91,17 @@ static NTSTATUS cmd_dfs_remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* Display a DFS_INFO_1 structure */ -static void display_dfs_info_1(NETDFS_DFS_INFO1 *info1) +static void display_dfs_info_1(struct dfs_Info1 *info1) { - fstring temp; - - unistr2_to_ascii(temp, &info1->path, sizeof(temp) - 1); - printf("path: %s\n", temp); + printf("path: %s\n", info1->path); } /* Display a DFS_INFO_2 structure */ -static void display_dfs_info_2(NETDFS_DFS_INFO2 *info2) +static void display_dfs_info_2(struct dfs_Info2 *info2) { - fstring temp; - - unistr2_to_ascii(temp, &info2->path, sizeof(temp) - 1); - printf("path: %s\n", temp); - - unistr2_to_ascii(temp, &info2->comment, sizeof(temp) - 1); - printf("\tcomment: %s\n", temp); + printf("path: %s\n", info2->path); + printf("\tcomment: %s\n", info2->comment); printf("\tstate: %d\n", info2->state); printf("\tnum_stores: %d\n", info2->num_stores); @@ -117,62 +109,57 @@ static void display_dfs_info_2(NETDFS_DFS_INFO2 *info2) /* Display a DFS_INFO_3 structure */ -static void display_dfs_info_3(NETDFS_DFS_INFO3 *info3) +static void display_dfs_info_3(struct dfs_Info3 *info3) { - fstring temp; int i; - unistr2_to_ascii(temp, &info3->path, sizeof(temp) - 1); - printf("path: %s\n", temp); + printf("path: %s\n", info3->path); - unistr2_to_ascii(temp, &info3->comment, sizeof(temp) - 1); - printf("\tcomment: %s\n", temp); + printf("\tcomment: %s\n", info3->comment); printf("\tstate: %d\n", info3->state); printf("\tnum_stores: %d\n", info3->num_stores); for (i = 0; i < info3->num_stores; i++) { - NETDFS_DFS_STORAGEINFO *dsi = &info3->stores[i]; + struct dfs_StorageInfo *dsi = &info3->stores[i]; - unistr2_to_ascii(temp, &dsi->server, sizeof(temp) - 1); - printf("\t\tstorage[%d] server: %s\n", i, temp); + printf("\t\tstorage[%d] server: %s\n", i, dsi->server); - unistr2_to_ascii(temp, &dsi->share, sizeof(temp) - 1); - printf("\t\tstorage[%d] share: %s\n", i, temp); + printf("\t\tstorage[%d] share: %s\n", i, dsi->share); } } /* Display a DFS_INFO_CTR structure */ -static void display_dfs_info(NETDFS_DFS_INFO_CTR *ctr) +static void display_dfs_info(uint32 level, union dfs_Info *ctr) { - switch (ctr->switch_value) { + switch (level) { case 0x01: - display_dfs_info_1(&ctr->u.info1); + display_dfs_info_1(ctr->info1); break; case 0x02: - display_dfs_info_2(&ctr->u.info2); + display_dfs_info_2(ctr->info2); break; case 0x03: - display_dfs_info_3(&ctr->u.info3); + display_dfs_info_3(ctr->info3); break; default: printf("unsupported info level %d\n", - ctr->switch_value); + level); break; } } -static void display_dfs_enumstruct(NETDFS_DFS_ENUMSTRUCT *ctr) +static void display_dfs_enumstruct(struct dfs_EnumStruct *ctr) { int i; /* count is always the first element, so we can just use info1 here */ - for (i = 0; i < ctr->e.u.info1.count; i++) { + for (i = 0; i < ctr->e.info1->count; i++) { switch (ctr->level) { - case 1: display_dfs_info_1(&ctr->e.u.info1.s[i]); break; - case 2: display_dfs_info_2(&ctr->e.u.info2.s[i]); break; - case 3: display_dfs_info_3(&ctr->e.u.info3.s[i]); break; + case 1: display_dfs_info_1(&ctr->e.info1->s[i]); break; + case 2: display_dfs_info_2(&ctr->e.info2->s[i]); break; + case 3: display_dfs_info_3(&ctr->e.info3->s[i]); break; default: printf("unsupported info level %d\n", ctr->level); @@ -186,25 +173,41 @@ static void display_dfs_enumstruct(NETDFS_DFS_ENUMSTRUCT *ctr) static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - NETDFS_DFS_ENUMSTRUCT str; - NETDFS_DFS_ENUMINFO_CTR ctr; + struct dfs_EnumStruct str; + struct dfs_EnumArray1 info1; + struct dfs_EnumArray2 info2; + struct dfs_EnumArray3 info3; + struct dfs_EnumArray4 info4; + struct dfs_EnumArray200 info200; + struct dfs_EnumArray300 info300; + NTSTATUS result; - uint32 info_level = 1; uint32 total = 0; + uint32 unknown = 0; if (argc > 2) { printf("Usage: %s [info_level]\n", argv[0]); return NT_STATUS_OK; } + str.level = 1; if (argc == 2) - info_level = atoi(argv[1]); - - ZERO_STRUCT(ctr); - init_netdfs_dfs_EnumStruct(&str, info_level, ctr); - str.e.ptr0 = 1; + str.level = atoi(argv[1]); + + switch (str.level) { + case 1: str.e.info1 = &info1; ZERO_STRUCT(info1); break; + case 2: str.e.info2 = &info2; ZERO_STRUCT(info2); break; + case 3: str.e.info3 = &info3; ZERO_STRUCT(info3); break; + case 4: str.e.info4 = &info4; ZERO_STRUCT(info4); break; + case 200: str.e.info200 = &info200; ZERO_STRUCT(info200); break; + case 300: str.e.info300 = &info300; ZERO_STRUCT(info300); break; + default: + printf("Unknown info level %d\n", str.level); + break; + } - result = rpccli_dfs_Enum(cli, mem_ctx, info_level, 0xFFFFFFFF, &str, &total); + result = rpccli_dfs_Enum(cli, mem_ctx, str.level, 0xFFFFFFFF, &str, &unknown, + &total); if (NT_STATUS_IS_OK(result)) display_dfs_enumstruct(&str); @@ -217,10 +220,15 @@ static NTSTATUS cmd_dfs_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, static NTSTATUS cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - NETDFS_DFS_ENUMSTRUCT str; - NETDFS_DFS_ENUMINFO_CTR ctr; + struct dfs_EnumStruct str; + struct dfs_EnumArray1 info1; + struct dfs_EnumArray2 info2; + struct dfs_EnumArray3 info3; + struct dfs_EnumArray4 info4; + struct dfs_EnumArray200 info200; + struct dfs_EnumArray300 info300; + NTSTATUS result; - uint32 info_level = 1; uint32 total = 0; if (argc < 2 || argc > 3) { @@ -229,13 +237,23 @@ static NTSTATUS cmd_dfs_enumex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, } if (argc == 3) - info_level = atoi(argv[2]); - - ZERO_STRUCT(ctr); - init_netdfs_dfs_EnumStruct(&str, info_level, ctr); - str.e.ptr0 = 1; + str.level = atoi(argv[2]); + + switch (str.level) { + case 1: str.e.info1 = &info1; ZERO_STRUCT(info1); break; + case 2: str.e.info2 = &info2; ZERO_STRUCT(info2); break; + case 3: str.e.info3 = &info3; ZERO_STRUCT(info3); break; + case 4: str.e.info4 = &info4; ZERO_STRUCT(info4); break; + case 200: str.e.info200 = &info200; ZERO_STRUCT(info200); break; + case 300: str.e.info300 = &info300; ZERO_STRUCT(info300); break; + default: + printf("Unknown info level %d\n", str.level); + break; + } - result = rpccli_dfs_EnumEx(cli, mem_ctx, info_level, 0xFFFFFFFF, &str, &total, argv[1]); + result = rpccli_dfs_EnumEx(cli, mem_ctx, argv[1], + str.level, 0xFFFFFFFF, &str, + &total); if (NT_STATUS_IS_OK(result)) display_dfs_enumstruct(&str); @@ -250,7 +268,7 @@ static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx NTSTATUS result; const char *path, *servername, *sharename; uint32 info_level = 1; - NETDFS_DFS_INFO_CTR ctr; + union dfs_Info ctr; if (argc < 4 || argc > 5) { printf("Usage: %s path servername sharename " @@ -269,7 +287,7 @@ static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx sharename, info_level, &ctr); if (NT_STATUS_IS_OK(result)) - display_dfs_info(&ctr); + display_dfs_info(info_level, &ctr); return result; } |