[SCM] Samba Shared Repository - branch master updated - 16bbfc22629ea9e9aebc6164cae28a6b031cd9e0

Tim Prouty tprouty at samba.org
Wed Oct 15 16:35:16 GMT 2008


On Oct 14, 2008, at 5:48 PM, Andrew Bartlett wrote:

> On Tue, 2008-10-14 at 19:34 -0500, Tim Prouty wrote:
>> The branch, master has been updated
>>       via  16bbfc22629ea9e9aebc6164cae28a6b031cd9e0 (commit)
>>      from  98a6b91da57ba71a0fe971cb24b1647d5f0062e8 (commit)
>>
>> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
>>
>>
>> - Log  
>> -----------------------------------------------------------------
>> commit 16bbfc22629ea9e9aebc6164cae28a6b031cd9e0
>> Author: Tim Prouty <tim.prouty at isilon.com>
>> Date:   Mon Oct 6 18:55:21 2008 -0700
>>
>>    Fixed "argument differ in signedness" warning on linux
>
>> -static NTSTATUS validate_smb_crypto(struct cli_state *cli, uint8_t  
>> *pdu)
>> +static NTSTATUS validate_smb_crypto(struct cli_state *cli, char  
>> *pdu)
>> {
>> 	NTSTATUS status;
>>
>> @@ -710,7 +710,7 @@ static NTSTATUS validate_smb_crypto(struct  
>> cli_state *cli, uint8_t *pdu)
>> 	if (cli_encryption_on(cli) && CVAL(pdu, 0) == 0) {
>> 		uint16_t enc_ctx_num;
>>
>> -		status = get_enc_ctx_num(pdu, &enc_ctx_num);
>> +		status = get_enc_ctx_num((uint8_t *)pdu, &enc_ctx_num);
>
> This does not look right - binary data buffers should always be  
> uint8_t
> *, and never char * (which in Samba normally indicates an ascii-like
> string).  Rather than adding casts, perhaps find the caller where the
> wrong sign starts?

Maybe I should have included the warnings in the commit message:

libsmb/async_smb.c: In function ‘validate_smb_crypto’:
libsmb/async_smb.c:727: warning: pointer targets in passing argument 2  
of ‘common_decrypt_buffer’ differ in signedness
libsmb/async_smb.c:735: warning: pointer targets in passing argument 2  
of ‘cli_check_sign_mac’ differ in signedness
libsmb/async_smb.c: In function ‘handle_incoming_pdu’:
libsmb/async_smb.c:812: warning: pointer targets in passing argument 2  
of ‘validate_smb_crypto’ differ in signedness

common_decrypt_buffer and cli_check_sign_mac which are both called  
from validate_smb_crypto, expect the buf to be a char * as opposed to  
a uint8_t  *.  Additionally, the only caller of validate_smb_crypto is  
using a char * for its buf.

Upon further inspection, my patch basically reverts Volker's patch:  
eeac8d4fbe729830b6daf6ee2e53db277000ffda.  Volker, have you considered  
changing this whole call stack to use uint8_t * all of the way down to  
the evt_inbuf in struct cli_state to avoid the need for casts at all?   
This would probably be the best direction to go before more async  
client functionality is implemented.

-Tim


More information about the samba-technical mailing list