From 398b9fb35f9e0f23d4c3176a3a6f78d64b2723ca Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 9 Dec 2024 17:27:11 +0530 Subject: [PATCH 1/7] Re-enable account creation --- Dockerfile | 4 +++ patches/039-reenable-ac-comment-setupfs.patch | 33 +++++++++++++++++++ .../040-reenable-ac-comment-exception.patch | 21 ++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 patches/039-reenable-ac-comment-setupfs.patch create mode 100644 patches/040-reenable-ac-comment-exception.patch diff --git a/Dockerfile b/Dockerfile index 1ae7463..f0205f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -236,6 +236,10 @@ RUN patch -u ${BASE_DIR}/lib/private/AppFramework/Middleware/Security/CORSMiddle #fixed regression in generic event type for nextcloud 28.0.9 RUN patch -u ${BASE_DIR}/apps/dav/lib/AppInfo/Application.php -i ${TMP_PATCH_DIR}/038-generic-event-fix.patch +#commenting code to re-enable account creation +RUN patch -u ${BASE_DIR}/lib/private/User/Session.php -i ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch +RUN patch -u ${BASE_DIR}/lib/base.php -i ${TMP_PATCH_DIR}/040-reenable-ac-comment-exception.patch + RUN rm -rf ${TMP_PATCH_DIR} diff --git a/patches/039-reenable-ac-comment-setupfs.patch b/patches/039-reenable-ac-comment-setupfs.patch new file mode 100644 index 0000000..f9d5ea2 --- /dev/null +++ b/patches/039-reenable-ac-comment-setupfs.patch @@ -0,0 +1,33 @@ +From: Ronak Patel +Date: Mon, 09 Dec 2024 18:50:00 +0530 +Subject: [PATCH] Enabling account creation which does not check FS for first-time login + +--- ./lib/private/User/Session.php 2024-09-04 16:26:24.610444326 +0000 ++++ ./lib/private/User/Session-new.php 2024-12-09 11:44:00.399364921 +0000 +@@ -542,19 +542,19 @@ + + if ($firstTimeLogin) { + //we need to pass the user name, which may differ from login name +- $user = $this->getUser()->getUID(); +- OC_Util::setupFS($user); ++ //$user = $this->getUser()->getUID(); ++ //OC_Util::setupFS($user); + + // TODO: lock necessary? + //trigger creation of user home and /files folder +- $userFolder = \OC::$server->getUserFolder($user); ++ //$userFolder = \OC::$server->getUserFolder($user); + +- try { ++ //try { + // copy skeleton +- \OC_Util::copySkeleton($user, $userFolder); +- } catch (NotPermittedException $ex) { ++ // \OC_Util::copySkeleton($user, $userFolder); ++ //} catch (NotPermittedException $ex) { + // read only uses +- } ++ //} + + // trigger any other initialization + \OC::$server->get(IEventDispatcher::class)->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); \ No newline at end of file diff --git a/patches/040-reenable-ac-comment-exception.patch b/patches/040-reenable-ac-comment-exception.patch new file mode 100644 index 0000000..90f0062 --- /dev/null +++ b/patches/040-reenable-ac-comment-exception.patch @@ -0,0 +1,21 @@ +From: Ronak Patel +Date: Mon, 09 Dec 2024 18:50:00 +0530 +Subject: [PATCH] Enabling account creation: Comment exception + +--- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 ++++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 +@@ -884,10 +884,10 @@ + } catch (\Exception $e) { + // a GC exception should not prevent users from using OC, + // so log the exception +- Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ +- 'app' => 'core', +- 'exception' => $e, +- ]); ++ //Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ ++ // 'app' => 'core', ++ // 'exception' => $e, ++ //]); + } + }); + } \ No newline at end of file -- GitLab From 26a0c85980dec075299bf2e9a5a5c21cc9143411 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 9 Dec 2024 17:36:25 +0530 Subject: [PATCH 2/7] Re-enable account creation --- patches/039-reenable-ac-comment-setupfs.patch | 22 +++++++++++++++++-- .../040-reenable-ac-comment-exception.patch | 21 ------------------ 2 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 patches/040-reenable-ac-comment-exception.patch diff --git a/patches/039-reenable-ac-comment-setupfs.patch b/patches/039-reenable-ac-comment-setupfs.patch index f9d5ea2..b13024c 100644 --- a/patches/039-reenable-ac-comment-setupfs.patch +++ b/patches/039-reenable-ac-comment-setupfs.patch @@ -1,6 +1,6 @@ From: Ronak Patel Date: Mon, 09 Dec 2024 18:50:00 +0530 -Subject: [PATCH] Enabling account creation which does not check FS for first-time login +Subject: [PATCH] Enabling account creation (by commenting) which does not check FS for first-time login --- ./lib/private/User/Session.php 2024-09-04 16:26:24.610444326 +0000 +++ ./lib/private/User/Session-new.php 2024-12-09 11:44:00.399364921 +0000 @@ -30,4 +30,22 @@ Subject: [PATCH] Enabling account creation which does not check FS for first-tim + //} // trigger any other initialization - \OC::$server->get(IEventDispatcher::class)->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); \ No newline at end of file + \OC::$server->get(IEventDispatcher::class)->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); + +--- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 ++++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 +@@ -884,10 +884,10 @@ + } catch (\Exception $e) { + // a GC exception should not prevent users from using OC, + // so log the exception +- Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ +- 'app' => 'core', +- 'exception' => $e, +- ]); ++ //Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ ++ // 'app' => 'core', ++ // 'exception' => $e, ++ //]); + } + }); + } \ No newline at end of file diff --git a/patches/040-reenable-ac-comment-exception.patch b/patches/040-reenable-ac-comment-exception.patch deleted file mode 100644 index 90f0062..0000000 --- a/patches/040-reenable-ac-comment-exception.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Ronak Patel -Date: Mon, 09 Dec 2024 18:50:00 +0530 -Subject: [PATCH] Enabling account creation: Comment exception - ---- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 -+++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 -@@ -884,10 +884,10 @@ - } catch (\Exception $e) { - // a GC exception should not prevent users from using OC, - // so log the exception -- Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ -- 'app' => 'core', -- 'exception' => $e, -- ]); -+ //Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ -+ // 'app' => 'core', -+ // 'exception' => $e, -+ //]); - } - }); - } \ No newline at end of file -- GitLab From 5befacb2392c85d8c5f96d1b12896393cc9494e5 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 9 Dec 2024 17:37:38 +0530 Subject: [PATCH 3/7] Re-enable account creation --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f0205f4..6e48755 100644 --- a/Dockerfile +++ b/Dockerfile @@ -237,8 +237,7 @@ RUN patch -u ${BASE_DIR}/lib/private/AppFramework/Middleware/Security/CORSMiddle RUN patch -u ${BASE_DIR}/apps/dav/lib/AppInfo/Application.php -i ${TMP_PATCH_DIR}/038-generic-event-fix.patch #commenting code to re-enable account creation -RUN patch -u ${BASE_DIR}/lib/private/User/Session.php -i ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch -RUN patch -u ${BASE_DIR}/lib/base.php -i ${TMP_PATCH_DIR}/040-reenable-ac-comment-exception.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch RUN rm -rf ${TMP_PATCH_DIR} -- GitLab From ac2f03e964c8e7be1f2832a27830806ef0955f1f Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Wed, 11 Dec 2024 14:11:00 +0530 Subject: [PATCH 4/7] separate patch files --- Dockerfile | 3 ++- patches/039-reenable-ac-comment-setupfs.patch | 20 +----------------- .../040-reenable-ac-comment-exception.patch | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 patches/040-reenable-ac-comment-exception.patch diff --git a/Dockerfile b/Dockerfile index 6e48755..f0205f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -237,7 +237,8 @@ RUN patch -u ${BASE_DIR}/lib/private/AppFramework/Middleware/Security/CORSMiddle RUN patch -u ${BASE_DIR}/apps/dav/lib/AppInfo/Application.php -i ${TMP_PATCH_DIR}/038-generic-event-fix.patch #commenting code to re-enable account creation -RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch +RUN patch -u ${BASE_DIR}/lib/private/User/Session.php -i ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch +RUN patch -u ${BASE_DIR}/lib/base.php -i ${TMP_PATCH_DIR}/040-reenable-ac-comment-exception.patch RUN rm -rf ${TMP_PATCH_DIR} diff --git a/patches/039-reenable-ac-comment-setupfs.patch b/patches/039-reenable-ac-comment-setupfs.patch index b13024c..b92be17 100644 --- a/patches/039-reenable-ac-comment-setupfs.patch +++ b/patches/039-reenable-ac-comment-setupfs.patch @@ -30,22 +30,4 @@ Subject: [PATCH] Enabling account creation (by commenting) which does not check + //} // trigger any other initialization - \OC::$server->get(IEventDispatcher::class)->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); - ---- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 -+++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 -@@ -884,10 +884,10 @@ - } catch (\Exception $e) { - // a GC exception should not prevent users from using OC, - // so log the exception -- Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ -- 'app' => 'core', -- 'exception' => $e, -- ]); -+ //Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ -+ // 'app' => 'core', -+ // 'exception' => $e, -+ //]); - } - }); - } \ No newline at end of file + \OC::$server->get(IEventDispatcher::class)->dispatch(IUser::class . '::firstLogin', new GenericEvent($this->getUser())); \ No newline at end of file diff --git a/patches/040-reenable-ac-comment-exception.patch b/patches/040-reenable-ac-comment-exception.patch new file mode 100644 index 0000000..945c501 --- /dev/null +++ b/patches/040-reenable-ac-comment-exception.patch @@ -0,0 +1,21 @@ +From: Ronak Patel +Date: Mon, 09 Dec 2024 18:50:00 +0530 +Subject: [PATCH] Enabling account creation: Comment exception for cache gc + +--- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 ++++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 +@@ -884,10 +884,10 @@ + } catch (\Exception $e) { + // a GC exception should not prevent users from using OC, + // so log the exception +- Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ +- 'app' => 'core', +- 'exception' => $e, +- ]); ++ //Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ ++ // 'app' => 'core', ++ // 'exception' => $e, ++ //]); + } + }); + } \ No newline at end of file -- GitLab From 82da3b08c81276089590322ca317bb969be7450e Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 16 Dec 2024 13:35:07 +0530 Subject: [PATCH 5/7] added new patch for disabling file sytem --- patches/039-reenable-ac-comment-setupfs.patch | 4 ++-- patches/040-reenable-ac-comment-exception.patch | 2 +- patches/041-false-canfilesystem.patch | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 patches/041-false-canfilesystem.patch diff --git a/patches/039-reenable-ac-comment-setupfs.patch b/patches/039-reenable-ac-comment-setupfs.patch index b92be17..8f74643 100644 --- a/patches/039-reenable-ac-comment-setupfs.patch +++ b/patches/039-reenable-ac-comment-setupfs.patch @@ -2,8 +2,8 @@ From: Ronak Patel Date: Mon, 09 Dec 2024 18:50:00 +0530 Subject: [PATCH] Enabling account creation (by commenting) which does not check FS for first-time login ---- ./lib/private/User/Session.php 2024-09-04 16:26:24.610444326 +0000 -+++ ./lib/private/User/Session-new.php 2024-12-09 11:44:00.399364921 +0000 +--- ./lib/private/User/Session.php 2024-12-09 16:26:24.610444326 +0000 ++++ ./lib/private/User/Session-new.php 2024-09-09 11:44:00.399364921 +0000 @@ -542,19 +542,19 @@ if ($firstTimeLogin) { diff --git a/patches/040-reenable-ac-comment-exception.patch b/patches/040-reenable-ac-comment-exception.patch index 945c501..a8ef001 100644 --- a/patches/040-reenable-ac-comment-exception.patch +++ b/patches/040-reenable-ac-comment-exception.patch @@ -2,7 +2,7 @@ From: Ronak Patel Date: Mon, 09 Dec 2024 18:50:00 +0530 Subject: [PATCH] Enabling account creation: Comment exception for cache gc ---- ./lib/base.php 2024-09-04 16:25:48.446616914 +0000 +--- ./lib/base.php 2024-12-09 16:25:48.446616914 +0000 +++ ./lib/base-new.php 2024-12-09 11:51:21.916843879 +0000 @@ -884,10 +884,10 @@ } catch (\Exception $e) { diff --git a/patches/041-false-canfilesystem.patch b/patches/041-false-canfilesystem.patch new file mode 100644 index 0000000..95d9803 --- /dev/null +++ b/patches/041-false-canfilesystem.patch @@ -0,0 +1,15 @@ +From: Ronak Patel +Date: Mon, 16 Dec 2024 18:50:00 +0530 +Subject: [PATCH] Disabling access file system + + +--- ./lib/private/Lockdown/LockdownManager.php 2023-12-16 15:01:25 ++++ ./lib/private/Lockdown/LockdownManager-new.php 2024-12-16 13:31:40 +@@ -77,6 +77,7 @@ + } + + public function canAccessFilesystem() { ++ return false; + $scope = $this->getScopeAsArray(); + return !$scope || $scope['filesystem']; + } -- GitLab From f7af8757675f83113e3616b768935f964a9c865e Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 16 Dec 2024 13:35:10 +0530 Subject: [PATCH 6/7] added new patch for disabling file sytem --- ...e-canfilesystem.patch => 041-return-false-canfilesystem.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{041-false-canfilesystem.patch => 041-return-false-canfilesystem.patch} (100%) diff --git a/patches/041-false-canfilesystem.patch b/patches/041-return-false-canfilesystem.patch similarity index 100% rename from patches/041-false-canfilesystem.patch rename to patches/041-return-false-canfilesystem.patch -- GitLab From abd437e8f1fabeb7846de1416dc4f3d4208ff638 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Mon, 16 Dec 2024 13:35:52 +0530 Subject: [PATCH 7/7] added new patch for disabling file sytem --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index f0205f4..d0392f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -239,6 +239,7 @@ RUN patch -u ${BASE_DIR}/apps/dav/lib/AppInfo/Application.php -i ${TMP_PATCH_DI #commenting code to re-enable account creation RUN patch -u ${BASE_DIR}/lib/private/User/Session.php -i ${TMP_PATCH_DIR}/039-reenable-ac-comment-setupfs.patch RUN patch -u ${BASE_DIR}/lib/base.php -i ${TMP_PATCH_DIR}/040-reenable-ac-comment-exception.patch +RUN patch -u ${BASE_DIR}/lib/private/Lockdown/LockdownManager.php -i ${TMP_PATCH_DIR}/041-return-false-canfilesystem.patch RUN rm -rf ${TMP_PATCH_DIR} -- GitLab