From: Douglas Bagnall Date: Tue, 8 Dec 2020 22:50:37 +0000 (+1300) Subject: dbcheck: clarify check_object userparams X-Git-Tag: samba-4.14.0rc1~425 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9bf9b998088b181955994da2004bf459ef131037;p=thirdparty%2Fsamba.git dbcheck: clarify check_object userparams Signed-off-by: Douglas Bagnall Reviewed-by: Noel Power --- diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index 71672482c59..364dc9427d7 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -2447,12 +2447,12 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) if attrname.lower() == 'userparameters': userparams = obj[attrname][0] - if len(userparams) == 1 and userparams[0] == b'\x20'[0]: + if userparams == b' ': error_count += 1 self.err_short_userParameters(obj, attrname, obj[attrname]) continue - elif userparams[:16] == b'\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00\x20\x00': + elif userparams[:16] == b'\x20\x00' * 8: # This is the correct, normal prefix continue @@ -2463,8 +2463,13 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) continue #43:00:00:00:74:00:00:00:78 - elif userparams[1] != b'\x00'[0] and userparams[3] != b'\x00'[0] and userparams[5] != b'\x00'[0] and userparams[7] != b'\x00'[0] and userparams[9] != b'\x00'[0]: - # This is a prefix that is not in UTF-16 format for the space or munged dialback prefix + elif (userparams[1] != 0 and + userparams[3] != 0 and + userparams[5] != 0 and + userparams[7] != 0 and + userparams[9] != 0): + # This is a prefix that is not in UTF-16 format + # for the space or munged dialback prefix error_count += 1 self.err_utf8_userParameters(obj, attrname, obj[attrname]) continue @@ -2475,8 +2480,14 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) self.err_odd_userParameters(obj, attrname) continue - elif userparams[1] == b'\x00'[0] and userparams[2] == b'\x00'[0] and userparams[3] == b'\x00'[0] and userparams[4] != b'\x00'[0] and userparams[5] == b'\x00'[0]: - # This is a prefix that would happen if a SAMR-written value was replicated from a Samba 4.1 server to a working server + elif (userparams[1] == 0 and + userparams[2] == 0 and + userparams[3] == 0 and + userparams[4] != 0 and + userparams[5] == 0): + # This is a prefix that would happen if a + # SAMR-written value was replicated from a Samba + # 4.1 server to a working server error_count += 1 self.err_doubled_userParameters(obj, attrname, obj[attrname]) continue