diff --git a/src/curve_server.cpp b/src/curve_server.cpp index ec55153400..eff4290b33 100644 --- a/src/curve_server.cpp +++ b/src/curve_server.cpp @@ -494,21 +494,23 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_) // encryption without authentication), but if it was requested and it does // not work properly the program will abort. rc = session->zap_connect (); - if (rc != 0) - return -1; - rc = send_zap_request (client_key); - if (rc != 0) - return -1; - rc = receive_and_process_zap_reply (); - if (rc == 0) - state = status_code == "200" - ? send_ready - : send_error; - else - if (errno == EAGAIN) - state = expect_zap_reply; + if (rc == 0) { + rc = send_zap_request (client_key); + if (rc != 0) + return -1; + rc = receive_and_process_zap_reply (); + if (rc == 0) + state = status_code == "200" + ? send_ready + : send_error; + else + if (errno == EAGAIN) + state = expect_zap_reply; + else + return -1; + } else - return -1; + state = send_ready; return parse_metadata (initiate_plaintext + crypto_box_ZEROBYTES + 128, clen - crypto_box_ZEROBYTES - 128); diff --git a/tests/test_heartbeats.cpp b/tests/test_heartbeats.cpp index ed251cc892..59bbae0e6d 100644 --- a/tests/test_heartbeats.cpp +++ b/tests/test_heartbeats.cpp @@ -102,7 +102,32 @@ mock_handshake (raw_socket fd) { } static void -prep_server_socket(void * ctx, int set_heartbeats, void ** server_out, void ** mon_out, +setup_curve (void * socket, int is_server) { + const char *secret_key; + const char *public_key; + const char *server_key; + + if (is_server) { + secret_key = "JTKVSB%%)wK0E.X)V>+}o?pNmC{O&4W4b!Ni{Lh6"; + public_key = "rq:rM>}U?@Lns47E1%kR.o@n%FcmmsL/@{H8]yf7"; + server_key = NULL; + } + else { + secret_key = "D:)Q[IlAW!ahhC2ac:9*A}h:p?([4%wOTJ%JR%cs"; + public_key = "Yne@$w-vo