Fix error codes.
[oweals/openssl.git] / apps / s_server.c
index ce83a1bcd4d2ba32a6903380e63cae5518927bfd..7cb9a08da51f23da8964b7ae6b0c9164e1ea177b 100644 (file)
@@ -938,6 +938,9 @@ int MAIN(int, char **);
 
 #ifndef OPENSSL_NO_JPAKE
 static char *jpake_secret = NULL;
+#define no_jpake !jpake_secret
+#else
+#define no_jpake 1
 #endif
 #ifndef OPENSSL_NO_SRP
        static srpsrvparm srp_callback_parm;
@@ -1465,14 +1468,7 @@ bad:
                        goto end;
                        }
                psk_identity = "JPAKE";
-               if (cipher)
-                       {
-                       BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
-                       goto end;
-                       }
-               cipher = "PSK";
                }
-
 #endif
 
        SSL_load_error_strings();
@@ -1719,8 +1715,7 @@ bad:
                SSL_CTX_set1_param(ctx, vpm);
 
        ssl_ctx_add_crls(ctx, crls, 0);
-
-       if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, no_ecdhe))
+       if (!args_ssl_call(ctx, bio_err, cctx, ssl_args, no_ecdhe, no_jpake))
                goto end;
 
        if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
@@ -1788,8 +1783,7 @@ bad:
                        SSL_CTX_set1_param(ctx2, vpm);
 
                ssl_ctx_add_crls(ctx2, crls, 0);
-
-               if (!args_ssl_call(ctx2, bio_err, cctx, ssl_args, no_ecdhe))
+               if (!args_ssl_call(ctx2, bio_err, cctx, ssl_args, no_ecdhe, no_jpake))
                        goto end;
                }
 
@@ -2033,9 +2027,13 @@ end:
                sk_OPENSSL_STRING_free(ssl_args);
        if (cctx)
                SSL_CONF_CTX_free(cctx);
+#ifndef OPENSSL_NO_JPAKE
+       if (jpake_secret && psk_key)
+               OPENSSL_free(psk_key);
+#endif
        if (bio_s_out != NULL)
                {
-        BIO_free(bio_s_out);
+               BIO_free(bio_s_out);
                bio_s_out=NULL;
                }
        if (bio_s_msg != NULL)