From 3063c256d4dee650fe66a8a8b937ffce7de6b8f6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 3 Aug 2013 12:45:15 +0100 Subject: [PATCH 1/3] Maximum message length configurable within keys.dat --- src/class_receiveDataThread.py | 13 ++++++++++++- src/helper_startup.py | 1 + src/shared.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index 2693b293..f1ba979d 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -46,6 +46,17 @@ class receiveDataThread(threading.Thread): self.PORT = port self.streamNumber = streamNumber self.payloadLength = 0 # This is the protocol payload length thus it doesn't include the 24 byte message header + self.maxMessageLength = 180000000 # maximum length of a message in bytes, default 180MB + + # get the maximum message length from the settings + try: + maxMsgLen = shared.config.getint( + 'bitmessagesettings', 'maxmessagelength') + if maxMsgLen > 32768: # minimum of 32K + self.maxMessageLength = maxMsgLen + except Exception: + pass + self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave = {} self.selfInitiatedConnections = selfInitiatedConnections shared.connectedHostsList[ @@ -140,7 +151,7 @@ class receiveDataThread(threading.Thread): shared.knownNodes[self.streamNumber][ self.HOST] = (self.PORT, int(time.time())) shared.knownNodesLock.release() - if self.payloadLength <= 180000000: # If the size of the message is greater than 180MB, ignore it. (I get memory errors when processing messages much larger than this though it is concievable that this value will have to be lowered if some systems are less tolarant of large messages.) + if self.payloadLength <= self.maxMessageLength: # If the size of the message is greater than the maximum, ignore it. remoteCommand = self.data[4:16] with shared.printLock: print 'remoteCommand', repr(remoteCommand.replace('\x00', '')), ' from', self.HOST diff --git a/src/helper_startup.py b/src/helper_startup.py index d60ad681..c36589d5 100644 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -67,6 +67,7 @@ def loadConfig(): shared.config.set( 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0') shared.config.set('bitmessagesettings', 'dontconnect', 'true') + shared.config.set('bitmessagesettings', 'maxMessageLength', '180000000') if storeConfigFilesInSameDirectoryAsProgramByDefault: # Just use the same directory as the program and forget about diff --git a/src/shared.py b/src/shared.py index 32370524..aed1971e 100644 --- a/src/shared.py +++ b/src/shared.py @@ -371,4 +371,4 @@ def fixSensitiveFilePermissions(filename, hasEnabledKeys): raise helper_startup.loadConfig() -from debug import logger \ No newline at end of file +from debug import logger From 3ff76875aa5d8b8dbadef48e28cc7e919b9042b3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 11 Aug 2013 12:07:54 +0100 Subject: [PATCH 2/3] Packaging updated to be architecture independent --- Makefile | 3 ++- arch.sh | 2 +- archpackage/PKGBUILD | 8 ++++---- debian.sh | 4 ++-- debian/changelog | 3 ++- debian/control | 4 ++-- generate.sh | 2 +- puppypackage/pybitmessage-0.3.5.pet.specs | 2 +- rpmpackage/pybitmessage.spec | 4 +++- src/bitmessageqt/__init__.py | 10 ++++++++++ 10 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e0ff247a..07e8b7bc 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ PREFIX?=/usr/local all: debug: source: - tar -cvzf ../${APP}_${VERSION}.orig.tar.gz ../${APP}-${VERSION} --exclude-vcs + tar -cvf ../${APP}_${VERSION}.orig.tar ../${APP}-${VERSION} --exclude-vcs + gzip -f9n ../${APP}_${VERSION}.orig.tar install: mkdir -p ${DESTDIR}/usr mkdir -p ${DESTDIR}${PREFIX} diff --git a/arch.sh b/arch.sh index 0ccc45b3..1ae5211d 100755 --- a/arch.sh +++ b/arch.sh @@ -4,7 +4,7 @@ APP=pybitmessage PREV_VERSION=0.3.5 VERSION=0.3.5 RELEASE=1 -ARCH_TYPE=`uname -m` +ARCH_TYPE=any CURRDIR=`pwd` SOURCE=archpackage/${APP}-${VERSION}.tar.gz diff --git a/archpackage/PKGBUILD b/archpackage/PKGBUILD index efbf33e2..fd13b92a 100644 --- a/archpackage/PKGBUILD +++ b/archpackage/PKGBUILD @@ -3,13 +3,13 @@ pkgname=pybitmessage pkgver=0.3.5 pkgrel=1 pkgdesc="Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide "non-content" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." -arch=('i686' 'x86_64') +arch=('any') url="https://github.com/Bitmessage/PyBitmessage" license=('MIT') groups=() -depends=('python2' 'qt4' 'python2-pyqt4' 'sqlite' 'openssl' 'gst123') +depends=('python2' 'qt4' 'python2-pyqt4' 'sqlite' 'openssl' 'mpg123') makedepends=() -optdepends=('python2-gevent') +optdepends=('python2-gevent: Python network library that uses greenlet and libevent for easy and scalable concurrency') provides=() conflicts=() replaces=() @@ -19,7 +19,7 @@ install= changelog= source=($pkgname-$pkgver.tar.gz) noextract=() -md5sums=() +md5sums=(ebf89129571571198473559b4b2e552c) build() { cd "$srcdir/$pkgname-$pkgver" ./configure --prefix=/usr diff --git a/debian.sh b/debian.sh index a4d6882e..ea46acaf 100755 --- a/debian.sh +++ b/debian.sh @@ -1,10 +1,10 @@ #!/bin/bash APP=pybitmessage -PREV_VERSION=0.3.4 +PREV_VERSION=0.3.5 VERSION=0.3.5 RELEASE=1 -ARCH_TYPE=`uname -m` +ARCH_TYPE=all DIR=${APP}-${VERSION} if [ $ARCH_TYPE == "x86_64" ]; then diff --git a/debian/changelog b/debian/changelog index 711f6488..8cdaff2c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,7 +14,8 @@ pybitmessage (0.3.5-1) raring; urgency=low * Added Russian translation * Added search support in the UI * Added 'make uninstall' - * To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 if PKCS5_PBKDF2_HMAC is unavailable + * To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 + if PKCS5_PBKDF2_HMAC is unavailable * Added better warnings for OSX users who are using old versions of Python * Repaired debian packaging * Altered Makefile to avoid needing to chase changes diff --git a/debian/control b/debian/control index 5e016a1c..6fb419f4 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,5 @@ Source: pybitmessage +Section: mail Priority: extra Maintainer: Bob Mottram (4096 bits) Build-Depends: debhelper (>= 9.0.0) @@ -7,8 +8,7 @@ Homepage: https://github.com/Bitmessage/PyBitmessage Vcs-Git: https://github.com/Bitmessage/PyBitmessage.git Package: pybitmessage -Section: mail -Architecture: any +Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev, gst123 Suggests: libmessaging-menu-dev Description: Send encrypted messages diff --git a/generate.sh b/generate.sh index d21f4d83..d65f4f86 100755 --- a/generate.sh +++ b/generate.sh @@ -4,4 +4,4 @@ rm -f Makefile rpmpackage/*.spec -packagemonkey -n "PyBitmessage" --version "0.3.5" --dir "." -l "mit" -e "Bob Mottram (4096 bits) " --brief "Send encrypted messages" --desc "Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide \"non-content\" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." --homepage "https://github.com/Bitmessage/PyBitmessage" --section "mail" --categories "Office/Email" --dependsdeb "python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev, gst123" --dependsrpm "python, PyQt4, openssl-compat-bitcoin-libs, gst123" --mainscript "bitmessagemain.py" --librarypath "/opt/openssl-compat-bitcoin/lib/" --suggestsdeb "libmessaging-menu-dev" --dependspuppy "openssl, python-qt4, sqlite3, sqlite3-dev, python-openssl, python-sip, gst123" --dependsarch "python2, qt4, python2-pyqt4, sqlite, openssl, gst123" --suggestsarch "python2-gevent" --pythonversion 2 --dependsebuild "dev-libs/openssl, dev-python/PyQt4[${PYTHON_USEDEP}]" --buildebuild "\${PYTHON_DEPS}" --pythonreq "sqlite" --repository "https://github.com/Bitmessage/PyBitmessage.git" +packagemonkey -n "PyBitmessage" --version "0.3.5" --dir "." -l "mit" -e "Bob Mottram (4096 bits) " --brief "Send encrypted messages" --desc "Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide \"non-content\" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." --homepage "https://github.com/Bitmessage/PyBitmessage" --section "mail" --categories "Office/Email" --dependsdeb "python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev, gst123" --dependsrpm "python, PyQt4, openssl-compat-bitcoin-libs, gst123" --mainscript "bitmessagemain.py" --librarypath "/opt/openssl-compat-bitcoin/lib/" --suggestsdeb "libmessaging-menu-dev" --dependspuppy "openssl, python-qt4, sqlite3, sqlite3-dev, python-openssl, python-sip, gst123" --dependsarch "python2, qt4, python2-pyqt4, sqlite, openssl, mpg123" --suggestsarch "python2-gevent: Python network library that uses greenlet and libevent for easy and scalable concurrency" --pythonversion 2 --dependsebuild "dev-libs/openssl, dev-python/PyQt4[${PYTHON_USEDEP}]" --buildebuild "\${PYTHON_DEPS}" --pythonreq "sqlite" --repository "https://github.com/Bitmessage/PyBitmessage.git" diff --git a/puppypackage/pybitmessage-0.3.5.pet.specs b/puppypackage/pybitmessage-0.3.5.pet.specs index 939294e4..717cd281 100644 --- a/puppypackage/pybitmessage-0.3.5.pet.specs +++ b/puppypackage/pybitmessage-0.3.5.pet.specs @@ -1 +1 @@ -pybitmessage-0.3.5-1|PyBitmessage|0.3.5|1|Internet;mailnews;|7.2M||pybitmessage-0.3.5-1.pet|+openssl,+python-qt4,+sqlite3,+sqlite3-dev,+python-openssl,+python-sip,+gst123|Send encrypted messages|ubuntu|precise|5| +pybitmessage-0.3.5-1|PyBitmessage|0.3.5|1|Internet;mailnews;|3.8M||pybitmessage-0.3.5-1.pet|+openssl,+python-qt4,+sqlite3,+sqlite3-dev,+python-openssl,+python-sip,+gst123|Send encrypted messages|ubuntu|precise|5| diff --git a/rpmpackage/pybitmessage.spec b/rpmpackage/pybitmessage.spec index b15bd586..3af43532 100644 --- a/rpmpackage/pybitmessage.spec +++ b/rpmpackage/pybitmessage.spec @@ -6,6 +6,7 @@ License: MIT URL: https://github.com/Bitmessage/PyBitmessage Packager: Bob Mottram (4096 bits) Source0: http://yourdomainname.com/src/%{name}_%{version}.orig.tar.gz +BuildArch: noarch Group: Office/Email Requires: python, PyQt4, openssl-compat-bitcoin-libs, gst123 @@ -83,7 +84,8 @@ make install -B DESTDIR=%{buildroot} PREFIX=/usr - Added Russian translation - Added search support in the UI - Added 'make uninstall' -- To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 if PKCS5_PBKDF2_HMAC is unavailable +- To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 + if PKCS5_PBKDF2_HMAC is unavailable - Added better warnings for OSX users who are using old versions of Python - Repaired debian packaging - Altered Makefile to avoid needing to chase changes diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 1d115af1..58452876 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1054,12 +1054,22 @@ class MyForm(QtGui.QMainWindow): if 'linux' in sys.platform: # Note: QSound was a nice idea but it didn't work if '.mp3' in soundFilename: + gst_available=False try: subprocess.call(["gst123", soundFilename], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + gst_available=True except: print "WARNING: gst123 must be installed in order to play mp3 sounds" + if not gst_available: + try: + subprocess.call(["mpg123", soundFilename], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + gst_available=True + except: + print "WARNING: mpg123 must be installed in order to play mp3 sounds" else: try: subprocess.call(["aplay", soundFilename], From 82db79ca397aeecf9a9ed2707ca5d9b12dec1e1b Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sat, 24 Aug 2013 20:23:49 -0400 Subject: [PATCH 3/3] removed option from previous commit which allowed user-settable maximum network message size pending further discussion --- src/class_receiveDataThread.py | 13 +------------ src/helper_startup.py | 4 ---- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index f014aedd..19df1bdc 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -45,17 +45,6 @@ class receiveDataThread(threading.Thread): self.peer = shared.Peer(HOST, port) self.streamNumber = streamNumber self.payloadLength = 0 # This is the protocol payload length thus it doesn't include the 24 byte message header - self.maxMessageLength = 180000000 # maximum length of a message in bytes, default 180MB - - # get the maximum message length from the settings - try: - maxMsgLen = shared.config.getint( - 'bitmessagesettings', 'maxmessagelength') - if maxMsgLen > 32768: # minimum of 32K - self.maxMessageLength = maxMsgLen - except Exception: - pass - self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave = {} self.selfInitiatedConnections = selfInitiatedConnections shared.connectedHostsList[ @@ -149,7 +138,7 @@ class receiveDataThread(threading.Thread): shared.knownNodesLock.acquire() shared.knownNodes[self.streamNumber][self.peer] = int(time.time()) shared.knownNodesLock.release() - if self.payloadLength <= self.maxMessageLength: # If the size of the message is greater than the maximum, ignore it. + if self.payloadLength <= 180000000: # If the size of the message is greater than 180MB, ignore it. (I get memory errors when processing messages much larger than this though it is concievable that this value will have to be lowered if some systems are less tolarant of large messages.) remoteCommand = self.data[4:16] with shared.printLock: print 'remoteCommand', repr(remoteCommand.replace('\x00', '')), ' from', self.peer diff --git a/src/helper_startup.py b/src/helper_startup.py index 8b4c2111..256dbcaa 100644 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -69,11 +69,7 @@ def loadConfig(): shared.config.set( 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0') shared.config.set('bitmessagesettings', 'dontconnect', 'true') -<<<<<<< HEAD ensureNamecoinOptions() -======= - shared.config.set('bitmessagesettings', 'maxMessageLength', '180000000') ->>>>>>> 3ff76875aa5d8b8dbadef48e28cc7e919b9042b3 if storeConfigFilesInSameDirectoryAsProgramByDefault: # Just use the same directory as the program and forget about