Commit graph

902 commits

Author SHA1 Message Date
Arthur Schiwon
33ac5fc640
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-05-19 15:09:39 +02:00
Arthur Schiwon
3c91048ad4
be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-21 14:04:20 +01:00
Arthur Schiwon
a5228a0c42
adjust backport to stable20
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-15 13:23:26 +01:00
Arthur Schiwon
2208ed6f67
fix code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-15 13:23:25 +01:00
Arthur Schiwon
c14dda9b44
fix use of executeQuery and -Statement
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-15 13:23:25 +01:00
Côme Chilliet
3188f5dc76
Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-15 13:23:25 +01:00
Côme Chilliet
9c7b769cb2
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-15 13:23:25 +01:00
Arthur Schiwon
66a9b77b37
add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-15 13:23:25 +01:00
Arthur Schiwon
bf31badac4
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-15 13:23:24 +01:00
Arthur Schiwon
6813b38148
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-15 13:23:24 +01:00
Côme Chilliet
d6b0ff4163
Functions executeQuery and executeStatement do not exists in 20
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-17 12:00:02 +01:00
Côme Chilliet
02e78231f9
Fix Types namespace for version 20
Use Doctrine\DBAL\Types\Types instead of OCP\DB\Types

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-17 10:34:52 +01:00
Côme Chilliet
e20548731f Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:46:46 +00:00
Côme Chilliet
f2204af7b2 Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:46:44 +00:00
Côme Chilliet
85f5fe6dda 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:46:44 +00:00
Côme Chilliet
d6d5f3d2f3 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:46:43 +00:00
Côme Chilliet
4b40402821 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:46:42 +00:00
Côme Chilliet
84c4f8530b
Merge pull request #30269 from nextcloud/backport/29523/stable20
[stable20] Support LDAP dns longer than 255 characters
2022-01-06 11:28:18 +01:00
Arthur Schiwon
55a27ead50 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-30 10:25:14 +00:00
Côme Chilliet
5a2b7fbc46
Adapt execute function name for stable21
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:51:53 +01:00
Côme Chilliet
e2d861313f
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:51:01 +01:00
Côme Chilliet
e3d541bf32
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:50:55 +01:00
Côme Chilliet
a51e366b0a
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:50:49 +01:00
Côme Chilliet
2a726a33e8
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-14 16:50:42 +01:00
Côme Chilliet
2aa748b782
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-14 16:50:35 +01:00
Côme Chilliet
0680271155
Fixes in migration step
We cannot set ldap_dn_hash column as notnull because it is empty for
 existing users before postSchemaChange is called

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:50:23 +01:00
Côme Chilliet
c22c7fa7a4
Put back length check to have a clear error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:50:17 +01:00
Côme Chilliet
e5c8ea4f5d
Fixed migration step for user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:50:09 +01:00
Joas Schilling
462b421cdb
Fix variable names
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-14 16:50:02 +01:00
Côme Chilliet
2ca7f31cbf
Change column names to ldap_dn and ldap_dn_hash and add migration
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:49:55 +01:00
Côme Chilliet
3d8d4f8c1b
Support LDAP dns longer than 255 characters
Adds an ldap_full_dn column to store the dn, and only store a sha256
 hash in the ldap_dn which is shorter and can be indexed without
 trouble.
Migration still needs to be implemented.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 16:49:31 +01:00
Côme Chilliet
349f4f6263 Fix Access constructor call
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-29 09:03:12 +00:00
Côme Chilliet
07c9dc0e4e Use Psr\Log\LoggerInterface where it can easily be used in user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-29 09:03:12 +00:00
Côme Chilliet
63f29cac4b Fix two mistakes in previous migration to LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-29 09:03:12 +00:00
Côme Chilliet
3f8ea18b45 Use Psr\Log\LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-29 09:03:12 +00:00
Côme Chilliet
355bf52508 Avoid PHP errors when the LDAP attribute is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-29 09:03:12 +00:00
blizzz
031c89ae52
adjust to old db interfaces
Co-authored-by: Daniel <mail@danielkesselberg.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-10-05 13:02:07 +02:00
Arthur Schiwon
e76211fdad
ensure that user and group IDs in LDAP's tables are also max 64chars
- limitation by core tables (e.g. sharing), IDs are always 64chars
- when longer group IDs were requested they are hashed (does not affect
  displaynames)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-27 17:59:52 +02:00
Arthur Schiwon
e1cac915e7 fix caching of objectsid searches
- store result when no name could be retrieved, too
- cached value is not an array, was treated wrongly

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-24 15:11:42 +00:00
Arthur Schiwon
46ae746379 do not try to search after the last page
- saves an LDAP requests in these cases
- prevents a Protocol Error logged on < 7.3 API (for backports)

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-04-27 17:41:58 +00:00
Arthur Schiwon
d78b213310
adds ldap user:reset command
- allows to delete data of existing LDAP users, which otherwise is safe
  guarded
- ensures that the user is not being deleted on LDAP through a plugin

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-25 13:36:16 +01:00
blizzz
6ee39e204f
Merge pull request #25844 from nextcloud/backport/25757/stable20
[stable20] fix detecting cyclic group memberships
2021-03-03 10:43:21 +01:00
Arthur Schiwon
4b9037e849 do not die after LDAP auth failed with expired acc
- some servers return error code 53

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-02 20:40:06 +00:00
Arthur Schiwon
ce6d64b122 fix detecting cyclic group memberships
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-01 11:13:14 +00:00
Arthur Schiwon
02ae52bb5b
really use known groups
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-02-17 13:51:08 +01:00
Arthur Schiwon
71a762b3a7 fix parameter provided as string not array
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-28 19:40:13 +00:00
Robin Appelman
b38149edaa extend ILDAPProvider to allow reading arbitrairy ldap attributes for users
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-22 13:33:32 +00:00
Arthur Schiwon
9d8b597605 silence log message
- this appears too often (in some configurations) when qualifying group
members which do not meet the criteria

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-21 21:09:57 +00:00
Arthur Schiwon
5dd7665f21
silence psalm false positive
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-14 13:04:02 +01:00
Arthur Schiwon
b0ea654653
respect DB limits limit per statement and query
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-14 13:03:36 +01:00