Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(LDAP) respect DB limits of arguments in an IN statement #25020

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Jan 7, 2021

Try to get a big list of users or groups from LDAP (you need to have them), for instance via php occ ldap:search --limit=3500 ''. The actual number of users depends on the database in use. When it is too many, you may run into SQLSTATE[HY000]: General error: 7 number of parameters must be between 0 and 65535 (Postgres) or ORA-01795: maximum number of expressions in a list is 1000 (Oracle). Both MySQL/MariaDB and Sqlite do not have a specific limit of arguments, but of total bytes per statement. With 1000 entries (currently limited to 255bytes each) default values are not being exceeded.

Background: when fetching users or groups from LDAP we collect the DN and fetch information from the database. In order to avoid a single read operation per entry, we collect them. Normally we do not need to deal with this huge numbers. Although, depending on the perspective, 1000 is already low. This is relevant when all users or groups are being fetched, which might happen. The prominent case for groups is the users page, as they are not paginated.

@blizzz
Copy link
Member Author

blizzz commented Jan 7, 2021

/backport to stable20

@rullzer rullzer mentioned this pull request Jan 7, 2021
5 tasks
@blizzz
Copy link
Member Author

blizzz commented Jan 7, 2021

/backport to stable19

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz force-pushed the fix/noid/limitied-allowed-items-db-in branch from 82ffd50 to 6eca8d6 Compare January 7, 2021 19:17
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Makes sense 👍

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

sure

@nickvergessen
Copy link
Member

I guess we could make the querybuilder always log a fatal when running with more than 1k ?

@MorrisJobke
Copy link
Member

I guess we could make the querybuilder always log a fatal when running with more than 1k ?

Yep 👍

@blizzz
Copy link
Member Author

blizzz commented Jan 8, 2021

I guess we could make the querybuilder always log a fatal when running with more than 1k ?

I had this thought briefly, although more in the direction that it would split it up itself. But didn't want to mess with the query and provoke odd behaviour. Logging a fatal makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants