svn commit: samba r17454 - in branches/SAMBA_3_0/source: include
rpc_client rpc_parse rpcclient
gd at samba.org
gd at samba.org
Tue Aug 8 11:45:58 GMT 2006
Author: gd
Date: 2006-08-08 11:45:57 +0000 (Tue, 08 Aug 2006)
New Revision: 17454
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17454
Log:
Adding dfs_EnumEx for rpcclient (Samba4 IDL to follow).
Guenther
Modified:
branches/SAMBA_3_0/source/include/rpc_dfs.h
branches/SAMBA_3_0/source/rpc_client/cli_dfs.c
branches/SAMBA_3_0/source/rpc_parse/parse_dfs.c
branches/SAMBA_3_0/source/rpcclient/cmd_dfs.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/rpc_dfs.h
===================================================================
--- branches/SAMBA_3_0/source/include/rpc_dfs.h 2006-08-08 11:00:16 UTC (rev 17453)
+++ branches/SAMBA_3_0/source/include/rpc_dfs.h 2006-08-08 11:45:57 UTC (rev 17454)
@@ -376,10 +376,21 @@
} NETDFS_R_DFS_REMOVE2;
typedef struct netdfs_q_dfs_EnumEx {
- uint32 dummy;
+ uint32 ptr0_dfs_name;
+ UNISTR2 dfs_name;
+ uint32 level;
+ uint32 bufsize;
+ uint32 ptr0_info;
+ NETDFS_DFS_ENUMSTRUCT info;
+ uint32 ptr0_total;
+ uint32 total;
} NETDFS_Q_DFS_ENUMEX;
typedef struct netdfs_r_dfs_EnumEx {
+ uint32 ptr0_info;
+ NETDFS_DFS_ENUMSTRUCT info;
+ uint32 ptr0_total;
+ uint32 total;
WERROR status;
} NETDFS_R_DFS_ENUMEX;
Modified: branches/SAMBA_3_0/source/rpc_client/cli_dfs.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_dfs.c 2006-08-08 11:00:16 UTC (rev 17453)
+++ branches/SAMBA_3_0/source/rpc_client/cli_dfs.c 2006-08-08 11:45:57 UTC (rev 17454)
@@ -576,7 +576,7 @@
return werror_to_ntstatus(r.status);
}
-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, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total, const char *dfs_name)
{
prs_struct qbuf, rbuf;
NETDFS_Q_DFS_ENUMEX q;
@@ -587,7 +587,7 @@
/* Marshall data and send request */
- if (!init_netdfs_q_dfs_EnumEx(&q))
+ 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,
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_dfs.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_parse/parse_dfs.c 2006-08-08 11:00:16 UTC (rev 17453)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_dfs.c 2006-08-08 11:45:57 UTC (rev 17454)
@@ -2569,10 +2569,33 @@
return True;
}
-BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v)
+BOOL init_netdfs_q_dfs_EnumEx(NETDFS_Q_DFS_ENUMEX *v, uint32 level, uint32 bufsize, NETDFS_DFS_ENUMSTRUCT *info, uint32 *total, const char *dfs_name)
{
DEBUG(5,("init_netdfs_q_dfs_EnumEx\n"));
+
+ if (!dfs_name)
+ return False;
+ init_unistr2(&v->dfs_name, dfs_name, UNI_FLAGS_NONE|UNI_STR_TERMINATE);
+
+ v->level = level;
+
+ v->bufsize = bufsize;
+
+ if (info) {
+ v->ptr0_info = 1;
+ v->info = *info;
+ } else {
+ v->ptr0_info = 0;
+ }
+
+ if (total) {
+ v->ptr0_total = 1;
+ v->total = *total;
+ } else {
+ v->ptr0_total = 0;
+ }
+
return True;
}
@@ -2583,6 +2606,42 @@
prs_debug(ps, depth, desc, "netdfs_io_q_dfs_EnumEx");
depth++;
+ if (!prs_align_custom(ps, 4))
+ return False;
+
+ if (!smb_io_unistr2("dfs_name", &v->dfs_name, 1, ps, depth))
+ return False;
+
+ if (!prs_align_custom(ps, 4))
+ return False;
+
+ if (!prs_uint32("level", ps, depth, &v->level))
+ return False;
+
+ if (!prs_uint32("bufsize", ps, depth, &v->bufsize))
+ return False;
+
+ if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info))
+ return False;
+
+ if (v->ptr0_info) {
+ if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth))
+ return False;
+ if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth))
+ return False;
+ }
+
+ if (!prs_align_custom(ps, 4))
+ return False;
+
+ if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total))
+ return False;
+
+ if (v->ptr0_total) {
+ if (!prs_uint32("total", ps, depth, &v->total))
+ return False;
+ }
+
return True;
}
@@ -2602,10 +2661,39 @@
prs_debug(ps, depth, desc, "netdfs_io_r_dfs_EnumEx");
depth++;
+ if (!prs_uint32("ptr0_info", ps, depth, &v->ptr0_info))
+ return False;
+
+ if (v->ptr0_info) {
+ if (!netdfs_io_dfs_EnumStruct_p("info", &v->info, ps, depth))
+ return False;
+ if (!netdfs_io_dfs_EnumStruct_d("info", &v->info, ps, depth))
+ return False;
+ }
+
+ if (!prs_align_custom(ps, 4))
+ return False;
+
+ if (!prs_uint32("ptr0_total", ps, depth, &v->ptr0_total))
+ return False;
+
+ if (v->ptr0_total) {
+ if (!prs_uint32("total", ps, depth, &v->total))
+ return False;
+ }
+
+ if (!prs_align_custom(ps, 4))
+ return False;
+
if (!prs_werror("status", ps, depth, &v->status))
return False;
return True;
+
+ if (!prs_werror("status", ps, depth, &v->status))
+ return False;
+
+ return True;
}
BOOL init_netdfs_q_dfs_SetInfo2(NETDFS_Q_DFS_SETINFO2 *v)
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_dfs.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_dfs.c 2006-08-08 11:00:16 UTC (rev 17453)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_dfs.c 2006-08-08 11:45:57 UTC (rev 17454)
@@ -212,6 +212,38 @@
return result;
}
+/* Enumerate dfs shares */
+
+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;
+ NTSTATUS result;
+ uint32 info_level = 1;
+ uint32 total = 0;
+
+ if (argc < 2 || argc > 3) {
+ printf("Usage: %s dfs_name [info_level]\n", argv[0]);
+ return NT_STATUS_OK;
+ }
+
+ if (argc == 3)
+ info_level = atoi(argv[2]);
+
+ ZERO_STRUCT(ctr);
+ init_netdfs_dfs_EnumStruct(&str, info_level, ctr);
+ str.e.ptr0 = 1;
+
+ result = rpccli_dfs_EnumEx(cli, mem_ctx, info_level, 0xFFFFFFFF, &str, &total, argv[1]);
+
+ if (NT_STATUS_IS_OK(result))
+ display_dfs_enumstruct(&str);
+
+ return result;
+}
+
+
static NTSTATUS cmd_dfs_getinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -253,6 +285,7 @@
{ "dfsremove", RPC_RTYPE_NTSTATUS, cmd_dfs_remove, NULL, PI_NETDFS, NULL, "Remove a DFS share", "" },
{ "dfsgetinfo",RPC_RTYPE_NTSTATUS, cmd_dfs_getinfo, NULL, PI_NETDFS, NULL, "Query DFS share info", "" },
{ "dfsenum", RPC_RTYPE_NTSTATUS, cmd_dfs_enum, NULL, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
+ { "dfsenumex", RPC_RTYPE_NTSTATUS, cmd_dfs_enumex, NULL, PI_NETDFS, NULL, "Enumerate dfs shares", "" },
{ NULL }
};
More information about the samba-cvs
mailing list