Commit graph

970 commits

Author SHA1 Message Date
Côme Chilliet
fdb20a036d fix: Add missing Attribute and fix parameter type in renewpassword route
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-03-19 10:34:01 +00:00
John Molakvoæ
61a62bdfbf Fix createNamedParameter in LDAP migrations
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2023-02-02 08:31:59 +00:00
Côme Chilliet
b19b0c8954
Remove property type for PHP 7.3 support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:57:24 +01:00
Côme Chilliet
7fdadce1ec
Use the new octetLength function to filter lines to migrate
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:56:49 +01:00
Côme Chilliet
0303021ed5
Adapt max length limit in AbstactMapping to match database
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:56:49 +01:00
Arthur Schiwon
569eeece72
shrink ldap_dn column to 4000
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-12-20 10:56:49 +01:00
Arthur Schiwon
7a944f748a
limit ldap_dn columns to 4000
- enlarging string cols from 255 to more than 4000 fails on default
  Oracle installations for invalid datatype conversion

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-12-20 10:56:42 +01:00
Côme Chilliet
8e73f29480 Add octetLength and charLength to function builder, and tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-13 16:14:15 +00:00
Côme Chilliet
884ea3e870 Use getLengthExpression to measure field length instead of like
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-13 16:14:14 +00:00
Joas Schilling
2dd9f285f4 Remove unused method
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-24 17:32:35 +00:00
Joas Schilling
1bd60e6df9 Fix plural usage in LDAP wizard
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-24 17:32:33 +00:00
Carl Schwan
e3021049f4 Don't use slow hashing to check the LDAP binding
Using password_hash is expensive and should be used for hashing
passwords when saving them in the database. Here we just want to see if
the bind was already done with the given password, so use a fast hashing
algorythm.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-05 16:59:42 +00:00
Côme Chilliet
fd61479c46
Avoid updating _lastChange when nothing is changed in the configuration
Had to set at least one var when creating an empty configuration in
 order to save the default values.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-22 12:48:10 +02:00
Côme Chilliet
68c4726e51
Do not update _lastChanged on auto-detected attributes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-22 12:46:20 +02:00
blizzz
74c3e6d8a4
Merge pull request #31777 from nextcloud/backport/31514/stable22
[stable22] user_ldap fix ldap connection resets #31421
2022-04-14 12:50:41 +02:00
blizzz
76f2400e1e
Merge pull request #31522 from nextcloud/backport/31491/stable22
[stable22] Fix duplicated UUID detection when there are empty uuids
2022-04-14 12:39:51 +02:00
Côme Chilliet
6b7f95b25b Fix $baseDN parameter type in ILDAPWrapper::read
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-04 08:32:42 +00:00
Côme Chilliet
b736d65f3e Inherit doc from interface in LDAP class
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-04 08:32:42 +00:00
Côme Chilliet
4db523c3fa Fix unit tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-04 08:32:42 +00:00
Côme Chilliet
755237f594 Fix executeRead when connection is reset because of a timeout
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-04 08:32:42 +00:00
Christoph Wurst
3f19da00f7 Fix assignment of the LDAP Wizard connection
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-04-01 08:56:25 +00:00
Arthur Schiwon
6a7353a3b6 do not forget DB table prefix with truncate query
- as used in LDAP's AbstractMapping::clear() method
- and in Comment's ManagerTest::setUp()
- fixes a DB Exception with Oracle

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-22 16:34:19 +00:00
Côme Chilliet
503b7422f5 Fix similar potential problems with fetchOne loops
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 17:23:48 +00:00
Côme Chilliet
1bb981abd6 Fix duplicated UUID detection when there are empty uuids
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 17:23:48 +00:00
Côme Chilliet
e610e9935d
Make it explicit that a DN can be used for ldap:check-user
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 14:40:31 +01:00
Côme Chilliet
07458e62bd
Improve typing in apps/user_ldap/lib/Command/CheckUser.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 14:40:24 +01:00
Côme Chilliet
bc6c11d79a
Remove parenthesis around return in apps/user_ldap/lib/Command/CheckUser.php
Co-authored-by: Carl Schwan <carl@carlschwan.eu>

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 14:40:16 +01:00
Côme Chilliet
fbb510d3f4
Fix ldap:check-user method for newly created LDAP users
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 14:40:00 +01:00
Arthur Schiwon
c0cc764a6a code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-04 09:33:16 +00:00
Arthur Schiwon
73d5e0c6ae be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-04 09:33:15 +00:00
Côme Chilliet
e502220693 Check LDAP upon user deletion instead of refusing based on cached information
This should avoid having to wait for background job to run after
 deleting a user in LDAP before being able to delete it in Nextcloud.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-21 15:48:07 +00:00
Côme Chilliet
6201d4c157 Ignore cache in occ ldap:check-ldap command
This avoids having to wait or reset the cache after deleting a user in
 the LDAP.
This also fixes a PHP error when running ldap:check-ldap --update on a
 deleted but cached user.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-21 15:48:07 +00:00
Côme Chilliet
a1d6678c25 Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 18:48:33 +00:00
Côme Chilliet
ef11c61f19 Fix ldap:update-uuid
Generators cannot be iterated with while or returned by an other
 generator, using foreach instead.
And a few other problems.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 18:48:33 +00:00
Arthur Schiwon
91578d0e5a add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 18:48:33 +00:00
Arthur Schiwon
0931853023 allow to re-run migration step when backup DB is already created
- to heal incomplete states from broken upgrades

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 18:48:33 +00:00
Arthur Schiwon
ac68b0662a invalidated duplicated UUIDs prior to migration change
- in a proper setup there are no duplicated UUIDs
- not all setups are proper
- log warning to admin

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 18:48:32 +00:00
Carl Schwan
57514e44a9
Psalm fixing
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-27 17:20:48 +01:00
Côme Chilliet
089377bd0d Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:56 +00:00
Côme Chilliet
488e17cd44 Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:54 +00:00
Côme Chilliet
9a13fb0b0e Move duplicated code to a base class for group_mapping migrations
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
2022-01-14 08:40:54 +00:00
Côme Chilliet
3d3bbf92aa Split dropTable and createTable in two migrations
It is not possible to drop and create the same table in one migration

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:53 +00:00
Côme Chilliet
58cd5eb2e1 Fix primary key change in user_ldap migration
Use a backup table to copy the data, drop table and recreate it with
 correct primary key, then copy the data back and drop the backup table.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:40:52 +00:00
Louis
7f82061ab9
Merge pull request #30340 from nextcloud/backport/29329/stable22
[stable22] fix potential unwarranted memberships in nested groups from LDAP
2021-12-30 11:03:03 +01:00
Côme Chilliet
c891fffde8 [stable23] Avoid use of iconv to get rid of unicode
Using iconv for translit depends upon server configuration, locale, and
 PHP version. Using htmlentities instead to have a consistent behavior
 independent of configuration.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Co-authored-by: MichaIng <micha@dietpi.com>
2021-12-20 09:57:43 +00:00
Arthur Schiwon
ad0ea2ccb0 fix potential unwarranted memberships in nested groups from LDAP
- the issue was present only when using PHP based resolving of nested
  group members. Normally nested members are common in AD (and Samba4) and
  are resolved per LDAP_MATCHING_RULE_IN_CHAIN by default
- resolving nested members is recursive
- when the cache entry was created it happend for intermediate groups, too,
  containing members from the parent group
- the check was added to only cache the root group with its members
- a runtime cache stores intermediate ldap read results


Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-12-20 09:10:49 +00:00
Côme Chilliet
1523482047
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:36 +01:00
Côme Chilliet
30507846bc
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:36 +01:00
Côme Chilliet
ddb9727be1
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:35 +01:00
Côme Chilliet
bab9964c01
Make sure that hash function returns a string
The documentation says it can return false, and even if that is highly
 unlikely for sha256, better safe than sorry.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:05:35 +01:00