ソースを参照

Fix issues caused by use of PostgreSQL keyword 'user' in SquirrelMail's default preferences database schema (#2943483)

pdontthink 15 年 前
コミット
7cab7f11c4
2 ファイル変更11 行追加1 行削除
  1. 3 1
      doc/ChangeLog
  2. 8 0
      functions/db_prefs.php

+ 3 - 1
doc/ChangeLog

@@ -344,7 +344,9 @@ Version 1.5.2 - SVN
     (reduces chances of session data growing too large)
     (reduces chances of session data growing too large)
   - Fixed minor vulnerability in Mail Fetch plugin [CVE-2010-1637/TEHTRI-SA-2010-009]
   - Fixed minor vulnerability in Mail Fetch plugin [CVE-2010-1637/TEHTRI-SA-2010-009]
   - Now properly quote personal part of encoded addresses when replying.
   - Now properly quote personal part of encoded addresses when replying.
-  - Now fill in default subject when forwarding as attachment (#2936541)
+  - Now fill in default subject when forwarding as attachment (#2936541).
+  - Fix issues caused by use of PostgreSQL keyword "user" in SquirrelMail's
+    default preferences database schema (#2943483).
 
 
 Version 1.5.1 (branched on 2006-02-12)
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 --------------------------------------

+ 8 - 0
functions/db_prefs.php

@@ -222,6 +222,14 @@ class dbPrefs {
         if (!empty($prefs_user_field)) {
         if (!empty($prefs_user_field)) {
             $this->user_field = $prefs_user_field;
             $this->user_field = $prefs_user_field;
         }
         }
+
+        // the default user field is "user", which in PostgreSQL
+        // is an identifier and causes errors if not escaped
+        //
+        if ($this->db_type == SMDB_PGSQL) {
+           $this->user_field = '"' . $this->user_field . '"';
+        }
+
         if (!empty($prefs_key_field)) {
         if (!empty($prefs_key_field)) {
             $this->key_field = $prefs_key_field;
             $this->key_field = $prefs_key_field;
         }
         }