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

David Disseldorp ddiss at suse.de
Tue May 27 02:52:46 MDT 2014


Thanks for the feedback Volker!

On Mon, 26 May 2014 21:58:06 +0200, Volker Lendecke wrote:

...
> >  	/* 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.

dup_sec_desc() returns NULL if @src is NULL, but for
security_descriptor_copy() it's up to the caller to check for a NULL
@src.
This patch shouldn't change the behaviour of this code-path, unless I'm
missing something?

Cheers, David


More information about the samba-technical mailing list