1 |
dilfridge 11/10/03 13:29:21 |
2 |
|
3 |
Added: kdelibs-4.6.5-qlabel-2.patch |
4 |
kdelibs-4.7.1-qlabel-2.patch |
5 |
kdelibs-4.6.5-qlabel-1.patch |
6 |
kdelibs-4.7.1-qlabel-1.patch |
7 |
Log: |
8 |
Fix QLabel spoofing vulnerability, bug 384227 and CVE-2011-3365 |
9 |
|
10 |
(Portage version: 2.1.10.19/cvs/Linux x86_64) |
11 |
|
12 |
Revision Changes Path |
13 |
1.1 kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-2.patch |
14 |
|
15 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-2.patch?rev=1.1&view=markup |
16 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-2.patch?rev=1.1&content-type=text/plain |
17 |
|
18 |
Index: kdelibs-4.6.5-qlabel-2.patch |
19 |
=================================================================== |
20 |
diff --git a/kioslave/http/http.cpp b/kioslave/http/http.cpp |
21 |
index 33f4cb1..6447a02 100644 |
22 |
--- a/kioslave/http/http.cpp |
23 |
+++ b/kioslave/http/http.cpp |
24 |
@@ -99,6 +99,27 @@ |
25 |
//authentication handlers |
26 |
#include "httpauthentication.cpp" |
27 |
|
28 |
+// KDE5 TODO (QT5) : use QString::htmlEscape or whatever https://qt.gitorious.org/qt/qtbase/merge_requests/56 |
29 |
+// ends up with. |
30 |
+static QString htmlEscape(const QString &plain) |
31 |
+{ |
32 |
+ QString rich; |
33 |
+ rich.reserve(int(plain.length() * 1.1)); |
34 |
+ for (int i = 0; i < plain.length(); ++i) { |
35 |
+ if (plain.at(i) == QLatin1Char('<')) |
36 |
+ rich += QLatin1String("<"); |
37 |
+ else if (plain.at(i) == QLatin1Char('>')) |
38 |
+ rich += QLatin1String(">"); |
39 |
+ else if (plain.at(i) == QLatin1Char('&')) |
40 |
+ rich += QLatin1String("&"); |
41 |
+ else if (plain.at(i) == QLatin1Char('"')) |
42 |
+ rich += QLatin1String("""); |
43 |
+ else |
44 |
+ rich += plain.at(i); |
45 |
+ } |
46 |
+ rich.squeeze(); |
47 |
+ return rich; |
48 |
+} |
49 |
|
50 |
// see filenameFromUrl(): a sha1 hash is 160 bits |
51 |
static const int s_hashedUrlBits = 160; // this number should always be divisible by eight |
52 |
@@ -3410,7 +3431,7 @@ endParsing: |
53 |
authinfo.url = reqUrl; |
54 |
authinfo.keepPassword = true; |
55 |
authinfo.comment = i18n("<b>%1</b> at <b>%2</b>", |
56 |
- authinfo.realmValue, authinfo.url.host()); |
57 |
+ htmlEscape(authinfo.realmValue), authinfo.url.host()); |
58 |
|
59 |
if (!openPasswordDialog(authinfo, errorMsg)) { |
60 |
if (sendErrorPageNotification()) { |
61 |
@@ -5122,7 +5143,7 @@ void HTTPProtocol::proxyAuthenticationForSocket(const QNetworkProxy &proxy, QAut |
62 |
"to access any sites."); |
63 |
info.keepPassword = true; |
64 |
info.commentLabel = i18n("Proxy:"); |
65 |
- info.comment = i18n("<b>%1</b> at <b>%2</b>", info.realmValue, m_request.proxyUrl.host()); |
66 |
+ info.comment = i18n("<b>%1</b> at <b>%2</b>", htmlEscape(info.realmValue), m_request.proxyUrl.host()); |
67 |
const bool dataEntered = openPasswordDialog(info, i18n("Proxy Authentication Failed.")); |
68 |
if (!dataEntered) { |
69 |
kDebug(7103) << "looks like the user canceled proxy authentication."; |
70 |
|
71 |
|
72 |
|
73 |
1.1 kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-2.patch |
74 |
|
75 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-2.patch?rev=1.1&view=markup |
76 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-2.patch?rev=1.1&content-type=text/plain |
77 |
|
78 |
Index: kdelibs-4.7.1-qlabel-2.patch |
79 |
=================================================================== |
80 |
diff --git a/kdecore/tests/kservicetest.cpp b/kdecore/tests/kservicetest.cpp |
81 |
index 7f3b737..747e11a 100644 |
82 |
--- a/kdecore/tests/kservicetest.cpp |
83 |
+++ b/kdecore/tests/kservicetest.cpp |
84 |
@@ -31,6 +31,7 @@ |
85 |
|
86 |
#include <kprotocolinfo.h> |
87 |
#include <kdebug.h> |
88 |
+#include <kprocess.h> |
89 |
#include <kservicegroup.h> |
90 |
#include <kservicetypetrader.h> |
91 |
#include <kservicetype.h> |
92 |
@@ -38,10 +39,23 @@ |
93 |
|
94 |
#include <QtCore/Q_PID> |
95 |
|
96 |
+QTEST_KDEMAIN_CORE( KServiceTest ) |
97 |
+ |
98 |
+static void eraseProfiles() |
99 |
+{ |
100 |
+ QString profilerc = KStandardDirs::locateLocal( "config", "profilerc" ); |
101 |
+ if ( !profilerc.isEmpty() ) |
102 |
+ QFile::remove( profilerc ); |
103 |
+ |
104 |
+ profilerc = KStandardDirs::locateLocal( "config", "servicetype_profilerc" ); |
105 |
+ if ( !profilerc.isEmpty() ) |
106 |
+ QFile::remove( profilerc ); |
107 |
+} |
108 |
+ |
109 |
void KServiceTest::initTestCase() |
110 |
{ |
111 |
// A non-C locale is necessary for some tests. |
112 |
- // This locale must have the follwing properties: |
113 |
+ // This locale must have the following properties: |
114 |
// - some character other than dot as decimal separator |
115 |
// If it cannot be set, locale-dependent tests are skipped. |
116 |
setlocale(LC_ALL, "fr_FR.utf8"); |
117 |
@@ -50,16 +64,8 @@ void KServiceTest::initTestCase() |
118 |
kDebug() << "Setting locale to fr_FR.utf8 failed"; |
119 |
} |
120 |
|
121 |
- QString profilerc = KStandardDirs::locateLocal( "config", "profilerc" ); |
122 |
- if ( !profilerc.isEmpty() ) |
123 |
- QFile::remove( profilerc ); |
124 |
- |
125 |
- profilerc = KStandardDirs::locateLocal( "config", "servicetype_profilerc" ); |
126 |
- if ( !profilerc.isEmpty() ) |
127 |
- QFile::remove( profilerc ); |
128 |
- |
129 |
m_hasKde4Konsole = false; |
130 |
- |
131 |
+ eraseProfiles(); |
132 |
|
133 |
// Create some fake services for the tests below, and ensure they are in ksycoca. |
134 |
|
135 |
@@ -111,10 +117,23 @@ void KServiceTest::initTestCase() |
136 |
QVERIFY(QTest::kWaitForSignal(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), 10000)); |
137 |
kDebug() << "got signal"; |
138 |
} |
139 |
- |
140 |
} |
141 |
|
142 |
-QTEST_KDEMAIN_CORE( KServiceTest ) |
143 |
+void KServiceTest::cleanupTestCase() |
144 |
+{ |
145 |
+ // If I want the konqueror unit tests to work, then I better not have a non-working part |
146 |
+ // as the preferred part for text/plain... |
147 |
+ QStringList services; services << "fakeservice.desktop" << "fakepart.desktop" << "faketextplugin.desktop"; |
148 |
+ Q_FOREACH(const QString& service, services) { |
149 |
+ const QString fakeService = KStandardDirs::locateLocal("services", service); |
150 |
+ QFile::remove(fakeService); |
151 |
+ } |
152 |
+ //QProcess::execute( KGlobal::dirs()->findExe(KBUILDSYCOCA_EXENAME) ); |
153 |
+ KProcess proc; |
154 |
+ proc << KStandardDirs::findExe(KBUILDSYCOCA_EXENAME); |
155 |
+ proc.setOutputChannelMode(KProcess::MergedChannels); // silence kbuildsycoca output |
156 |
+ proc.execute(); |
157 |
+} |
158 |
|
159 |
void KServiceTest::testByName() |
160 |
{ |
161 |
diff --git a/kdecore/tests/kservicetest.h b/kdecore/tests/kservicetest.h |
162 |
index 18bddd9..ffab302 100644 |
163 |
--- a/kdecore/tests/kservicetest.h |
164 |
+++ b/kdecore/tests/kservicetest.h |
165 |
@@ -28,6 +28,7 @@ public: |
166 |
KServiceTest() : m_sycocaUpdateDone(0) {} |
167 |
private Q_SLOTS: |
168 |
void initTestCase(); |
169 |
+ void cleanupTestCase(); |
170 |
void testByName(); |
171 |
void testProperty(); |
172 |
void testAllServiceTypes(); |
173 |
diff --git a/kioslave/http/http.cpp b/kioslave/http/http.cpp |
174 |
index 6d41a13..3009ff1 100644 |
175 |
--- a/kioslave/http/http.cpp |
176 |
+++ b/kioslave/http/http.cpp |
177 |
@@ -86,6 +86,27 @@ |
178 |
//string parsing helpers and HeaderTokenizer implementation |
179 |
#include "parsinghelpers.cpp" |
180 |
|
181 |
+// KDE5 TODO (QT5) : use QString::htmlEscape or whatever https://qt.gitorious.org/qt/qtbase/merge_requests/56 |
182 |
+// ends up with. |
183 |
+static QString htmlEscape(const QString &plain) |
184 |
+{ |
185 |
+ QString rich; |
186 |
+ rich.reserve(int(plain.length() * 1.1)); |
187 |
+ for (int i = 0; i < plain.length(); ++i) { |
188 |
+ if (plain.at(i) == QLatin1Char('<')) |
189 |
+ rich += QLatin1String("<"); |
190 |
+ else if (plain.at(i) == QLatin1Char('>')) |
191 |
+ rich += QLatin1String(">"); |
192 |
+ else if (plain.at(i) == QLatin1Char('&')) |
193 |
+ rich += QLatin1String("&"); |
194 |
+ else if (plain.at(i) == QLatin1Char('"')) |
195 |
+ rich += QLatin1String("""); |
196 |
+ else |
197 |
+ rich += plain.at(i); |
198 |
+ } |
199 |
+ rich.squeeze(); |
200 |
+ return rich; |
201 |
+} |
202 |
|
203 |
// see filenameFromUrl(): a sha1 hash is 160 bits |
204 |
static const int s_hashedUrlBits = 160; // this number should always be divisible by eight |
205 |
@@ -3431,7 +3452,7 @@ endParsing: |
206 |
authinfo.url = reqUrl; |
207 |
authinfo.keepPassword = true; |
208 |
authinfo.comment = i18n("<b>%1</b> at <b>%2</b>", |
209 |
- authinfo.realmValue, authinfo.url.host()); |
210 |
+ htmlEscape(authinfo.realmValue), authinfo.url.host()); |
211 |
|
212 |
if (!openPasswordDialog(authinfo, errorMsg)) { |
213 |
if (sendErrorPageNotification()) { |
214 |
@@ -5262,7 +5283,7 @@ void HTTPProtocol::proxyAuthenticationForSocket(const QNetworkProxy &proxy, QAut |
215 |
"to access any sites."); |
216 |
info.keepPassword = true; |
217 |
info.commentLabel = i18n("Proxy:"); |
218 |
- info.comment = i18n("<b>%1</b> at <b>%2</b>", info.realmValue, m_request.proxyUrl.host()); |
219 |
+ info.comment = i18n("<b>%1</b> at <b>%2</b>", htmlEscape(info.realmValue), m_request.proxyUrl.host()); |
220 |
const bool dataEntered = openPasswordDialog(info, i18n("Proxy Authentication Failed.")); |
221 |
if (!dataEntered) { |
222 |
kDebug(7103) << "looks like the user canceled proxy authentication."; |
223 |
|
224 |
|
225 |
|
226 |
1.1 kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-1.patch |
227 |
|
228 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-1.patch?rev=1.1&view=markup |
229 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.6.5-qlabel-1.patch?rev=1.1&content-type=text/plain |
230 |
|
231 |
Index: kdelibs-4.6.5-qlabel-1.patch |
232 |
=================================================================== |
233 |
diff --git a/kio/kssl/ksslcertificatebox.cpp b/kio/kssl/ksslcertificatebox.cpp |
234 |
index 4ffc613..094787a 100644 |
235 |
--- a/kio/kssl/ksslcertificatebox.cpp |
236 |
+++ b/kio/kssl/ksslcertificatebox.cpp |
237 |
@@ -36,6 +36,10 @@ KSslCertificateBox::KSslCertificateBox(QWidget *parent) |
238 |
d(new KSslCertificateBoxPrivate()) |
239 |
{ |
240 |
d->ui.setupUi(this); |
241 |
+ // No fooling us with html tags |
242 |
+ Q_FOREACH(QLabel* label, qFindChildren<QLabel *>(this)) { |
243 |
+ label->setTextFormat(Qt::PlainText); |
244 |
+ } |
245 |
} |
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
1.1 kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-1.patch |
252 |
|
253 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-1.patch?rev=1.1&view=markup |
254 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.7.1-qlabel-1.patch?rev=1.1&content-type=text/plain |
255 |
|
256 |
Index: kdelibs-4.7.1-qlabel-1.patch |
257 |
=================================================================== |
258 |
diff --git a/kio/kssl/ksslcertificatebox.cpp b/kio/kssl/ksslcertificatebox.cpp |
259 |
index 4ffc613..094787a 100644 |
260 |
--- a/kio/kssl/ksslcertificatebox.cpp |
261 |
+++ b/kio/kssl/ksslcertificatebox.cpp |
262 |
@@ -36,6 +36,10 @@ KSslCertificateBox::KSslCertificateBox(QWidget *parent) |
263 |
d(new KSslCertificateBoxPrivate()) |
264 |
{ |
265 |
d->ui.setupUi(this); |
266 |
+ // No fooling us with html tags |
267 |
+ Q_FOREACH(QLabel* label, qFindChildren<QLabel *>(this)) { |
268 |
+ label->setTextFormat(Qt::PlainText); |
269 |
+ } |
270 |
} |