Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
46576767
Commit
46576767
authored
12 years ago
by
Michael Gapczynski
Browse files
Options
Downloads
Patches
Plain Diff
Check blacklist when renaming files
parent
39b9052c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/base.php
+1
-0
1 addition, 0 deletions
lib/base.php
lib/filesystem.php
+11
-3
11 additions, 3 deletions
lib/filesystem.php
with
12 additions
and
3 deletions
lib/base.php
+
1
−
0
View file @
46576767
...
@@ -362,6 +362,7 @@ class OC{
...
@@ -362,6 +362,7 @@ class OC{
// Check for blacklisted files
// Check for blacklisted files
OC_Hook
::
connect
(
'OC_Filesystem'
,
'write'
,
'OC_Filesystem'
,
'isBlacklisted'
);
OC_Hook
::
connect
(
'OC_Filesystem'
,
'write'
,
'OC_Filesystem'
,
'isBlacklisted'
);
OC_Hook
::
connect
(
'OC_Filesystem'
,
'rename'
,
'OC_Filesystem'
,
'isBlacklisted'
);
//make sure temporary files are cleaned up
//make sure temporary files are cleaned up
register_shutdown_function
(
array
(
'OC_Helper'
,
'cleanTmp'
));
register_shutdown_function
(
array
(
'OC_Helper'
,
'cleanTmp'
));
...
...
This diff is collapsed.
Click to expand it.
lib/filesystem.php
+
11
−
3
View file @
46576767
...
@@ -363,13 +363,21 @@ class OC_Filesystem{
...
@@ -363,13 +363,21 @@ class OC_Filesystem{
/**
/**
* checks if a file is blacklsited for storage in the filesystem
* checks if a file is blacklsited for storage in the filesystem
* Listens to write and rename hooks
* @param array $data from hook
* @param array $data from hook
*/
*/
static
public
function
isBlacklisted
(
$data
){
static
public
function
isBlacklisted
(
$data
){
$blacklist
=
array
(
'.htaccess'
);
$blacklist
=
array
(
'.htaccess'
);
$filename
=
strtolower
(
basename
(
$data
[
'path'
]));
if
(
isset
(
$data
[
'path'
]))
{
if
(
in_array
(
$filename
,
$blacklist
)){
$path
=
$data
[
'path'
];
$data
[
'run'
]
=
false
;
}
else
if
(
isset
(
$data
[
'newpath'
]))
{
$path
=
$data
[
'newpath'
];
}
if
(
isset
(
$path
))
{
$filename
=
strtolower
(
basename
(
$path
));
if
(
in_array
(
$filename
,
$blacklist
))
{
$data
[
'run'
]
=
false
;
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment