summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-02-25 05:39:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:54 -0500
commit84d632ab5edfef0b7e7ca3ae6db983744f4e3fdf (patch)
treee265bee8ff6e35ef379a34e1a098acd9443a8b9f /source4/torture
parentc9b766a9af70ac7e94f7ebf872fa5b9e21220d12 (diff)
downloadsamba-84d632ab5edfef0b7e7ca3ae6db983744f4e3fdf.tar.gz
samba-84d632ab5edfef0b7e7ca3ae6db983744f4e3fdf.tar.bz2
samba-84d632ab5edfef0b7e7ca3ae6db983744f4e3fdf.zip
r5552: Don't try to read the value of r.out.result when the dcerpc client
function returns non-OK. If a non-OK status is returned then some or all or r.out is likely to be uninitialised. (This used to be commit 0e83a306b06442a1adfe02ea6bdb727a42c7bacf)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/spoolss.c122
1 files changed, 87 insertions, 35 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 869b0abc6c..7ca8db5a10 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -55,10 +55,15 @@ static BOOL test_GetPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_GetPrinter(p, mem_ctx, &r);
}
- if (!NT_STATUS_IS_OK(status) ||
- !W_ERROR_IS_OK(r.out.result)) {
- printf("GetPrinter failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetPrinter failed - %s\n", nt_errstr(status));
+ ret = False;
+ continue;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("GetPrinter failed - %s\n",
+ win_errstr(r.out.result));
ret = False;
continue;
}
@@ -174,9 +179,13 @@ static BOOL test_EnumForms(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
}
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("EnumForms failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumForms failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("EnumForms failed - %s\n", win_errstr(r.out.result));
return False;
}
@@ -195,9 +204,13 @@ static BOOL test_DeleteForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_DeleteForm(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("DeleteForm failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("DeleteForm failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("DeleteForm failed - %s\n", win_errstr(r.out.result));
return False;
}
@@ -248,11 +261,17 @@ static BOOL test_AddForm(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_SetForm(p, mem_ctx, &sf);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("SetForm failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetForm failed - %s\n", nt_errstr(status));
+ ret = False;
+ goto done;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("SetForm failed - %s\n",
+ win_errstr(r.out.result));
ret = False;
- /* Fall through to delete */
+ goto done;
}
}
@@ -454,9 +473,15 @@ static BOOL test_GetPrinterData(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_GetPrinterData(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("GetPrinterData failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetPrinterData failed - %s\n",
+ nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("GetPrinterData failed - %s\n",
+ win_errstr(r.out.result));
return False;
}
}
@@ -496,9 +521,15 @@ static BOOL test_GetPrinterDataEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_GetPrinterDataEx(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("GetPrinterDataEx failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetPrinterDataEx failed - %s\n",
+ nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("GetPrinterDataEx failed - %s\n",
+ win_errstr(r.out.result));
return False;
}
}
@@ -743,9 +774,14 @@ static BOOL test_OpenPrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("\nTesting OpenPrinter(%s)\n", r.in.printername);
status = dcerpc_spoolss_OpenPrinter(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) {
- printf("OpenPrinter failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("OpenPrinter failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("OpenPrinter failed - %s\n", win_errstr(r.out.result));
return False;
}
@@ -893,10 +929,15 @@ static BOOL test_EnumPrinters(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
status = dcerpc_spoolss_EnumPrinters(p, mem_ctx, &r);
}
- if (!NT_STATUS_IS_OK(status) ||
- !W_ERROR_IS_OK(r.out.result)) {
- printf("EnumPrinters failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumPrinters failed - %s\n",
+ nt_errstr(status));
+ continue;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("EnumPrinters failed - %s\n",
+ win_errstr(r.out.result));
continue;
}
@@ -957,10 +998,15 @@ static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
status = dcerpc_spoolss_GetPrinterDriver2(p, mem_ctx, &r);
}
- if (!NT_STATUS_IS_OK(status) ||
- !W_ERROR_IS_OK(r.out.result)) {
- printf("GetPrinterDriver2 failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetPrinterDriver2 failed - %s\n",
+ nt_errstr(status));
+ return False;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("GetPrinterDriver2 failed - %s\n",
+ win_errstr(r.out.result));
return False;
}
@@ -1007,10 +1053,16 @@ static BOOL test_EnumPrinterDrivers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
status = dcerpc_spoolss_EnumPrinterDrivers(p, mem_ctx, &r);
}
- if (!NT_STATUS_IS_OK(status) ||
- !W_ERROR_IS_OK(r.out.result)) {
- printf("EnumPrinterDrivers failed - %s/%s\n",
- nt_errstr(status), win_errstr(r.out.result));
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumPrinterDrivers failed - %s\n",
+ nt_errstr(status));
+ ret = False;
+ break;
+ }
+
+ if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("EnumPrinterDrivers failed - %s\n",
+ win_errstr(r.out.result));
ret = False;
break;
}