[PATCH] fix display of REG_DWORD in spoolss rpcclient

Günther Deschner gd at samba.org
Fri May 5 16:24:17 UTC 2017


Hi Jeremy,

there is no need to do that. In an enumdata(ex) context, the first reply
will return with content in a buffer that can fill the largest entry in
the array of attributes. All subsequent queries then reuse this buffer
even if the key/value pair in question then is just a 4 byte DWORD. The
remaining buffer will be just empty and of no interest.

Guenther

On 05/05/17 07:44, Jeremy Allison via samba-technical wrote:
> On Thu, May 04, 2017 at 11:44:50AM +0200, Günther Deschner via samba-technical wrote:
>> Hi,
>>
>> please review and push.
> 
> Doesn't this then only print the first 4 bytes of the blob.
> If it's bigger, shouldn't we be printing all of it ?
> 
> Just curious.
> 
> Jeremy.
> 
>> -- 
>> Günther Deschner                    GPG-ID: 8EE11688
>> Red Hat                         gdeschner at redhat.com
>> Samba Team                              gd at samba.org
> 
>> From 6f8fd87e78e3a61feeae66219176c812f63acc3e Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
>> Date: Wed, 3 May 2017 11:31:20 +0200
>> Subject: [PATCH] s3-rpcclient: Fix enumdata spoolss display of REG_DWORD
>>
>> One should not assume a REG_DWORD is always 4 byte long.
>>
>> Guenther
>>
>> Signed-off-by: Guenther Deschner <gd at samba.org>
>> ---
>>  source3/rpcclient/cmd_spoolss.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
>> index e5077d5..b7cdd5b 100644
>> --- a/source3/rpcclient/cmd_spoolss.c
>> +++ b/source3/rpcclient/cmd_spoolss.c
>> @@ -770,7 +770,7 @@ static void display_reg_value(const char *name, enum winreg_Type type, DATA_BLOB
>>  
>>  	switch(type) {
>>  	case REG_DWORD:
>> -		if (blob.length == sizeof(uint32_t)) {
>> +		if (blob.length >= sizeof(uint32_t)) {
>>  			printf("%s: REG_DWORD: 0x%08x\n", name, IVAL(blob.data,0));
>>  		} else {
>>  			printf("%s: REG_DWORD: <invalid>\n", name);
>> -- 
>> 2.9.3
>>
> 
> 
> 
> 


-- 
Günther Deschner                    GPG-ID: 8EE11688
Red Hat                         gdeschner at redhat.com
Samba Team                              gd at samba.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 201 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170505/6b735181/signature.sig>


More information about the samba-technical mailing list