Commit Graph

35 Commits

Author SHA1 Message Date
Luca Boccassi
4f35d1af1a Problem: using BSD sockets in test is duplicated across many tests
Solution: refactor in testutil.lib, so that they can be used for fuzzers too
2020-04-26 17:59:26 +01:00
Simon Giesecke
cd954e207d Problem: use of C-style casts
Solution: use static_cast/reinterpret_cast instead
2019-12-08 15:24:48 +01:00
Simon Giesecke
34999d5069 Problem: s_send(more) can be replaced by safer send_string_expect_success
Solution: remove s_send(more) and replace all uses
2019-03-24 13:34:13 -04:00
Simon Giesecke
1450830611 Problem: unused include directives
Solution: remove and add where needed
2019-03-23 09:46:37 -04:00
Simon Giesecke
5d74eba64a Problem: remaining basic assertions
Solution: use unity assertions instead
2019-03-23 09:09:36 -04:00
Simon Giesecke
223ef516b6 Problem: test_security_null not using a test framework
Solution: migrate to Unity and separate test_security_no_zap_handler
2019-03-16 17:20:19 +01:00
Simon Giesecke
779d120fa3 Problem: tests do not follow naming style
Solution: apply naming style
2018-05-27 13:24:08 +02:00
Simon Giesecke
3cbc7cb0dc Problem: C4244 warnings regarding SOCKET vs. int in test_security_null and test_security_plain
Solution: Use fd_t
2018-05-14 21:09:56 +02:00
Luca Boccassi
1c5a63e939 Problem: backward incompatible change to NULL with ZAP
Solution: like for other mechanism, do not enforce strict ZAP protocol
adherence unless the specific socket option is enabled with NULL auth.

Add test to exercise this functionality, and fix ZAP test to set the
socket option when it uses NULL auth.

See: https://github.com/zeromq/pyzmq/pull/1152
2018-03-22 19:27:23 +00:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
sigiesec
1414bf938c Problem: use of unqualified "id" in code example
Solution: use "routing_id" instead
2017-09-19 17:54:52 +02:00
Luca Boccassi
5934919f3e Problem: tests bind to hardcoded TCP ports
Solution: use ZMQ_LAST_ENDPOINT in most places. This alllows running
tests in paralle, and on over-booked shared machines where many of
the ports would be already in use.
Keep 3 tests with an hardcoded port, as there are some code paths that
require it (eg: connect before bind), but list those ports in
tests/testutil.hpp as macros so that they do not overlap and still
allow parallel runs.

These changes were inspired by a patch uploaded to Ubuntu by the
package maintainer, Steve Langasek <steve.langasek@ubuntu.com>.
Thank you Steve!
2017-05-01 22:57:05 +01:00
Pieter Hintjens
9c0d176d68 Problem: tests don't build on Windows
There were numerous small issues with test cases:

- some lacked the right source file header
- some were not portable at all
- some were using internal libzmq APIs (headers)

Solution: fixed and cleaned up.
2016-02-12 16:12:44 +01:00
Michael
596fd2408a added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:58 +11:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
Dan Riegsecker
f4f918ba73 Some test fail to build targeting less that Windows Vista
When targeting a version of Windows less than Windows Vista, the
security tests fail to build. Added a check for Windows version
and substituted inet_pton for inet_addr. Fixes libzmq issue #1396.
2015-05-07 16:52:37 -04:00
Pieter Hintjens
a7a512ab3d Problem: test cases are failing on slower PCs (eee PC)
Solution: raise timeouts from 100-150 msec to 250 msec
2015-01-30 11:57:31 +01:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Min RK
5385a51527 craft vanilla socket security test messages
use explicit ZMTP/1.0 anonymous greeting
rather than HTTP request that just happened to work
2014-12-03 14:52:39 -08:00
Min RK
5a8b46e375 allow vanilla socket security tests to run on Windows
- add ws2tcpip.h
- alias close->closesocket
- increment port in sec_null test
2014-12-03 14:07:07 -08:00
Min RK
c35c0ca1bb test unauthenticated messages from vanilla sockets
fails on all auth mechanisms
2014-12-03 10:34:34 -08: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
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
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Markus Rothe
b13230510c tests: don't listen on public ports 2013-09-18 12:58:19 +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
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
52370bff44 Removed debugging printfs 2013-09-12 12:46:23 +02: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
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