From: Samuel Cabrero Date: Thu, 5 Oct 2017 17:22:29 +0000 (+0200) Subject: s3: spoolss: Extend publish_toggle test to check returned GUID string format X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=015bdbd10b43df0e792032248b50edf9157a0f3e;p=obnox%2Fsamba%2Fsamba-obnox.git s3: spoolss: Extend publish_toggle test to check returned GUID string format Extend the rpc.spoolss.printer.addprinter.publish_toggle test to check the format of the returned GUID string in GetPrinter info level 7 structure. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12993 Signed-off-by: Samuel Cabrero Reviewed-by: Jeremy Allison Reviewed-by: David Disseldorp Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Oct 11 06:39:00 CEST 2017 on sn-devel-144 --- diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index d4f69698d96..31b9525ee62 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -9218,14 +9218,26 @@ static bool test_printer_set_publish(struct torture_context *tctx, "info7 publish flag not set"); } else { struct GUID guid; + char *ref_guid; torture_assert_int_equal(tctx, info.info7.action, DSPRINT_PUBLISH, "info7 publish flag not set"); + + /* GUID_from_string is able to parse both plain and + * curly-braced guids */ torture_assert_ntstatus_ok(tctx, GUID_from_string(info.info7.guid, &guid), "invalid published printer GUID"); + + /* Build reference GUID string */ + ref_guid = GUID_string2(tctx, &guid); + torture_assert_not_null(tctx, ref_guid, "ENOMEM"); + ref_guid = talloc_strdup_upper(tctx, ref_guid); + torture_assert_not_null(tctx, ref_guid, "ENOMEM"); + torture_assert_str_equal(tctx, info.info7.guid, ref_guid, + "invalid GUID format"); } return true;