see #782 - merge in fix from @johnfawcett - escape slashes in the raw password

This commit is contained in:
David Goodwin committed 2023-11-20 21:58:15 +00:00
1 parent 36b59cc8b0
commit ecdd40c9aa
1 file changed
+13 -1
+13 -1
View File
@@ -54,6 +54,18 @@ sub log_and_die {
die $message;
}
sub escape_password {
$output = "";
for $i (0..length($_[0])-1){
$char = substr($_[0], $i, 1);
if ($char eq "\\" or $char eq "\"")
{
$output = $output . "\\";
}
$output = $output . $char;
}
return $output;
}
# read options and arguments
$configfile = "/etc/fetchmail-all/config";
@@ -109,7 +121,7 @@ map{
syslog("info","fetch ${src_user}@${src_server} for ${mailbox}");
$cmd="user '${src_user}' there with password '".decode_base64($src_password)."'";
$cmd="user '${src_user}' there with password '".escape_password(decode_base64($src_password))."'";
$cmd.=" folder '${src_folder}'" if ($src_folder);
if ($mda) {