summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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-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-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
2018-10-09Address compiler warnings about missing override on dtorsTobias Markmann
Test-Information: Builds and compiler warnings in not emitted by clang 8.0.0 anymore. Change-Id: I118552b3b058acd15cdb9579e3695d9bf3d6b2fe
2018-10-04Prevent connect on active sluift clients and componentsEdwin Mons
Connect should not be called twice on clients or compoments without disconnecting first. While this worked in some cases, mixing connect options, specifically first trying without, and then with a bosh_url, would lead to asserts being triggered. The connect logic now checks whether there's already a connection in progress or established, and raises a Lua exception early if there is. Test-Information: Tested on macOS 10.13 Connected components and clients with invalid and valid hosts, and with valid and invalid bosh_urls, all with and without disconnecting in between attempts. No asserts were triggered, and appropriate Lua exceptions were thrown. Change-Id: I6b91b57945844bce7fce0073e5d0fe199ab815d5
2018-10-01Catch numeric cast errors in BoostConnectionServerEdwin Mons
When BoostConnectionServer tries to set up a listener, it casts an int to an unsigned short, which may throw an uncaught exception if the cast fails. Test-Information: Unit tests pass on Debian 9 Test server code no longer crashes when it tries to set up a listener on an invalid port. Change-Id: If6b920e54481ce6bf174df01d14ad12eff90e3f4
2018-09-26Update SCons in 3rdParty from 2.4.0 to 3.0.1Tobias Markmann
This also has our scons patch in 3rdParty/SCons applied. Test-Information: Builds with unit tests on macOS 10.13.6. Change-Id: I25d3662eeec27a76dab10d501ba46dc16f0bef4b
2018-08-02Have StreamStack own the top and bottom layerTobias Markmann
Test-Information: Builds, unit tests and integration tests pass on macOS with clang 7.0 master. Change-Id: I0db411e49339ccb2301edd1a16612cb1ad2c927c
2018-08-01Use interfaces for top and bottom layer in StreamStackTobias Markmann
Test-Information: Builds, unit and integration tests pass on macOS with clang 7.0 master Change-Id: Idb9648c1293adbe6f4b79af3ad619ebb0630e48d
2018-08-01Avoid lvalue and simplify boolean expressionTobias Markmann
Test-Information: Builds and unit tests pass on macOS with clang 7 master. Change-Id: I0bf2828db49dfb6a7e99c78f1d2f7e76e87f8ca1
2018-07-31Have StreamStack own intermediate layers via std::unique_ptrTobias Markmann
Test-Information: `./scons test=all` passes with no errors on macOS with clang 7 master. Change-Id: I31765ac15750dc5af7b70d1a85171dc8e3590181
2018-07-30Use std::unique_ptr to have TLS classes own the TLSContextTobias Markmann
TLSLayer and TLSConnection now own the TLSContext they use. The TLSContextFactory interface is adjusted to use std::unique_ptr. Test-Information: Builds and all tests pass on macOS with clang-7-master. Change-Id: I14e33c98b48445094f404b73ea41af0a51d2dde6
2018-07-27Autofix boost-use-to-string clang-tidy warningsKevin Smith
Done by adding --fix --fix-errors to the clang-tidy args in the Makefile Test-Information: Unit tests pass (macOS) Change-Id: I3a4df955ac3553afeb9384f23f9d8b2ef01117e2
2018-07-24Add a XEP-346 FDP Form Submission DialogPeter Burgess
A new form submission dialog that will discover nodes containing fdp form templates in a given pubsub domain, and will present the form to the user ready to be filled out and submitted. Test-Infomation: Personally tested the request for all node items, loading the latest form from one of the discovered nodes, submitting a form and checking it turns up on my mlink server using mlc, checked that the submitted infomation is correct, what happens when an incorrect domain is queried, what happens when a valid domain is queried but it has no fdp nodes, and what happens when a form is requested from an invalid node. Unit tests written to test success and failure of the three controller functions requestPubSubNodeData(), requestTemplateForm() and testSubmitForm(). Change-Id: If8c57bb4e3120dd44d52f7332069eb18a14cb385
2018-07-17Rename variable for consistencyKevin Smith
Everything else in the class uses underscore suffixes already. Test-Information: Unit tests pass. Change-Id: I1263025f18a6e06971610f8c7fc06f47bbbe9c9d
2018-07-17Add unit test for missing bookmark responsesKevin Smith
Test-Information: Without the recent fix for missing bookmark results, tests crash, on master they pass Change-Id: Iab2d55d6d60e5926485d31f4dd63a117a9d12aee
2018-07-17Don'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-06-21Add a leave room option in MUC roomsThanos Doukoudakis
This patch will add a leave room option in the cog menu of a MUC room, allowing the user to leave the room and close the window. Additionally when joining or leaving a room the autojoin field will change to true or false respectively. This patch also fixes a minor issue with a gui option that was not identifying bookmarked rooms at the cog menu. The autojoin option on the Enter room, Bookmark room and Edit Bookmark menu has been removed, since the default behaviour will be to automatically bookmark every MUC room the user joins, setting autojoin to true. If the user chooses to leave the room, then the autojoin flag will be set to false and the bookmark will be updated. Test-Information: Tested the changes in the UI in Windows Qt 5.9. Updated the ChatsManagerTests unit tests to check the chattables and the behaviour of the bookmarks, when joining and leaving MUCs. Change-Id: Iad1f34480a1e0b9df25c73b49247acc7b7825e20
2018-06-19Don't double-connect to IP literalsKevin Smith
Before this change, an IP literal would be attempted directly, and if that failed it would then 'resolve' the literal and try the result. Test-Information: Added a unit test verifying the bug before fixing it. Change-Id: Ic887c74152f5a4b259392dad402952b3777268b1
2018-05-29Sort input file listBernhard M. Wiedemann
so that the swift-im openSUSE package builds in a reproducible way in spite of indeterministic filesystem readdir order See https://reproducible-builds.org/ for why this is good. License: This patch is BSD licensed - see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Builds on different machines should no longer have differences in Swiften.h Change-Id: I8066a66db83c7d7ff10858196cb72b13af3f6008
2018-05-14Allow resending messages without 198 acksThanos Doukoudakis
This patch will allow to resend messages that have not been successfully delivered to the server. It requires that the server will have stream management enabled as described in XEP-198. Test-Information: Tested the changes on Windows and Linux. Modified the code to force messages to fail, and then tested the resend functionality. Added ChatControllerTest, with unit Tests for the resend case. The rest of unit test pass. Change-Id: Id095528247b25a47e34c5632b8469ebd4c97149b
2018-05-07Replace boost::lambda with C++11 lambdasTobias Markmann
Test-Information: Builds on macOS 10.13.4 with clang trunk. All unit and integration tests pass. Produces fewer warnings with clang trunk (previously reported marked-unused-but-used warnings). Change-Id: I849d764537cfbc380155e87b033dc5e517b3c342
2018-05-03Replace BOOST_AUTO with C++11 auto keywordTobias Markmann
Test-Information: Code builds on macOS 10.13.4 with clang trunk. Change-Id: Ia80ef02701f93e32447a471b2398ba8a3cc29c32
2018-04-28Disable false-positive clang warningKevin Smith
Test-Information: ./scons check=1 allow_warnings=0 now passes on latest macOS Change-Id: I4411d6b4953e6e2eb7fbb53e460fef296d24b0e6
2018-04-28Fix compiler warnings for SwiftenKevin Smith
Test-Information: ./scons allow_warnings=0 Swiften now builds on latest macOS Change-Id: Ic2095d5d112093d021f7f4695fbce73f315377cf
2018-04-18Mark jids with an empty domainpart as invalidEdwin Mons
When Swiften parsed jids with an empty domainpart (e.g. user@/resource), it would mark the jid as valid, and treat the localpart as domainpart. RFC 6122 states in 2.2 that "A domainpart MUST NOT be zero bytes in length". Unit tests for both a bare jid and a full jid with an empty domainpart have been added. Test-Information: Unit tests pass on Debian 9 Change-Id: Iadaf399cd4158666bfcdd6c075b8bf2102ff5538
2018-03-27Add new ReferencePayload element class, parser and serializerPeter Burgess
Added a new element object ReferencePayload, and created the parser and serializer to handle this element. Currently no functionality to send references directly in swift, nor to render their contents. Test-Information: Unit tests written and passed for serializer and parser, testing various types of valid and invalid references, and testing references with embedded payloads. Change-Id: I81fd5d9e020fac1729640f297705806af97f6388
2018-03-24Allow setting full JID affiliations in MUCsKevin Smith
Test-Information: Equivalent change in Stroke has been tested in MLC. Change-Id: I254e974fc55e9bd99c722c79a02a3ae1ed515565
2018-03-20Merge branch 'swift-4.x'swift-5.0alpha2Tobias Markmann
* swift-4.x: (44 commits) Test-Information: Builds on macOS 10.13.3 with clang trunk. Change-Id: If50381f103b0ad18d038b920d3d43537642141cb
2018-03-19Update Swift and Swiften changelog for upcoming 4.0 releaseswift-4.0Tobias Markmann
Test-Information: None. Change-Id: I4d89315b084406f44654c4d6a7e2e9c8da0874ce
2018-03-14Fix building with OpenSSL on WindowsTobias Markmann
Define NOMINMAX when building OpenSSL backend on Windows and otherwise you cannot use std::numeric_limits<T>::max. Test-Information: Swiften builds on Windows 10 with VS2015 with the OpenSSL TLS backend. Change-Id: I9621c14426a0af2280cef7ee973abcff2fd0a48d
2018-03-12Ability to set Diffie-Hellman parameters for OpenSSLContextTobias Markmann
Test-Information: Unit tests pass on macOS 10.13.3 with ASAN and Clang 7.0. Change-Id: Ifc2bf2c1b63fca7f3ee43ef61c79a96b8e5ced5f
2018-03-12Add getPeerFinishMessage() method and OpenSSL TLS backendTobias Markmann
This method allows to calculate the TLS finish message of the peer of a TLS connection. It can be used to provide SASL channel binding for TLS servers. Test-Information: Added unit test that verifies the finish messages of a server TLS context with the finish messages of a client TLS context. Tests pass on macOS 10.13.3 with OpenSSL. Change-Id: Ia5ba539e1fb6d1bef6b4436bb59c7384b57a69b0
2018-02-27Divide differently marked msgs and elide msgs matching roomPeter Burgess
If consecutive message from the same user have differing security markings, then mark them as non continuing to show clearer seperation of messages with different security markings. They are seperated in the same way as consecutive messages from different users are. Further to this, there is a new scheme for displaying message security markings. Messages with a security marking matching the room security marking will not be marked, aside from the first in a series of consecutive messages marked with the same security marking. Unmarked messages in a room with a security marking will be marked as such. This new marking display system can be turned on and off via an xml setting "mucMarkingElision". Test-Information: Unit tests written and passed in MUCControllerTest, runs as expected. Change-Id: Id2b66417f363c49c131d27e738ce786755d65203
2018-02-26Ignore invalid vCard avatar update notificationsTobias Markmann
Test-Information: Tests pass on macOS 10.13.3 with clang-trunk and ASAN. Change-Id: Ice68e93341693349ed5d95dfc062c0a7b07dc673
2018-02-22Request and display security markings for MUC chat windowsPeter Burgess
Disco#info requested and handled by MUCController on rejoin(). UI display of disco#info implemented for QtChatWindow. Test-Information: Tests written for new MUCController features, and all tests passed. Swift runs with changes and security markings show as and when expected in local isode MUC windows. Change-Id: Ibef4a31f6f8c4cff5f518a66106266a7f961d103
2018-02-21Add support for Server Name Indication to OpenSSLContextTobias Markmann
Test-Information: Builds and unit tests pass on macOS 10.13.3 with OpenSSL TLS backend. Change-Id: Ie8f4578c867a2e4bf84484cde4a7cff048566ca4
2018-02-02Add basic TLS server support in OpenTLSContextTobias Markmann
This also extends the TLSContext interface with methods required for server mode. Test-Information: Added unit tests that test new functionality in TLSContex. This includes test certificates in the source file that are not for public use. This new ClientServerTest is only enabled for OpenSSL, as other TLS backends do not support the new functionality yet. Tested on macOS 10.13.3 with clang-trunk. Change-Id: I8e43476057608067eb3b9852328aa21cd22974a0