Fixes for SAMBA3RPC torture test
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sun, 21 Jun 2009 17:07:02 +0000 (19:07 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 29 Jun 2009 03:39:33 +0000 (13:39 +1000)
On calls where both NT_STATUS and WERROR results are returned and consulted
we have to make sure to form function results considering both.
This errors have been found through a run against SAMBA 4.

source4/torture/rpc/samba3rpc.c

index e31135c0de3361a79b45c7092c9ccc5ca421feb4..65d251013be352bb25a4bd74b06b6326c6a09509 100644 (file)
@@ -3252,13 +3252,14 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
                d_printf("(%s) srvsvc_NetShareGetInfo failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(r.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(r.out.result) : status;
                goto fail;
        }
 
        *info502 = talloc_move(mem_ctx, &info.info502);
        return NT_STATUS_OK;
 
- fail:
+fail:
        talloc_free(p);
        return status;
 }
@@ -3319,6 +3320,7 @@ static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
                d_printf("(%s) OpenHKLM failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(r.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(r.out.result) : status;
                goto fail;
        }
 
@@ -3373,6 +3375,7 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(c.out.result)) {
                d_printf("(%s) OpenKey failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(c.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(c.out.result) : status;
                goto fail;
        }
 
@@ -3382,11 +3385,12 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(cl.out.result)) {
                d_printf("(%s) OpenKey failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(cl.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(cl.out.result) : status;
                goto fail;
        }
 
 
- fail:
+fail:
        talloc_free(mem_ctx);
        return status;
 }
@@ -3423,10 +3427,11 @@ static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(d.out.result)) {
                d_printf("(%s) OpenKey failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(d.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(d.out.result) : status;
                goto fail;
        }
 
- fail:
+fail:
        talloc_free(mem_ctx);
        return status;
 }
@@ -3467,6 +3472,7 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(o.out.result)) {
                d_printf("(%s) OpenKey failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(o.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(o.out.result) : status;
                goto done;
        }
 
@@ -3486,10 +3492,11 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
        if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(s.out.result)) {
                d_printf("(%s) SetValue failed: %s, %s\n", __location__,
                         nt_errstr(status), win_errstr(s.out.result));
+               status = NT_STATUS_IS_OK(status) ? werror_to_ntstatus(s.out.result) : status;
                goto done;
        }
 
- done:
+done:
        talloc_free(hklm);
        return status;
 }