From c6623f9ce4e1bde729ed6f729da5981c9f26c728 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Fri, 20 Oct 2023 10:20:57 +0200 Subject: [PATCH] Handle samba changes in samba.security.dom_sid() samba.security.dom_sid() in 4.19 now raises ValueError instead of TypeError. Fix the expected exception. Related: https://pagure.io/freeipa/issue/9466 Signed-off-by: Florence Blanc-Renaud Reviewed-By: Alexander Bokovoy --- ipaserver/dcerpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index 7e585c87639db093222fe2cebca5c9094a22d7ce..675572c036e4ea5434d2c6808dd301b425229b38 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -97,7 +97,7 @@ logger = logging.getLogger(__name__) def is_sid_valid(sid): try: security.dom_sid(sid) - except TypeError: + except (TypeError, ValueError): return False else: return True @@ -457,7 +457,7 @@ class DomainValidator: try: test_sid = security.dom_sid(sid) return unicode(test_sid) - except TypeError: + except (TypeError, ValueError): raise errors.ValidationError(name=_('trusted domain object'), error=_('Trusted domain did not ' 'return a valid SID for ' -- 2.43.0