revbump; add sec patch from bug #544230, rm affected version
authorIan Delaney <idella4@gentoo.org>
Mon, 30 Mar 2015 05:48:11 +0000 (05:48 +0000)
committerIan Delaney <idella4@gentoo.org>
Mon, 30 Mar 2015 05:48:11 +0000 (05:48 +0000)
Package-Manager: portage-2.2.18/cvs/Linux x86_64
Manifest-Sign-Key: 0xB8072B0D

net-irc/quassel/ChangeLog
net-irc/quassel/Manifest
net-irc/quassel/files/DOS-sec.patch [new file with mode: 0644]
net-irc/quassel/quassel-0.11.0-r1.ebuild [moved from net-irc/quassel/quassel-0.11.0.ebuild with 98% similarity]

index 67c711e4edb44c9237f42e44f1b8c02332092705..07e982575a58037dd688ff395f6abb7df694c502 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for net-irc/quassel
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/ChangeLog,v 1.197 2015/03/29 14:30:03 johu Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/ChangeLog,v 1.198 2015/03/30 05:47:44 idella4 Exp $
+
+*quassel-0.11.0-r1 (30 Mar 2015)
+
+  30 Mar 2015; Ian Delaney <idella4@gentoo.org> +files/DOS-sec.patch,
+  +quassel-0.11.0-r1.ebuild, -quassel-0.11.0.ebuild:
+  revbump; add sec patch from bug #544230, rm affected version
 
   29 Mar 2015; Johannes Huber <johu@gentoo.org>
   -files/missing-bsd-includes.patch, -quassel-0.10.1.ebuild,
index afa6ed1352c787c75ae29e708e89f09a851e018e..b5676202953e8e9fb844aea90aa009cac8e1a8b5 100644 (file)
@@ -1,6 +1,7 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA256
 
+AUX DOS-sec.patch 15062 SHA256 324ce0edfe5744544846a4796187ceda77921434498089c49c2e50a7f8654fa1 SHA512 fe1a82f824445c75b2c73814a83817eb5ccdde0f586b62178bd58633ded0a1ef17c81b04d26fc0e1a0333528d1d8ca401ff3dfd5d42c67113c913e7526b41c26 WHIRLPOOL a02f7bb39810c00a338f555ba57a8e85b7c3173a81b8fe751fc82f2325a3e26ed830b603649122694c1a32a56972d7b34cfdb310b0651f1c741c423703622721
 AUX quassel.logrotate 105 SHA256 00c32e857d7a4346d09ac057768565692da9cacf41ed37cc7e357b395e033a45 SHA512 60371b4046c3c20c06d01f9cbf3f8465b40c9a989f392ed3e5a4724deff71960015eeb1707817af256618be8085b2aa5809377fec8cfae59e6b8fc958317e780 WHIRLPOOL 5b5185a6a68c12ce08ec5b41bb10644e487308f81b3e5d554524b05f70573410e31b299ac5fcec8806390deb37d0529ac69c435d0fcbaac005e59aec5a4095c5
 AUX quasselcore.conf 721 SHA256 fc6960a3b17f00eec09530b1ba797056abd2cde0900dce4bd3aeb06c535c6fc8 SHA512 15abd15f7008d58771dd37d59de0121b8920070596ca9f1bca73d84052f4ac1629b1ee0eb9da303bfff02ad4130e6ded27c0f316a0a0e5209987d9c62f155b9d WHIRLPOOL f28abb1ddf48cd260820e42081e5c6eb8ffb9cc580e43ab3a68b6248fe1c83102e08e2a34c876d2aca5c405b6b46182cf3934684f7627c50ab89671c88a52a97
 AUX quasselcore.init 1857 SHA256 af041a6c800ffb443d008b861c639bf32580b3655f7db3bc00db833374af6b2e SHA512 0405af90fe65589e163d6b2470ea4d4d3b8dad49ee3b89caba9bcffd7186bd92f204da4f8404e5ed489a949fc89b898f0b94c94c8382f90f89ccda5e2b8e2382 WHIRLPOOL 7fefa3e977f5edce047c8f928e52b3dfc702a151930a92365be7d9eb0e88adffa924164e080bf8170dfb4a95c357cb9b059394d3854464f93d58f577ecea41de
@@ -10,25 +11,15 @@ DIST quassel-0.11.0.tar.bz2 2875387 SHA256 99a191b8bc2a410f7020b890ec57e0be49313
 DIST quassel-0.12-rc1.tar.bz2 3640851 SHA256 be2a982a2725dbebb5c4f908787b5173febcd2a7511f0a54ab6cf1a742a1464a SHA512 345325c69e26781864120bfb057e79e36b2bba391ee7a0cd700af432a83946939a308c7e90e50b959036fa9b583570147adfb6c804dad3819f6faf3d8a585166 WHIRLPOOL 571794d396fd047d6447b4c79f7031485785ded9592eb4ce5f0a86a7bda80e9d2464a4f94c07b5e591dcdc9386dfb0cadffa780d15eaf5a2258eaeb23110073b
 DIST quassel-0.12_rc1-fix-ftbfs.patch 597 SHA256 f26e219f07f01508d73fe216bc1d040855aa35645828c070e121c0409b131fcc SHA512 d0239a12dc5b0348ffdca232565f610ed92aa2e1a055096262126ec3caafbd3b4599b94dd30b52473a663f579fccbe40ebbe3ded62de88c3c929b2b0c4253a6b WHIRLPOOL 044ef09bdf9f067b17153c61d0125effe9a4a1a002c67d1864ba749e9a43025192dfe0ca136cbb5b722b519015497b7215aec07974e15e529d5d2e011571db43
 EBUILD quassel-0.10.0-r1.ebuild 4993 SHA256 61e6419c63aacf38855e4f89125b2b31e642227bfc8e337796f93b73aa8b672f SHA512 7bcee9ab879e2b9545743dcf91f7b6e70101791b34e40021fd0161c2c3a2fd0223934aaa48e11eb865662215fd95928f70478cfb189b1f2607caecf8415320c2 WHIRLPOOL 1c884fc4354a533da41d18d8bb26834d0828e62d0514eb5ffc9e8ae52c4d049861c53979e5a0c546ecd84e0cf189fd50b3877c561518c6e3ec6cead478fac0bb
-EBUILD quassel-0.11.0.ebuild 5621 SHA256 6bc36f01160007c3411ab3b903213672f8319d893b97e6f42983a0fcb24b2def SHA512 7993183acef66aa5fb9fb117da4643e70a9fdd78344023a25d65074e662e103f4372e54975a81a92628ca6c865de511c85cbc9e7f5596fe8a424b37634be20d4 WHIRLPOOL 1b187e13784805c2af85277482a1b5dae27a7be632f67224781b609f2179f0528bd7e94d3bc5bdd0a8148349f683cfbdfe062becdee43efc16974c2a471fd295
+EBUILD quassel-0.11.0-r1.ebuild 5666 SHA256 16d4a6ad5c8c5e2600b28a31e8febb73d94077594d19c3d54773c0a4d3236b50 SHA512 868b6f4f40dabe0cfdddf900ddac6ef3736af2e0ed0eeffe7dbaaf991fb44b1af8cb07ff551afd617930c58046bbd4e9675d3f4efc0747dc7552920bbc5d6808 WHIRLPOOL db202c837e9dbd36bd5427976c1e32efde329bbb94f90a373030caf19ea190548d3f9d6cdfafd6e4eb174e6f117352bc10eaa9fc819309f860ba4cd37a86ce79
 EBUILD quassel-0.12_rc1.ebuild 6139 SHA256 1a0e55bdaea1271d1d4d6f7f85c520ec5f7b62f65c8038715be5ec3174ffc9bf SHA512 3e2adc62d3cfa7b71c657886f92393c8a2cd396c7ea38796775c0ab22f46e2fc7ce3bceac27951e1c80d0353dacec10264ae92e5954a76f601b0fbc6c22cca3f WHIRLPOOL 9c37776433fe4010802e92ab8b98d9c17af6c156979f677723a57c781e63e25382cfb8740ec2c32bf80dc4a6e16d68960da179349623018d4f89672336b6cfde
 EBUILD quassel-9999.ebuild 5949 SHA256 1be872f9e03a6ee270716857ee97c17c0fa36d990269fe44652a9570e20e8e9b SHA512 6138c310954f5ace10270296eced8b882c3191b386b99c0b21a7603d835a8655c9299d33b923befafa59bfc9abafd804eeede8c4170c3cdab8a98227176733ef WHIRLPOOL fc73c334975331bf70aebc0e981db80ee642161d6a772506aca713cbee05a15849e2b2b9bf8fa4d6a72c5874d683d4858716e5a32f0eb22d1af01506064853bd
-MISC ChangeLog 30757 SHA256 68d805001cde5af9ea5b2dbe2d26febb6ec28f2a951b48109cb85bdb07a9dc1e SHA512 17c4eb2127bfb8e15419479e22af79b83f45e6356cd79ef5958fe8e6635545b6ac25145277fb2a025df90159fdbd5e158e57fb71e27b81fb31da872b28617fdd WHIRLPOOL 11daaf6ae3bead50d0cf4026ff49a8dab72d96b9eea473aa2b41e8aed9bb2e1e59c473cc48f965b5ff383f330d7decf3250e559327e0fedf55a6faa28d9c118f
+MISC ChangeLog 30981 SHA256 949411fa863866a0e9019d74b41480de48f7fd5b6b527bce2f5448b90764cf6b SHA512 0fa8177a019055c0617a217dca2506b1814736657f82343d37a1faa14897e6822010bb804c63da2a8fe39816b0f481a5b468e5f40501e54ebd230c178fb1631f WHIRLPOOL f004ba52c6e3fd6f31fb0e68c2cff857684ffcda6923f32b03c2827e3c8a34f164d6be8bcc0486afdca767c2e1712ec78f08549b17f08d8718aecc70123336d1
 MISC metadata.xml 1687 SHA256 20a821b954973d1f6c42184c6ca474b972896e6649ab37a44f093a7b3964e3c5 SHA512 7586fd9fa8552ae40e9294819bd56365e8e97eda8c5669519b57e8712e801c3513937effb716bd3e2cb75f47c3d180947b5a7a20107a8292f92d7c4c2837684a WHIRLPOOL 165eb876fc157171ac2d25ead567fce5ecd4d8ccab275591c0d9d18b8cb4e2f104a6a1b63c3bde76c0afdeee5651f13668ee30fe98a9bdc1b28e6f6fa2dcbc33
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
-iQIcBAEBCAAGBQJVGAxvAAoJEGVpnaTzz9K9ZEcQAK5MFqsHNfCk6bXcG3J8fqQ/
-wR+4BHFbisuC1euU95weMaANl8KeCtWPta6ggdzyvqD32MT+G1qcoKQnpGdZMP0Y
-kawUraAfx/HOqsWuvZoxp8ah+vVWh81nxnCGsKtkqpv39GMVGgwRyIGNh81945hC
-iohDws4uSUsd3WWvN2BMwNUl1BzfUR40cr4MwtV03fxI4yw/bqCoE+6lkooA3eFP
-mi+Xpj/AGCxiRhw4BrhkmEjBxB0+DDxfJvQ77qjMpcEzsaBuitwyqUlCC+6MpHuN
-/zfcvNd6Mj/sN+t01YHSITqcAOge4tLuQdmnVWdGhmd7VVB+x/br8Ov+ZMbtgtrp
-eGhO+Bmr7hCONNPRUwSTzeTyw2VieIzU9vpQtpRR5zl8+mireVQg/8cJ64vNIYdF
-JdwSI9ApOy6CFr2AnSWzr3qHJhlD3D7s/6lwGkCO3P74NUcLsHBuO+sLUmMa9Dqu
-tZtj+2MufRXiKB9rNSzWR0Uc89xgaunNoqLwvy15jbm0i32J1/Pt8Cp6GO4RFmmE
-VuYO7VswSI3V2OuBHACO7AX+jPTq/gxkHsgL7XxwJOcY6dw1WVjTUq1NWxh2V2iQ
-Ok/pFhS3VD0LTiQZXY2+4oEyd6zBHUtjLLYGQxYeHRt/rtWVcFiWYG3oHCOHY36+
-far77n2ADP+KufJrGxSX
-=mxOk
+iEYEAREIAAYFAlUY45AACgkQso7CE7gHKw0O5QCeLxogN5ycXudMTED2okFeHf5M
+yJIAn2hu36vODUYmehw7taPtH2xTc9VO
+=SliX
 -----END PGP SIGNATURE-----
diff --git a/net-irc/quassel/files/DOS-sec.patch b/net-irc/quassel/files/DOS-sec.patch
new file mode 100644 (file)
index 0000000..bc3714f
--- /dev/null
@@ -0,0 +1,318 @@
+diff --git a/src/core/corebasichandler.cpp b/src/core/corebasichandler.cpp
+index dfa8a99..fbfc76c 100644
+--- a/src/core/corebasichandler.cpp
++++ b/src/core/corebasichandler.cpp
+@@ -33,6 +33,9 @@ CoreBasicHandler::CoreBasicHandler(CoreNetwork *parent)
+     connect(this, SIGNAL(putCmd(QString, const QList<QByteArray> &, const QByteArray &)),
+         network(), SLOT(putCmd(QString, const QList<QByteArray> &, const QByteArray &)));
+ 
++    connect(this, SIGNAL(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)),
++        network(), SLOT(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)));
++
+     connect(this, SIGNAL(putRawLine(const QByteArray &)),
+         network(), SLOT(putRawLine(const QByteArray &)));
+ }
+diff --git a/src/core/corebasichandler.h b/src/core/corebasichandler.h
+index 20d057f..a4b5a7f 100644
+--- a/src/core/corebasichandler.h
++++ b/src/core/corebasichandler.h
+@@ -55,6 +55,7 @@ class CoreBasicHandler : public BasicHandler
+ signals:
+     void displayMsg(Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None);
+     void putCmd(const QString &cmd, const QList<QByteArray> &params, const QByteArray &prefix = QByteArray());
++    void putCmd(const QString &cmd, const QList<QList<QByteArray>> &params, const QByteArray &prefix = QByteArray());
+     void putRawLine(const QByteArray &msg);
+ 
+ protected:
+diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp
+index 7e9ce26..932af6f 100644
+--- a/src/core/corenetwork.cpp
++++ b/src/core/corenetwork.cpp
+@@ -284,6 +284,16 @@ void CoreNetwork::putCmd(const QString &cmd, const QList<QByteArray> &params, co
+ }
+ 
+ 
++void CoreNetwork::putCmd(const QString &cmd, const QList<QList<QByteArray>> &params, const QByteArray &prefix)
++{
++    QListIterator<QList<QByteArray>> i(params);
++    while (i.hasNext()) {
++        QList<QByteArray> msg = i.next();
++        putCmd(cmd, msg, prefix);
++    }
++}
++
++
+ void CoreNetwork::setChannelJoined(const QString &channel)
+ {
+     _autoWhoQueue.prepend(channel.toLower()); // prepend so this new chan is the first to be checked
+@@ -980,3 +990,79 @@ void CoreNetwork::requestSetNetworkInfo(const NetworkInfo &info)
+         }
+     }
+ }
++
++
++QList<QList<QByteArray>> CoreNetwork::splitMessage(const QString &cmd, const QString &message, std::function<QList<QByteArray>(QString &)> cmdGenerator)
++{
++    QString wrkMsg(message);
++    QList<QList<QByteArray>> msgsToSend;
++
++    // do while (wrkMsg.size() > 0)
++    do {
++        // First, check to see if the whole message can be sent at once.  The
++        // cmdGenerator function is passed in by the caller and is used to encode
++        // and encrypt (if applicable) the message, since different callers might
++        // want to use different encoding or encode different values.
++        int splitPos = wrkMsg.size();
++        QList<QByteArray> initialSplitMsgEnc = cmdGenerator(wrkMsg);
++        int initialOverrun = userInputHandler()->lastParamOverrun(cmd, initialSplitMsgEnc);
++
++        if (initialOverrun) {
++            // If the message was too long to be sent, first try splitting it along
++            // word boundaries with QTextBoundaryFinder.
++            QString splitMsg(wrkMsg);
++            QTextBoundaryFinder qtbf(QTextBoundaryFinder::Word, splitMsg);
++            qtbf.setPosition(initialSplitMsgEnc[1].size() - initialOverrun);
++            QList<QByteArray> splitMsgEnc;
++            int overrun = initialOverrun;
++
++            while (overrun) {
++                splitPos = qtbf.toPreviousBoundary();
++
++                // splitPos==-1 means the QTBF couldn't find a split point at all and
++                // splitPos==0 means the QTBF could only find a boundary at the beginning of
++                // the string.  Neither one of these works for us.
++                if (splitPos > 0) {
++                    // If a split point could be found, split the message there, calculate the
++                    // overrun, and continue with the loop.
++                    splitMsg = splitMsg.left(splitPos);
++                    splitMsgEnc = cmdGenerator(splitMsg);
++                    overrun = userInputHandler()->lastParamOverrun(cmd, splitMsgEnc);
++                }
++                else {
++                    // If a split point could not be found (the beginning of the message
++                    // is reached without finding a split point short enough to send) and we
++                    // are still in Word mode, switch to Grapheme mode.  We also need to restore
++                    // the full wrkMsg to splitMsg, since splitMsg may have been cut down during
++                    // the previous attempt to find a split point.
++                    if (qtbf.type() == QTextBoundaryFinder::Word) {
++                        splitMsg = wrkMsg;
++                        splitPos = splitMsg.size();
++                        QTextBoundaryFinder graphemeQtbf(QTextBoundaryFinder::Grapheme, splitMsg);
++                        graphemeQtbf.setPosition(initialSplitMsgEnc[1].size() - initialOverrun);
++                        qtbf = graphemeQtbf;
++                    }
++                    else {
++                        // If the QTBF fails to find a split point in Grapheme mode, we give up.
++                        // This should never happen, but it should be handled anyway.
++                        qWarning() << "Unexpected failure to split message!";
++                        return msgsToSend;
++                    }
++                }
++            }
++
++            // Once a message of sendable length has been found, remove it from the wrkMsg and
++            // add it to the list of messages to be sent.
++            wrkMsg.remove(0, splitPos);
++            msgsToSend.append(splitMsgEnc);
++        }
++        else{
++            // If the entire remaining message is short enough to be sent all at once, remove
++            // it from the wrkMsg and add it to the list of messages to be sent.
++            wrkMsg.remove(0, splitPos);
++            msgsToSend.append(initialSplitMsgEnc);
++        }
++    } while (wrkMsg.size() > 0);
++
++    return msgsToSend;
++}
+diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h
+index 87121ba..05565a4 100644
+--- a/src/core/corenetwork.h
++++ b/src/core/corenetwork.h
+@@ -40,6 +40,8 @@
+ 
+ #include "coresession.h"
+ 
++#include <functional>
++
+ class CoreIdentity;
+ class CoreUserInputHandler;
+ class CoreIgnoreListManager;
+@@ -93,6 +95,8 @@ class CoreNetwork : public Network
+     inline quint16 localPort() const { return socket.localPort(); }
+     inline quint16 peerPort() const { return socket.peerPort(); }
+ 
++    QList<QList<QByteArray>> splitMessage(const QString &cmd, const QString &message, std::function<QList<QByteArray>(QString &)> cmdGenerator);
++
+ public slots:
+     virtual void setMyNick(const QString &mynick);
+ 
+@@ -112,6 +116,7 @@ public slots:
+     void userInput(BufferInfo bufferInfo, QString msg);
+     void putRawLine(QByteArray input);
+     void putCmd(const QString &cmd, const QList<QByteArray> &params, const QByteArray &prefix = QByteArray());
++    void putCmd(const QString &cmd, const QList<QList<QByteArray>> &params, const QByteArray &prefix = QByteArray());
+ 
+     void setChannelJoined(const QString &channel);
+     void setChannelParted(const QString &channel);
+diff --git a/src/core/coreuserinputhandler.cpp b/src/core/coreuserinputhandler.cpp
+index 33d1f67..72ac996 100644
+--- a/src/core/coreuserinputhandler.cpp
++++ b/src/core/coreuserinputhandler.cpp
+@@ -473,12 +473,16 @@ void CoreUserInputHandler::handleMsg(const BufferInfo &bufferInfo, const QString
+         return;
+ 
+     QString target = msg.section(' ', 0, 0);
+-    QByteArray encMsg = userEncode(target, msg.section(' ', 1));
++    QString msgSection = msg.section(' ', 1);
++
++    std::function<QByteArray(const QString &, const QString &)> encodeFunc = [this] (const QString &target, const QString &message) -> QByteArray {
++        return userEncode(target, message);
++    };
+ 
+ #ifdef HAVE_QCA2
+-    putPrivmsg(serverEncode(target), encMsg, network()->cipher(target));
++    putPrivmsg(target, msgSection, encodeFunc, network()->cipher(target));
+ #else
+-    putPrivmsg(serverEncode(target), encMsg);
++    putPrivmsg(target, msgSection, encodeFunc);
+ #endif
+ }
+ 
+@@ -594,11 +598,14 @@ void CoreUserInputHandler::handleSay(const BufferInfo &bufferInfo, const QString
+     if (bufferInfo.bufferName().isEmpty() || !bufferInfo.acceptsRegularMessages())
+         return;  // server buffer
+ 
+-    QByteArray encMsg = channelEncode(bufferInfo.bufferName(), msg);
++    std::function<QByteArray(const QString &, const QString &)> encodeFunc = [this] (const QString &target, const QString &message) -> QByteArray {
++        return channelEncode(target, message);
++    };
++
+ #ifdef HAVE_QCA2
+-    putPrivmsg(serverEncode(bufferInfo.bufferName()), encMsg, network()->cipher(bufferInfo.bufferName()));
++    putPrivmsg(bufferInfo.bufferName(), msg, encodeFunc, network()->cipher(bufferInfo.bufferName()));
+ #else
+-    putPrivmsg(serverEncode(bufferInfo.bufferName()), encMsg);
++    putPrivmsg(bufferInfo.bufferName(), msg, encodeFunc);
+ #endif
+     emit displayMsg(Message::Plain, bufferInfo.type(), bufferInfo.bufferName(), msg, network()->myNick(), Message::Self);
+ }
+@@ -763,56 +770,23 @@ void CoreUserInputHandler::defaultHandler(QString cmd, const BufferInfo &bufferI
+ }
+ 
+ 
+-void CoreUserInputHandler::putPrivmsg(const QByteArray &target, const QByteArray &message, Cipher *cipher)
++void CoreUserInputHandler::putPrivmsg(const QString &target, const QString &message, std::function<QByteArray(const QString &, const QString &)> encodeFunc, Cipher *cipher)
+ {
+-    // Encrypted messages need special care. There's no clear relation between cleartext and encrypted message length,
+-    // so we can't just compute the maxSplitPos. Instead, we need to loop through the splitpoints until the crypted
+-    // version is short enough...
+-    // TODO: check out how the various possible encryption methods behave length-wise and make
+-    //       this clean by predicting the length of the crypted msg.
+-    //       For example, blowfish-ebc seems to create 8-char chunks.
++    QString cmd("PRIVMSG");
++    QByteArray targetEnc = serverEncode(target);
+ 
+-    static const char *cmd = "PRIVMSG";
+-    static const char *splitter = " .,-!?";
++    std::function<QList<QByteArray>(QString &)> cmdGenerator = [&] (QString &splitMsg) -> QList<QByteArray> {
++        QByteArray splitMsgEnc = encodeFunc(target, splitMsg);
+ 
+-    int maxSplitPos = message.count();
+-    int splitPos = maxSplitPos;
+-    forever {
+-        QByteArray crypted = message.left(splitPos);
+-        bool isEncrypted = false;
+ #ifdef HAVE_QCA2
+-        if (cipher && !cipher->key().isEmpty() && !message.isEmpty()) {
+-            isEncrypted = cipher->encrypt(crypted);
++        if (cipher && !cipher->key().isEmpty() && !splitMsg.isEmpty()) {
++            cipher->encrypt(splitMsgEnc);
+         }
+ #endif
+-        int overrun = lastParamOverrun(cmd, QList<QByteArray>() << target << crypted);
+-        if (overrun) {
+-            // In case this is not an encrypted msg, we can just cut off at the end
+-            if (!isEncrypted)
+-                maxSplitPos = message.count() - overrun;
+-
+-            splitPos = -1;
+-            for (const char *splitChar = splitter; *splitChar != 0; splitChar++) {
+-                splitPos = qMax(splitPos, message.lastIndexOf(*splitChar, maxSplitPos) + 1); // keep split char on old line
+-            }
+-            if (splitPos <= 0 || splitPos > maxSplitPos)
+-                splitPos = maxSplitPos;
+-
+-            maxSplitPos = splitPos - 1;
+-            if (maxSplitPos <= 0) { // this should never happen, but who knows...
+-                qWarning() << tr("[Error] Could not encrypt your message: %1").arg(message.data());
+-                return;
+-            }
+-            continue; // we never come back here for !encrypted!
+-        }
+-
+-        // now we have found a valid splitpos (or didn't need to split to begin with)
+-        putCmd(cmd, QList<QByteArray>() << target << crypted);
+-        if (splitPos < message.count())
+-            putPrivmsg(target, message.mid(splitPos), cipher);
++        return QList<QByteArray>() << targetEnc << splitMsgEnc;
++    };
+ 
+-        return;
+-    }
++    putCmd(cmd, network()->splitMessage(cmd, message, cmdGenerator));
+ }
+ 
+ 
+diff --git a/src/core/coreuserinputhandler.h b/src/core/coreuserinputhandler.h
+index 69a429e..6e69ce6 100644
+--- a/src/core/coreuserinputhandler.h
++++ b/src/core/coreuserinputhandler.h
+@@ -88,7 +88,7 @@ public slots:
+ private:
+     void doMode(const BufferInfo& bufferInfo, const QChar &addOrRemove, const QChar &mode, const QString &nickList);
+     void banOrUnban(const BufferInfo &bufferInfo, const QString &text, bool ban);
+-    void putPrivmsg(const QByteArray &target, const QByteArray &message, Cipher *cipher = 0);
++    void putPrivmsg(const QString &target, const QString &message, std::function<QByteArray(const QString &, const QString &)> encodeFunc, Cipher *cipher = 0);
+ 
+ #ifdef HAVE_QCA2
+     QByteArray encrypt(const QString &target, const QByteArray &message, bool *didEncrypt = 0) const;
+diff --git a/src/core/ctcpparser.cpp b/src/core/ctcpparser.cpp
+index fba3d13..37b0af3 100644
+--- a/src/core/ctcpparser.cpp
++++ b/src/core/ctcpparser.cpp
+@@ -312,29 +312,13 @@ QByteArray CtcpParser::pack(const QByteArray &ctcpTag, const QByteArray &message
+ 
+ void CtcpParser::query(CoreNetwork *net, const QString &bufname, const QString &ctcpTag, const QString &message)
+ {
+-    QList<QByteArray> params;
+-    params << net->serverEncode(bufname) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message)));
+-
+-    static const char *splitter = " .,-!?";
+-    int maxSplitPos = message.count();
+-    int splitPos = maxSplitPos;
++    QString cmd("PRIVMSG");
+ 
+-    int overrun = net->userInputHandler()->lastParamOverrun("PRIVMSG", params);
+-    if (overrun) {
+-        maxSplitPos = message.count() - overrun -2;
+-        splitPos = -1;
+-        for (const char *splitChar = splitter; *splitChar != 0; splitChar++) {
+-            splitPos = qMax(splitPos, message.lastIndexOf(*splitChar, maxSplitPos) + 1); // keep split char on old line
+-        }
+-        if (splitPos <= 0 || splitPos > maxSplitPos)
+-            splitPos = maxSplitPos;
+-
+-        params = params.mid(0, 1) <<  lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message.left(splitPos))));
+-    }
+-    net->putCmd("PRIVMSG", params);
++    std::function<QList<QByteArray>(QString &)> cmdGenerator = [&] (QString &splitMsg) -> QList<QByteArray> {
++        return QList<QByteArray>() << net->serverEncode(bufname) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, splitMsg)));
++    };
+ 
+-    if (splitPos < message.count())
+-        query(net, bufname, ctcpTag, message.mid(splitPos));
++    net->putCmd(cmd, net->splitMessage(cmd, message, cmdGenerator));
+ }
+ 
+ 
similarity index 98%
rename from net-irc/quassel/quassel-0.11.0.ebuild
rename to net-irc/quassel/quassel-0.11.0-r1.ebuild
index 719dfc198dc50452650bf57c0c6c802ecbea24b0..61b8e6329d87943750a18b4b7b2d45230b4c7b51 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/quassel-0.11.0.ebuild,v 1.6 2015/02/22 18:41:23 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/quassel-0.11.0-r1.ebuild,v 1.1 2015/03/30 05:47:44 idella4 Exp $
 
 EAPI=5
 
@@ -98,6 +98,8 @@ REQUIRED_USE="
        webkit? ( || ( X monolithic ) )
 "
 
+PATCHES=( "${FILESDIR}"/DOS-sec.patch )
+
 pkg_setup() {
        if use server; then
                QUASSEL_DIR=/var/lib/${PN}