Skip to content

Commit b84b62a

Browse files
committed
Fixed: FS#636 - Fetchmail/Getmail configs do not delete
1 parent fee7a4a commit b84b62a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/plugins-available/getmail_plugin.inc.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,22 @@ function update($event_name,$data) {
140140
function delete($event_name,$data) {
141141
global $app, $conf;
142142

143+
// load the server specific configuration options for getmail
144+
$app->uses("getconf");
145+
$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
146+
$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
147+
143148
$config_file_path = escapeshellcmd($this->getmail_config_dir.'/'.$data["old"]["source_server"].'_'.$data["old"]["source_username"].'.conf');
144149
if(stristr($config_file_path,"..") || stristr($config_file_path,"|") || stristr($config_file_path,";") || stristr($config_file_path,'$')) {
145150
$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.",LOGLEVEL_ERROR);
146151
return false;
147152
}
148-
if(is_file($config_file_path)) unlink($config_file_path);
153+
if(is_file($config_file_path)) {
154+
unlink($config_file_path);
155+
$app->log("Deleting file: '$config_file_path'.",LOGLEVEL_DEBUG);
156+
} else {
157+
$app->log("Nothing to delete: '$config_file_path'.",LOGLEVEL_DEBUG);
158+
}
149159
}
150160

151161

0 commit comments

Comments
 (0)