summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-09-17Set DEBIAN_FRONTEND=noninteractive for Dockerfile.package.inTobias Markmann
Test-Information: Tested that it does not request input from user anymore. Change-Id: I85d231dab20e124f4ee8a9575a1b0422d216abe0
2019-09-17Fix casing of enums to avoid conflict on WindowsTobias Markmann
Test-Information: Tested on Windows with OpenSSL that this fixes the compilation issue. Change-Id: I01887c8eb758a6c1c208244cdae32aa9c0a99565
2019-09-16Close the stream for disallowed XML featuresJoanna Hulboj
According to RFC 6120 if any disallowed XML feature is encountered, we should close the stream with a <restricted-xml/>. The following features of XML are prohibited in XMPP: - processing instructions - internal or external DTD subsets - internal or external entity references - comments Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS Change-Id: I475920c91b7f9da51ab37c106a4783a52f6e3cae
2019-09-03Add enhanced OpenSSL configurationTim Costen
Adds TLSOptions to the OpenSSLContext, which invokes a new private 'configure' method which allows various OpenSSL options to be set. Also add standard verification callbacks and external (via a std::function field in TLSOptions) to allow the user to specify their own method which will perform client certificate checking when a new TLS connection is accepted. Only set up the internal verifyCertCallback if the user-supplied hook is set. All callback hooks are set up in the 'configure' method, and only then if TLSOptions.verifyMode is present (i.e. not defaulted to boost::none), to preserve compatibility for users of this class (e.g. Swift) which want to use OpenSSL's own internal validation functions rather than setting the callbacks. Test-information: Used new code under development in M-Link when setting up a TLSContext, setting verify-mode=require, and set up verifyCertCallback with a local method. Making a client TLS connection which includes a client certificate results in the local verify callback being invoked. Change-Id: Idbb7279e1711fca8123f430bfca0dcfb65bc8da6
2019-08-20Fix building 3rdParty/Expat on non-WindowsTobias Markmann
Test-Information: Tested successfully on macOS 10.14.6 and Debian 9. Change-Id: I341589b6e92e9d16b53ea247d0b91ac1a0639f66
2019-07-29Add KDE Neon support to InstallSwiftDependencies.shTobias Markmann
Thanks Miroslaw Stein. Test-Information: After running BuildTools/InstallSwiftDependencies.sh Swift builds fine on KDE Neon User Edition 5.16. Change-Id: I05c074051aaecfdaf2352308285bcfaeaa4d8c2c
2019-07-26Update 3rdParty/Expat to 2.2.7Tobias Markmann
Test-Information: None yet. Change-Id: Ia5b570c918b8059561b52062e8d43496f188ee4a
2019-07-22Signal namespace declarations to ParserClientsEdwin Mons
Prior to calling handleStartElement, the ParserClient handleNamespaceDeclaration will fire for each namespace declared on the element. Test-Information: Unit tests pass on Debian 9 for both expat and libxml2 Change-Id: Ic42e83aee83edfbb2aa5c971997808eb6e133223
2019-05-28Add check if IPv4, IPv6 are valid JID domain partJoanna Hulboj
When creating a JID we were not checking if a domain part is a valid IPv4, IPv6 addresses. We were only checking if the domain is correct according to internationalized domain name rules which was failing for IPv6 addresses. Test-Information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS Change-Id: Ia1b67089f6edfdc6a0ebf2d26a7eaab9ce8171c0
2019-05-13Add flag to signal final XML dataEdwin Mons
XML parse now takes an optional boolean that will signal that with the data that is fed into the parser, the document should now be complete. This will allow the parser to reject partial documents. Test-Information: Updated unit tests pass. Checked that default behaviour wasn't changed. Tested with various partial and complete documents. Change-Id: Ide7c2e47c49d5667f1febcb23da366e96d0dbc21
2019-03-19Replace use of Cocoa API deprecated in 10.14 in SlimberTobias Markmann
macOS 10.14 started to deprecate some old Cocoa API. This replaces use of the deprecated API with newer Cocoa API. Test-Information: Still builds fine on macOS 10.14.3. Verified that Slimber still works as expected. Change-Id: Id772af58b3fd233ecf829b80eca59815184a6113
2019-03-18Remove non-library code from 3rdParty LibNATPMP SConscriptTobias Markmann
libSwiften should not ship with any main symbol. While it is not harmful directly it bloats the library and prevents a main symbol free library, which is useful in some cases. Test-Information: All unit and integration tests pass on macOS 10.14.3. Change-Id: Idf2294ebef04acacc8f1f95d2be58b3f96409ebb
2019-03-12Remove duplicated sources in DockerJohnny Sheppard
Change-Id: I4ee9b2e6d9c8c224e428f9fa06a74315872603ef
2019-02-28Create Debian packages using DockerThanos Doukoudakis
This patch will setup Docker containers to build the source and Debian packages. The script will use the private key under gpg-keys folder to sign the Debian packages. If the folder is not there or doesn’t exist then the build will fail. Keys are expected to be in .asc format, unencrypted and not password protected. Added .dockerignore file to avoid copying the cache files to the container. The output is stored in out/ folder and the folder structure is ready for update_debian_repo.sh script. SWIFT_PACKAGE_PLATFORMS defines the platforms that it will be build for. Default values are: ubuntu:bionic ubuntu:cosmic debian:stretch debian:sid. DOCKERRUNEXTRAFLAGS variable can set additional flags for Docker builders. Currently is set to --privileged to avoid an issue during build with Qt5.11.1 https://bugreports.qt.io/browse/QTBUG-64490. Updated the Debian repo scripts to new distributions and Docker changes. Test-Information: Run the script and created source & binaries for all the distributions. Verified that changelog, compact, control, copyright, rules and source/format exist under the Debian folder when building the Debian package. Created tags and generated dev builds, rc builds, and release builds to test the output of the different release channels. Created a container, tested the Swift and Swiften packages, and the installations: Tested the following debs with piuparts in a docker container of the system they are build for. No errors raised and a few warnings related with chroot (which fails within a docker container) *libswiften-dev-dbgsym*.deb, *libswiften-dev_*.deb *libswiften5-dbgsym_*.deb *libswiften5_*.deb *swift-im-dbgsym_*.deb *swift-im_*.deb Installed the above packages and verified the install with swift-im –version, headers exist in /usr/include/Swiften/ and libSwiften.so under /usr/lib/. Verified the gpg signatures on the .changes and .buildinfo files. Tested the output with the update_debian_repo.sh and the import was successful. Verified the .changes and .buildinfo files with lintion which reported the following errors and warnings (there are differences between different channels release, beta, development): E: swift-im changes: bad-distribution-in-changes-file development E: swift-im changes: multiple-distributions-in-changes-file beta development W: libswiften5: new-package-should-close-itp-bug W: libswiften-dev: new-package-should-close-itp-bug W: swift-im: new-package-should-close-itp-bug Tested that the man page exists after installing in a docker container (ubuntu xenial, debian stetch, debian sid). Change-Id: Ic28d2731bbca34716645e76e7e7e7e8183dea4f8
2019-02-26Fix library search path for man page generationThanos Doukoudakis
This patch will fix an issue that occurs when generating the man pages for swift-im. The man page is generated from the Swiften library using help2man. The issue occurs when the library cannot be found during build time and help2man is generating a man page with the output of that error, ignoring the return error code from swift-im. To avoid this happening in future builds, swift-im --help is run before generating the page and checked if the execution was successful. If yes we proceed with the generation, if not we stop the build and throw an error. swiften-config man page generation was not affected by this issue. Test-Information: Build with ubuntu 18.04 on a machine that hasn’t got Swift or Swiften installed. Build the Debian package for Debian stretch with pbuilder, and installed on a clean docker container (Debian stretch). Repeated the test with Debian sid but with packages build from docker containers. Change-Id: Icf8a84ba7f4810c87e5835e5ac1a91d1324ddac8
2019-02-20Fix Python 3 Unicode issues related to Windows packagingTobias Markmann
Test-Information: Without these fixes, the build of a Windows MSI package is not possible on Windows Server 2012. This is due to the fact that on Windows you must force UTF8 coding on file open as it defaults to Windows specific codec for everything. Tested by building a Windows MSI package on Windows Server 2012. Change-Id: I32664824188775f5ba27d9644fbbf33bf7094dfa
2019-02-12Force textfile.py tool output encoding to UTF-8Tobias Markmann
On Windows the preferred encoding is cp1252, which makes zero sense for text files. This change will force it to UTF-8, which is a sensible choice that works best. Test-Information: Build now works on Windows 2012 with MSVC 2015 32bit, with test=unit. Change-Id: I3324d41fe33df98cdd5b90e0712f741f401176c3
2019-02-07Split out attribute escape routineEdwin Mons
Test-Information: Unit tests pass on Debian 9 Change-Id: I60f95816cfa48a619f83daac1d88e229bbe228ed
2019-01-25Allow Sluift to set stanza IDsKevin Smith
Test-Information: Compiles Change-Id: I5bfbf270524a1a31c9105f108f47f64eb95276d1
2019-01-22Avoid deprecated boost endianess includeMiroslaw Stein
As of Boost 1.69.0, boost/detail/endian.h is deprecated in favour of boost/predef/other/endian.h, and BOOST_(LITTLE|BIG)_ENDIAN by BOOST_ENDIAN_(LITTLE|BIG)_BYTE. Test-Information: Unit tests pass on Debian 9 Change-Id: If7076c559a4e35219ff97603f50b80cfbe05b29b
2019-01-22Don't assume that tribool has an implicit bool conversionBruce Stephens
In boost 1.68.0 the conversion is implicit, but in 1.69.0 it's explicit and we must explicitly call it. Change-Id: I24eb78be7510c89b88342d28c539cad4977f99fd
2019-01-21Make Version.py compatible with both Py2 and Py3Edwin Mons
The merge of 4.x changes onto master introduced changes to Pyhon scripts that weren't compatible with Python 3. The Version.py script is now compatible with both Python 2 and Python 3, and a slightly underimplemented test has been expanded to actually live up to its name. getGitBuildVersion has been refactored completely. It has been simplified to require only one invocation of git describe, unit tests for the parsing have been added, and a way to call getGitBuildVersion from the commandline has been added to Version.py (to avoid adding a unit test that would call out to an external tool). DocBook.py has been made compatible with Python3, and some additional logic to prevent emitting b'path/to/docbook/xml' instead of the desired 'path/to/docbook/xml' has been added. Generation of COPYING in Swift/QtUI now uses the upstream version provided with SCons 3, and our custom version has been removed. Unused code in the SwiftenDevelopersGuide SConscript with invalid regular expressions has been removed, and the remaining regular expressions in SConscripts have been fixed. Test-Information Code has been tested on macOS 10.14. Scons now completes a build on a clean tree using either Python 2 or Python 3. Running it on a previouly built tree works with either, as well, mixing versions between invocations is not an issue. Swift unit tests pass with Python 3.7.0. Version.py unit tests pass with Python 2.7.15 and 3.7.0. Running with doc=1 works with both Python 2 and Python 3, even if the docbook points to a path with unicode characters in it. Resulting COPYING file has been verified both visually and against a Python2 generated one on master. Resulting XML files for documentation have been inspected. Resulting manual HTML and PDF files have been inspected. Change-Id: I54de909d80b8e35a8c351261ae10ce3537729c84
2019-01-21Fix OpenSSLContext to work correctly with OpenSSL 1.1.1Tobias Markmann
The previous code only worked with 1.1.0j or older. Now the code works with 1.1.0j and OpenSSL 1.1.1. Adjusted ClientServerTest to be more graceful in case of errors, i.e. failing tests instead of crashing. Test-Information: Tested that without the changes, the tests pass with OpenSSL 1.1.0j and test fail or crash with OpenSSL 1.1.1 and OpenSSL 1.1.1a. Tested that with the changes, the tests pass with OpenSSL 1.1.0j, OpenSSL 1.1.1, and OpenSSL 1.1.1a. Tested on macOS 10.14.2 with system clang. Change-Id: Ic63774049727f6d949153166f63a8545e9a24892
2019-01-18Allow ownership transfer of certificatesEdwin Mons
OpenSSL TLS contexts assume ownership of any additional certificate passed into it. The CertificateFactory now returns a vector of unique_ptrs, and OpenSSLContext will do the needful with releasing ownership at the right moment. A unit test has been added that uses a chained certificate in client/server context. Before the fix, this test would either fail, or result in a segmentation fault, depending on the mood of OpenSSL. Test-Information: Unit tests pass on Debian 9 Ran manual tests with server test code, tested both chained and single certificates, and no longer observed crashes when accepting a connection. Change-Id: I21814969e45c7d77e9a1af14f2c958c4c0311cd0
2019-01-18Have checker tool not use '--.*' arguments as test namesTobias Markmann
Without this you could not pass through Google Test flags down, because they would be used as CppUnit test names and exit the tool early as the test do not exit. Test-Information: Verified that flags are passed along. This allows to filter specific Google Test test cases. Running checker without parameters still works. Tested that things build on Debian 9.6. Change-Id: I4d4b97a84e2baf81a25cc2f9641c6e49594c0044
2019-01-15Merge tag 'swift-4.x' into masterTobias Markmann
* branch 'swift-4.x': Update for Debian Don't crash on missing bookmark result Add missing include for QAbstractItemModel Update Debian changelog Fix convertToWindowsVersion() function to handle more RCs Fix error response handling when requesting VCards Test-Information: ./scons test=all succeeded on macOS 10.14.2. Change-Id: I99d20a8b0e1b0be501fbbe95adebbff15f510184
2019-01-14Add optional message to TLSErrorEdwin Mons
TLSError now takes an optional error message. OpenSSLContext has been updated to send out one, and calls to SWIFT_LOG have been removed from it for anything but setCertificateChain. OpenSSLContext::handleDataFromApplication misinterpreted the return code of SSL_write, triggering an onError in cases where more network I/O was required. Test-Information: Unit tests pass on Debian 9 Server test code no longer emits undesirable warnings to stderr on macOS 10.14. Change-Id: If0f932693361ef9738ae50d5445bfb4d3ed9b28f
2019-01-07Update for Debianswift-4.0.3Tobias Markmann
Fix UTF-8 handling issues in BuildTools/SCons/Tools/textfile.py . Test-Information: Tested that ./scons test=unit Swift works on Debain Unstable (sid) and macOS 10.14.2. Tested that build_for_debian.sh runs successfully on latest Debian Unstable (sid). Change-Id: I29d8c97ce3b4eb3e4fd680bdc814fb0c911262ff
2019-01-07Don't crash on missing bookmark resultKevin Smith
Test-Information: Before the patch, boom, after the patch, no boom. (No boom today. Boom tomorrow. There's always a boom tomorrow) Change-Id: Id454d7b0d0cd05774d0f1ee0b3cb77057371c459
2018-11-27Sluift: Added handling of roster push eventRoger Planas
Swiften handles roster push event notifications, but those were not passed to Sluift, so a Sluift client, when querying events, would not be aware if an XMPP server roster pushes. This patch adds extra events types to Sluift so that method for_each_event reports roster pushes notifications. Test-information: Used sluift client to retrieve all items after adding, removing and updating roster items, and now Sluift clients can see these events. Change-Id: Ide5597bf2b39e3cc20014c66ba9153c551eec670
2018-11-19Fix incorrect cast in OpenSSL providerEdwin Mons
A numeric cast was added to the call to HMAC that doesn't belong there, this commit reverts that. Test-Information: Unit tests pass on macOS 10.14 and Debian 9 Change-Id: I8deb568f7bff4d401fc6dd6de21edf7f061ebd59
2018-11-15Allow HostAddress(Port) to be used in a mapKevin Smith
Test-Information: Added unit tests Change-Id: I405d9e9c2b64c4953ca0cec8f6481b695c15e30f
2018-11-14Build on MojaveKevin Smith
We can't target 10.5 any more with the latest xcode, so instead of thinking too much about the right thing, just bump to 10.6 for the moment. Test-Information: Builds again on Mojave Change-Id: I3975a3ce0c8246ba4dabb0f86390060c4c4a1972
2018-11-14Address bad_numeric_casts for filetransfersEdwin Mons
The filetransfer blockSize is now an unsigned integer, as 0 could be used to denote an invalid block size as well (and indeed, already indicated that better than -1 did). All use of numeric_cast in filetransfer code has been fixed to deal with the possibility of thrown exceptions. Test-Information: Unit tests pass on macOS and Debian Change-Id: I1833d553bae071238be20ebc386ef602effb78b0
2018-11-14Remove numeric_casts from BOSH parserEdwin Mons
The two uses of numeric_casts have been rewritten as static casts, with asserts to guarantee (and inform the developer) that the number is never negative (code inspection showed that this should never be the case). Test-Information: Unit tests pass on macOS and Debian Change-Id: I3ca63724721ecd8e351d9017e0975b6ae326f85f
2018-11-14Address LinkLocal issuesEdwin Mons
Generation of TXT records might fail if any of the fields is too long, so the result is now an optional (pending Expected). Callsites have been updated to deal with this. Three potentially uncaught exceptions in the Bonjour implementation have been addressed. Test-Information: Unit tests pass on macOS 10.14 and Debian 9 Change-Id: Iec02c4606a18eee855362fd3c3d15614a9e72547
2018-11-14Catch bad_numeric_casts in crypto codeEdwin Mons
Exceptions thrown by boost::numeric_cast are now caught and an assert explicitly triggered. Test-Information: Unit tests pass on macOS 10.13 Change-Id: I9a1cbe5ae2765e4275bf35473a871ef8468fd729
2018-11-14Fix various uses of numeric_cast in UI bitsEdwin Mons
Apart from QtUI bits, this addresses use of uncaught numeric cast exceptions in message count handling, the spell parser and the MacOS idle querier. The WindowsServicePrincipalName logic previously had an issue where using ports from 32768 onwards would result in a bad_numeric_cast exception to be thrown. This has been addressed at the same time as the uncaught exceptions, and all ports should work now. The tags file has been extended to ignore more files. Change-Id: I73ced35f06517bee5c58f990d20fa437b40ac84e
2018-11-14Fix Stanza Ack maximum and testsEdwin Mons
The stanza ack code now uses a constexpr without numeric cast to calculate the maximum, and test code uses the constant UINT32_MAX from limits, both of which should result in the same number. Test-Information: Unit tests pass on macOS 10.14 Change-Id: Iba8fc779e52699d480d1ce458df0c6581a16ad06
2018-11-13Update one forgotten port in BoostConnectionEdwin Mons
Test-Information: Unit tests pass on Debian 9 and macOS 10.14 Change-Id: I7881249c68a294679a6a9d0f6bef65cad5034687
2018-11-09Remove numeric_casts from XML parsersEdwin Mons
The code has been updated to use asserts where a sensible recovery path was deemed impossible, and a conditional return for parse. In general, our XML parsing will fail for any single parse of a document over roughly 2 2GiB, which is probably not going to be a practical issue soon. Test-Information: Unit tests pass on macOS 10.13 using Expat and Debian 9 using LibXML Change-Id: I3a8da802860028ea278b322af081c2b22b55a442
2018-11-09Store NATPortMapping lifetime as uint32_tEdwin Mons
The NAT-PMP RFC specifies lifetime as an unsigned, 32 bit integer, so using this internally makes sense. This also removes the need for casts in interface code. A slight bug in the NATPMPInterface implementation to remove a mapping has been addressed. Test-Information: Unit tests pass on macOS 10.13 Change-Id: I06687fd2735a8706f339f85d6c957ad7aadaaf02
2018-11-08Handle RFC 1035 label and domain len restrictions in libidn backendTobias Markmann
LibIDNConverter was fixed to handle these restrictions correctly. Test-Information: Added unit tests for RFC 1035 length restrictions for labels and domain names. The libidn and ICU backends pass the new test. Change-Id: Ie570b0ee4c5c6381f7769f6178ec2a5824074221
2018-11-08Change unread counters to size_tEdwin Mons
Since the counters cannot be negative, changing the type used for unread counters to size_t seems a better fit, and it avoids the need for numeric_casts. Test-Information: Unit tests pass on macOS 10.13 Change-Id: I61badcfc410f0cce7f922da90b50ef5a809c6521
2018-11-08Consistently use unsigned short for network portsEdwin Mons
Network ports are now consistently stored as unsigned shorts, apart from the options and user interface, where -1 is still used to denote the use of default ports. Test-Information: Unit tests pass on macOS 10.13 and Debian 9 On macOS: tested the UI with various proxy and manual ports, behaviour as expected. Change-Id: I7a65f40083022887aa30ed7b21eadc56d0c52be1
2018-10-25Strip off trailing dot from domainpart of jidEdwin Mons
RFC 6122 specifies that if a domainpart ends in a dot, it must be stripped off before any other canonicalisation steps are taken. Unit tests have been added to check that various JID scenarios with a domain ending in a dot pass or are rejected as expected. Test-Information: Unit tests pass on macOS 10.13. Manual tests in sluift show expected behaviour. Change-Id: Id6813aaa4422a81bff0a4559eacd6855ef104dc3
2018-10-24Honour JID part length in ICUConverterEdwin Mons
ICUConverter allowed jidparts greater than 1023 bytes during stringprep. The SConscript of StorageTest did not work when libidn had been disabled, which prevented test=unit from completing. Test-Information: Unit tests pass on Debian 9 in a build with ICU and ASan enabled. Change-Id: I791a09457c6b852e61ce1281871e0f3ca0ce645c
2018-10-24Fix buffer overrun in LibIDNConverterEdwin Mons
When Swift::LibIDNConverter::getStringPrepared was called with an input of 1024 or more characters, stringprep would be called on a memory region that wasn't NUL-terminated. It also blindly trimmed the input to 1024 bytes, even though there may be input longer than that that still results in a valid 1023 byte prepped string. IDNConverterTest has been converted to gtest, as cppunit cannot deal with testing for std::exceptions being thrown on at least macOS Test-Information: Unit tests pass on macOS 10.13 and Debian 9 Before fix, the newly added unit tests triggered an ASan abort due to a buffer overrun. After fix, all unit tests pass, even with ASan enabled. Change-Id: Ia3e51a39f5db1de32b8f8bb388f81ca041136df7
2018-10-12Fix Component's disconnect to run event loop while isActiveRoger Planas
The Component::disconnect() was controlling the running of the event loop with the isAvailable flag, but it turns out that depending on timing, a re-connect could be attempted and the component erroneously claim that the "Component is already connecting or connected", which could not possibly the case if the first attempt to connect the component failed (hence, not possible it was connected). By updating the event loop to use the correct isActive flag, this issue is fixed. This error was highlighted as a result of the previous commit "Prevent connect on active sluift clients and components". Also, the getNextEvent is fixed to do not suffer from the same problem, and use isActive instead of isAvailable. Test-information: Before the patch, a test that would attempt a second component connect after a failed one would randomly fail. After the patch, a test that would attempt a second component connect after a failed one has passed hundreds of time without failure. Change-Id: I20be6b1c8aec485ded3330c143dedd2161c4c66e
2018-10-10Remove JID prep caching from JID classTobias Markmann
Ran a flamegraph diff on Swift login to an account with a moderate number of JIDs in roster and more than 10 rooms in auto join. It showed a difference less that 0.1% on the changed method. As it does not make much of a difference for Swift at least, caching is removed. Test-Information: Unit tests passes, Swift still logins fine on macOS. Change-Id: Id33d6d1a655580e06e1364df717fd6f34cce5327