1. 28 Jul, 2017 3 commits
    • Luca Boccassi's avatar
      Problem: reading from /dev/urandom is clunky · fbb6bbdc
      Luca Boccassi authored
      Solution: if available use the getrandom function as it doesn't
      require any synchronization, state or cleanup
      fbb6bbdc
    • Luca Boccassi's avatar
      Problem: tweetnacl leaks file descriptor on fork+exec · 2626fdfa
      Luca Boccassi authored
      Solution: open with O_CLOEXEC if available or set FD_CLOEXEC if not
      2626fdfa
    • Luca Boccassi's avatar
      Problem: fd leak in tweetnacl with one ctx per thread · e015a0f8
      Luca Boccassi authored
      Solution: add a crypto [de-]initialiser, refcounted and serialised
      through critical sections.
      This is necessary as utility APIs such as zmq_curve_keypair also
      call into the sodium/tweetnacl libraries and need the initialisation
      outside of the zmq context.
      Also the libsodium documentation explicitly says that sodium_init
      must not be called concurrently from multiple threads, which could
      have happened until now. Also the randombytes_close function does
      not appear to be thread safe either.
      This change guarantees that the library is initialised only once at
      any given time across the whole program.
      Fixes #2632
      e015a0f8
  2. 27 Jul, 2017 2 commits
  3. 22 Jul, 2017 1 commit
  4. 14 Jul, 2017 1 commit
    • Marc Sune's avatar
      Fix ROUTER's xhas_out() in MANDATORY mode · b7b89a8f
      Marc Sune authored
      Before this commit, xhas_out() was returning true regardless. This
      was correct before the ZMQ_ROUTER_MANDATORY flag as introduced.
      However, ZMQ_POLLOUT.
      
      With this commit, _if_ ZMQ_ROUTER_MANDATORY is set, xhas_out() will
      return false if ALL peer's outgoing pipes are full.
      
      There is an outstanding high-level design question:
      
      If ZMQ_ROUTER_MANDATORY is set, and zmq_poll() waits for ZMQ_POLLOUT
      events, zmq_poll() will immediately wake up if only 1 pipe has
      room to send, regardless of the peer, creating a busy loop of
      zmq_poll() wake-up, zmq_send() (EAGAIN). There is no way for
      the application to selectively wait for ZMQ_POLLOUT for specific
      peer(s), which seems somehow necessary in ZMQ_ROUTER_MANDATORY.
      
      This discussion will be addressed in a separate issue.
      Signed-off-by: 's avatarMarc Sune <marc@voltanet.io>
      Signed-off-by: 's avatarFredi Raspall <fredi@voltanet.io>
      b7b89a8f
  5. 01 Jul, 2017 1 commit
    • Luca Boccassi's avatar
      Problem: CURVE server (connect) fails when client rebinds · d04065b7
      Luca Boccassi authored
      Solution: if a CURVE server is using zmq_connect, the same session
      will be used for any client "reconnect" (actual binds). This is
      acceptable, so do not assert if zap_pipe already exists during the
      handshake, but simply reuse it.
      Fixes #2608
      d04065b7
  6. 27 Jun, 2017 2 commits
  7. 22 Jun, 2017 1 commit
  8. 13 Jun, 2017 3 commits
  9. 12 Jun, 2017 1 commit
  10. 02 Jun, 2017 1 commit
    • laplaceyang's avatar
      fix bug: coredump if set linger and immediate together · 67a6594f
      laplaceyang authored
      In function session_base_t::reconnect, if we set immediate to 1 and set linger, we will get into first block of reconnect function, and set pipe to NULL, but we forget to cancel timer of linger. Once timer tiggered, we will get coredump. Solution: cancel timer in the end of set pipe to NULL
      67a6594f
  11. 17 May, 2017 2 commits
    • rkfg's avatar
      Problem: abort at socket creation on Android with jzmq · 72b4b683
      rkfg authored
      Solution: don't set thread name on Android
      
      Setting a thread name on Android may fail with "permission
      denied" error and abort the process due to failed assertion.
      Tested on Android 5 and 6 (two phones).
      Strangely enough, it only happens on signed APKs and is fine
      in debug. Using JeroMQ is not an option as we need TCP keepalive
      settings and authentication which JeroMQ doesn't support.
      72b4b683
    • Luca Boccassi's avatar
      Problem: REP leaves label msgs for dead REQ in pipe · bdc676f6
      Luca Boccassi authored
      Solution: roll back the pipe if writing messages other than the
      first fails in router::xsend. Roll it back also when the pipe is
      terminating.
      Also add test case that reproduces the memory leak when ran with
      valgrind.
      Fixes #2567
      bdc676f6
  12. 16 May, 2017 1 commit
  13. 10 May, 2017 1 commit
  14. 06 May, 2017 1 commit
  15. 01 May, 2017 1 commit
  16. 28 Apr, 2017 1 commit
    • Luca Boccassi's avatar
      Problem: new zmq_poller used by zmq_poll without DRAFTs · 90c76fbd
      Luca Boccassi authored
      Solution: do not define ZMQ_HAVE_POLLER in src/zmq_drafts.h otherwise
      src/zmq.cpp will implement zmq_poll using the new poller classes.
      Same for ZMQ_HAVE_TIMERS, even though it has no internal effect, but
      to be safe against future development.
      90c76fbd
  17. 25 Apr, 2017 2 commits
    • Jim Garlick's avatar
      gssapi: drop unnecessary ifdefs · 53918fc1
      Jim Garlick authored
      Problem: GSSAPI DRAFT code was made conditional on
      ZMQ_BUILD_DRAFT_API, but zmq_draft.h duplicates the DRAFT
      symbols definitions from zmq.h so this is unnecessary.
      
      Solution: drop the extra ifdefs
      53918fc1
    • Jim Garlick's avatar
      gssapi: renumber socket options · c978d3bb
      Jim Garlick authored
      Problem: GSSAPI NAMETYPE socket option numbers were modified
      +1000 when moved to DRAFT section, but should use the definitive
      values while in DRAFT to minimize disruption later.
      
      Solution: renumber the socket options
      c978d3bb
  18. 24 Apr, 2017 2 commits
    • Jim Garlick's avatar
      gssapi: add NAMETYPE options to zmq_getsockopt · 8892087e
      Jim Garlick authored
      Problem: GSSAPI NAMETYPE options were added to zmq_setsockopt()
      but not zmq_getsockopt().
      
      Add them to zmq_getsockopt().
      8892087e
    • Jim Garlick's avatar
      gssapi: move new options to DRAFT section · 9fbf2e2e
      Jim Garlick authored
      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
      9fbf2e2e
  19. 21 Apr, 2017 1 commit
    • Jim Garlick's avatar
      gssapi: add NAMETYPE socket options · 0b185e82
      Jim Garlick authored
      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
      0b185e82
  20. 20 Apr, 2017 4 commits
    • Jim Garlick's avatar
      gssapi: use gss_buffer_desc consistently · 2b9a352a
      Jim Garlick authored
      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.
      2b9a352a
    • Jim Garlick's avatar
      gssapi: fail if client sets wrong principal · 4e22dd0e
      Jim Garlick authored
      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
      4e22dd0e
    • Jim Garlick's avatar
      gssapi: use GSS_C_BOTH to acquire credentials · f2b579ce
      Jim Garlick authored
      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.
      f2b579ce
    • Juan A. Garcia Pardo's avatar
      Problem: Windows build broken by #if ZMQ_USE_POLL · 52ce6aab
      Juan A. Garcia Pardo authored
      Solution: use #if defined ZMQ_USE_POLL
      52ce6aab
  21. 19 Apr, 2017 1 commit
    • Asmod4n's avatar
      change macOS < 10.12 clock to SYSTEM_CLOCK, fixes #2537 (#2538) · ce602d08
      Asmod4n authored
      * 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
      ce602d08
  22. 14 Apr, 2017 2 commits
  23. 11 Apr, 2017 1 commit
  24. 10 Apr, 2017 4 commits