[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/mailody/src
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2007-01-19 13:57:42
Message-ID: 1169215062.467332.8756.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 625208 by toma:

Quote login and password. Please check if it works, there is nothing in the IMAP rfc \
                about this. Copied KDE kioslave behaviour, so should be ok.
BUG: 140291


 M  +22 -3     imap.cpp  
 M  +1 -0      imap.h  


--- trunk/playground/pim/mailody/src/imap.cpp #625207:625208
@@ -95,7 +95,8 @@
     else
     {
         m_queue.prepend(Queue(Queue::Auth, "",
-                    "login \"" + login + "\" \"" + pass + "\""));
+                    "login \"" + quoteIMAP(login) 
+                    + "\" \"" + quoteIMAP(pass) + "\""));
         m_currentQueueItem=Queue();
         emit statusReady();
 
@@ -125,8 +126,8 @@
     }
     if (result == KPasswordDialog::Accepted)
         m_queue.prepend(Queue(Queue::Auth, "",
-                        "login \"" + login + "\" \"" +
-                                QString(password) + "\""));
+                        "login \"" + quoteIMAP(login) + "\" \"" +
+                                quoteIMAP(QString(password)) + "\""));
     password.fill(0); // safe enough?
     m_currentQueueItem=Queue();
     emit statusReady();
@@ -1145,6 +1146,24 @@
     m_imap->reconnect();
 }
 
+/* Copy from KDE/3.5/kdepim/kioslaves/imap4/rfcdecoder.cc */
+/* Copyright (C) 2000 s.carstens@gmx.de */
+/* replace " with \" and \ with \\ " and \ characters */
+QString Imap::quoteIMAP(const QString &src)
+{
+    uint len = src.length();
+    QString result;
+    result.reserve(2 * len);
+    for (unsigned int i = 0; i < len; i++)
+    {
+        if (src[i] == '"' || src[i] == '\\')
+            result += '\\';
+        result += src[i];
+    }
+    //result.squeeze(); - unnecessary and slow
+    return result;
 }
 
+}
+
 #include "imap.moc"
--- trunk/playground/pim/mailody/src/imap.h #625207:625208
@@ -232,6 +232,7 @@
     void integrity(const QString& mb, int);
     void timerEvent( QTimerEvent * );
     void getCapabilities();
+    QString quoteIMAP(const QString &src);
 
   signals:
     /**


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic