Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

jchapma
Copy link
Contributor

@jchapma jchapma commented Jul 9, 2024

Description: When a invalid value for the attribute nsslapd-numlisteners is used, config normalises the value but the invalid value is written to dse.ldif.

Fix description: Modify config to return operations error if an invalid value is used. Modify configdse to handle an operations error if an invalid value is used.

Fixes: #6256

Reviewed by:

if ((strcasecmp(attr_name, CONFIG_MAXDESCRIPTORS_ATTRIBUTE) == 0) ||
(strcasecmp(attr_name, CONFIG_RESERVEDESCRIPTORS_ATTRIBUTE) == 0)) {
(strcasecmp(attr_name, CONFIG_RESERVEDESCRIPTORS_ATTRIBUTE) == 0) ||
(strcasecmp(attr_name, CONFIG_NUM_LISTENERS_ATTRIBUTE) == 0)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why to put the attribute to this check if we don't benefit from that?

We should either remove it from here or we should add this (or something like this with LDAP_UNWILLING_TO_PERFORM) to ldap/servers/slapd/libglobs.c::config_set_num_listeners:

        if (nValue > maxVal) {
            nValue = maxVal;
            retVal = LDAP_UNWILLING_TO_PERFORM;
        } else {
            retVal = LDAP_OPERATIONS_ERROR;
        }

Or do I miss something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is here to cover the corner case where a user has changed version, if we don't add the check and the "nsslapd-numlisteners" attr is present in dse.ldif the instance will fail to start.

IIUC we need to return LDAP_OPERATIONS_ERROR when an invalid value has been used for this attr, otherwise the invalid value gets written to dse.ldif.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look over this again and yes, it is best to return LDAP_UNWILLING_TO_PERFORM when an invalid value for the nsslapd-numlisteners is used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, IIUC, you changed the behaviour now to reject the value instead of normalizing it (as it was before).
Could you please elaborate on why you think it's the current thing to do for nsslapd-numlisteners?

You probably need to change the commit message and test the docstring with the explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the dse backend callback is called there are two passes done for each mod, the first pass validates the value and the second pass apply's the change. With the existing behaviour, when an invalid value is input the config code normalises the value during the first pass, then during the second pass the invalid value is written to dse.ldif, which is why this issue was created.

To avoid this we need to reject an invalid value so the second pass doesn't apply the change. To reject the invalid value we need to return either LDAP_OPERATIONS_ERROR like almost all of the other config_set functions or LDAP_UNWILLING_TO_PERFORM.

Yes the plan was to update the commit message during merge, I need to update the CI test so I will update the doc string also.

@droideck
Copy link
Member

droideck commented Jul 26, 2024

Sorry, I was waiting for GitHub CI to be working again, but maybe we had some fix recently? Could you please rebase onto main?

It will also give us the test you and @ssidhaye added.

jchapma added 4 commits July 26, 2024 15:16
Description: When a invalid value for the attribute nsslapd-numlisteners
is used, config normalises the value but the invalid value is written to
dse.ldif.

Fix description: Modify config to return operations error if an invalid
value is used. Modify configdse to handle an operations error if an
invalid value is used.

Fixes: #6256

Reviewed by:
@jchapma
Copy link
Contributor Author

jchapma commented Jul 29, 2024

Sorry, I was waiting for GitHub CI to be working again, but maybe we had some fix recently? Could you please rebase onto main?

It will also give us the test you and @ssidhaye added.

Rebased with main branch, the CI test I added wasn't used, I just added the with statement to @ssidhaye test.

Copy link
Member

@droideck droideck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jchapma jchapma merged commit 9753fb9 into main Jul 30, 2024
@jchapma jchapma deleted the numlisteners branch July 30, 2024 02:56
vashirov pushed a commit that referenced this pull request Jul 30, 2024
Description: When a invalid value for the attribute nsslapd-numlisteners
is used, config normalises the value but the invalid value is written to
dse.ldif.

Fix description: Modify config to reject an invalid value is used.

Fixes: #6256

Reviewed by: @droideck (Thank you)
vashirov pushed a commit that referenced this pull request Jul 30, 2024
Description: When a invalid value for the attribute nsslapd-numlisteners
is used, config normalises the value but the invalid value is written to
dse.ldif.

Fix description: Modify config to reject an invalid value is used.

Fixes: #6256

Reviewed by: @droideck (Thank you)
vashirov pushed a commit that referenced this pull request Jul 30, 2024
Description: When a invalid value for the attribute nsslapd-numlisteners
is used, config normalises the value but the invalid value is written to
dse.ldif.

Fix description: Modify config to reject an invalid value is used.

Fixes: #6256

Reviewed by: @droideck (Thank you)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nsslapd-numlisteners limit is not enforced

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.