[PATCHES] Some fixes in s4/scripting/upgradeprovision

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Fri Oct 12 02:21:01 UTC 2018


On 12/10/18 12:47, Douglas Bagnall via samba-technical wrote:
> On 11/10/18 21:24, Noel Power wrote:
>>
>> -            if (long(str(old[0][att])) == 0):
>> +            if (int(str(old[0][att])) == 0):
>>
>>
>> very minor nitpick, we should do
>>
>> -            if (long(str(old[0][att])) == 0):
>> +            if (int(old[0][att]) == 0):
>>
>> and remove the attempt to convert to str because it could cause a
>> UnicodeDecode error rather than a desired ValueError if the attribute
>> value is not a valid string/byte/bytearray representation of a number. I
>> don't think anyone is filtering any particular exceptions here so
>> probably not a real issue with this piece of code perse
> 
> A good point. There are a few other cases in that file so I have made
> another patch as attached.

Ah, but it won't work, at least not in the form of my patch:

Traceback (most recent call last):
  File "/tmp/samba-testbase/b17/samba-none-env/bin/samba_upgradeprovision", line 1702, in <module>
    minUSN = int(get_max_usn(ldbs.sam, str(names.rootdn))) + 1
TypeError: int() argument must be a string or a number, not 'ldb.MessageElement'

Douglas



More information about the samba-technical mailing list