Commit graph

927 commits

Author SHA1 Message Date
Arthur Schiwon
a7ee9f561e 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 17:24:11 +00:00
Arthur Schiwon
b62ac487a0
be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-03-21 13:56:48 +01:00
Arthur Schiwon
28b5f0ccce
fix code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-11 10:14:03 +01:00
Arthur Schiwon
37a5a266df
fix use of executeQuery and -Statement
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 23:18:09 +01:00
Côme Chilliet
31ac987c3d Fix psalm errors in apps/user_ldap/lib/Jobs/CleanUp.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-02-10 21:40:24 +00:00
Côme Chilliet
a6e367ecbf 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 21:40:24 +00:00
Arthur Schiwon
3e434f27a4 add occ command to update UUIDs (incomplete)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2022-02-10 21:40:24 +00:00
Arthur Schiwon
8f92270547 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 21:40:23 +00:00
Arthur Schiwon
2ff0fffbd3 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 21:40:23 +00:00
Carl Schwan
7240843289 Use existing API
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-31 18:31:14 +01:00
Côme Chilliet
7ebbee52b7 Remove useless indexes with duplicated names on backup table
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:43:46 +00:00
Côme Chilliet
417e76cd2d Fix user_ldap migration for long DNs support
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-01-14 08:43:45 +00:00
Côme Chilliet
a56ef49033 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:43:44 +00:00
Côme Chilliet
655dfcda01 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:43:43 +00:00
Côme Chilliet
e9d7ab15fc 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:43:42 +00:00
Louis
4fde409901
Merge pull request #30341 from nextcloud/backport/29329/stable21
[stable21] fix potential unwarranted memberships in nested groups from LDAP
2021-12-30 11:03:30 +01:00
Côme Chilliet
32831de424 [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 10:00:42 +00:00
Arthur Schiwon
47c916d77a 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:13:22 +00:00
Côme Chilliet
f3632cf020
Adapt execute function name for stable21
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 11:04:37 +01:00
Côme Chilliet
5e345f80ce
Add missing copyright headers in migration steps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 11:03:21 +01:00
Côme Chilliet
ded493de06
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 11:00:53 +01:00
Côme Chilliet
44fe945d39
Add an index for directory_uuid as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 10:58:57 +01:00
Côme Chilliet
41e365aa3b
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 10:58:47 +01:00
Côme Chilliet
d8263692d0
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 10:58:37 +01:00
Côme Chilliet
94b5b21e8c
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 10:58:30 +01:00
Côme Chilliet
8367bda445
Put back length check to have a clear error
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 10:58:22 +01:00
Côme Chilliet
dd8d90923e
Fixed migration step for user_ldap
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-14 10:58:13 +01:00
Joas Schilling
c90f9b52d0
Fix variable names
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-12-14 10:58:04 +01:00
Côme Chilliet
8904c51ca9
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 10:57:50 +01:00
Côme Chilliet
071a58a7f4
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 10:57:39 +01:00
Arthur Schiwon
9a4f7172d0 unset ldap provider when disabling user_ldap
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-12-01 08:27:56 +00:00
Côme Chilliet
23f42f3b50 Make sure mapping cache is cleared when deleting a user
This avoids phantom remnants staying after user deletion

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 10:23:14 +00:00
Côme Chilliet
573a6eadcf 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-19 09:24:55 +00:00
Côme Chilliet
c256c9be19 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-19 09:24:55 +00:00
Côme Chilliet
ad1d9edb43 Use Psr\Log\LoggerInterface in OCA\User_LDAP\Access
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-19 09:24:55 +00:00
Côme Chilliet
2f5dd75b55 Avoid PHP errors when the LDAP attribute is not found
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-19 09:24:54 +00:00
Daniel Kesselberg
670a2d57e3
executeQuery and executeStatement are 22+
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-10-04 19:58:45 +02:00
Arthur Schiwon
24f2974267
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:52:13 +02:00
Arthur Schiwon
4f7ffa69cb 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:09:16 +00:00
Arthur Schiwon
de3aa22057
LDAP: determine shares of offline users only when needed
- determine shares may via Sharing code result in user exists checks
- this may result in an infinite loop when user exists was called before
- the info is really only required at one occ command

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-28 23:57:29 +02:00
Arthur Schiwon
4dc4b7617b 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:39:53 +00:00
Joas Schilling
e9ea4a0f01 Fix parameter types in docs
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-03-22 20:07:53 +01:00
Arthur Schiwon
4cd15b7815 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-17 13:38:55 +00:00
Roeland Jago Douma
3922966f3c
Merge pull request #25843 from nextcloud/backport/25757/stable21
[stable21] fix detecting cyclic group memberships
2021-03-03 11:34:25 +01:00
Arthur Schiwon
9d937489db 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:02 +00:00
Arthur Schiwon
81fcc0a618 fix detecting cyclic group memberships
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-03-01 11:10:31 +00:00
Christoph Wurst
6a3321cefe
Merge pull request #25101 from nextcloud/fix/noid/ldap-known-groups
LDAP: make actually use of batch read known groups
2021-01-29 10:57:31 +01:00
Arthur Schiwon
90d82b03ef
fix parameter provided as string not array
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-28 15:15:55 +01:00
blizzz
939433363e
Merge pull request #25128 from nextcloud/ldapprovider-get-property
extend ILDAPProvider to allow reading arbitrairy ldap attributes for users
2021-01-22 14:31:19 +01:00
Arthur Schiwon
ef0a3a92f4
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 17:25:44 +01:00