#50512 Issue 50511 - lib389 PosixGroups type can not handle rdn properly
Closed by spichugi. Opened by aborah.
aborah/389-ds-base possix  into  master

Download 50512.patch

Description: lib389 PosixGroups type can not handle rdn properly

Fixes: https://pagure.io/389-ds-base/issue/50511

Author: aborah

Reviewed by: ???

It is better to compare it with None. More safe

It is better to compare it with None. More safe

The original Issue considers e.g. an empty string to be the same case as None. Therefore, the suggestion would be invalid. However, a question would be if the original request is itself valid; IDK.

@spichugi if we compare with None . it will make it

    if rdn is None:
        self._basedn = basedn
    else:
        self._basedn = '{},{}'.format(rdn, basedn)

(Pdb) PosixGroups(topo_m4.all_insts.get('master1'), SUBSUFFIX, rdn=None)._basedn
'dc=SubSuffix,dc=autoMembers,dc=com' ---- right
(Pdb) PosixGroups(topo_m4.all_insts.get('master1'), SUBSUFFIX, rdn='')._basedn
',dc=SubSuffix,dc=autoMembers,dc=com' ---- wrong

with the current version:

    if rdn:
        self._basedn = '{},{}'.format(rdn, basedn)
    else:
        self._basedn = basedn

(Pdb) PosixGroups(topo_m4.all_insts.get('master1'), SUBSUFFIX, rdn=None)._basedn
'dc=SubSuffix,dc=autoMembers,dc=com' ---- right
(Pdb) PosixGroups(topo_m4.all_insts.get('master1'), SUBSUFFIX, rdn='')._basedn
'dc=SubSuffix,dc=autoMembers,dc=com' ---- right

so we have to go with current version

rebased onto 2c0ab1e780df9c43283c4923785475b894b994e1

@spichugi changes are done , as per pour suggestion .

Please, fix other groups.py functionality too as stated in the issue.

rebased onto 0b0d360adc8db5507024d45de9492f26640dd5c7

@spichugi changes are done

I think it is better to preserve ensure_str(rdn), ensure_str(basedn) part because it is safer.
Sorry if I created confusion by me first comment here.

rebased onto c64030836b87014146a4617ed0e97dd2bc397abb

@spichugi changes are done

You haven't applied the same logic for PosixGroups... Was it intentional?

rebased onto 9ea5b9bf17cd3391816a50ed12427e42a0feaca9

You haven't applied the same logic for PosixGroups... Was it intentional?

ensure_str was not imported there in PosixGroups before , now i have imported and applied same logic there also .

Pull-Request has been merged by spichugi

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 pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3568

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata