mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s4-smbtorture: add test_PrintProcessors_winreg.
This does cross reference checks between spoolss PrintProcessors and entries stored in winreg. Guenther
This commit is contained in:
parent
4a10635371
commit
6acaa70d64
@ -4363,6 +4363,47 @@ do {\
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool test_PrintProcessors(struct torture_context *tctx,
|
||||
struct dcerpc_binding_handle *b,
|
||||
struct policy_handle *handle,
|
||||
const char *environment,
|
||||
struct dcerpc_binding_handle *winreg_handle,
|
||||
struct policy_handle *hive_handle)
|
||||
{
|
||||
union spoolss_PrintProcessorInfo *info;
|
||||
uint32_t count;
|
||||
int i;
|
||||
|
||||
torture_comment(tctx, "Testing Print Processor Info and winreg consistency\n");
|
||||
|
||||
torture_assert(tctx,
|
||||
test_EnumPrintProcessors_level(tctx, b, environment, 1, &count, &info),
|
||||
"failed to enum print processors level 1");
|
||||
|
||||
for (i=0; i < count; i++) {
|
||||
|
||||
const char *processor_key;
|
||||
struct policy_handle key_handle;
|
||||
|
||||
processor_key = talloc_asprintf(tctx, "%s\\%s\\Print Processors\\%s",
|
||||
TOP_LEVEL_CONTROL_ENVIRONMENTS_KEY,
|
||||
environment,
|
||||
info[i].info1.print_processor_name);
|
||||
|
||||
torture_assert(tctx,
|
||||
test_winreg_OpenKey(tctx, winreg_handle, hive_handle, processor_key, &key_handle), "");
|
||||
|
||||
/* nothing to check in there so far */
|
||||
|
||||
torture_assert(tctx,
|
||||
test_winreg_CloseKey(tctx, winreg_handle, &key_handle), "");
|
||||
}
|
||||
|
||||
torture_comment(tctx, "Print Processor Info and winreg consistency test succeeded\n\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool test_GetPrinterDriver2_level(struct torture_context *tctx,
|
||||
struct dcerpc_binding_handle *b,
|
||||
struct policy_handle *handle,
|
||||
@ -5011,6 +5052,32 @@ static bool test_DriverInfo_winreg(struct torture_context *tctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test_PrintProcessors_winreg(struct torture_context *tctx,
|
||||
struct dcerpc_binding_handle *b,
|
||||
struct policy_handle *handle,
|
||||
const char *environment)
|
||||
{
|
||||
struct dcerpc_pipe *p2;
|
||||
bool ret = true;
|
||||
struct policy_handle hive_handle;
|
||||
struct dcerpc_binding_handle *b2;
|
||||
|
||||
torture_assert_ntstatus_ok(tctx,
|
||||
torture_rpc_connection(tctx, &p2, &ndr_table_winreg),
|
||||
"could not open winreg pipe");
|
||||
b2 = p2->binding_handle;
|
||||
|
||||
torture_assert(tctx, test_winreg_OpenHKLM(tctx, b2, &hive_handle), "");
|
||||
|
||||
ret = test_PrintProcessors(tctx, b, handle, environment, b2, &hive_handle);
|
||||
|
||||
test_winreg_CloseKey(tctx, b2, &hive_handle);
|
||||
|
||||
talloc_free(p2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test_PrinterData_DsSpooler(struct torture_context *tctx,
|
||||
struct dcerpc_pipe *p,
|
||||
struct policy_handle *handle,
|
||||
@ -6443,6 +6510,10 @@ static bool test_one_printer(struct torture_context *tctx,
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (!test_PrintProcessors_winreg(tctx, b, handle, environment)) {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (!test_PrinterData_DsSpooler(tctx, p, handle, name)) {
|
||||
ret = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user