Commit Graph

553 Commits

Author SHA1 Message Date
Martin Hurton
fe4396c597 Merge pull request #1188 from hintjens/master
Problem: stream_engine.cpp security can be downgraded
2014-09-19 20:16:09 +02:00
Pieter Hintjens
77f14aad95 Problem: stream_engine.cpp security can be downgraded
Solution: accept only the mechanism defined by the socket options.

I've not tested this yet, so it's a speculative fix.
2014-09-19 19:24:45 +02:00
Martin Hurton
8e9005d591 Merge pull request #1186 from hintjens/master
Problem: test_security_curve does't try wrong mechanisms
2014-09-18 10:09:49 +02:00
Pieter Hintjens
57ade6d5bb Problem: test_security_curve does't try wrong mechanisms
Solution: check that it rejects attempts to connect to a CURVE server
using NULL or PLAIN client.
2014-09-18 07:32:07 +02:00
evoskuil
8cd85857fb Fix potential redefinition of common DEBUG symbol, replace tabs. 2014-09-02 23:39:33 -07:00
evoskuil
d76536eb70 Default Travis clang build fails on unused variable 'MAX_SENDS'. 2014-08-28 18:25:35 -07:00
Richard Newton
8926cb3ddb Fix test broken when we changed FD_SETSIZE. 2014-08-26 08:36:51 +01:00
kreuzberger
212220dda7 Bugfix wrong CMakeLists.txt after rename of file 2014-08-12 21:34:30 +02:00
Pieter Hintjens
f20b70bef5 Cleaned up test_xpub_nodrop
Renamed test case to actually explain what it's testing, and cleaned up
the code a little.
2014-08-12 12:37:49 +02:00
Pieter Hintjens
785aebc6a8 Reworking Travis script 2014-08-12 12:37:49 +02:00
Pieter Hintjens
75d4f50be3 Problem: ZMQ_CURVE_SECRETKEY reads beyond end of Z85 data
Solution: change setsockopts on printable keys to expect 41, nor 40
bytes. Code still accepts 40 bytes for compatibility, and copies the
key to a well-terminated string before using it.

Fixes #1148
2014-08-12 12:37:49 +02:00
kreuzberger
f042ea9e26 better naming of flags and variables to real functionality: nodrop 2014-08-08 19:45:41 +02:00
kreuzberger
d9a3cc48d4 do not silently drop messages in publisher if hwm is reached 2014-08-08 19:36:00 +02:00
Pieter Hintjens
bbbe8d7832 Merge pull request #1154 from mrvn/pull-test_router_mandatory_hwm
Add test for HWM behaviour for mandatory ROUTER sockets over tcp
2014-08-07 13:09:54 +02:00
Goswin von Brederlow
893995e698 Add test for HWM behaviour for mandatory ROUTER sockets over tcp 2014-08-07 12:52:07 +02:00
Diego
6537e202d6 moved root CMakeLists.txt tests config to tests/CMakeLists.txt 2014-08-05 13:24:32 +02:00
Thomas Rodgers
03f097a541 Update zmq_msg_get(ZMQ_SHARED) to return true for type_cmsg messages 2014-07-29 13:43:38 -05:00
Ewen McNeill
829b1bb4d4 Include testutil.hpp if using SETTLE_TIME
Updated:
   tests/test_connect_delay_tipc.cpp
   tests/test_sub_forward_tipc.cpp
   tests/test_term_endpoint_tipc.cpp
2014-07-24 13:00:21 +12:00
Ewen McNeill
fc80e8cda1 z/OS: signal(SIGPIPE, SIG_IGN) for tests
Updated:
   tests/testutil.hpp: Add signal(SIGPIPE, SIG_IGN) to
        setup_test_environment(), on z/OS (__MVS__)
2014-07-23 13:39:45 +12:00
Pieter Hintjens
81b9f21bdd Merge pull request #1132 from rodgert/master
Added test and doc section for ZMQ_SHARED message flag
2014-07-13 02:03:51 +02:00
Thomas Rodgers
82282d6973 Added test and doc section for ZMQ_SHARED message flag 2014-07-12 18:05:49 -05:00
Richard Newton
31cff7ccf9 Add test for unbinding inproc socket. 2014-07-09 10:28:26 +01:00
Pieter Hintjens
a087ce55ea Problem: two header files for a single library
Users who need e.g. zmq_curve_keypair() have to remember to include
zmq_utils.h, which is counter-intuitive. The whole library should be
represented by a single include file.

Solution: merge all contents of zmq_utils.h into zmq.h, and deprecate
zmq_utils.h. Existing apps can continue unchanged. New apps can ignore
zmq_utils.h completely.
2014-06-27 15:58:18 +02:00
Pieter Hintjens
dd05a64462 Problem: zmq_msg_gets did not set errno on unknown properties
Solution: set errno to EINVAL when a property does not exist.

Also fixed test_metadata.cpp to test this case.
2014-06-25 17:28:36 +02:00
Pieter Hintjens
deaad00ad9 Problem: zmq_connect() does not validate TCP addresses
Since https://github.com/zeromq/libzmq/commit/350a1a, TCP addresses
get resolved asynchronously, so zmq_connect no longer returned an
error on incorrect addresses.

This is troublesome since we rely on some error checking to catch
blatant errors.

Solution add some upfront syntax checking that catches at least the
obvious kinds of errors (invalid characters, wrong or missing port
number).
2014-06-24 14:33:38 +02:00
Richard Newton
82be399527 Merge pull request #1097 from hintjens/master
Added capabilities API
2014-06-23 13:23:20 +01:00
chrox
bdf6427a00 Fixed build with arm-linux-androideabi toolchain 2014-06-22 18:13:05 +08:00
Pieter Hintjens
36db9c0803 Fixed compile error if Kerberos installed 2014-06-19 15:28:04 +02:00
Pieter Hintjens
f11d673ba9 Problem: need way to probe library capabilities
As libzmq is compiled with optional transports and security mechanisms,
there is no clean way for applications to determine what capabilities
are actually available in a given libzmq instance.

Solution: provide an API specifically for capability reporting. The
zmq_has () method is meant to be open ended. It accepts a string so
that we can add arbitrary capabilities without breaking existing
applications.

zmq.h also defines ZMQ_HAS_CAPABILITIES when this method is provided.
2014-06-18 15:19:07 +02:00
Richard Newton
1d236d81c8 Merge pull request #1090 from hintjens/master
Problem: zmq_ctx_get (ZMQ_MAX_SOCKETS) returns gibberish
2014-06-16 08:45:37 +01:00
Pieter Hintjens
188f7864ea Fixed testcase for ZMQ_MAX_SOCKETS 2014-06-11 21:25:46 +02:00
Dave Meehan
a1f8737976 Exclude test_abstract_ipc from non-Linux builds 2014-06-06 12:08:55 +01:00
Pieter Hintjens
cfc754f393 Merge pull request #1020 from jemc/inproc_simult
Add failing test reproducing issue #1015.
2014-05-23 16:03:15 +02:00
Joe Eli McIlvain
8b47d36875 Revert "Mark failing test for issue #1015 as XFAIL"
This reverts commit b6c577a9ec.
2014-05-22 12:21:32 -07:00
Pieter Hintjens
11175a33f1 Problem: security tests block on zmq_send
The expect_bounce_fail () helper assumed that messages could always
be sent. However in some cases zmq_send() blocks, due to there not
being any outgoing pipe. This changed in 77f5f7, where previously
there would be a pipe that kept trying to reconnect forever.

Solution: use a send timeout and check for EAGAIN if sending failed.
2014-05-20 15:42:35 +02:00
Pieter Hintjens
155feccb3f Merge pull request #1047 from mrvn/pull-testutil-expect_bounce_fail-send-timeout
Add a send timeout in expect_bounce_fail()
2014-05-19 17:52:27 +02:00
Goswin von Brederlow
2ba5af6d83 Set an alarm(60) in setup_test_environment() when not on windows so tests
will not block too long if they go wrong.
2014-05-19 17:03:41 +02:00
Goswin von Brederlow
0ebf94e429 Add a send timeout in expect_bounce_fail() so tests for authentication
failures don't block.
2014-05-19 17:03:24 +02:00
Pieter Hintjens
a9a15ccf6f Use different endpoint for each test step 2014-05-16 16:00:37 +02:00
Stoian Ivanov
6f5e7714cf test case for zmq_getsockopt/ZMQ_IDENTITY_FD 2014-05-13 15:19:48 +03:00
Daniel Shih
70b6516d96 add untracked test_stream_timeout into .gitignore and tests/Makefile.am 2014-05-11 23:46:51 +08:00
Joe Eli McIlvain
b6c577a9ec Mark failing test for issue #1015 as XFAIL 2014-05-09 14:06:17 -07:00
Joe Eli McIlvain
5cf74db6bb Add failing test reproducing issue #1015.
There is a race condition when connect and bind on a new inproc
endpoint happen "simultaneously" in threads.  Causes the error:
  Assertion failed: ok (ctx.cpp:474)
2014-05-09 11:02:01 -07:00
Will Strang
afe5fd87e9 Issue #1017: add ZMQ_HANDSHAKE_IVL time limit on connection handshake 2014-05-09 13:54:24 +00:00
Franco Fichtner
fff29a4a0c ipc: fail harder for abstract ipc on non-Linux
Using 'ipc://@abstract-socket' on non-Linux platforms yields inconsistent
behaviour.  Abstract sockets don't exist, so the literal file is created.
The test previously failed, but for a different reason: this is not the
directory you are looking for.  Now, zmq_bind() will fail for the right
reason: the socket can't be created.  Put the XFAIL back.
2014-05-05 23:26:06 +02:00
Franco Fichtner
69bd470103 tests: fix abstract ipc test by omitting slashes 2014-05-05 23:04:40 +02:00
Samuel Martin
6fdafc458a autotools: tests: disable test_fork if fork() is not available
fork() support is optional and its availability is correctly detected at
contfigure time.

But test_fork was all always built, preventing build for targets that do
not provide fork() from building successfully.

This pacth fixes the autotools on this point.
2014-05-03 21:55:03 +02:00
Pieter Hintjens
0d13971c05 Fixed compile error in test_security_null 2014-05-02 22:28:19 +02:00
Pieter Hintjens
84ed81c014 Added test_metadata
- also prioritize ZAP metadata over ZMTP metadata in case application
  uses same names.
2014-05-02 22:21:50 +02:00
Pieter Hintjens
d190325e4d Revert "Enlarge the race window for some test cases"
This reverts commit 2a84d25974.

Broke regression test on test_hwm.cpp.
2014-05-02 16:49:03 +02:00
Pieter Hintjens
0bc669b106 Merge pull request #1000 from daveab/feature/divide_by_zero_investigation
Feature/divide by zero investigation
2014-05-02 16:31:48 +02:00
dave b
2a84d25974 Enlarge the race window for some test cases
These changes cause an assertion in lb_sendpipe() when executing the test_security_plain testcase.
2014-05-02 14:32:14 +01:00
Pieter Hintjens
79ef02538f Port 9999 is unsafe for tests 2014-05-01 11:23:41 +02:00
Pieter Hintjens
408dea796f Merge pull request #993 from klnikita/src_addr_connect
Allow to set up a source address and port for outgoing tcp connections in zmq_connect
2014-04-30 14:57:08 +02:00
nikita kozlov
acb6807041 Allow to set up a source address and port for outgoing tcp connections in zmq_connect()
Few examples:
tcp:://192.168.0.4:55555;192.168.0.254:1234
tcp:://192.168.0.4:0;192.168.0.254:1234
tcp:://eth2:55555;192.168.0.254:1234
2014-04-30 14:43:37 +02:00
Pieter Hintjens
39ccfea036 Added more scaffolding for security
- additional messages to help people debugging security errors
2014-04-29 22:21:58 +02:00
Pieter Hintjens
d1232d144a Fixed NULL security test
Has some bits commented out due to #939, now work.

Note: there is an issue in libzmq when binding/unbinding or
connecting/disconnecting (I did not investigate deeper) the
same socket several times. Even closing the socket with zero
linger, zmq_ctx_term will block. The workaround in this test
case is to close the sockets for each test step.
2014-04-29 12:13:54 +02:00
Pieter Hintjens
9753de8566 Problem: zmq_socket_monitor code is dirty
Specifically:

* zmq_event_t should not be used internally in libzmq, it was
  meant to be an outward facing structure.

* In 4.x, zmq_event_t does not correspond to monitor events, so
  I removed the structure entirely.

* man page for zmq_socket_monitor is incomplete and the example
  code was particularly nasty.

* test_monitor.cpp needed rewriting, it was not clean.
2014-04-28 11:30:49 +02:00
Pieter Hintjens
8fcda0d5da Cleaned up XFAIL on resources
- this failing test was confusing users
- ZMTP v3.0 now does not define resources at all
- resources, along with other unimplemented aspects moved to
  RFC 37 ZMTP v3.1
2014-04-05 15:32:43 +02:00
Richard Newton
f5eebc2ae3 Remove delays and destroy/recreate context between tests 2014-03-17 13:41:02 +00:00
Richard Newton
e27a610897 Fix tabs 2014-03-17 12:32:21 +00:00
Richard Newton
26dc643205 Add delays in test_connect_rid to allow time for socket to close before address reuse. 2014-03-17 12:24:52 +00:00
Pieter Hintjens
b433adf49e Fixed comment 2014-03-16 11:53:40 +01:00
Mark Barbisan
350a1ac12b Allow TCP addresses to be re-resolved whenever there is a reconnection attempt 2014-03-12 13:28:37 -04:00
Olaf Mandel
e41c8cba0e Rename ZMQ_MAX_SOCKETS_MAX to ZMQ_SOCKET_LIMIT
As per suggestion by Pieter Hintjens. Also update wording in
zmq_ctx_set manual a bit.
2014-02-14 10:09:19 +01:00
Pieter Hintjens
1e9ea54bf6 Merge pull request #889 from olafmandel/MAX_SOCKETS_MAX
Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
2014-02-13 19:15:01 +01:00
Laurent Alebarde
abf9d8b74e Revert "add a proxy hook"
This reverts commit 9ae6a91fad.
2014-02-13 18:35:09 +01:00
Laurent Alebarde
bc25366f7c Revert "add proxy_chain, a multi proxies chaining in the same thread feature"
This reverts commit bc7441f517.
2014-02-13 18:35:09 +01:00
Olaf Mandel
5815b768b9 Add ZMQ_MAX_SOCKETS_MAX to zmq_ctx_get()
The new options allows querying the maximum allowed number of sockets.
This is system dependent and cannot be encoded in the include file as a
preprocessor macro: for ZMQ_USE_SELECT, this depends on the FD_SETSIZE
macro at time of library compilation, not at time of include file use.
2014-02-13 15:54:06 +01:00
Richard Newton
668c42fc26 Fix hang on term when inproc is connected but never bound. 2014-02-12 23:10:23 +00:00
Pieter Hintjens
046e37e907 Test for 127.0.0.1 at tests startup 2014-01-29 20:16:58 +01:00
Laurent Alebarde
bc7441f517 add proxy_chain, a multi proxies chaining in the same thread feature 2014-01-28 18:15:01 +01:00
Laurent Alebarde
9ae6a91fad add a proxy hook 2014-01-24 16:52:30 +01:00
Pieter Hintjens
9c228e9374 Fixes to test cases
- renamed test_stream_disconnect_notifications (too long!)
- removed print statements in that test case
- fixed Makefile.am for test_zap_ipc_creds (was not building)
2014-01-23 09:23:46 -06:00
Tim M
188e76a73f Added asserts on socket close in test_conenct_rid. 2014-01-21 11:49:41 -08:00
Tim M
515af9b147 Added assert on duplicate id in ROUTER and STREAM sockets. Updated man to reflect this change. Modified test case to match. 2014-01-21 11:43:34 -08:00
Tim M
141e1b5966 Cleaned up formatting of test_connect_rid. Set LINGER to 0 on sockets. This may address the test failing on some devices. 2014-01-21 11:24:39 -08:00
Tim M
2d6d8af0b8 added space at end of file 2014-01-20 12:26:26 -08:00
Tim M
de1164255a added test_connect_rid file and added to CMakeLists again. 2014-01-20 12:18:04 -08:00
Ivan Pechorin
1d7a07d919 Fix compilation of tests on MSVC 2008 2014-01-20 20:55:32 +13:00
Matt Arsenault
00aeaddf94 Fix unused parameter and variable warnings. 2014-01-18 13:17:29 -08:00
Goswin von Brederlow
afb24b53e6 Add STREAM connect notification.
Adjust test cases to connection notification.
Increase error checking in test cases.
2014-01-17 23:31:51 +01:00
Andre Caron
17651b9276 Adds support for detecting ZMQ_STREAM disconnections.
When a ZMQ_STREAM socket connection is broken (intentionally, via `shutdown()`
or accidentally via client crash or network failure), there is no way for the
application to dertermine that it should drop per-connection data (such as
buffers).

This contribution makes sure the application receives a 0-length message to
notify it that the connection has been broken.  This is symmetric with the
process of closing the connection from within the application (where the
application sends a 0-length message to tell ZeroMQ to close the connection).

Conflicts:
	CMakeLists.txt
2014-01-14 17:20:46 -08:00
Jeremy Tan
5efee6e0d5 Fix compilation on MinGW-w64 2014-01-13 18:38:59 +08:00
Sergei Nikulov
bd2874a3a0 windows: changed tcp port from glrpc assigned to unassigned one 2014-01-10 13:50:56 +04:00
Stefan Radomski
3aeaa6fab1 ZMQ_SRCFD docs and tests
Also moved the fd field from message content to message itself
2014-01-07 01:09:51 +01:00
Matt Connolly
8c3e645013 Update test_filter_ipc to not use abstract socket.
This fixes the test on Mac OS X and SmartOS (probably other Solarises).
Also updates the sockets using ipc: to use DEALER sockets instead
of PAIR sockets.
2014-01-03 10:42:57 +10:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Pieter Hintjens
5bf96f64b0 Removed ZMQ_ZAP_IPC_CREDS option
- This seems redundant; is there a use case for NOT providing
  the IPC credentials to the ZAP authenticator?

- More, why is IPC authentication done via libzmq instead of ZAP?
  Is it because we're missing the transport type on the ZAP request?
2014-01-01 17:39:14 +01:00
Pieter Hintjens
311b6bf9f7 Test was sometimes failing
- was not waiting long enough at socket close
- increased to 50 msec
2013-12-20 14:34:29 +01:00
Pieter Hintjens
bf3702395c Fixed wildcard IPC endpoint and added test case 2013-12-20 14:28:54 +01:00
MinRK
f4c5c9e890 add failing test for binding to resources 2013-12-18 16:37:37 -08:00
Brandon Carpenter
a018ef5e86 Add support for extending ZAP request address with IPC peer credentials.
Another take on LIBZMQ-568 to allow filtering IPC connections, this time
using ZAP.  This change is backward compatible.  If the
ZMQ_ZAP_IPC_CREDS option is set, the user, group, and process IDs of the
peer process are appended to the address (separated by colons) of a ZAP
request; otherwise, nothing changes.  See LIBZMQ-568 and zmq_setsockopt
documentation for more information.
2013-12-06 14:28:44 -08:00
Brandon Carpenter
dc9b1309b9 Shortened ZMQ_IPC_ACCEPT_FILTER_[UGP]ID to ZMQ_IPC_FILTER_[UGP]ID. 2013-12-06 09:58:10 -08:00
Brandon Carpenter
af808203d7 Fix failing test case in test_filter_ipc.
Add explicit check for primary group.
2013-12-06 00:46:14 -08:00
Brandon Carpenter
2252322acc Add IPC accept filter socket options.
Adds ZMQ_IPC_ACCEPT_FILTER_{PID,UID,GID} socket options to add processs,
user, and group IDs to the IPC filter sets. Fixes LIBZMQ-568.
2013-12-04 14:23:13 -08:00
Brian Knox
ff292d62d0 changing zmq_proxy_steerable to not use null terminated strings 2013-12-01 20:29:03 +00:00
Chris Laws
a4385e6105 tidy up 2013-11-25 13:40:05 +10:30
Chris Laws
38bceca9ca Add ability to set and get DSCP socket option 2013-11-25 13:31:21 +10:30
Shannen Saez
8f97f621a8 Move linger test to issue repo.
See https://github.com/zeromq/issues/pull/7

Signed-off-by: Shannen Saez <shannenlaptop@gmail.com>
2013-11-25 14:37:47 +11:00
Pieter Hintjens
4d22d456a9 Reverting path change on platform.hpp, this broke some builds 2013-11-19 17:11:15 +01:00
Pieter Hintjens
f98fbd5ad8 Fixed test_many_sockets
* failed on systems where process could not allocate 1024 sockets by default
* include path for platform.hpp was wrong; fixed it
2013-11-19 16:51:06 +01:00
Richard Newton
5f8067cd1b Fix signed/unsigned comparison 2013-11-11 13:54:58 +00:00
Richard Newton
dee333b2ed Fix signed/unsigned comparison 2013-11-11 13:53:25 +00:00
Richard Newton
7c51429440 Reduce default maximum number of sockets by 1 so there is room for the reaper socket. 2013-11-11 13:41:42 +00:00
Bruno D. Rodrigues
750426037d Fix socket creation above sistem limits for all 'other' OS not covered by eventfd, windows or vms; enhanced test to create sockets up to a bigger limit to really test hitting the OS limit 2013-11-10 10:19:19 +00:00
Richard Newton
554b3c1f70 Add test case for many sockets 2013-11-07 16:47:55 +00:00
Pieter Hintjens
5b60540ed0 Removed over-long pauses in tests
- used msleep (10) in most places instead of zmq_sleep (1)
- may cause failures on slower machines
- to change, modify SETTLE_TIME in testutil.h
- tested down to 1 msec on fast boxes
2013-11-06 13:42:57 +01:00
Pieter Hintjens
027990a112 Merge pull request #732 from Hugne/tipc
zmq: narrow condition to include TIPC in build/test
2013-11-01 07:14:00 -07:00
Erik Hugne
58ac87def1 zmq: narrow condition to include TIPC in build/test
As TIPC transport for 0MQ will only work on post 3.8
Linux kernels where nonblocking connect was added,
we add AC_RUN test to check for this functionality.
Should the test fail, tipc is excluded from build/test.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
2013-11-01 14:59:31 +01:00
Pieter Hintjens
299068b571 Merge pull request #731 from mbarbisan/master
Shorten ZMQ_ROUTER_REASSIGN_IDENTITIES to ZMQ_ROUTER_HANDOVER. Also, add...
2013-11-01 06:30:27 -07:00
Erik Hugne
9d5a379331 zmq: add TIPC transport tests
The tests are identical to the TCP ones, only the
addressing is changed.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
2013-11-01 10:10:02 +01:00
Mark Barbisan
5e71475d45 Shorten ZMQ_ROUTER_REASSIGN_IDENTITIES to ZMQ_ROUTER_HANDOVER. Also, added a test for the HANDOVER functionality. 2013-11-01 00:03:00 -04:00
Richard Newton
5405c6ac21 Remove redundant entry in tests makefile. 2013-10-29 11:18:49 +00:00
Matt Connolly
36d7bba389 Adding source for test_stream_empty 2013-10-29 20:50:52 +10:00
Pieter Hintjens
eaba5dfe37 Renamed test_router_raw_empty to test_stream_empty
* The ZMQ_ROUTER_RAW API was deprecated in favor of ZMQ_STREAM
* Same issue hit router.cpp, which I've fixed
2013-10-28 21:00:42 +01:00
Richard Newton
379c280bde Fix test warning. 2013-10-28 08:34:32 +00:00
Richard Newton
15f5b7ff6a Fix test warning. 2013-10-28 08:30:31 +00:00
MinRK
366c8f87c4 test zmq_msg_close after sending empty message on ROUTER_RAW 2013-10-27 22:50:32 -07:00
Pieter Hintjens
1ee7b9b1ea test_stream failed when response was broken into frames 2013-10-23 23:58:39 +02:00
Laurent Alebarde
e33a382f8d new zmq_proxy is zmq_proxy_steerable to respect C API 2013-10-18 15:01:05 +02:00
Laurent Alebarde
1b75d1ecb5 add proxy control flow and test 2013-10-18 11:12:48 +02:00
Brandon Carpenter
f499c89528 Add test for abstract namespace support in ipc sockets on Linux.
See issue 567.
2013-10-04 11:33:52 -07:00
KIU Shueng Chuan
55bfe7dbab WinSock2.h filename should be all lowercase 2013-10-05 00:51:47 +08:00
KIU Shueng Chuan
79c2598a08 test for _MSC_VER before using MSVC specific code 2013-10-05 00:48:52 +08:00
Pieter Hintjens
edeedc6dd8 Disabled randomly failing part of test 2013-10-02 12:15:31 +02:00
Pieter Hintjens
fd4d125d8e Packaging for zmq_curve_keypair function
* Added new man page for this
* Added test case, in tests/test_security_curve.cpp
* Noted in zmq_utils.h that these methods are documented
2013-09-30 15:14:02 +02:00
Pieter Hintjens
e42a0a4074 Added test case for issue 566
* Tests dealer-to-router connection 100 times
* This was failing in ZMQ v4.0.0 RC1
2013-09-26 14:18:40 +02:00
Pieter Hintjens
9d51155ce2 Build/test errors on OS/X with clang++ 2013-09-26 11:33:44 +02:00
Pieter Hintjens
f36a49de6d Move away from port 8080 which is occupied on some boxes 2013-09-20 23:16:29 +02:00
Pieter Hintjens
5e609be345 Renamed new socket options to be clearer
* ZMQ_REQ_STRICT was negative option (default 1) which goes against
  the standard, where defaults are zero. I renamed this to
  ZMQ_REQ_RELAXED.

* ZMQ_REQ_REQUEST_IDS felt clumsy and describes the technical solution
  rather than the problem/requirement. I changed to ZMQ_REQ_CORRELATE
  which seems more explicit.
2013-09-20 15:30:04 +02:00
Pieter Hintjens
92c01f69db Renamed test_connect_delay to test_immediate
* The ZMQ_CONNECT_DELAY option was renamed to ZMQ_IMMEDIATE
2013-09-20 14:23:43 +02:00
Pieter Hintjens
e05556075f Renamed inproc connect test (name was too long) 2013-09-19 09:36:43 +02:00
Richard Newton
de91c7362c Merge pull request #668 from mrothe/no-public-tests
tests: don't listen on public ports
2013-09-18 04:09:51 -07:00
Markus Rothe
b13230510c tests: don't listen on public ports 2013-09-18 12:58:19 +02:00
Pieter Hintjens
825052f83f Revert "makes curve keys symetric as in libcurve + factorisation"
This reverts commit bfd472f97c.
2013-09-17 14:05:55 +02:00
Pieter Hintjens
22eb4d600b Revert "oblige the application to explicitely set the node type for PLAIN"
This reverts commit 1206f4572b.
2013-09-17 14:05:41 +02:00
Laurent Alebarde
1206f4572b oblige the application to explicitely set the node type for PLAIN 2013-09-17 12:47:21 +02:00
Laurent Alebarde
bfd472f97c makes curve keys symetric as in libcurve + factorisation 2013-09-17 12:44:14 +02:00
Pieter Hintjens
7bb2b6ae11 Fixed length of domain setting 2013-09-17 10:04:57 +02:00
Pieter Hintjens
7735ca5f8d Added test case for NULL domains 2013-09-17 09:48:32 +02:00
Pieter Hintjens
fe9815a789 Fixed random failures in test_security_plain and _curve
* ZAP handler thread was not getting time to start up
* Code now creates and binds handler socket in parent thread and
  passes the socket to the zap_handler, so this always gets the
  authentication requests.
2013-09-16 10:56:49 +02:00
Richard Newton
6f351007d4 Fix windows build 2013-09-16 09:23:47 +01:00
Laurent Alebarde
dc1f5e9f7c simplify test_security_curve.cpp with zmq_z85_encode 2013-09-16 00:06:24 +02:00
Pieter Hintjens
576e3ca5e0 Added z85 codec to ZMQ API
* Removed redundant Z85 code and include files from project
* Simplified use of headers in test cases (now they all just use testutil.hpp)
* Export zmq_z85_encode() and zmq_z85_decode() in API
* Added man pages for these two functions
2013-09-15 20:13:44 +02:00
Pieter Hintjens
193d0bb634 Fixed Z85 methods to be static and not pollute library 2013-09-15 17:30:18 +02:00
Richard Newton
b9298823b4 Set hwm on connect socket before bind has happend to just that of connects hwm. 2013-09-15 13:35:44 +01:00
Richard Newton
7841b0dd0f Support high water mark on inproc socket connect before bind. 2013-09-14 17:27:18 +01:00
Richard Newton
d5bd68b60b Merge branch 'master' of https://github.com/zeromq/libzmq into inproc_connect_before_bind 2013-09-12 21:09:30 +01:00
Richard Newton
379bcb0881 Send identities when connecting pending sockets. 2013-09-12 21:07:29 +01:00
Richard Newton
7c3496a76a Fix race condition and support multiple socket connects before bind. 2013-09-12 18:09:37 +01:00
Laurent Alebarde
6c84a54388 add exhaustive comparison in testutil bounce 2013-09-12 18:17:31 +02:00
Richard Newton
6fefa4166a Merge remote-tracking branch 'upstream/master' into inproc_connect_before_bind 2013-09-12 15:13:25 +01:00
Richard Newton
5f20d63665 First attempt at inproc connect before bind 2013-09-12 14:44:44 +01:00
Martin Hurton
168efb9739 Merge pull request #653 from mattconnolly/master
Fix preprocessor typoe
2013-09-12 05:21:25 -07:00
Pieter Hintjens
52370bff44 Removed debugging printfs 2013-09-12 12:46:23 +02:00
Matt Connolly
0f9e5f6049 Fix preprocessor typoe 2013-09-12 20:30:16 +10:00
Richard Newton
8e6b5ad17e Fix Makefile.am for test_ctx_destroy 2013-09-11 15:02:16 +01:00
Richard Newton
ccf0e61b77 Merge remote-tracking branch 'upstream/master' 2013-09-10 13:30:11 +01:00
Richard Newton
64e1c181f7 Implement non-blocking shutdown command that unblocks other threads waiting on blocking operations. 2013-09-10 13:30:00 +01:00
Martin Hurton
25c89cace1 Merge pull request #649 from hintjens/master
Fixed minor error in NULL mechanism (spec was wrong)
2013-09-09 12:12:36 -07:00
Pieter Hintjens
6725c4644f Added ZMQ_ZAP_DOMAIN socket option
* This is passed to the ZAP handler in the 'domain' field

* If not set, or empty, then NULL security does not call the ZAP handler

* This resolves the phantom ZAP request syndrome seen with sockets where
  security was never intended (e.g. in test cases)

* This means if you install a ZAP handler, it will not get any requests
  for new connections until you take some explicit action, which can be
  setting a username/password for PLAIN, a key for CURVE, or the domain
  for NULL.
2013-09-09 20:40:34 +02:00
Richard Newton
a601b3f6f4 Remove windows debug code. 2013-09-06 10:25:00 +01:00
Richard Newton
7485b09cba Fix tests on windows 2013-09-06 10:08:11 +01:00
Martin Hurton
498dc37988 Merge pull request #645 from hintjens/master
Updated libzmq to match RFCs
2013-09-06 00:54:51 -07:00
Pieter Hintjens
4c75306023 Fixed test_stream case
- was not looping to read all input from peer
- broke on OS/X specifically
2013-09-06 09:22:09 +02:00
Pieter Hintjens
9dd324aab2 z85 encoding buffer overrun 2013-09-05 15:18:42 +02:00
Pieter Hintjens
32fa426e61 Added system check at start of selftests
- tests that system can provide at least 1,000 sockets
- we could expand on this but this covers the main case of OS/X
  having a too-low default limit of 256 handles per process
2013-09-04 19:38:15 +02:00
MinRK
bb348858f1 mark test_linger as expected failure
rather than pretending it passes
2013-09-04 09:40:08 -07:00
Pieter Hintjens
6612280946 Removed temporary patch on tests/Makefile.am 2013-09-04 18:10:47 +02:00
Pieter Hintjens
28b0a5fa27 Updated libzmq to match RFC 23, 24, 25, 26
* Command names changed from null terminated to length-specified
* Command frames use the correct flag (bit 2)
* test_stream acts as test case for command frames
* Some code cleanups
2013-09-04 17:59:45 +02:00
Pieter Hintjens
1844a27c82 Removed test_raw_sock test case (replaced by test_stream) 2013-09-04 15:00:05 +02:00
Pieter Hintjens
fb67e160a1 Fixed ZAP authentication
- if ZAP server returns anything except 200, connection is closed
- all security tests now pass correctly
- test_security_curve now does proper client key authentication using test key
- test_security_plain now does proper password authentication
2013-09-02 18:21:36 +02:00
Pieter Hintjens
fba5612026 Fixed 'make check' failures
- Split off NULL security check from PLAIN
- Cleaned up test_linger code a little
- Got all tests to pass, added TODOs for outstanding issues
- Added ZAP authentication for NULL test case
- NULL mechanism was not passing server identity - fixed
- cleaned up test_security_plain and removed option double-checks (made code ugly)
- lowered timeout on expect_bounce_fail to 150 msec to speed up checks
- removed all sleeps from test_fork and simplified code (it still passes :-)
2013-09-02 17:22:24 +02:00
Pieter Hintjens
01b336f1f1 Whitespace fixes 2013-09-02 15:08:40 +02:00
Pieter Hintjens
c128fac7a7 Merge pull request #639 from minrk/test_linger
add test_linger
2013-09-02 06:06:58 -07:00
Pieter Hintjens
6fa274ebef Merge pull request #640 from mattconnolly/fork
Adding ability for a context to be terminated in a forked child process
2013-09-02 06:06:31 -07:00
Matt Connolly
1771755888 test_fork.cpp: adding missing headers for linux 2013-09-02 07:13:46 +10:00
MinRK
c646ac96c0 cast rc to size_t for comparisons
avoids -Wall failures comparing int to uint
2013-09-01 13:50:18 -07:00
Matt Connolly
a3d9d01af8 test_fork: update test to verify communication between parent and child 2013-09-01 20:42:19 +10:00
Matt Connolly
0478ee04f4 Adding test showing failure to close socket/context in forked child 2013-09-01 20:42:10 +10:00
MinRK
58b370df69 add test_linger
tests that default LINGER (-1) ensures message delivery.

Note: it fails for large messages ( > 1MB, depending on the system).
2013-08-31 18:27:50 -07:00
MinRK
9d94640edc test failed CURVE auth
adds expect_bounce_fail test function

which is like bounce, but fails if messages arrive.
2013-08-30 17:56:59 -07:00
MinRK
0cac56fe52 test PLAIN auth with failed login
This test fails because PLAIN authentication doesn't actually reject connections
2013-08-30 15:28:16 -07:00
Guido Goldstein
93a068a832 Fixed silly port number. 2013-08-29 20:55:23 +02:00
Pieter Hintjens
2e9385ac02 Merge pull request #631 from jrossi/master
Add the Socket Identity info to the ZAP Messages
2013-08-21 01:35:43 -07:00
Ian Barber
d485404aab Merge pull request #626 from dkrikun/master
Add ZMQ_CONFLATE socket option
2013-08-20 14:37:52 -07:00
Jeremy Rossi
19ca8a0fc0 Add the Socket Identity info to the ZAP Messages
This change adds the socket identity infomartion from the socket to the
zap frames.  In doing this the ZAP is able preform different operations
based on different sockets.  This is not compaitable with the current ZAP
RFC, but that can be updated.  As the ZAP rfc is currently draft for I
did not change the version number.

Tests also modified and passing.
2013-08-20 13:48:05 -04:00
danielkr
3f3777d05b Add test for ZMQ_CONFLATE option 2013-08-19 15:34:11 +03:00
Pieter Hintjens
1011e8ad20 Merge pull request #624 from ricnewton/master
Port tests to windows and add to cmake build.
2013-08-18 00:51:39 -07:00
Uli Köhler
10becae7eb Added zmq_send_const test 2013-08-17 20:37:07 +02:00
Richard Newton
a83baa9b0b Fix up threading code from port tests to windows. 2013-08-17 14:23:22 +01:00
Richard Newton
7f74fc7c99 Port tests to windows and add to cmake build. 2013-08-17 13:43:45 +01:00
Christian Kamm
423ca36b17 Rename ZMQ_REQ_SEND_RESETS -> ZMQ_REQ_STRICT.
It defaults to enabled. Switch it off to be able to send a new message
before the previous reply has been received.
2013-08-03 14:35:18 +02:00
Christian Kamm
a0cc87a9d9 Add ZMQ_REQ_SEND_RESETS option.
This allows making a new request on a REQ socket by sending a new
message. Without the option set, calling send() after the first message
is done will continue to return an EFSM error.

It's useful for when a REQ is not getting a response. Previously that
meant creating a new socket or switching to DEALER.
2013-07-28 11:43:38 +02:00
Christian Kamm
b9646f2aac Add ZMQ_REQ_REQUEST_IDS option.
* Documentation:
The default behavior of REQ sockets is to rely on the ordering of messages
to match requests and responses and that is usually sufficient. When this option
is set to 1, the REQ socket will prefix outgoing messages with an extra frame
containing a request id. That means the full message is (request id, 0,
user frames...). The REQ socket will discard all incoming messages that don't
begin with these two frames.

* Behavior change: When a REQ socket gets an invalid reply, it used to
  discard the message and return EAGAIN. REQ sockets still discard
  invalid messages, but keep looking at the next one automatically
  until a good one is found or there are no more messages.
* Add test_req_request_ids.
2013-07-26 21:38:21 +02:00
Martin Hurton
53bc53da04 Update PLAIN mechanism to the latest ZAP revision 2013-07-18 10:59:34 +02:00
Martin Hurton
d65231be1c Update CURVE mechanism to the latest ZAP revision 2013-07-18 10:59:31 +02:00
Pieter Hintjens
d46c2ee2fc Disabled last step in test_spec_req so build can complete 2013-07-14 13:04:31 +02:00
Christian Kamm
7de23c0c8d Fix intermittent failure in test_spec_req.
There still is a problem when a stale peer's message
arrives at the REQ just after a request was sent to that peer.
2013-07-14 11:57:15 +02:00
Pieter Hintjens
bccf3d6126 Merge pull request #613 from ckamm/coding-style-spec-tests
Fix coding style in spec tests.
2013-07-14 02:32:20 -07:00
Christian Kamm
bbc9a61197 Fix coding style in spec tests. 2013-07-14 08:33:33 +02:00
Christian Kamm
c56d797bf9 REQ sockets drop replies from unasked peers.
* Add lb_t::sendpipe() that returns the pipe that was used for sending,
  similar to fq_t::recvpipe().
* Add forwarder functions to dealer_t to access these two.
* Add logic to req_t to ignore replies on pipes that are not the one
  where the request was sent.
* Enable test in test_spec_req.
2013-07-14 07:55:47 +02:00
Pieter Hintjens
9ca6898f24 Got new test cases working with libzmq
* disabled the specific tests that do not work (yet) on libzmq
* cleaned up one source (test_spec_rep.c) but the others need similar work
* added sleep in test_spec_rep to allow connects time to happen; this would
  not be needed if we connected out to the REP peers instead in from them,
  but I didn't want to change the logic of the test code.
2013-07-07 12:49:24 +02:00
Christian Kamm
dfba19c4b6 Make pipeline/reqrep tests try tcp:// endpoints.
The inproc:// endpoints sometimes use different code paths so
testing with regular tcp:// endpoints as well can show different
issues.
2013-07-05 17:58:01 +02:00
Christian Kamm
8fd163cf5c Add tests for PUSH/PULL sockets. 2013-07-05 15:20:42 +02:00
Christian Kamm
798b394087 Add tests for Request-Reply pattern sockets.
* See http://rfc.zeromq.org/spec:28/REQREP
* Not all testable statements are covered.
* At this point, there are several failures:
  - test_spec_req: The REQ socket does not correctly discard messages
    from peers that are not currently being talked to.
  - test_spec_dealer/router: On disconnect, the queues seem to not be
    emptied. The DEALER can still receive a message the disconnected
    peer sent, the ROUTER can still send to the identity of the dis-
    connected peer.
2013-07-02 15:04:31 +02:00
Richard Newton
998610602e Fix tab/space formatting issue 2013-07-01 12:10:57 +01:00
Richard Newton
f6e972d546 Fix montior tests to handle the monitor stopped event correctly 2013-07-01 10:31:57 +00:00
Martin Hurton
783bb890a9 Check socket types during mechanism handshake 2013-07-01 10:12:08 +02:00
Pieter Hintjens
7041770108 Added Z85 support
The use of binary for CURVE keys is painful; you cannot easily copy
these in e.g. email, or use them directly in source code. There are
various encoding possibilities. Base16 and Base64 are not optimal.
Ascii85 is not safe for source (it generates quotes and escapes).

So, I've designed a new Base85 encoding, Z85, which is safe to use
in code and elsewhere, and I've modified libzmq to use this where
it also uses binary keys (in get/setsockopt).

Very simply, if you use a 32-byte value, it's Base256 (binary),
and if you use a 40-byte value, it's Base85 (Z85).

I've put the Z85 codec into z85_codec.hpp, it's not elegant C++
but it is minimal and it works. Feel free to rewrap as a real class
if this annoys you.
2013-06-28 22:10:22 +02:00
Pieter Hintjens
7832addd20 Updated security mechanisms to use variable-length commands
RFC23, RFC24, RFC26 now use variable-length command names that
end in null octet (valid C strings) instead of fixed-length
space padded strings.
2013-06-28 11:42:54 +02:00
Pieter Hintjens
ad77937956 Added ZMQ_STREAM socket type
- designed for TCP clients and servers
- added HTTP client / server example in tests/test_stream.cpp
- same as ZMQ_ROUTER + ZMQ_ROUTER_RAW + ZMQ_ROUTER_MANDATORY
- includes b893ce set ZMQ_IDENTITY on outgoing connect
- deprecates ZMQ_ROUTER_RAW
2013-06-27 20:53:15 +02:00
Ian Barber
211bf2b08e Added security curve test
Test is skipped if no libsodium.
Added warning if libsodium not configured
2013-06-22 16:17:25 +01:00
Pieter Hintjens
fadfcac1de Fixed compile error, needed unistd.h 2013-06-22 13:50:22 +02:00
Pieter Hintjens
675bd4640b Merge pull request #584 from hurtonm/master
Fix test_disconnect_inproc to work on ILP64 systems
2013-06-22 04:18:27 -07:00
Martin Hurton
1b86324396 Fix test_disconnect_inproc to work on ILP64 systems 2013-06-22 13:05:46 +02:00
Ian Barber
f4c51db842 Fix small streamengine issue w/ term and handshake
Also tidy up monitor test a little.
2013-06-22 10:58:16 +01:00
shripchenko
627190c8be another iteration on ZMQ_PROBE_ROUTER
now it properly works for ROUTER
2013-06-10 02:31:00 -07:00
Pieter Hintjens
6ff51ee909 Updated ZAP request for changed protocol draft
- username and password sent as two string frames
- fixed test case to match
2013-06-07 15:50:36 +02:00
Martin Hurton
2928c91a6d Implement ZAP and integrate it with PLAIN mechanism 2013-06-06 13:28:21 +02:00
Pieter Hintjens
a9679da764 Packaging on ZMQ_PROBE_ROUTER
- renamed to ZMQ_PROBE_ROUTER
2013-06-05 15:55:15 +02:00
Pieter Hintjens
2344131db3 Packaging of ZMQ_PROBE
- Cleaned up man page a little
- Wrote test case tests/test_router_probe.cpp
2013-06-05 15:29:40 +02:00
Pieter Hintjens
c7c865da75 Whitespace fixes 2013-05-21 18:52:44 +02:00
Pieter Hintjens
f06abca046 Disable failing test for now 2013-05-17 17:26:54 +01:00
Pieter Hintjens
f909b9c722 plain_mechanism now uses options.as_server
- we need to switch to PLAIN according to options.mechanism
- we need to catch case when both peers are as-server (or neither is)
- and to use username/password from options, for client
2013-05-17 17:21:59 +01:00
Pieter Hintjens
da1e9a178a Cleaned up test pingpong code 2013-05-17 17:20:33 +01:00
Pieter Hintjens
e1f797b048 Added configuration for PLAIN security
* ZMQ_PLAIN_SERVER, ZMQ_PLAIN_USERNAME, ZMQ_PLAIN_PASSWORD options
* Man page changes to zmq_setsockopt and zmq_getsockopt
* Man pages for ZMQ_NULL, ZMQ_PLAIN, and ZMQ_CURVE
* Test program test_security
2013-05-15 17:55:21 +02:00
Martin Hurton
a7032e9ca8 Update test_raw_sock to work with ZMTP/3.0 2013-04-28 14:13:40 +02:00
Pieter Hintjens
cb2ee7a5c2 Fixed up test_iov case 2013-04-27 14:53:14 +02:00
Jon Dyte
56ead84490 Experimental function zmq_recviov doesnt work correctly in a couple of cases
1) VSM - you cannot hand out the 'data' address as it was not allocated on the heap
2) for other messages the 'data' address cannot be handed out either, as it not the address
originally returned by malloc and hence cannot be passed to 'free'.
see msg.cpp
u.lmsg.content = (content_t*) malloc (sizeof (content_t) + size_);
....
u.lmsg.content->data = u.lmsg.content + 1;

So the function is changed to always malloc a data buffer and copy the data into it.
There is a possible optimisation using memmove for the non-VSM case but that is not done yet.
2013-04-25 21:58:26 +01:00
Pieter Hintjens
257debf659 Removed IPC endpoint from test; not portable, and fragile (#80) 2013-03-24 15:12:34 +01:00
Pieter Hintjens
f1738b9b92 More copyright cleanups 2013-03-12 17:04:51 +01:00
Pieter Hintjens
d826c53b9b Bumped ZMTP revision to 2
* Starting draft ZMTP/2.1 protocol (revision 2)
* Basis for adding security to the wire protocol
* Maintains backward compatibility
2013-03-12 15:49:23 +01:00
Pieter Hintjens
785ef41f67 Refactored codecs to match ZMTP version numbers 2013-03-12 15:29:37 +01:00
Guido Goldstein
b0b8ab27c5 Changed message structure for event notifications. 2013-03-08 13:48:18 +01:00
Guido Goldstein
21eeb03b6c Simplified the zmq_event_t structure for easier access and better usability towards language bindings. 2013-03-08 10:34:25 +01:00
Pieter Hintjens
51cfcb117a Some DNSs will resolve ANY domain name so I made more reliable errors. 2013-02-10 08:39:27 +01:00
montoyaedu
1a13554fe0 solved broken tests compilation 2013-02-07 12:27:33 +01:00
Pieter Hintjens
8ab3c4a1bf Fixed issue #500 2013-01-31 21:52:30 +01:00
Pieter Hintjens
963c6a8e2f Lots of cleanups to self-tests
* Removed or truncated sleeps so the tests run faster
* Removed dependencies on zmq_utils
* Rewrote a few tests that were confusing
* Minor code cleanups
2013-01-31 19:46:22 +01:00
Pieter Hintjens
c39cb0bde1 Rewrote completely, was bogusly testing EAGAIN 2013-01-31 16:26:28 +01:00
Pieter Hintjens
3a558fcc4b Rewrote raw test completely 2013-01-31 15:00:17 +01:00
Pieter Hintjens
8c9289342a Fixed use of deprecated zmq_init/term 2013-01-31 09:10:49 +01:00
Pieter Hintjens
5f009e5234 Various cleanups to test programs 2013-01-30 23:53:23 +01:00
MinRK
edd43e1ca4 deprecate zmq_ctx_destroy in favor of zmq_ctx_term
in order to avoid logical collisions with pre-existing notions of context destruction in bindings (czmq, pyzmq).
2013-01-17 15:48:18 -08:00
Adrian Muraru
35f18aef74 Fixed newline in test_disconnect_inproc 2013-01-12 16:21:56 +02:00
Pieter Hintjens
d997d88096 Revert "Old change to move ports off 5555 (was conflicting with other stuff)"
This reverts commit da0efaa817.
2013-01-08 09:18:38 +01:00
Pieter Hintjens
aff1406713 Revert "Test cases were failing on bind"
This reverts commit 8ba097f3da.
2013-01-08 09:18:23 +01:00
Pieter Hintjens
da0efaa817 Old change to move ports off 5555 (was conflicting with other stuff) 2013-01-08 09:09:27 +01:00