diff options
author | Rafal Szczesniak <mimir@samba.org> | 2005-08-02 22:25:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:00 -0500 |
commit | 798fbb45e3eadbfdd5f17396a331c33ba6010d03 (patch) | |
tree | 72b72fa4e58e33b66441c1fa1a1f09d465e00ff8 /source4/torture | |
parent | 304e3dfb661128c237d36c53d6ce4d93cf90f801 (diff) | |
download | samba-798fbb45e3eadbfdd5f17396a331c33ba6010d03.tar.gz samba-798fbb45e3eadbfdd5f17396a331c33ba6010d03.tar.bz2 samba-798fbb45e3eadbfdd5f17396a331c33ba6010d03.zip |
r8954: Use binding string to specify host rather than share path, as we use
rpc call here after all. Also, safely exit (freeing memory context) in
case of any error.
rafal
(This used to be commit be2584df1d167f3e8ef600a926979f081e72c6a9)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/libnet/libnet_share.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index 058158226b..d0214a102a 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -114,18 +114,31 @@ BOOL torture_listshares(void) int i; BOOL ret = True; struct libnet_context* libnetctx; - const char* host; + const char *binding, *host; + struct dcerpc_binding *bind; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init("test_listshares"); - host = lp_parm_string(-1, "torture", "host"); + binding = lp_parm_string(-1, "torture", "binding"); + status = dcerpc_parse_binding(mem_ctx, binding, &bind); + if (!NT_STATUS_IS_OK(status)) { + printf("Error while parsing the binding string\n"); + ret = False; + goto done; + } libnetctx = libnet_context_init(NULL); + if (!libnetctx) { + printf("Couldn't allocate libnet context\n"); + ret = False; + goto done; + } + libnetctx->cred = cmdline_credentials; printf("Testing libnet_ListShare\n"); - share.in.server_name = talloc_asprintf(mem_ctx, "%s", host); + share.in.server_name = talloc_asprintf(mem_ctx, "%s", bind->host); for (i = 0; i < ARRAY_SIZE(levels); i++) { share.in.level = levels[i]; @@ -135,12 +148,15 @@ BOOL torture_listshares(void) if (!NT_STATUS_IS_OK(status)) { printf("libnet_ListShare level %u failed - %s\n", share.in.level, nt_errstr(status)); ret = False; + goto done; } printf("listing shares:\n"); test_displayshares(share); } +done: + talloc_free(mem_ctx); return ret; } |