[Telepathy-commits] [telepathy-qt4/master] Changed KeyFile key validation to also accept ".", "_" and "@" as valid characters.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Fri Jan 16 11:00:48 PST 2009


---
 TelepathyQt4/key-file.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/TelepathyQt4/key-file.cpp b/TelepathyQt4/key-file.cpp
index 0dd34c9..4aa08ca 100644
--- a/TelepathyQt4/key-file.cpp
+++ b/TelepathyQt4/key-file.cpp
@@ -204,10 +204,15 @@ bool KeyFile::Private::validateKey(const QByteArray &data, int from, int to, QSt
     bool ret = true;
     while (i < to) {
         uint ch = data.at(i++);
+        // as an extension to the Desktop Entry spec, we allow "_", "." and "@"
+        // as valid key characters - "_" and "." are needed for keys that are
+        // D-Bus property names, and GKeyFile and KConfigIniBackend also accept
+        // all three of those characters.
         if (!((ch >= 'a' && ch <= 'z') ||
               (ch >= 'A' && ch <= 'Z') ||
               (ch >= '0' && ch <= '9') ||
-              (ch == '-'))) {
+              (ch == '-') || (ch == '_') ||
+              (ch == '.') || (ch == '@'))) {
             ret = false;
         }
         result += ch;
-- 
1.5.6.5



More information about the Telepathy-commits mailing list