diff options
author | David Disseldorp <ddiss@samba.org> | 2014-03-29 02:18:20 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-04-01 00:54:05 +0200 |
commit | d550acf24a8ec20e3e32891ed702c6cc42bc3dee (patch) | |
tree | 0eae4b0a522db4d745b7b815864fc14be24ce55a /source3/rpcclient | |
parent | cbc6082ec75ee97ae28d94ccfb92c3d93705798a (diff) | |
download | samba-d550acf24a8ec20e3e32891ed702c6cc42bc3dee.tar.gz |
rpcclient: abort shadow-copy set on commit failure
Use similar behaviour to the diskshadow.exe FSRVP client, which aborts
the shadow-copy set if it receives a failed commit response.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 1 00:54:06 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_fss.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/source3/rpcclient/cmd_fss.c b/source3/rpcclient/cmd_fss.c index a2e26c66fce..945f4d994e0 100644 --- a/source3/rpcclient/cmd_fss.c +++ b/source3/rpcclient/cmd_fss.c @@ -263,6 +263,24 @@ static NTSTATUS cmd_fss_create_expose_parse(TALLOC_CTX *mem_ctx, int argc, return NT_STATUS_OK; } +static NTSTATUS cmd_fss_abort(TALLOC_CTX *mem_ctx, + struct dcerpc_binding_handle *b, + struct GUID *sc_set_id) +{ + NTSTATUS status; + struct fss_AbortShadowCopySet r_scset_abort; + + ZERO_STRUCT(r_scset_abort); + r_scset_abort.in.ShadowCopySetId = *sc_set_id; + status = dcerpc_fss_AbortShadowCopySet_r(b, mem_ctx, &r_scset_abort); + if (!NT_STATUS_IS_OK(status) || (r_scset_abort.out.result != 0)) { + DEBUG(0, ("AbortShadowCopySet failed: %s result: 0x%x\n", + nt_errstr(status), r_scset_abort.out.result)); + return NT_STATUS_UNSUCCESSFUL; + } + return NT_STATUS_OK; +} + static NTSTATUS cmd_fss_create_expose(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -356,7 +374,7 @@ static NTSTATUS cmd_fss_create_expose(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(status) || (r_scset_add.out.result != 0)) { DEBUG(0, ("AddToShadowCopySet failed: %s result: 0x%x\n", nt_errstr(status), r_scset_add.out.result)); - goto err_out; + goto err_sc_set_abort; } printf("%s(%s): %s shadow-copy added to set\n", GUID_string(tmp_ctx, r_scset_start.out.pShadowCopySetId), @@ -374,7 +392,7 @@ static NTSTATUS cmd_fss_create_expose(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(status) || (r_scset_prep.out.result != 0)) { DEBUG(0, ("PrepareShadowCopySet failed: %s result: 0x%x\n", nt_errstr(status), r_scset_prep.out.result)); - goto err_out; + goto err_sc_set_abort; } printf("%s: prepare completed in %llu secs\n", GUID_string(tmp_ctx, r_scset_start.out.pShadowCopySetId), @@ -388,7 +406,7 @@ static NTSTATUS cmd_fss_create_expose(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(status) || (r_scset_commit.out.result != 0)) { DEBUG(0, ("CommitShadowCopySet failed: %s result: 0x%x\n", nt_errstr(status), r_scset_commit.out.result)); - goto err_out; + goto err_sc_set_abort; } printf("%s: commit completed in %llu secs\n", GUID_string(tmp_ctx, r_scset_start.out.pShadowCopySetId), @@ -424,6 +442,11 @@ static NTSTATUS cmd_fss_create_expose(struct rpc_pipe_client *cli, map->ShadowCopyShareName, map->ShareNameUNC); } + talloc_free(tmp_ctx); + return NT_STATUS_OK; + +err_sc_set_abort: + cmd_fss_abort(tmp_ctx, b, r_scset_start.out.pShadowCopySetId); err_out: talloc_free(tmp_ctx); return status; |