summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-08-11Make access to deadline_timer thread-safeTobias Markmann
According to boost doucmentation shared deadline_timers are not thread-safe. Adding a mutext to protect access to boost::asio::deadline_timer instance in Swift::BoostTimer. This fixes a data-race reported by TSAN when running Swiften/QA/ClientTest/ClientTest. Test-Information: Verified that the data-race report is gone with this fix. Change-Id: I62c8c3a07d6ea16fe6e2d24c879340040406699b
2015-08-11Add missing virtual keyword on FileTransferManagerImpl dtorTobias Markmann
FileTransferManagerImpl should have a virtual dtor, as the parent class also has a virtual dtor. Test-Information: Unit tests still run. Change-Id: I72a0757a930254caadfd1463b3f90af6c4829bd0
2015-08-11Add 'check_headers' flag to scons for missing include detectionTobias Markmann
Running './scons check_headers=1 will compile each header file as an object file. Test-Information: Tested on OS X 10.9.5 and Elementary OS 0.2. Change-Id: Ia429ccc6dc0a5bd76c08a2c2e91bf192c6ad2901
2015-08-11Add note on use of Connector::stop()Kevin Smith
As the correct API usage might not be obvious Change-Id: I1d4887d7101ce59eb8f3a3dc13d94befe4a58948
2015-07-24Add missing includes for dependencies in public header filesTobias Markmann
Added Swiften/Base/Concat.h to the exception list for <algorithm> include, as Concat.h uses std::copy, defined in <algorithm>. Added Swiften/FileTransfer/S5BTransportSession.h to the exception list for <boost/bind.hpp> include, as S5BTransportSession.h declares a template class using boost::bind. Test-Information: Tested that each of Swiften's public header files compiles on its own. Change-Id: Iac794b6e0f5959cd8261888a67761813b710fe85
2015-07-21Explicitly disconnect from remaining resources in destructorsTobias Markmann
Explicitly disconnect from remaining resources in the ChainedConnected and ClientSessionStanzaChannel destructors, so the event loop will not call the signal handler methods on a freed object. Test-Information: Repeating the test case of creating a Swift::Client instance, connecting it and then deleting it after a random time below one second. On Mac OS X 10.9.5 running this test case causes two ASAN heap-use-after-free errors and with this patch the errors are gone. Change-Id: I3e48150c3633f4076ca9172aad9e85ba389df950
2015-07-20Do not reallocate FileTransferManager on connect of Clientswift-3.0beta2Tobias Markmann
Now Client allocates a FileTransferManager in its ctor and frees it in its dtor, like all the other resources of the Client class. This fixes an ASAN crash in the use case where you do a file transfer, go offline and online again and try to start another file transfer. Test-Information: Tested that the mentioned use case does not crash anymore, that file transfers still work, and that FileTransferTest still passes. Change-Id: Iddbcd8522af7df528bdc2b030fe616ad3f0c4701
2015-07-17Fix S5B proxy connection management for multiple hosts per JIDTobias Markmann
A recent commit introduced resolving of S5B proxy domain names to their IPv4 and IPv6 addresses. With that a proxy identified by a JID can have more than one host and we try them in parallel until the first succeeds. The old code just handled one host per proxy JID and a failed IPv6 attempt would override the succeeded connection. The code uses shared pointers and the succeeded connecting is deallocated and disconnected when it is replaced with the failing IPv6 connection. The result is the proxy server complaining that we are not connected as we try to activate the proxy stream. This commit changes the the proxy management to handle multiple connections per proxy JID. Failing connections are removed from the proxy sessions data structure. With the first succeeding connections, others are stopped and also removed. Test-Information: Tested on Linux (Elementary OS 0.2) with "Swiften/QA/FileTransferTest/FileTransferTest 4 4", which forces the use of SOCKS5 bytestream proxy. Change-Id: If3071c3d058e1040556bb72702bf83f4f5f25334
2015-07-16Fix memory leak in SOCKS5BytestreamServerManagerTobias Markmann
Test-Information: This LSAN reported leak is gone with this fix. Change-Id: Ib25fdfb7f4a82f62cd3f82ddb99f45618ea72ea9
2015-07-16Fix memory leaks in FileReadBytestream and FileWriteBytestreamTobias Markmann
Reported by LSAN. Test-Information: Detected by running FileTransferTest with LSAN on Linux. The leak reports for the allocations in FileReadBytestream and FileWriteBytestream are gone with this fix. Change-Id: I32711990eca0c9a2a2982837cfac38cb11a28caa
2015-07-14Add tests for Parsers and Serializers.Tarun Gupta
Adds InBandRegistrationPayloadParserTest, IBBSerializerTest, IsodeIQDelegationSerializerTest. Adds UserTune Parser and Serializer. Adds UserLocation Parser and Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: All tests passes. Change-Id: Ida220574c33ca9ee6f2aa8a2f4fba4c68e3fec60
2015-07-10Fix memory leaks reported by memcheck (Valgrind) in Jingle FT TestsTobias Markmann
Test-Information: Detected with valgrind-3.10.1 on OS X 10.9.5 and verified they are gone with this fix. Change-Id: I8cab09efd2227a8d43fa77bd2c315bd9b67435fb
2015-07-10Explicitly disconnect early from signals in candidate generatorTobias Markmann
This is an attempt to fix crash reports with a segmentation fault on call of onLocalTransportCandidatesGenerated(). Test-Information: Tested that file-transfer still works. Change-Id: I415be0d8bc5fa15dcd68d0794ee2478a0d836f27
2015-07-08Use GSSAPI when SSO is usedMili Verma
This patch uses the GSSAPI authenticator on Windows if the server advertises it and the client requests it. (The user is not able to request it in the UI yet) Also sends the manual port to the GSSAPI authenticator to construct the SPN if a non-default port is used. Test-information: Tested on Windows using WIP code. Tested both on TLS & without. Unit tests pass. Change-Id: I9a9ad9604fe084d5fb2003b7a91174a9512e2eec
2015-07-08Show canceled file-transfer by other party as canceled and not failedTobias Markmann
Test-Information: Added unit test that checks for the expected behavior. Change-Id: I4079bdc1182af466eedd2496b9837e024f14acb2
2015-07-08Create S5B proxy candidates for each DNS lookup resultTobias Markmann
If the S5B proxy lookup result has no direct IP address listed the name is resolved using DNS. This change will create a proxy result per resolved result address and not only the first result address. Test-Information: Verified the candidate list contains both entires for a proxy name that resolves to an A and an AAAA record. Change-Id: Iec21ff90af981030ff49fb53803d88a59694767c
2015-07-08Stop timer when SOCKS5BytestreamClientSession is deletedTobias Markmann
ASAN reported heap-use-after-free because if the timer is running and an instance is freed, the signal of the timer is still emitted and connected slots are called. Test-Information: Tested that the ASAN report wents away with this fix. Change-Id: Id785737c4c015e5c638e9d9f6419d740d6cf83b9
2015-07-08Rearranged initialization list to be in sync with sequence in headerTobias Markmann
Test-Information: Still builds Change-Id: I93cd349364093eae320104b5b551c25da47b1d74
2015-07-08Wait for assisted candidate detection before emitting candidatesTobias Markmann
Due to missing signal connection and a copy'n'paste bug, Swift did not wait for port forwarding/public IP detection before emitting the list of local candidates. This is fixed now. The signal is automatically disconnected when the file transfer is finished and s5bServerPortForwardingUser_ is freed. Test-Information: Send a file between two Swift instances and verified log output. Change-Id: I6530a7ac1cbf6941061bd99aa3f3b0624ebc984c
2015-07-07Use environment variables for addresses used in NetworkTestTobias Markmann
Introducing SWIFT_NETWORK_TEST_IPV4 and SWIFT_NETWORK_TEST_IPV6 for the host addresses used in BoostConnectionTest.cpp. Passing these variables and ASAN/LSAN_OPTIONS for memory leak detection when calling the test from SCons. Test-Information: Tested on Elementary OS with correct available hosts and unavailable hosts. In both cases the behavior is the same as before. Change-Id: I24128c766642c5a2ee273f7c11624525ae33e270
2015-07-07Fix memory leaks reported by ASANTobias Markmann
Test-Information: Tested on Elementary OS with a LLVM/Clang 3.7.0 build. With this patch the reports for the fixed locations are gone. Change-Id: I0260fc85ad662335a69ace331f51ebe2f864ef97
2015-07-07Add hidden option to prevent disconnect when smartcard removedMili Verma
This patch adds an option 'disconnectOnCardRemoval' to system-settings.xml which when set to false allows the user's session to stay connected if the smartcard is removed. The default value of this option is true if it is not specified. Test-information: Tested on Windows using NIST smartcards. Tested true and false values set for this option in the file and also when option is not specified (true). Unit tests pass. Change-Id: I7e421b4153ff7d3000f41999add20d339076c96e
2015-07-06Add GSSAPI client authenticatorMili Verma
Test-information: Tested on Windows using WIP code. Unit tests pass. Change-Id: I766294e57dc6374830b865f3e57b07b67e7d2fe2
2015-07-02Reestablish connection with smart cardMili Verma
When the card is reset in shared mode (which is the mode we use), an application trying to access certain commands will be returned the value SCARD_W_RESET_CARD. When this occurs SCardReconnect() must be called. This wasn't done before so this patch fixes it. Also provides more logging for SCard function returns. Test-information: Tested on Windows using NIST smart cards. Before the fix, the Card Removed Error was seen often even after the initial connection was established. After the fix, the reconnect attempt is done so the error is not seen. Also verified that if a card is removed deliberately, then the user is logged out. Change-Id: I94748ab9ff944a79de655646e1e06a8b61776f4b
2015-06-30Add wrappers for Windows API to be used in GSSAPIMili Verma
Test-information: Tested on Windows using WIP GSSAPI code. Unit tests pass. Change-Id: I21f8f637480a21a014ec172431dd8d4a01a11620
2015-06-30Remove when sending an empty responseMili Verma
In RFC 6120, there are only 2 places where "=" is allowed - in the initial client auth and in the final server success response. While testing challenge response exchanges in Kerberos, it was seen that Swift was adding an '=' in other empty responses. This patch fixes it by sending an empty response instead of an '='. Test-information: Tested on Windows using a WIP GSSAPI authentication exchange with M-Link. Change-Id: I1f82bddbd1380361cbe43e45a2804156249582ae
2015-06-29Add WindowsServicePrincipalName classMili Verma
Test-information: Tested on Windows using WIP GSSAPI code. Unit tests pass. Change-Id: If872863d6a8b5a164f8ebec4f88e9939b4e73c62
2015-06-29Pass an optional error codeMili Verma
This patch creates and passes on an optional boost::system::error_code variable which contains more error info which can be displayed in case of an error. Test-information: Tested using WIP code on Windows. Change-Id: I285b8aec5e9c00d3a8e0d8cc0d5e7b4c5d94c099
2015-06-29Parse hostname for xep-0233Mili Verma
Test-information: Verified with M-Link. Unit tests pass. Change-Id: Ic675c8d7cd70e01be61c51c0280e1d7208b364ba
2015-06-18Only delete HistoryStorage if building with experimental featuresTobias Markmann
Clang raises a warning in non-experimental builds because the full type of HistoryStorage is not known and it tries to delete an instance (even though a null ptr) in the dtor. Test-Information: Tested on OS X 10.9.5 with Clang (Apple LLVM version 6.0). Change-Id: I8a06890967427af21e11e077e9ac59b67bdb810c
2015-06-14Fix Swiften DLL building on WindowsTobias Markmann
Template classes cannot have SWIFTEN_API annotations as with annotation code for instantiations of the template are expected to be in the DLL which cannot be guaranteed for any user type. With the complete implementation in available in the header it is not needed because 3rdParty Swiften users can instantiate an implementation as needed. This also conditionally includes SQLiteHistoryStorage.h conditionally in MemoryStorages.cpp, as otherwise the linker will expect an implementation of SQLiteHistoryStorage in the DLL. However, it is only built into the DLL if experimental features are turned on. Test-Information: Tested with experimental=on/off and swiften_dll=on/off. Change-Id: Ieec85675c167ec34cffd4745ac854a5949fb2037
2015-06-11Update progress bar on incoming file transfersTobias Markmann
Test-Information: Send a file from one Swift to another. Previously the progress bar did not update in the receiving client. Now it does. Change-Id: Ie710a4c1cfc389d6fcfb93de96250a80787883d3
2015-06-10Add ability to limit SChannel to TLS 1.0Kevin Smith
Some servers have very restrictive TLS stacks that respond badly to a bug in the SChannel TLS implementation, meaning that TLS has to be limited to 1.0. Add ClientOptions.tlsOptions. This is a method of passing options into the TLS stack. It's currently only used for the TLS 1.0 workaround in SChannel, but we might reasonably expose other options in the future, such as limiting cypher suites. Disables use of SSLv3 for SChannel Also updates the coding style in SchannelContext a bit. Test-Information: Compiles on both OS X and Windows(SChannel). OS X doesn't show the new option. Windows shows it, and remembers it between logins. Not tested against a server requiring 1.0 only, but a previous hack with the same approach was tested. Change-Id: I1e7854d43811fd173f21f98d4dc3915fc7a4b322
2015-06-08Add missing SWIFTEN_API annotations to public Swiften APITobias Markmann
Test-Information: Tested build on Windows 8 with VS 2014 and ran unit tests. Change-Id: I3d8096df4801be6901f22564e36eecba0e7310c4
2015-05-26Fix crash when sending a file to yourselfTobias Markmann
Use scoped_connection to prevent missing disconnection from signals. Stop and free S5BServer when stopping SOCKS5BytestreamServerManager. Test-Information: Tried sending a file to myself multiple times and it did not crash. Change-Id: If32075d8e9c243cab254776b924248227520e030
2015-05-19Consolidate Python and SCons files to tab based indentationTobias Markmann
Test-Information: Verified that SCons still runs on OS X. Change-Id: I7e9b97f90ee5581a691a959b6f2c999d93e0be53
2015-05-01Fix typoTobias Markmann
Change-Id: Ieeb9636b40bfd43b9b79dede71eefc288e6014d2
2015-05-01Add an EventOwner to NATTraversalRequests so that accociated objects are not ↵Tobias Markmann
released early This patch also disconnects possible slots on stop() from the signals. Test-Infromation: This fixes a crash that occured during testing with ConcurrentFileTransferTest. Change-Id: I2b443f40ac3359c8142fcffc084647312b9a1e76
2015-05-01Fix hash verification in Jingle FT to only verify one hash algorithmTobias Markmann
This also adds missing resets pointers to NULL after they are deleted. Test-Information: FileTransferTest crashed in some scenarios before; now it always runs successful. Change-Id: Ic63fd51eeb46e708221a04dc912e8bf2f1d4f9fb
2015-05-01Only close unneedded S5B connections on the S5B server if a S5B server is ↵Tobias Markmann
running Add a check on whether we have a running SOCKS5 bytestream server before trying to access it to close unneeded S5B connections to it after we decided on a candidate to use. Test-Information: Without this FileTransferTest crashes in the configuration that does not allow direct or assisted S5B connections. This patch fixes this issue. Change-Id: Ifcf59f82755b9620e7f5fa5841e45815a41ac442
2015-05-01Add resource management for S5B server and port forwardingsTobias Markmann
This patchs adds management of the SOCKS5 bytestream server and port forwarding setup to Swiften. The first file-transfer, regardless of incoming or outgoing transfer, will start and initialize the S5B server and if configured try to set up port forwarding. The last file-transfer to finish will will close the server and remove the port forwarding. Test-Information: Tested with upcoming ConcurrentFileTransferTest.cpp and running multiple S5B file-transfers in parallel. Change-Id: Idd09d3d0ef9498fc9435b0aee81f2b1061783342
2015-04-10Introduce FeatureOracle class for contact feature support detectionTobias Markmann
This modifies the feature detection in the ChatController to try to use the common features of all available resources feature detection if no full JID has been bound to the chat yet. Test-Information: Tested with two Swift instances. Tested a) the initial chat start case and, b) the offline/online. In case a) Swift used to initally show a yellow warning about no support for message receipts. This warning is gone now. In case b), after a user gone offline and online again in a running chat, Swift used to show a warning about missing support for message receipts. This warning is gone now. Change-Id: I7a769fde8d14847b180503aeaa58280c572d81b3
2015-04-08Add optional logging to native log framework on AndroidTobias Markmann
To enable native Android logging you need to pass "-DSWIFT_ANDROID_LOGGING" to the "cxxflags" and "-llog" to the "linkflags". Test-Information: Tested on OS X 10.9.5, with NDK API level 14 on an emulated Android 4.0 ARM instance. Tested that if enabled, Swift log messages appear in the Android system log via "adb logcat" instead of appearing on stdout. Change-Id: If89c870f0b664a5e65ccc1fa8a244826d2875ec1
2015-04-08Skip name lookup if manual hostname is a valid IP addressTobias Markmann
Removed dead debugging code and unnecessary includes as well. Test-Information: Tested with Swiften/QA/ClientTest, adjusted to have a manual hostname set in the ClientOptions. Tested on OS X 10.9.5, with NDK API level 14 on an emulated Android 4.0 ARM instance. Without this patch the connector timed out during name lookup trying to resolve the IP set in the ClientOptions::manualHostname. With this patch it skips lookup and connects successfully. Tested and verified unchanged behavior with this patch and without the manual address override set. Change-Id: I737327b2e66c9da78a1963e754bcf201b7d40626
2015-04-08Fix warning about unused private member variableKevin Smith
Test-Information: Compiles without the warning, unit tests pass. Change-Id: I31bce47e4d6595b4ef405a87b56cf71db004e6a0
2015-03-28Fix a bug in successful file-transfer termination in IncomingJingleFTTobias Markmann
IncomingJingleFileTransfer::terminate already sets the finshed state for the file-transfer. Test-Information: Verified in the logs that onFinished signal is only called once. Change-Id: Ib2084e1487ded2a921f61b237cd036e1ae4cf992
2015-03-28Set file-transfer finished state after checking the dataTobias Markmann
Test-Information: The FileTransfer::onFinished was not called when the file transfer finished. Verified with log output that it is called correctly now. Change-Id: I05f2a749ca3f0aece08cae9503a212cf0327f98a
2015-03-28Change IQ handling to allow non-final IQ handlers/respondersTobias Markmann
Previously all IQ handlers were final. The IQ handles were processed in last-added-first order and if the IQ payload matched the handler payload, the IQ would only be passed to that handler. This conflicts with our IBBReceiveSession. When running multiple concurrent file-transfers using multiple IBBReceiveSessions there are multiple IQ handlers for IBB content; one for every transfer. This commit allows a Responder to be set as non-final. In this case unhandled IQs will not be responded with an error but returned to the IQRouter so it can pass it to the next possible IQ handler. Test-Information: Tested with ConcurrentFileTransferTest with runs multiple IBB transfers in parallel. Change-Id: I8237e234cbe5c110deaa8c3d6ba303b65fd53d00
2015-03-28Add missing line endingsTobias Markmann
Test-Information: Builds. Change-Id: Ica4b1bca4ff71f103ee5ebad707bc0f95595ad37
2015-03-27Fix OutgoingJingleFileTransferTest and enable it againTobias Markmann
Test-Information: Unit tests pass. Change-Id: I793fb65fd2e760daddab0142abc33d4aa5b4fce5