From e5efa217467b5b9e582c62830a94712da7c0e840 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 22 Feb 2024 16:16:17 +1300 Subject: [PATCH] samba-tool domain: add LDB Result to json encoders Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- python/samba/netcmd/encoders.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/samba/netcmd/encoders.py b/python/samba/netcmd/encoders.py index 7f0e41a5cb7..230309f74d9 100644 --- a/python/samba/netcmd/encoders.py +++ b/python/samba/netcmd/encoders.py @@ -25,7 +25,7 @@ from datetime import datetime from decimal import Decimal from enum import Enum -from ldb import Dn +from ldb import Dn, MessageElement, Result from samba.dcerpc.security import descriptor @@ -40,8 +40,10 @@ class JSONEncoder(json.JSONEncoder): """ def default(self, obj): - if isinstance(obj, (Decimal, Dn)): + if isinstance(obj, (Decimal, Dn, MessageElement)): return str(obj) + if isinstance(obj, Result): + return obj.msgs elif isinstance(obj, Enum): return str(obj.value) elif isinstance(obj, datetime):