[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6324) slapd -d ? emits incorrect value for LDAP_DEBUG_ANY on x86_64



jwm@horde.net wrote:
> On Tue, Oct 06, 2009 at 10:04:45PM +0200, masarati@aero.polimi.it wrote:
>>> The 32-bit value 4294967295 for LDAP_DEBUG_ANY is also rejected.
>>> lutil_atoix() declares i as type long and tries to check for overflow(?)
>>> with this cast:
>>>
>>> if ( (long)(int)i != i ) {
>>>
>>> which always fails in this case on x86_64. lutil_atoux() might be the more
>>> appropriate choice here.
>>>
>>> str2loglevel() seems to behave correctly by virtue of verb_to_mask()
>>> returning an index into loglevel_ops, but I haven't checked extensively.
>>> loglevel_init(), however, does specify a hardcoded -1 for the Any level
>>> instead of LDAP_DEBUG_ANY.
>> Please check the fix in HEAD.  I can't check right now on x86_64, but I'll
>> probably do it tomorrow.  Apparently, I didn't break anything on 32 bit.
> 
> 'slapd -d ?' still lists the 64-bit value for LDAP_DEBUG_ANY on x86_64:
> 
> --
> Installed log subsystems:
> 
>         Any                            (18446744073709551615)
> [...]
> --
> 
> As I mentioned, this is due to the unsigned long format specifier (%lu) in
> loglevel_print(). Changing the format specifier to %u emits the correct
> value (4294967295) on this architecture.
> 
> With your fix, slapd accepts the numeric value 4294967295 for
> LDAP_DEBUG_ANY on x86_64.

OK, I overlooked that.  My point was to make sure unsigned values are 
correctly cast into (unsigned)-1 by routines intended to deal with 
integers.  I'll fix that again.

Thanks, p.