X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_client.c;h=c4c3b0e94a59b6b6746bd2f061d0b719f35f2218;hp=60a8728c9bc837d4af966a8261b51a1d71de7458;hb=07fb39c32e62cc8fb710e07c20c66b6f22398246;hpb=a31011e8e0ea18f1cc79d7eb53238768ae9369c6 diff --git a/apps/s_client.c b/apps/s_client.c index 60a8728c9b..c4c3b0e94a 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -91,10 +91,6 @@ typedef unsigned int u_int; #undef FIONBIO #endif -#if defined(NO_RSA) && !defined(NO_SSL2) -#define NO_SSL2 -#endif - #undef PROG #define PROG s_client_main @@ -152,11 +148,13 @@ static void sc_usage(void) BIO_printf(bio_err," -tls1 - just use TLSv1\n"); BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); - BIO_printf(bio_err," -cipher - prefered cipher to use, use the 'openssl ciphers'\n"); + BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n"); BIO_printf(bio_err," command to see what is available\n"); } +int MAIN(int, char **); + int MAIN(int argc, char **argv) { int off=0; @@ -176,6 +174,7 @@ int MAIN(int argc, char **argv) int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending; SSL_CTX *ctx=NULL; int ret=1,in_init=1,i,nbio_test=0; + int prexit = 0; SSL_METHOD *meth=NULL; BIO *sbio; #ifdef WINDOWS @@ -245,6 +244,8 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; cert_file= *(++argv); } + else if (strcmp(*argv,"-prexit") == 0) + prexit=1; else if (strcmp(*argv,"-crlf") == 0) crlf=1; else if (strcmp(*argv,"-quiet") == 0) @@ -338,7 +339,8 @@ bad: } } - SSLeay_add_ssl_algorithms(); + OpenSSL_add_ssl_algorithms(); + SSL_load_error_strings(); ctx=SSL_CTX_new(meth); if (ctx == NULL) { @@ -353,7 +355,11 @@ bad: if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback); if (cipher != NULL) - SSL_CTX_set_cipher_list(ctx,cipher); + if(!SSL_CTX_set_cipher_list(ctx,cipher)) { + BIO_printf(bio_err,"error setting cipher list\n"); + ERR_print_errors(bio_err); + goto end; + } #if 0 else SSL_CTX_set_cipher_list(ctx,getenv("SSL_CIPHER")); @@ -366,14 +372,13 @@ bad: if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) || (!SSL_CTX_set_default_verify_paths(ctx))) { - /* BIO_printf(bio_err,"error seting default verify locations\n"); */ + /* BIO_printf(bio_err,"error setting default verify locations\n"); */ ERR_print_errors(bio_err); /* goto end; */ } - SSL_load_error_strings(); - con=(SSL *)SSL_new(ctx); + con=SSL_new(ctx); /* SSL_set_cipher_list(con,"RC4-MD5"); */ re_start: @@ -503,6 +508,7 @@ re_start: * are any keypresses. Note: this is a hack, in a proper * Windows application we wouldn't do this. */ + i=0; if(!write_tty) { if(read_tty) { tv.tv_sec = 1; @@ -735,6 +741,7 @@ shut: SHUTDOWN(SSL_get_fd(con)); ret=0; end: + if(prexit) print_stuff(bio_c_out,con,1); if (con != NULL) SSL_free(con); if (con2 != NULL) SSL_free(con2); if (ctx != NULL) SSL_CTX_free(ctx);