0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-31 01:43:02 +08:00

6033 Commits

Author SHA1 Message Date
sigiesec
ebba815a4d Problem: duplicate but equivalent state enums in curve_server_t and plain_server_t
Solution: pull state enum up to zap_client_t and unify names of enum values
2017-08-16 18:05:35 +02:00
sigiesec
414c6f45b8 Problem: receive_and_process_zap_reply is duplicated in all mechanisms
Solution: extract receive_and_process_zap_reply into zap_client_t and convert zap_client_t into base class of the server mechanism classes
2017-08-16 18:05:35 +02:00
sigiesec
d7a3778387 Problem: plain_server_t duplicates zap_client_t::send_zap_request
Solution: Use zap_client_t::send_zap_request
2017-08-16 18:05:35 +02:00
sigiesec
014b201d3e Problem: ZAP message without credentials is not terminated
Solution: Set more flag depending on presence of credentials
2017-08-16 18:05:35 +02:00
sigiesec
b324c66b6f Problem: null_mechanism duplicates zap_client_t::send_zap_request\nSolution: use zap_client_t::send_zap_request 2017-08-16 18:05:34 +02:00
sigiesec
f3884f3380 Problem: gssapi_server_t duplicates zap_client_t::send_zap_request
Solution: Use zap_client_t::send_zap_request
2017-08-16 18:04:31 +02:00
sigiesec
6e8a0b31be Problem: ZAP client code is duplicated in all mechanisms
Solution: created a zap_client_t class, extracted first function send_zap_request from curve_server_t
2017-08-16 18:04:30 +02:00
Luca Boccassi
97e532e7db Problem: missing flags break build of test_security_curve
Solution: add all the required compiler flags since the test includes
source code from the library directly
2017-08-16 15:19:09 +01:00
Luca Boccassi
e2df328d17 Merge pull request #2685 from minrk/uint32_t
add missing uint32_t typedef on msvc
2017-08-16 09:41:37 +01:00
Min RK
e0271087f0 add missing uint32_t typedef on msvc
uint32_t is used in the draft APIs
and undefined on MSC 1500
preventing compilation
2017-08-16 09:40:20 +02:00
Simon Giesecke
4a18f6204c Problem: Possible buffer overruns related to metadata in various mechanisms (#2683)
* Problem: no test case with CURVE encryption and large identity

Solution: added test case (currently crashing)

* Problem: possible buffer overflow in mechanism_t::add_property

Solution: add target buffer length parameter and check the buffer is sufficiently large

* Problem: test cases accidentally excluded from build

Solution: remove #if/#endif

* Problem: possible buffer overruns related to metadata at various locations

Solution: allocate buffer large enough for actual metadata, reduce code duplication

* Problem: syntax error related to pointer type conversion

Solution: change argument type of make_command_with_basic_properties to const char *

* Problem: large metadata may cause an assertion in produce_initiate

Solution: Allow metadata of arbitrary size in produce_initiate
2017-08-15 18:42:31 +01:00
Simon Giesecke
d5e4319edc [WIP, do not merge] Problem: insufficient tests for ZMTP-CURVE protocol errors (#2680)
* Extracted connect_vanilla_socket function

* Problem: no tests for ZMTP-CURVE protocol errors

Solution: added two test cases with erroneous HELLO commands

* Problem: insufficient tests for ZMTP-CURVE protocol errors

Solution: added two test cases with erroneous HELLO command version

* Problem: test HELLO message is invalid apart from deliberate errors

Solution: create cryptographically correct HELLO message
add tweetnacl.c to test_security_curve

* Problem: nonce is incorrect, build fails with GCC

Solution: use correct non prefix

* Problem: make builds are failing

Solution: transfer CMake changes to (auto)make files

* Problem: nonce is incorrect, build fails with GCC

Solution: use correct non prefix

* Problem: make builds are failing

Solution: transfer CMake changes to (auto)make files

* Problem: no test with INITIATE command with invalid length

Solution: added test case

* Problem: code duplication between test_security_curve.cpp and curve_client.cpp

Solution: extracted parts of zmq::curve_client_t::produce_hello into reusable function

* Problem: code duplication between test_security_curve.cpp and curve_client.cpp

Solution: extracted further parts of zmq::curve_client_t into reusable functions
added missing file

* Problem: mechanism_t::add_property can be declared static

Solution: declare mechanism_t::add_property static

* Problem: intermediate crypto data needs to be passed between static function calls to curve_client_tools_t

Solution: add non-static member functions

* Problem: msg_t instance may be closed twice

Solution: remove offending close

* Problem: prepare_hello uses static curve_client_tools_t::produce_hello

Solution: Use non-static curve_client_tools_t::produce_hello

* Problem: no test with invalid command name where INITIATE command is expected

Solution: added test case

* Problem: make builds are failing due to curve_client_tools.hpp not being found

Solution: add curve_client_tools.hpp to list of source files

* Problem: wrong initializer order in zmq::curve_client_t

Solution: reorder

* Problem: under non-Windows systems, test fails because random_open was not called

Solution: call random_open/random_close within test

* Problem: conflict between custom function htonll and macro definition on Darwin

Solution: define htonll function only if not defined as a macro

* Problem: nullptr not defined on all platforms

Solution: replace nullptr by NULL

* Problem: libsodium builds not working

Solution: adapt compile and link file sets for libsodium builds

* Problem: Makefile.am broken

Solution: Fix syntax

* Problem: no tests for garbage encrypted cookie or content in INITIATE

Solution: added test cases

* Problem: test cases accidentally excluded from build

Solution: remove #if/#endif

* Solution: some error cases are unreachable

Problem: for the time being, added some comments without changing the code

* Added comments on hard-to-test cases
2017-08-15 15:28:24 +01:00
Luca Boccassi
a927ecc0ed Merge pull request #2678 from evoskuil/fix-warnings
Problem: unused variable causing warnings or breaks.
2017-08-12 10:32:31 +01:00
evoskuil
16dd37bbff Problem: unused variable causing warnings or breaks. 2017-08-11 16:07:54 -07:00
Luca Boccassi
85b8b38fe1 Merge pull request #2677 from evoskuil/fix-warnings
Problem: unused variables causing warnings or breaks.
2017-08-11 22:24:48 +01:00
evoskuil
a604b84ab6 Problem: unused variables causing warnings or breaks. 2017-08-11 14:16:55 -07:00
Constantin Rack
6abeb7ec2f Merge pull request #2675 from bluca/sunos_sigbus
Problem SIGBUS under 64-bit SunOS Sparc
2017-08-11 20:01:05 +02:00
Luca Boccassi
e376c81c2d Problem: SIGBUS on SPARC64
Solution: force the compiler to make the atomic_counter_t alignment
friendly.
This will ensure that the pointers inside the buffers allocated by
shared_message_memory are aligned, at the cost of growing the memory
size of atomic_counter_t from 4 to 8 bytes on 64 bit (when not using
mutexes).
Note that although content_t contains an atomic_counter_t, the
compiler already padded the struct so there is no change in the
buffer sizes used by the engines, save for the extra 4 bytes for the
buffer's own single atomic counter.
Fixes #2588
2017-08-11 17:48:23 +01:00
Luca Boccassi
f0ae5e585c Problem: C++11 atomic API never used
Solution: remove requirement to manually define macro and just check
for the C++ supported version.
Note that compiler intrinsics still have priority if available, to
avoid changes unless necessary.
2017-08-11 17:47:18 +01:00
Luca Boccassi
347f143a5c Merge pull request #2673 from jakecobb/curve_testing
CURVE throughput performance testing
2017-08-10 21:16:51 +01:00
Jake Cobb
84ab771808 Problem: Throughput calculation underestimates slow messages
Solution: Use a double for messages per second and calculate
Megabits per second using it.  Truncate messages per second
only in the reported output.
2017-08-10 14:30:22 -04:00
Jake Cobb
78b26d7ac2 Problem: Throughput perf tool doesn't support CURVE
Solution: Add extra argument to enable CURVE, use
fixed keys to make local_thr and remote_thr compatible
with CURVE enabled.
2017-08-10 14:29:21 -04:00
Luca Boccassi
6652a0d742 Merge pull request #2672 from jakecobb/cmake_libsodium
Problem: CMake build does not allow static linking libsodium
2017-08-10 18:17:45 +01:00
Jake Cobb
0cbdc18817 Problem: CMake build does not allow static linking libsodium
Solution: Pass along SODIUM_STATIC define if set in CMake config
2017-08-10 13:04:15 -04:00
Luca Boccassi
889a6bff05 Merge pull request #2671 from AlainODea/ao-clarify-null-ZAP-status-code
Problem: log for bad ZAP status code is confusing
2017-08-10 15:01:31 +01:00
Alain O'Dea
454d1eda65
Problem: log for bad ZAP status code is confusing
Solution: log that handler sent bad status code to clarify ZAP debugging
2017-08-10 10:59:18 -02:30
Constantin Rack
82c4792e21 Merge pull request #2668 from bluca/fix_pgm_build 2017-08-08 19:53:58 +02:00
Luca Boccassi
75fba539d0 Problem: PGM/NORM builds broken due to i_engine API change
Solution: implement get_endpoint in the NORM and PGM engines too
2017-08-08 15:18:07 +01:00
Simon Giesecke
a6cef4ef86 Problem: ZAP status codes != 200 do not result in an appropriate monitor event (#2665)
* Problem: missing test for status code 300, inadequate assertion for status code 500

Solution: add test, change assertion (currently test fails)

* Problem: gcc compiler error deprecated conversion from string constant

Solution: declare variable as const

* Problem: in case of ZAP handler returning a status code other than 200, no appropriate event is emitted

Solution: immediately emit event after receiving reply from ZAP handler

* Problem: endpoint address is not included in zap-reply monitor event

Solution: added functions to retrieve endpoint address in zmq::i_engine and zmq::session_base_t
removed unused code block in zmq::stream_engine_t::next_handshake_command

* Problem: wrong formatting

Solution: fix formatting

* Problem: test fails because of EPIPE

Solution: add EPIPE/ECONNRESET/ECONNAGAIN handling for more test cases
2017-08-08 13:10:20 +01:00
Simon Giesecke
834b9e4cd7 Problem: some test cases may still fail because of EPIPE/ECONNABORT/ECONNRESET (#2664)
* Problem: CI failure on Appveyor with err==ECONNRESET

Solution: ignore ECONNRESET analogous to EPIPE

* Problem: blocking test execution

Solution: added more debug output, do not wait for monitor infinitely without output
2017-08-07 17:07:37 +01:00
Jim Klimov
612d81a831 Merge pull request #2659 from bluca/fix_getrandom
Problems: test_security_curve occasionally hangs or fails due to ECONNABORTED
2017-08-07 12:36:59 +02:00
Luca Boccassi
20bbd016c1 Merge pull request #2663 from sigiesec/fix-zap-assertion
Problem: failing assertion on ZAP protocol error
2017-08-07 11:15:54 +01:00
Luca Boccassi
2564c8e5b9 Merge pull request #2662 from sigiesec/fix-hwm-tests-race-2
Problem: occasional test failures due to messages not (yet) received in test assertion
2017-08-07 10:51:11 +01:00
Simon Giesecke
de82cbe4ba Problem: failing assertion on ZAP protocol error
Solution: do not assert on ZAP protocol error when connection was closed by client
2017-08-07 10:59:36 +02:00
Simon Giesecke
8842e0f0a9 Problem: occasional test failures due to messages not (yet) received in test assertion
Solution: add sleep
2017-08-07 10:35:25 +02:00
Luca Boccassi
5f6ff69f62 Problem: test_security_curve fails due to ECONNABORTED
Solution: expect that error, which can happen on very slow machines
due to a client timimng out or RST before the connection is accepted
by the server
2017-08-07 09:26:38 +01:00
Luca Boccassi
1c1f10a25a Problem: test_security_curve occasionally hangs
Solution: refactor the ZAP thread to avoid creating the socket in the
main thread and using it in the ZAP thread, and also to eliminate
races at shutdown use another inproc control socket to signal
termination to the thread
2017-08-07 09:18:37 +01:00
Constantin Rack
02e93492b6 Merge pull request #2661 from jimklimov/brandom
Problem: getrandom usage breaks build
2017-08-07 09:07:13 +02:00
Luca Boccassi
3046fe2053 Problem: getrandom usage breaks build
Solution: add missing flags parameter
2017-08-07 08:43:25 +02:00
Constantin Rack
98a3bb6f24 Merge pull request #2656 from bluca/unwind
Problems: use-before-initialise error in print_backtrace, test_security_curve sometimes fails due to unexpected ECONNRESET
2017-08-06 03:06:06 +02:00
Luca Boccassi
14df80ae3a Problem: test_security_curve does not account for ECONNRESET
Solution: ignore ECONNRESET as with EPIPE - it can happen on very
slow machines when the engine sends data to the peer and then tries
to read from the TCP socket before the peer has read
2017-08-05 18:08:21 +01:00
Luca Boccassi
dc51ebeb1f Problem: valgrind shows unitialised errors in backtrace print
Solution: fix them
2017-08-05 18:04:15 +01:00
Constantin Rack
03c0b2dfe2 Merge pull request #2654 from bluca/appveyor
Problems: timeout in curve test, redundant windows and android CI jobs
2017-08-04 22:48:33 +02:00
Luca Boccassi
0a8775e717 Merge pull request #2655 from sigiesec/fix-curve-produce-error
Problem: zmq::curve_server_t::produce_error sends sizeof std::string instead of status code length
2017-08-04 17:43:24 +01:00
Luca Boccassi
067b7b0d27 Problem: Android build on Travis OSX takes 10 minutes+
Solution: remove it, and test it only on Linux, as the toolchain and
build process is the same.
2017-08-04 16:29:11 +01:00
Luca Boccassi
9c085381ee Problem: test_security_curve timeouts on CMake
Solution: bump timeout from 20 to 60 seconds
2017-08-04 16:25:59 +01:00
Luca Boccassi
8275f6356a Problem: redundant appveyor test
Solution: remove it. No need to do an additional sodium on - curve
off test, as sodium will be disabled anyway
2017-08-04 16:24:40 +01:00
Luca Boccassi
e83abb3de3 Merge pull request #2652 from sigiesec/curve-security-tests-improvement
Problem: open TODOs in test code, CI failures
2017-08-04 16:03:44 +01:00
Simon Giesecke
41108b203e Problem: zmq::curve_server_t::produce_error sends sizeof std::string instead of status code length
Solution: send status code length (always 3) instead
2017-08-04 16:54:46 +02:00
Simon Giesecke
7ba70e95e5 Problem: test failure on CI due to ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL/EPIPE problem
Solution: add workaround at another place, unify two code fragments to remove duplication
2017-08-04 16:05:20 +02:00