Commit a263309 intg: convert results returned as bytes to strings

1 file Authored by lslebodn 5 months ago , Committed by jhrozek 5 months ago ,
intg: convert results returned as bytes to strings

With python3 comparisons between byte literals and strings will fail. To
make sure assertions will pass the search results must be converted to
(utf-8) strings first.

Resolves https://pagure.io/SSSD/sssd/issue/3666

Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>

    
 1 @@ -212,12 +212,17 @@
 2       ts_attrs = dict()
 3   
 4       for attr in attr_list:
 5 -         sysdb_attrs[attr] = ldb_conn.get_entry_attr(
 6 -                                      sssd_ldb.CacheType.sysdb,
 7 -                                      type, name, domain, attr)
 8 -         ts_attrs[attr] = ldb_conn.get_entry_attr(
 9 -                                      sssd_ldb.CacheType.timestamps,
10 -                                      type, name, domain, attr)
11 +         val = ldb_conn.get_entry_attr(sssd_ldb.CacheType.sysdb,
12 +                                       type, name, domain, attr)
13 +         if val:
14 +             val = val.decode('utf-8')
15 +         sysdb_attrs[attr] = val
16 + 
17 +         val = ldb_conn.get_entry_attr(sssd_ldb.CacheType.timestamps,
18 +                                       type, name, domain, attr)
19 +         if val:
20 +             val = val.decode('utf-8')
21 +         ts_attrs[attr] = val
22       return (sysdb_attrs, ts_attrs)
23   
24