Commit Graph

2321 Commits

Author SHA1 Message Date
Jim Garlick
8892087e99 gssapi: add NAMETYPE options to zmq_getsockopt
Problem: GSSAPI NAMETYPE options were added to zmq_setsockopt()
but not zmq_getsockopt().

Add them to zmq_getsockopt().
2017-04-24 16:12:42 -07:00
Jim Garlick
9fbf2e2eb6 gssapi: move new options to DRAFT section
Problem: The new GSSAPI NAMESPACE options should have been
added to the DRAFT section of the API so they can be changed
until stabilized.

Solution:
- Move defines to the DRAFT section of zmq.h
- Duplicate them in zmq_draft.h, as is the local custom
- Compile only if defined (ZMQ_BUILD_DRAFT_API)
- Refactor internals slightly to avoid #ifdef hell
2017-04-24 16:12:27 -07:00
Jim Garlick
0b185e8297 gssapi: add NAMETYPE socket options
Problem: principals are looked up unconditionally
with the GSS_C_NT_HOSTBASED_SERVICE name type.

Solution: Add two new socket options to set the name type
for ZMQ_GSSAPI_PRINCIPAL and ZMQ_GSSAPI_SERVICE_PRINCIPAL:

ZMQ_GSSAPI_PRINCIPAL_NAMETYPE
ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE

They take an integer argument which must be one of
ZMQ_GSSAPI_NT_HOSTBASED (0) - default
ZMQ_GSSAPI_NT_USER_NAME (1)
ZMQ_GSSAPI_NT_KRB5_PRINCIPAL (2)

These correspond to GSSAPI name types of:
GSS_C_NT_HOSTBASED_SERVICE
GSS_C_NT_USER_NAME
GSS_KRB5_NT_PRINCIPAL_NAME

Fixes #2542
2017-04-21 13:08:45 -07:00
Luca Boccassi
427292561c Merge pull request #2541 from garlick/gssapi_fix
fix misc. bugs in GSSAPI support
2017-04-20 18:49:05 +01:00
Jim Garlick
2b9a352a3c gssapi: use gss_buffer_desc consistently
Problem: one call to gss_import_name() includes the terminating
NULL in a gss_buffer_desc.length, and one doesn't.

According to the examples at:
http://docs.oracle.com/cd/E19253-01/816-4863/overview-22/index.html
the NULL should be included in the length.

Solution:  Fix one case to include the terminating NULL in the length.
2017-04-20 09:42:06 -07:00
Jim Garlick
4e22dd0e97 gssapi: fail if client sets wrong principal
Problem: if client sets ZMQ_GSSAPI_PRINCIPAL to a name
for which credentials cannot be obtained, authentication
proceeds with default credentials.

Solution: Before initializing the security context, check
whether there was a failed attempt to acquire credentials
for a specific principal and bail out if so.

Fixes #2531
2017-04-20 09:42:06 -07:00
Jim Garlick
f2b579ce02 gssapi: use GSS_C_BOTH to acquire credentials
Problem: if client sets the ZMQ_GSSAPI_PRINCIPAL to a valid
principal, authentication fails.

When an application sets ZMQ_GSSAPI_PRINCIPAL, whether as a
client or a server, libzmq internally calls gss_acquire_cred()
with cred_usage=GSS_C_ACCEPT.  This cred_usage setting is for
acceptors (servers) only, thus it doesn't work for initiators
(clients).

Solution: Change the cred_usage parameter to GSS_C_BOTH to allow
initiators to set ZMQ_GSSAPI_PRINCIPAL.
2017-04-20 09:42:06 -07:00
Juan A. Garcia Pardo
52ce6aab86 Problem: Windows build broken by #if ZMQ_USE_POLL
Solution: use #if defined ZMQ_USE_POLL
2017-04-20 15:53:06 +02:00
Asmod4n
ce602d08db change macOS < 10.12 clock to SYSTEM_CLOCK, fixes #2537 (#2538)
* change macOS < 10.12 clock to SYSTEM_CLOCK, fixes #2537

* remove clock_id option from alt_clock_gettime since we always want a monotonic clock.

* update header definition for alt_clock_gettime

* pass clock definition down to host_get_clock_service for macOS < 10.12

* change to monotonic clocks
2017-04-19 23:13:06 +01:00
BJovke
1d4014dc52 Problem: Minor inconsistency in macro syntax. Solution: Code fixed. (#2534)
* Problem: Minor inconsistency in macro syntax. Solution: Code fixed.
2017-04-14 17:10:57 +01:00
bjovke
dc7bbe35b4 Problem: FD set copying on Windows still not optimal on some places. Solution: Improved memcpy() of FD sets for Windows builds. 2017-04-14 16:31:05 +02:00
bjovke
aa3540e657 Problem: misleading indentation and visually ambiguous if/else block ordering.
Solution: fixed indentation and if/else block.
2017-04-11 13:14:13 +02:00
Luca Boccassi
d815228246 Merge pull request #2523 from bjovke/my_working_branch
Critical BUG introduced with #2518 fixed.
2017-04-10 20:09:07 +01:00
bjovke
c635ee7e9d Critical BUG introduced with #2518 fixed. 2017-04-10 20:09:22 +02:00
Jake Cobb
f89e3ee854 Problem: Bad style in tcp.hpp/cpp
Solution: Add spaces between function
name and parentheses.
2017-04-10 13:57:29 -04:00
Luca Boccassi
2df4e87849 Merge pull request #2522 from bjovke/my_working_branch
Another macro correction.
2017-04-10 17:31:32 +01:00
Jake Cobb
cd39b00e19 Consistency of Windows TCP tuning assertions
Treat ECONNRESET, ENETRESET and EINTR as non-fatal
failures in TCP Tuning on Windows as they are in the
Unixes.  Also adds ENETRESET to the Unix list that was missing.
2017-04-10 10:57:17 -04:00
bjovke
9bee9d6d03 Another macro correction. 2017-04-10 16:14:26 +02:00
bjovke
b6fb1f64a5 Macro correction. 2017-04-10 15:39:20 +02:00
bjovke
30cd655b3d Case found not covered in latest zmq::proxy() code. 2017-04-10 14:10:47 +02:00
bjovke
26520fe152 zmq::socket_poller_t speed improvement for constructor and wait() function. 2017-04-10 11:35:08 +02:00
bjovke
a7977a5e84 Reworked zmq::proxy() for improved performance. 2017-04-10 11:34:24 +02:00
bjovke
3e55545ab0 Code reformatting of proxy.cpp 2017-04-10 11:30:52 +02:00
Luca Boccassi
6853e3f935 Merge pull request #2514 from lytboris/freebsd-enable-ai_v4mapped
re-enable AI_V4MAPPED on FreeBSD & DragonFlyBSD
2017-04-09 10:24:50 +01:00
Boris Lytochkin
ef8b0c60fc re-enable AI_V4MAPPED on FreeBSD & DragonFlyBSD
Detect AI_V4MAPPED is not supported in getaddrinfo() on the fly
and retry query. This issue was seen on ancient FreeBSD releases
and current implementation does support this flag correctly.
2017-04-09 11:49:21 +03:00
Boris Lytochkin
2b1bbf1673 fix a typo - assigment was used instead of comparison 2017-04-09 11:37:22 +03:00
Boris Lytochkin
8bc92bde34 choose IP(v6) address based on ipv6_ flag in a correct way 2017-04-08 23:00:23 +03:00
bjovke
319eb27f19 Unnecessary dynamic memory allocation for zmq::socket_poller_t in zmq_poller_poll(). Fixed by allocating zmq::socket_poller_t from stack. 2017-04-04 11:51:59 +02:00
Jake Cobb
5d5263ed8a Prevent DOS by asserts in TCP tuning (#2492)
* Prevent DOS by asserts in TCP tuning

-Propagates socket option errors from the
tuning functions to the callers.
-Asserts a subset of error conditions during tuning,
excluding external network causes.
-Checks tuning results in 3 call sites and treats
them like failures to connect, accept, etc.

* Fix variable name

* Remove lambda requiring C++11
2017-04-04 09:55:26 +01:00
bbdb68
1d58a00992 Problem: no windows UWP support
* add define for windows/UWP

* prevent issue with COM references

* gettickcount not available on uwp

* add compiler definitions

* add convenitnece cmake file

* brute force uwp compilation

* fix compiler version

* cosmetics
2017-04-04 09:50:33 +01:00
evoskuil
1dd9cac24d Problem: xpub_t.xattach_pipe no handle msg.copy or pipe_t.write fails. 2017-03-30 14:45:40 -07:00
evoskuil
6436bc51e6 Problem: sub.xsetsockopt leaks message (0..n bytes) payload on fail. 2017-03-30 14:06:39 -07:00
evoskuil
1b79da0d7d Problem: proxy leaks one message payload (0..n bytes) on close. 2017-03-30 13:57:48 -07:00
evoskuil
4ea7d01803 Problem: send_failure() util name undergeneralized (for read success). 2017-03-30 13:57:47 -07:00
evoskuil
8c165ad1d2 Problem: excess whitespace (style). 2017-03-30 13:57:47 -07:00
evoskuil
a014e77ef7 Problem: leaks on send_zap_request fail, use of goto idiom is fragile. 2017-03-29 16:48:40 -07:00
evoskuil
29a5c98d83 Problem: zap_connect() asserts on write fail (yet returns fail codes). 2017-03-29 14:31:48 -07:00
evoskuil
a0ccdc866e Problem: secure servers ignore zap_connect failre code and set ready. 2017-03-29 14:31:47 -07:00
evoskuil
f44300cb00 Problem: assert used for ZAP error handling aborts process. 2017-03-29 10:43:56 -07:00
Thomas Braun
33e29bd383 Problem: Out of memory condition not always checked
Solution: Use the appropriate assertion macro.
2017-03-27 23:58:38 +02:00
Thomas Braun
fe9f6b2837 Problem: GSSAPI check for Out of memory is done conditionally
Solution: Do it unconditionally.
2017-03-27 23:58:27 +02:00
Thomas Braun
19f30f7926 Problem: throwing version of new called
Solution: Pass (std::nothrow) as done in all other places.
2017-03-27 23:58:19 +02:00
evoskuil
616fbeff21 Problem: insufficient use of const complicates calling. 2017-03-26 00:53:50 -07:00
evoskuil
feb8e868df Problem: typo in comment. 2017-03-25 13:51:18 -07:00
evoskuil
068c815224 Problem: __STDC_LIMIT_MACROS before PCH causes VC++ warning. 2017-03-23 13:58:26 -07:00
evoskuil
af0320f786 Problem: implicit cast from size_t to int implies data loss. 2017-03-23 11:38:51 -07:00
Goswin von Brederlow
1dd5fef20c zmq_curve_keypair(): return result from crypto_box_keypair() to make testcase meaningfull 2017-03-16 14:01:08 +00:00
Luca Boccassi
d7aceef2ed Problem: thread name is redundant
Solution: call it simply "ZMQ background" instead of "ZMQ b/g thread"
2017-03-12 13:11:44 +00:00
Luca Boccassi
092ad50b0c Problem: I can't refactor
Solution: fix ifdef check for pthread_setname
2017-03-12 13:11:11 +00:00
Luca Boccassi
3ab4796c5a Problem: ZMQ background threads are unnamed
Solution: use pthread API to set the name. For now call every thread
"ZMQ b/g thread". Would be nice to number the I/O threads and name
explicitly the reaper thread, but in reality a bit of internal API
churn would be necessary, so perhaps it's not worth it.
This is useful when debugging a process with many threads.
2017-03-12 00:46:15 +00:00