[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Mon Mar 15 07:16:16 MDT 2010
The branch, master has been updated
via 06cbf05... s4-smbtorture: when cross checking enumdata{ex} make sure to have at least one entry.
via 6bfde08... s4-smbtorture: add PrinterInfo_to_SetPrinterInfo helper to RPC-SPOOLSS.
from 163e559... s4:registry - rpc - don't crash when communication partner isn't available
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 06cbf05e8b964d353d0ca505ade7b018f93c8465
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 15 14:11:44 2010 +0100
s4-smbtorture: when cross checking enumdata{ex} make sure to have at least one entry.
Guenther
commit 6bfde084e65718cfdf81696120f64f17e832b313
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 15 12:38:17 2010 +0100
s4-smbtorture: add PrinterInfo_to_SetPrinterInfo helper to RPC-SPOOLSS.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source4/torture/rpc/spoolss.c | 152 +++++++++++++++++++++-------------------
1 files changed, 80 insertions(+), 72 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 53c44fc..3f675a8 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -156,6 +156,53 @@ struct test_spoolss_context {
}\
} while(0)
+static bool PrinterInfo_to_SetPrinterInfo(struct torture_context *tctx,
+ const union spoolss_PrinterInfo *i,
+ uint32_t level,
+ union spoolss_SetPrinterInfo *s)
+{
+ switch (level) {
+ case 0:
+ s->info0 = talloc(tctx, struct spoolss_SetPrinterInfo0);
+ break;
+ case 2:
+ s->info2 = talloc(tctx, struct spoolss_SetPrinterInfo2);
+ s->info2->servername = i->info2.servername;
+ s->info2->printername = i->info2.printername;
+ s->info2->sharename = i->info2.sharename;
+ s->info2->portname = i->info2.portname;
+ s->info2->drivername = i->info2.drivername;
+ s->info2->comment = i->info2.comment;
+ s->info2->location = i->info2.location;
+ s->info2->devmode_ptr = 0;
+ s->info2->sepfile = i->info2.sepfile;
+ s->info2->printprocessor = i->info2.printprocessor;
+ s->info2->datatype = i->info2.datatype;
+ s->info2->parameters = i->info2.parameters;
+ s->info2->secdesc_ptr = 0;
+ s->info2->attributes = i->info2.attributes;
+ s->info2->priority = i->info2.priority;
+ s->info2->defaultpriority = i->info2.defaultpriority;
+ s->info2->starttime = i->info2.starttime;
+ s->info2->untiltime = i->info2.untiltime;
+ s->info2->status = i->info2.status;
+ s->info2->cjobs = i->info2.cjobs;
+ s->info2->averageppm = i->info2.averageppm;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ default:
+ return false;
+ }
+
+ return true;
+}
+
static bool test_OpenPrinter_server(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *server_handle)
@@ -1596,6 +1643,7 @@ static bool test_sd_set_level(struct torture_context *tctx,
struct spoolss_SetPrinterInfoCtr info_ctr;
struct spoolss_DevmodeContainer devmode_ctr;
struct sec_desc_buf secdesc_ctr;
+ union spoolss_SetPrinterInfo sinfo;
ZERO_STRUCT(devmode_ctr);
ZERO_STRUCT(secdesc_ctr);
@@ -1603,33 +1651,11 @@ static bool test_sd_set_level(struct torture_context *tctx,
switch (level) {
case 2: {
union spoolss_PrinterInfo info;
- struct spoolss_SetPrinterInfo2 info2;
torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 2, &info), "");
-
- info2.servername = info.info2.servername;
- info2.printername = info.info2.printername;
- info2.sharename = info.info2.sharename;
- info2.portname = info.info2.portname;
- info2.drivername = info.info2.drivername;
- info2.comment = info.info2.comment;
- info2.location = info.info2.location;
- info2.devmode_ptr = 0;
- info2.sepfile = info.info2.sepfile;
- info2.printprocessor = info.info2.printprocessor;
- info2.datatype = info.info2.datatype;
- info2.parameters = info.info2.parameters;
- info2.secdesc_ptr = 0;
- info2.attributes = info.info2.attributes;
- info2.priority = info.info2.priority;
- info2.defaultpriority = info.info2.defaultpriority;
- info2.starttime = info.info2.starttime;
- info2.untiltime = info.info2.untiltime;
- info2.status = info.info2.status;
- info2.cjobs = info.info2.cjobs;
- info2.averageppm = info.info2.averageppm;
+ torture_assert(tctx, PrinterInfo_to_SetPrinterInfo(tctx, &info, 2, &sinfo), "");
info_ctr.level = 2;
- info_ctr.info.info2 = &info2;
+ info_ctr.info = sinfo;
break;
}
@@ -1788,6 +1814,7 @@ static bool test_devmode_set_level(struct torture_context *tctx,
struct spoolss_SetPrinterInfoCtr info_ctr;
struct spoolss_DevmodeContainer devmode_ctr;
struct sec_desc_buf secdesc_ctr;
+ union spoolss_SetPrinterInfo sinfo;
ZERO_STRUCT(devmode_ctr);
ZERO_STRUCT(secdesc_ctr);
@@ -1795,33 +1822,11 @@ static bool test_devmode_set_level(struct torture_context *tctx,
switch (level) {
case 2: {
union spoolss_PrinterInfo info;
- struct spoolss_SetPrinterInfo2 info2;
torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 2, &info), "");
-
- info2.servername = info.info2.servername;
- info2.printername = info.info2.printername;
- info2.sharename = info.info2.sharename;
- info2.portname = info.info2.portname;
- info2.drivername = info.info2.drivername;
- info2.comment = info.info2.comment;
- info2.location = info.info2.location;
- info2.devmode_ptr = 0;
- info2.sepfile = info.info2.sepfile;
- info2.printprocessor = info.info2.printprocessor;
- info2.datatype = info.info2.datatype;
- info2.parameters = info.info2.parameters;
- info2.secdesc_ptr = 0;
- info2.attributes = info.info2.attributes;
- info2.priority = info.info2.priority;
- info2.defaultpriority = info.info2.defaultpriority;
- info2.starttime = info.info2.starttime;
- info2.untiltime = info.info2.untiltime;
- info2.status = info.info2.status;
- info2.cjobs = info.info2.cjobs;
- info2.averageppm = info.info2.averageppm;
+ torture_assert(tctx, PrinterInfo_to_SetPrinterInfo(tctx, &info, 2, &sinfo), "");
info_ctr.level = 2;
- info_ctr.info.info2 = &info2;
+ info_ctr.info = sinfo;
break;
}
@@ -3144,6 +3149,14 @@ static bool test_EnumPrinterDataEx(struct torture_context *tctx,
return true;
}
+static bool test_SetPrinterData(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *handle,
+ const char *value_name,
+ enum winreg_Type type,
+ uint8_t *data,
+ uint32_t offered);
+
static bool test_EnumPrinterData_consistency(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *handle)
@@ -3155,9 +3168,20 @@ static bool test_EnumPrinterData_consistency(struct torture_context *tctx,
uint32_t value_offered, data_offered;
WERROR result;
+ enum winreg_Type type;
+ DATA_BLOB blob;
+
torture_comment(tctx, "Testing EnumPrinterData vs EnumPrinterDataEx consistency\n");
torture_assert(tctx,
+ reg_string_to_val(tctx, lp_iconv_convenience(tctx->lp_ctx),
+ "REG_SZ", "torture_data", &type, &blob), "");
+
+ torture_assert(tctx,
+ test_SetPrinterData(tctx, p, handle, "torture_value", type, blob.data, blob.length),
+ "SetPrinterData failed");
+
+ torture_assert(tctx,
test_EnumPrinterDataEx(tctx, p, handle, "PrinterDriverData", &count, &info),
"failed to call EnumPrinterDataEx");
@@ -3221,6 +3245,8 @@ static bool test_EnumPrinterData_consistency(struct torture_context *tctx,
torture_assert_mem_equal(tctx, data, info[i].data->data, info[i].data_length, "data mismatch");
}
+ torture_comment(tctx, "EnumPrinterData vs EnumPrinterDataEx consistency test succeeded\n\n");
+
return true;
}
@@ -3887,41 +3913,23 @@ static bool test_ChangeID(struct torture_context *tctx,
struct spoolss_SetPrinterInfoCtr info_ctr;
struct spoolss_DevmodeContainer devmode_ctr;
struct sec_desc_buf secdesc_ctr;
- struct spoolss_SetPrinterInfo2 info2;
+ union spoolss_SetPrinterInfo sinfo;
ZERO_STRUCT(info_ctr);
ZERO_STRUCT(devmode_ctr);
ZERO_STRUCT(secdesc_ctr);
- info2.servername = info.info2.servername;
- info2.printername = info.info2.printername;
- info2.sharename = info.info2.sharename;
- info2.portname = info.info2.portname;
- info2.drivername = info.info2.drivername;
- info2.comment = "torture_comment";
- info2.location = info.info2.location;
- info2.devmode_ptr = 0;
- info2.sepfile = info.info2.sepfile;
- info2.printprocessor = info.info2.printprocessor;
- info2.datatype = info.info2.datatype;
- info2.parameters = info.info2.parameters;
- info2.secdesc_ptr = 0;
- info2.attributes = info.info2.attributes;
- info2.priority = info.info2.priority;
- info2.defaultpriority = info.info2.defaultpriority;
- info2.starttime = info.info2.starttime;
- info2.untiltime = info.info2.untiltime;
- info2.status = info.info2.status;
- info2.cjobs = info.info2.cjobs;
- info2.averageppm = info.info2.averageppm;
+
+ torture_assert(tctx, PrinterInfo_to_SetPrinterInfo(tctx, &info, 2, &sinfo), "");
+ sinfo.info2->comment = "torture_comment";
info_ctr.level = 2;
- info_ctr.info.info2 = &info2;
+ info_ctr.info = sinfo;
torture_assert(tctx, test_SetPrinter(tctx, p, handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0),
"failed to call SetPrinter");
- info2.comment = comment;
+ sinfo.info2->comment = comment;
torture_assert(tctx, test_SetPrinter(tctx, p, handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0),
"failed to call SetPrinter");
--
Samba Shared Repository
More information about the samba-cvs
mailing list