Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ISPConfig 3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lolo888
ISPConfig 3
Commits
a6a997ee
Commit
a6a997ee
authored
Jul 27, 2014
by
Till Brehm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FS#3574 - Improve corrupt maildir removal function
parent
b00e4752
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
server/plugins-available/mail_plugin.inc.php
server/plugins-available/mail_plugin.inc.php
+8
-6
No files found.
server/plugins-available/mail_plugin.inc.php
View file @
a6a997ee
...
...
@@ -107,10 +107,11 @@ class mail_plugin {
$maildomain_path
.
=
'/Maildir'
;
}
//* When the mail user dir exists but it is not a valid maildir,
remove it
//* When the mail user dir exists but it is not a valid maildir,
move it to corrupted maildir folder
if
(
!
empty
(
$maildomain_path
)
&&
is_dir
(
$maildomain_path
)
&&
!
is_dir
(
$maildomain_path
.
'/new'
)
&&
!
is_dir
(
$maildomain_path
.
'/cur'
))
{
exec
(
"su -c 'rm -rf "
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
])
.
"' vmail"
);
$app
->
log
(
'Removed invalid maildir and rebuild it: '
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
]),
LOGLEVEL_WARN
);
if
(
!
is_dir
(
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
]))
$app
->
system
->
mkdirpath
(
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
],
0700
,
$mail_config
[
'mailuser_name'
],
$mail_config
[
'mailuser_group'
]);
exec
(
"su -c 'mv -f "
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
])
.
" "
.
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
]
.
"' vmail"
);
$app
->
log
(
'Moved invalid maildir to corrupted Maildirs folder: '
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
]),
LOGLEVEL_WARN
);
}
//* Create the maildir, if it doesn not exist, set permissions, set quota.
...
...
@@ -238,10 +239,11 @@ class mail_plugin {
$maildomain_path
.
=
'/Maildir'
;
}
//* When the mail user dir exists but it is not a valid maildir,
remove it
//* When the mail user dir exists but it is not a valid maildir,
move it to corrupted maildir folder
if
(
!
empty
(
$maildomain_path
)
&&
is_dir
(
$maildomain_path
)
&&
!
is_dir
(
$maildomain_path
.
'/new'
)
&&
!
is_dir
(
$maildomain_path
.
'/cur'
))
{
exec
(
"su -c 'rm -rf "
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
])
.
"' vmail"
);
$app
->
log
(
'Removed invalid maildir and rebuild it: '
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
]),
LOGLEVEL_WARN
);
if
(
!
is_dir
(
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
]))
$app
->
system
->
mkdirpath
(
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
],
0700
,
$mail_config
[
'mailuser_name'
],
$mail_config
[
'mailuser_group'
]);
exec
(
"su -c 'mv -f "
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
])
.
" "
.
$mail_config
[
'homedir_path'
]
.
'/corrupted/'
.
$data
[
'new'
][
'mailuser_id'
]
.
"' vmail"
);
$app
->
log
(
'Moved invalid maildir to corrupted Maildirs folder: '
.
escapeshellcmd
(
$data
[
'new'
][
'maildir'
]),
LOGLEVEL_WARN
);
}
//* Create the maildir, if it doesn not exist, set permissions, set quota.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment