Quantcast

[PATCH] fix display of REG_DWORD in spoolss rpcclient

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] fix display of REG_DWORD in spoolss rpcclient

Samba - samba-technical mailing list
Hi,

please review and push.

Thanks,
Guenther
--
Günther Deschner                    GPG-ID: 8EE11688
Red Hat                         [hidden email]
Samba Team                              [hidden email]

patch (1K) Download Attachment
signature.asc (208 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] fix display of REG_DWORD in spoolss rpcclient

Samba - samba-technical mailing list
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                         [hidden email]
> Samba Team                              [hidden email]

> From 6f8fd87e78e3a61feeae66219176c812f63acc3e Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <[hidden email]>
> 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 <[hidden email]>
> ---
>  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
>




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] fix display of REG_DWORD in spoolss rpcclient

Samba - samba-technical mailing list
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                         [hidden email]
>> Samba Team                              [hidden email]
>
>> From 6f8fd87e78e3a61feeae66219176c812f63acc3e Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <[hidden email]>
>> 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 <[hidden email]>
>> ---
>>  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                         [hidden email]
Samba Team                              [hidden email]


signature.asc (208 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] fix display of REG_DWORD in spoolss rpcclient

Samba - samba-technical mailing list
On Fri, May 05, 2017 at 06:24:17PM +0200, Günther Deschner wrote:
> 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.

Thanks Günther, makes perfect sense. Pushed !

Loading...