Projet

Général

Profil

0001-ldap-add-DN-to-normalized-results.patch

Voir les différences:

Subject: [PATCH 1/2] ldap: add DN to normalized results

 src/authentic2/backends/ldap_backend.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
src/authentic2/backends/ldap_backend.py
1115 1115
                    for dn, attrs in results:
1116 1116
                        log.debug(u'Object retrieved for extra attr %s with item %s : %s %s' % (
1117 1117
                            extra_attribute_name, item, dn, attrs))
1118
                        obj_attributes = attrs.copy()
1119
                        obj_attributes['dn'] = dn
1120 1118
                        for key in ldap_attributes_mapping:
1121
                            item_value[key] = obj_attributes.get(ldap_attributes_mapping[key].lower())
1119
                            item_value[key] = attrs.get(ldap_attributes_mapping[key].lower())
1122 1120
                            log.debug('Object attribute %s value retrieved for extra attr %s with item %s : %s' % (
1123 1121
                                ldap_attributes_mapping[key], extra_attribute_name, item, item_value[key]))
1124 1122
                            if not item_value[key]:
......
1317 1315
            results = cls.paged_search(conn, user_basedn, ldap.SCOPE_SUBTREE, user_filter, attrlist=attribute_names)
1318 1316
            backend = cls()
1319 1317
            for dn, attrs in results:
1320
                data = attrs.copy()
1321
                data['dn'] = dn
1322
                yield backend._return_user(dn, None, conn, block, data)
1318
                yield backend._return_user(dn, None, conn, block, attrs)
1319

  
1323 1320

  
1324 1321
    @classmethod
1325 1322
    def ad_encoding(cls, s):
......
1357 1354
            # ignore referrals
1358 1355
            if not dn:
1359 1356
                continue
1360
            new_attrs = {}
1357
            new_attrs = {'dn': dn}
1361 1358
            for key in attrs:
1362 1359
                try:
1363 1360
                    new_attrs[key.lower()] = [force_text(value, encoding) for value in attrs[key]]
1364
-