From 704db5b230c7232588e92820eaacca5ceb1b625e Mon Sep 17 00:00:00 2001 From: fidian Date: Mon, 5 Mar 2001 16:14:53 +0000 Subject: [PATCH] * Got rid of problem with passwords (finally) * Added a new function in strings.php to quote a string to be sent to the IMAP server git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1170 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 4 ++-- functions/strings.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index 830efaa8..8e2dc16b 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -128,8 +128,8 @@ exit; } - fputs ($imap_stream, "a001 LOGIN \"" . addslashes($username) . - '" "' . addslashes($password) . "\"\r\n"); + fputs ($imap_stream, "a001 LOGIN \"" . quoteIMAP($username) . + '" "' . quoteIMAP($password) . "\"\r\n"); $read = sqimap_read_data ($imap_stream, 'a001', false, $response, $message); /** If the connection was not successful, lets see why **/ diff --git a/functions/strings.php b/functions/strings.php index 67409c07..3b737114 100644 --- a/functions/strings.php +++ b/functions/strings.php @@ -569,5 +569,10 @@ return $String; } + + function quoteIMAP($str) + { + return ereg_replace('(["\\])', '\\\\1', $str); + } ?> -- 2.25.1