Commit graph

974 commits

Author SHA1 Message Date
Côme Chilliet
d1051263e9 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:33:13 +00:00
John Molakvoæ
87b552faf8
Fix createNamedParameter in LDAP migrations
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2023-02-01 10:15:55 +01:00
Côme Chilliet
167a54299d
Remove property type for PHP 7.3 support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:45:03 +01:00
Côme Chilliet
a6143ab0da
Use the new octetLength function to filter lines to migrate
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:45:03 +01:00
Côme Chilliet
f9b0c85933
Adapt max length limit in AbstactMapping to match database
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-20 10:45:03 +01:00
Arthur Schiwon
8ce4f33e10
shrink ldap_dn column to 4000
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-12-20 10:45:02 +01:00
Arthur Schiwon
65cd09face
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:45:02 +01:00
Côme Chilliet
131a397472
Add octetLength and charLength to function builder, and tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 10:10:00 +01:00
Côme Chilliet
774bb066d9
Use getLengthExpression to measure field length instead of like
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 10:09:41 +01:00
Joas Schilling
2d748c928e Remove unused method
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-24 17:27:47 +00:00
Joas Schilling
3af407f364 Fix plural usage in LDAP wizard
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-08-24 17:27:45 +00:00
Carl Schwan
22831d27e4 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:49 +00:00
Côme Chilliet
a8ebd9909c 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-25 10:46:07 +00:00
Côme Chilliet
6e1ac0a9bb Do not update _lastChanged on auto-detected attributes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-25 10:46:07 +00:00
Christoph Wurst
766942a554
Fix assignment of the LDAP Wizard connection
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-04-14 13:28:10 +02:00
blizzz
e4b68e4b37
Merge pull request #31521 from nextcloud/backport/31491/stable23
[stable23] Fix duplicated UUID detection when there are empty uuids
2022-04-14 13:18:38 +02:00
Côme Chilliet
ab6439a04b
Fix $baseDN parameter type in ILDAPWrapper::read
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-29 16:20:28 +02:00
Côme Chilliet
0b88d725b0
Inherit doc from interface in LDAP class
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-29 14:50:54 +02:00
Côme Chilliet
92415eaef7
Fix unit tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-29 13:47:52 +02:00
Côme Chilliet
414d4bf200 Fix executeRead when connection is reset because of a timeout
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-29 08:34:03 +00:00
Arthur Schiwon
132af866a7 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 14:19:41 +00:00
Côme Chilliet
a737a2561b Fix similar potential problems with fetchOne loops
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 17:20:31 +00:00
Côme Chilliet
82f9eab30e Fix duplicated UUID detection when there are empty uuids
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-10 17:20:29 +00:00
Arthur Schiwon
75326f7149 code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-04 09:29:56 +00:00
Arthur Schiwon
85e7dc4403 be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-04 09:29:55 +00:00
Côme Chilliet
c29ba3a1d8
Make it explicit that a DN can be used for ldap:check-user
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-22 10:14:58 +01:00
Côme Chilliet
9c34638a36
Improve typing in apps/user_ldap/lib/Command/CheckUser.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-22 10:14:57 +01:00
Côme Chilliet
6e7ed28e06
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-02-22 10:14:57 +01:00
Côme Chilliet
bbfaeabdf3
Fix ldap:check-user method for newly created LDAP users
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-22 10:14:41 +01:00
Côme Chilliet
99c5a414df
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 12:19:52 +01:00
Côme Chilliet
ff7cf4d6b5
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 12:18:47 +01:00
Côme Chilliet
8cd5a901a8
Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 17:46:18 +01:00
Côme Chilliet
3c259d76ee
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 17:46:09 +01:00
Arthur Schiwon
b954462667
add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 17:45:48 +01:00
Arthur Schiwon
9153d698bc
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 17:45:01 +01:00
Arthur Schiwon
f975fe4ff3
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 17:44:46 +01:00
Carl Schwan
d69531ac8e
Fix psalm not running
The issue was that we were using psalm/phar instead of vimeo/psalm. This
caused issue with the custom psalm plugin in buildd/psalm.

This is using the opportunity to also update the psalm version from 3.8
to 3.17 and the php-cs-fixer too.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-27 17:20:00 +01:00
Côme Chilliet
101338063e Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:31:42 +00:00
Côme Chilliet
e4235bdeba Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:31:40 +00:00
Côme Chilliet
66ca2925e7 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:31:38 +00:00
Côme Chilliet
03a570a500 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:31:38 +00:00
Côme Chilliet
d90e9088d0 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:31:36 +00:00
Louis
955cb63e41
Merge pull request #30343 from nextcloud/backport/29329/stable23
[stable23] fix potential unwarranted memberships in nested groups from LDAP
2021-12-30 11:04:39 +01:00
Arthur Schiwon
bf81fa432a 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:18:59 +00:00
Côme Chilliet
4010e58a96 [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 03:00:37 +01:00
Côme Chilliet
b5b080a219
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-13 09:40:38 +01:00
Côme Chilliet
e7a769158d
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-13 09:40:15 +01:00
Côme Chilliet
9e33d51c44
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-13 09:40:08 +01:00
Côme Chilliet
fbed00bab4
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-13 09:39:55 +01:00
Côme Chilliet
98476a9d5d
Add the columns and alter the index in Version1010Date20200630192842
This is to ensure new installations do not need to go through migration
 history.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-13 09:39:45 +01:00