X Tutup
Skip to content

Include a flag to mark if the loginName2userName has been processed#39105

Merged
JammingBen merged 3 commits intomasterfrom
loginname_process_chain
Sep 16, 2021
Merged

Include a flag to mark if the loginName2userName has been processed#39105
JammingBen merged 3 commits intomasterfrom
loginname_process_chain

Conversation

@jvillafanez
Copy link
Member

@jvillafanez jvillafanez commented Aug 11, 2021

Description

Add a flag when asking for the username to indicate that someone has already processed the request and there is no need for others to check further.

Requires:

Related Issue

  • Fixes <issue_link>

Motivation and Context

When the user_ldap app is enabled, logging in with the admin user triggered an LDAP request. This shouldn't happen when the admin's account is empty and there is no relation with any ldap user.
If the LDAP server is busy, it will slow down the login process even for non-ldap users.

How Has This Been Tested?

Having the user_ldap app enabled (and patched), log in with the admin user. With both patches, there is no bind request send to the LDAP server when logged in with the admin user.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented Aug 11, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jvillafanez
Copy link
Member Author

This is pending to confirm that it fixes the original issue. Code should be ready to review, and only the changelog is missing.

@jvillafanez jvillafanez marked this pull request as ready for review September 6, 2021 09:16
@jvillafanez jvillafanez force-pushed the loginname_process_chain branch from 113f0a0 to aae4449 Compare September 6, 2021 09:18
Copy link

@AlexAndBear AlexAndBear left a comment

Choose a reason for hiding this comment

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

I don't like how the value is passed by reference through multiple files, maybe we should use a class to handle this?

@jvillafanez
Copy link
Member Author

I don't think we have a better choice. The result comes from an event, so we shouldn't change the approach. We have multiple listeners and all of them have to respond, so that flag will indicate that we have a valid result and the next listeners shouldn't need to process anything.

A better approach would be to use an interface with a registration process so core could have a better control on who and how the calls are done. The problem is that this is a breaking change which will need changes in all the related apps.

Note that the goal of the fix is that if someone has already returned a valid value for the event, the rest of the listeners shouldn't need to bother to process the event because we already have a result. Without changing the approach of using an event (which, as said, is questionable), using a flag in the event is the easiest solution.

Copy link

@AlexAndBear AlexAndBear left a comment

Choose a reason for hiding this comment

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

Understood, maybe you could add some comments, that those vars are called by reference, so we make sure,no bugs will be implemented later...

@AlexAndBear
Copy link

Restarted CI

@jvillafanez jvillafanez force-pushed the loginname_process_chain branch from 0bb489f to 362bb6e Compare September 13, 2021 10:56
@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUIComments-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/32303/124/1

@phil-davis
Copy link
Contributor

Note: Issue #39213 PR #39219 will skip it. That will be merged when CI finishes. After that you can rebase, and that annoying fail will be gone.

@jvillafanez jvillafanez force-pushed the loginname_process_chain branch from 362bb6e to 8c5e5fb Compare September 13, 2021 12:39
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

76.9% 76.9% Coverage
0.0% 0.0% Duplication

@JammingBen JammingBen merged commit 3967fb2 into master Sep 16, 2021
@delete-merged-branch delete-merged-branch bot deleted the loginname_process_chain branch September 16, 2021 13:02
@jnweiger
Copy link
Contributor

jnweiger commented Dec 1, 2021

Confirmed fixed in 10.9.0 beta1

When user admin types his correct password, no ldap requests are done.
When user admin mistypes his password, ldap is still queried. That is as expected.

@jvillafanez
Copy link
Member Author

Weird... owncloud/user_ldap#675 should be needed and it hasn't been merged yet... 🤔
I'd expect no changes comparing the behaviour with previous versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

X Tutup