BUG in enumprintprocdatatypes

Martin Zielinski mz at seh.de
Tue Feb 27 07:46:58 GMT 2007



Gerald (Jerry) Carter schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Martin Zielinski wrote:
>> Hello!
>>
>> enumprintprocdatatypes_level_1() in rpc_server/srv_spoolss_nt.c allways
>> returns WERR_NOMEM.
>>
>> I'd propose to initialize the result var with WERR_OK 
>> instead WERR_NOMEM.
> 
> Shouldn't we always just return "RAW" ?
> 
That would be fine :-)
It's just a coding error. "result" is initialized with WERR_NOMEM and 
never changed to a "NO_ERROR" value. So the returned RPC status is "NOMEM".
look (i removed the empty lines):

static WERROR enumprintprocdatatypes_level_1(RPC_BUFFER *buffer, uint32 
offered, uint32 *needed, uint32 *returned)
{
	PRINTPROCDATATYPE_1 *info_1=NULL;
	WERROR result = WERR_NOMEM;
	if((info_1 = SMB_MALLOC_P(PRINTPROCDATATYPE_1)) == NULL)
		return WERR_NOMEM;
	(*returned) = 0x1;
	init_unistr(&info_1->name, "RAW");
	*needed += spoolss_size_printprocdatatype_info_1(info_1);
	if (*needed > offered) {
		result = WERR_INSUFFICIENT_BUFFER;
		goto out;
	}
	if (!rpcbuf_alloc_size(buffer, *needed)) {
		result = WERR_NOMEM;
		goto out;
	}
	smb_io_printprocdatatype_info_1("", buffer, info_1, 0);
out:
	SAFE_FREE(info_1);
	if ( !W_ERROR_IS_OK(result) )
		*returned = 0;
	return result;
}
----
regards,

Martin

-- 
Martin Zielinski             mz at seh.de
Software Development
SEH Computertechnik GmbH     www.seh.de



More information about the samba-technical mailing list