added permissions checks
This commit is contained in:
parent
d8eaaaf47a
commit
856f0cccff
|
@ -24,6 +24,14 @@ if (!is_writable("/var/vmail/$virtualhost")) {
|
|||
|
||||
$roundcubemail = array();
|
||||
|
||||
if (!is_readable('/usr/local/etc/vmail-db-info.conf')) {
|
||||
$user = posix_getpwuid(posix_geteuid());
|
||||
$username = $user['name'];
|
||||
echo "/var/vmail/$virtualhost is not writable by this user ($username).\n";
|
||||
echo "re-run this script as user vmail or root or another user that can read the /usr/local/etc/vmail-db-info.conf config file\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbHost = trim(`grep -m 1 host /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||
$dbDatabase = trim(`grep -m 1 database /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||
$dbUser = trim(`grep -m 1 user /usr/local/etc/vmail-db-info.conf |cut -d = -f 2|cut -d ' ' -f 2`);
|
||||
|
|
|
@ -9,8 +9,8 @@ if ($virtualhost == "") {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (!is_file("/var/vmail/$virtualhost/roundcubemail")) {
|
||||
echo "$virtualhost roundcubemail file does not exist\n";
|
||||
if (!is_readable("/var/vmail/$virtualhost/roundcubemail")) {
|
||||
echo "$virtualhost roundcubemail file does not exist or is not readable by you\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user