[PATCH] s3: spoolss: Fix GUID string format on GetPrinter info

Jeremy Allison jra at samba.org
Mon Oct 9 22:01:02 UTC 2017


On Mon, Oct 09, 2017 at 12:32:40PM +0200, Samuel Cabrero wrote:
> Hi Jeremy,
> 
> checks added.

LGTM. RB+. Can I get a second Team reviewer ?

> On Fri, 2017-10-06 at 09:59 -0700, Jeremy Allison via samba-technical
> wrote:
> > On Fri, Oct 06, 2017 at 11:09:51AM +0200, David Disseldorp via samba-
> > technical wrote:
> > > On Fri, 06 Oct 2017 10:04:44 +0200, Samuel Cabrero wrote:
> > > 
> > > > Subject: [PATCH] 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 <scabrero at suse.de>
> > > 
> > > Looks good, thanks for adding this...
> > > Reviewed-by: David Disseldorp <ddiss at samba.org>
> > > 
> > > @Jeremy: please push if you're okay with this.
> > 
> > Can you add missing return NULL from allocation
> > checks in:
> > 
> > +               /* Build reference GUID string */
> > +               ref_guid = GUID_string2(tctx, &guid);
> > +               ref_guid = talloc_strdup_upper(tctx, ref_guid);
> > 
> > please ?
> > 

> From 9b9c2c63b968d878bebe7e4854046aef89ec357f Mon Sep 17 00:00:00 2001
> From: Samuel Cabrero <scabrero at suse.de>
> Date: Thu, 5 Oct 2017 19:22:29 +0200
> Subject: [PATCH] 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 <scabrero at suse.de>
> ---
>  source4/torture/rpc/spoolss.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> 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;
> -- 
> 2.14.2
> 




More information about the samba-technical mailing list