(imap-quote-specials): New function.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 17 Apr 2006 16:04:54 +0000 (16:04 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 17 Apr 2006 16:04:54 +0000 (16:04 +0000)
(imap-login-auth): Quote specials.

lisp/ChangeLog
lisp/imap.el

index 33c8229..c851d80 100644 (file)
@@ -1,5 +1,8 @@
 2006-04-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * imap.el (imap-quote-specials): New function.
+       (imap-login-auth): Quote specials.
+
        * rfc2231.el (rfc2231-parse-string): Remove dead code.
        (rfc2231-parse-string): Allow concatanation of parameters that
        aren't contiguous.  The test case is
index 6d489b6..c8772de 100644 (file)
@@ -912,14 +912,27 @@ Returns t if login was successful, nil otherwise."
   (and (not (imap-capability 'LOGINDISABLED buffer))
        (not (imap-capability 'X-LOGIN-CMD-DISABLED buffer))))
 
+(defun imap-quote-specials (string)
+  (with-temp-buffer
+    (insert string)
+    (goto-char (point-min))
+    (while (re-search-forward "[\\\"]" nil t)
+      (forward-char -1)
+      (insert "\\")
+      (forward-char 1))
+    (buffer-string)))
+
 (defun imap-login-auth (buffer)
   "Login to server using the LOGIN command."
   (message "imap: Plaintext authentication...")
   (imap-interactive-login buffer
                          (lambda (user passwd)
                            (imap-ok-p (imap-send-command-wait
-                                       (concat "LOGIN \"" user "\" \""
-                                               passwd "\""))))))
+                                       (concat "LOGIN \""
+                                               (imap-quote-specials user)
+                                               "\" \""
+                                               (imap-quote-specials passwd)
+                                               "\""))))))
 
 (defun imap-anonymous-p (buffer)
   t)