[PATCH 06/13] s3/profiles: replace dup_sec_desc() usage

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon May 26 13:58:06 MDT 2014


Hi!

Great work. I did not know we have this code duplication!

On Mon, May 26, 2014 at 05:29:56PM +0200, David Disseldorp wrote:
> Use security_descriptor_copy() instead, which is also provided by
> libcli.
> 
> Signed-off-by: David Disseldorp <ddiss at samba.org>
> ---
>  source3/utils/profiles.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c
> index 442a7de..a193582 100644
> --- a/source3/utils/profiles.c
> +++ b/source3/utils/profiles.c
> @@ -129,8 +129,14 @@ static bool copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
>  
>  	/* swap out the SIDs in the security descriptor */
>  
> -	if ( !(new_sd = dup_sec_desc( outfile->mem_ctx, nk->sec_desc->sec_desc )) ) {
> -		fprintf( stderr, "Failed to copy security descriptor!\n" );
> +	if (nk->sec_desc->sec_desc == NULL) {
> +		new_sd = NULL;
> +	} else {
> +		new_sd = security_descriptor_copy(outfile->mem_ctx,
> +						  nk->sec_desc->sec_desc);
> +	}
> +	if (new_sd == NULL) {
> +		fprintf(stderr, "Failed to copy security descriptor!\n");

This looks wrong in the case when nk->sec_desc->sec_desc was
NULL initially.

Regards,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list