#50416 Functions should normalize attribute names
Closed: wontfix 3 years ago by spichugi. Opened 4 years ago by aborah.

Issue Description:

Functions should normalize attribute names

with search_s:
topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, F4, ['cn', 'Cn', 'CN'])
[dn: uid=bhall,ou=People,dc=example,dc=com
cn: Benjamin Hall ]

with filter:
Accounts(topo.standalone, DEFAULT_SUFFIX).filter(F4)[0].get_attrs_vals_utf8(['cn', 'Cn', 'CN'])
{'cn': ['Benjamin Hall'], 'Cn': ['Benjamin Hall'], 'CN': ['Benjamin Hall']}

This filter should return only 'cn' value not Cn, CN


I believe better wording would be ... functions should normalize attribute names. Because currently the issue is they are case sensitive.

Metadata Update from @mhonek:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None

4 years ago

It's a twofold issue... Functions should normalize attribute names for their internal representation (see #50373), but they should respect the case provided by the user and returned by the server.

@vashirov I think even if you were to do ldapsearch ... '(uid=name)' CN, you would get back the attribute as "cn: name". So Ithink that just normalising and deduping on the function call is fine, because we should respect the case the server returns to us in the result.

@vashirov I think even if you were to do ldapsearch ... '(uid=name)' CN, you would get back the attribute as "cn: name".

This is true for openldap, but 389-ds returns attribute name as requested:

$ ldapsearch -x -b dc=example,dc=com -s base DeScRiPtIoN
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope baseObject
# filter: (objectclass=*)
# requesting: DeScRiPtIoN 
#

# example.com
dn: dc=example,dc=com
DeScRiPtIoN: dc=example,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

That is right it returns the first requested attribute name

ldapsearch  -xLLL -h localhost -p 38901  -b "dc=example,dc=com" "(gidNumber=99999)" 
dn: cn=demo_group,ou=groups,dc=example,dc=com
...
cn: demo_group
gidNumber: 99999

ldapsearch  -xLLL -h localhost -p 38901  -b "dc=example,dc=com" "(gidNumber=99999)" GidNumber GIDNUMBER gidNumber
dn: cn=demo_group,ou=groups,dc=example,dc=com
GidNumber: 99999

So then our normalise just has to dedup and remove the subsequent attribute names on request then?

I think that if 'Accounts' wants to mimic the 389-ds behavior, it could build a list of requested attribute as they are provided by the client application. An attribute is added in the list at the condition it is not already present (case insensitive). Then when returning the attribute name/value, 'Accounts' returns the name as present in the list.

Actually we'd do this in DSLdapObject because then every type would get the behaviour that we want here.

Metadata Update from @mreynolds:
- Issue set to the milestone: 1.4.1

4 years ago

Metadata Update from @mreynolds:
- Issue priority set to: minor
- Issue set to the milestone: 1.4.3 (was: 1.4.1)

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/3474

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata