diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-12-31 06:19:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:49 -0500 |
commit | ccbfe7b61db1948b552e0629856385a2eb4def10 (patch) | |
tree | 91137a5d8bf8ca8ff2a8b8378f26248a694968fe | |
parent | e046e9dd733adf61d3d9d950a2e764fbe606b896 (diff) | |
download | samba-ccbfe7b61db1948b552e0629856385a2eb4def10.tar.gz samba-ccbfe7b61db1948b552e0629856385a2eb4def10.tar.bz2 samba-ccbfe7b61db1948b552e0629856385a2eb4def10.zip |
r4434: - fix some NetShare* idl functions
- add torture test for NetShareCheck()
metze
(This used to be commit 96000a2261ed56fda613a45e3aa460eb3c87082a)
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 8 | ||||
-rw-r--r-- | source4/torture/rpc/srvsvc.c | 37 |
2 files changed, 38 insertions, 7 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index c637d93841..5991284ee9 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -518,7 +518,7 @@ /* Function: 0x11 */ WERROR srvsvc_NetShareSetInfo( [in] unistr *server_unc, - [in] unistr *share_name, + [in] unistr share_name, [in] uint32 level, [in,switch_is(level)] srvsvc_NetShareInfo info, [in,out] uint32 *parm_error @@ -528,7 +528,7 @@ /* Function: 0x12 */ WERROR srvsvc_NetShareDel( [in] unistr *server_unc, - [in] unistr *share_name, + [in] unistr share_name, [in] uint32 reserved ); @@ -536,7 +536,7 @@ /* Function: 0x13 */ WERROR srvsvc_NetShareDelSticky( [in] unistr *server_unc, - [in] unistr *share_name, + [in] unistr share_name, [in] uint32 reserved ); @@ -544,7 +544,7 @@ /* Function: 0x14 */ WERROR srvsvc_NetShareCheck( [in] unistr *server_unc, - [in] unistr *share_name, + [in] unistr device_name, [out] uint32 type ); diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 4ddbbc7289..4cc7dc6291 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -448,6 +448,32 @@ static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } +static BOOL test_NetShareCheck(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + const char *device_name) +{ + NTSTATUS status; + struct srvsvc_NetShareCheck r; + BOOL ret = True; + + r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); + r.in.device_name = device_name; + + printf("testing NetShareCheck on device '%s'\n", r.in.device_name); + + status = dcerpc_srvsvc_NetShareCheck(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("dcerpc_srvsvc_NetShareCheck on device '%s' failed - %s\n", + r.in.device_name, nt_errstr(status)); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("NetShareCheck on device '%s' failed - %s\n", + r.in.device_name, win_errstr(r.out.result)); + ret = False; + } + + return ret; +} + /**************************/ /* srvsvc_NetShare */ /**************************/ @@ -489,13 +515,18 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, } /* call srvsvc_NetShareGetInfo for each returned share */ - if (r.in.level == 1) { - for (j=0;j<r.out.ctr.ctr1->count;j++) { + if (r.in.level == 2) { + for (j=0;j<r.out.ctr.ctr2->count;j++) { const char *name; - name = r.out.ctr.ctr1->array[j].name; + const char *device; + name = r.out.ctr.ctr2->array[j].name; if (!test_NetShareGetInfo(p, mem_ctx, name)) { ret = False; } + device = r.out.ctr.ctr2->array[j].path; + if (!test_NetShareCheck(p, mem_ctx, device)) { + ret = False; + } } } } |