]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix double-escaping possible with encrypted passwords
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 13 Apr 2013 14:58:09 +0000 (18:58 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 13 Apr 2013 14:58:09 +0000 (18:58 +0400)
classes/pref/feeds.php
classes/rpc.php
include/functions.php

index 4a77ed8cfdf166fc952189adccd153065c250ae8..c57cccc44e9f17fd2e5ce2fc4ec6e78c364f4a8e 100644 (file)
@@ -932,7 +932,7 @@ class Pref_Feeds extends Handler_Protected {
                $feed_ids = db_escape_string($this->link, $_POST["ids"]); /* batchEditSave */
                $cat_id = (int) db_escape_string($this->link, $_POST["cat_id"]);
                $auth_login = db_escape_string($this->link, trim($_POST["auth_login"]));
-               $auth_pass = db_escape_string($this->link, trim($_POST["auth_pass"]));
+               $auth_pass = trim($_POST["auth_pass"]);
                $private = checkbox_to_sql_bool(db_escape_string($this->link, $_POST["private"]));
                $include_in_digest = checkbox_to_sql_bool(
                        db_escape_string($this->link, $_POST["include_in_digest"]));
@@ -954,6 +954,8 @@ class Pref_Feeds extends Handler_Protected {
                        $auth_pass_encrypted = 'false';
                }
 
+               $auth_pass = db_escape_string($this->link, $auth_pass);
+
                if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
                        if ($cat_id && $cat_id != 0) {
                                $category_qpart = "cat_id = '$cat_id',";
@@ -1842,7 +1844,7 @@ class Pref_Feeds extends Handler_Protected {
                $cat_id = db_escape_string($this->link, $_REQUEST['cat']);
                $feeds = explode("\n", $_REQUEST['feeds']);
                $login = db_escape_string($this->link, $_REQUEST['login']);
-               $pass = db_escape_string($this->link, $_REQUEST['pass']);
+               $pass = trim($_REQUEST['pass']);
 
                foreach ($feeds as $feed) {
                        $feed = db_escape_string($this->link, trim($feed));
@@ -1869,6 +1871,8 @@ class Pref_Feeds extends Handler_Protected {
                                        $auth_pass_encrypted = 'false';
                                }
 
+                               $pass = db_escape_string($this->link, $pass);
+
                                if (db_num_rows($result) == 0) {
                                        $result = db_query($this->link,
                                                "INSERT INTO ttrss_feeds
index 508dd8d41e321f73697d328b191276f6e94497ac..1569a9a35bc8fd4ea7b162056b45464307ba9c0f 100644 (file)
@@ -104,7 +104,7 @@ class RPC extends Handler_Protected {
                $feed = db_escape_string($this->link, $_REQUEST['feed']);
                $cat = db_escape_string($this->link, $_REQUEST['cat']);
                $login = db_escape_string($this->link, $_REQUEST['login']);
-               $pass = db_escape_string($this->link, $_REQUEST['pass']);
+               $pass = trim($_REQUEST['pass']); // escaped later
 
                $rc = subscribe_to_feed($this->link, $feed, $cat, $login, $pass);
 
index 73ed97d086bbcc8338a337d4ca35fc9cc795de2c..1b6b3e820f9027e9c10b389969eac3e2b501b185 100644 (file)
                        $auth_pass_encrypted = 'false';
                }
 
+               $auth_pass = db_escape_string($this->link, $auth_pass);
+
                if (db_num_rows($result) == 0) {
                        $result = db_query($link,
                                "INSERT INTO ttrss_feeds