Changeset 2971 for pjproject/trunk
- Timestamp:
- Oct 27, 2009 2:21:28 AM (15 years ago)
- Location:
- pjproject/trunk/pjlib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/build/cacert.pem
- Property svn:eol-style deleted
-
pjproject/trunk/pjlib/build/privkey.pem
- Property svn:eol-style deleted
-
pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c
r2970 r2971 480 480 ssock->sock = PJ_INVALID_SOCKET; 481 481 } 482 483 /* Upon error, OpenSSL may leave any error description in the thread 484 * error queue, which sometime may cause next call to SSL API returning 485 * false error alarm, e.g: in Linux, SSL_CTX_use_certificate_chain_file() 486 * returning false error after a handshake error (in different SSL_CTX!). 487 * For now, just clear thread error queue here. 488 */ 489 ERR_clear_error(); 482 490 } 483 491 -
pjproject/trunk/pjlib/src/pjlib-test/ssl_sock.c
r2970 r2971 21 21 #include <pjlib.h> 22 22 23 #define ECHO_SERVER_NAME "localhost" 24 #define ECHO_SERVER_ADDR "localhost" 25 #define ECHO_SERVER_PORT 12345 26 27 #define CERT_DIR "..\\build\\" 23 24 #define CERT_DIR "../build/" 28 25 #define CERT_CA_FILE NULL 29 26 #define CERT_FILE CERT_DIR "cacert.pem" … … 50 47 if (status != PJ_SUCCESS) { 51 48 app_perror("...FAILED to get available ciphers", status); 52 return -10;49 return status; 53 50 } 54 51 … … 455 452 struct test_state state_serv = { 0 }; 456 453 struct test_state state_cli = { 0 }; 457 pj_sockaddr l ocal_addr, rem_addr;454 pj_sockaddr laddr, raddr; 458 455 pj_str_t tmp_st; 459 456 pj_ssl_cipher ciphers[1]; … … 510 507 } 511 508 512 pj_sockaddr_init(PJ_AF_INET, &l ocal_addr, pj_strset2(&tmp_st, ECHO_SERVER_ADDR), ECHO_SERVER_PORT);513 status = pj_ssl_sock_start_accept(ssock_serv, pool, &l ocal_addr, sizeof(local_addr));509 pj_sockaddr_init(PJ_AF_INET, &laddr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 510 status = pj_ssl_sock_start_accept(ssock_serv, pool, &laddr, pj_sockaddr_get_len(&laddr)); 514 511 if (status != PJ_SUCCESS) { 515 512 goto on_return; … … 542 539 } 543 540 544 pj_sockaddr_init(PJ_AF_INET, &local_addr, pj_strset2(&tmp_st, "0.0.0.0"), 0); 545 pj_sockaddr_init(PJ_AF_INET, &rem_addr, pj_strset2(&tmp_st, ECHO_SERVER_ADDR), ECHO_SERVER_PORT); 546 status = pj_ssl_sock_start_connect(ssock_cli, pool, &local_addr, &rem_addr, sizeof(rem_addr)); 541 { 542 pj_ssl_sock_info info; 543 544 pj_ssl_sock_get_info(ssock_serv, &info); 545 pj_sockaddr_cp(&raddr, &info.local_addr); 546 } 547 548 status = pj_ssl_sock_start_connect(ssock_cli, pool, &laddr, &raddr, pj_sockaddr_get_len(&raddr)); 547 549 if (status == PJ_SUCCESS) { 548 550 ssl_on_connect_complete(ssock_cli, PJ_SUCCESS); … … 684 686 param.cb.on_data_sent = &ssl_on_data_sent; 685 687 param.ioqueue = ioqueue; 688 param.timer_heap = timer; 686 689 param.timeout.sec = 0; 687 690 param.timeout.msec = ms_timeout; 688 param.timer_heap = timer;689 691 pj_time_val_normalize(¶m.timeout); 690 692 … … 703 705 } 704 706 705 pj_sockaddr_init(PJ_AF_INET, &listen_addr, pj_strset2(&tmp_st, ECHO_SERVER_ADDR), ECHO_SERVER_PORT); 706 status = pj_ssl_sock_start_accept(ssock_serv, pool, &listen_addr, sizeof(listen_addr)); 707 if (status != PJ_SUCCESS) { 708 goto on_return; 707 pj_sockaddr_init(PJ_AF_INET, &listen_addr, pj_strset2(&tmp_st, "127.0.0.1"), 0); 708 status = pj_ssl_sock_start_accept(ssock_serv, pool, &listen_addr, pj_sockaddr_get_len(&listen_addr)); 709 if (status != PJ_SUCCESS) { 710 goto on_return; 711 } 712 713 { 714 pj_ssl_sock_info info; 715 716 pj_ssl_sock_get_info(ssock_serv, &info); 717 pj_sockaddr_cp(&listen_addr, &info.local_addr); 709 718 } 710 719 … … 801 810 PJ_LOG(3,("", "..echo test w/ incompatible ciphers")); 802 811 ret = echo_test(PJ_SSL_SOCK_PROTO_DEFAULT, TLS_RSA_WITH_DES_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA); 803 if (ret == 0)804 return -10;812 if (ret != PJ_EEOF) 813 return ret; 805 814 806 815 PJ_LOG(3,("", "..client non-SSL timeout in 5 secs"));
Note: See TracChangeset
for help on using the changeset viewer.