Oops, get selection logic right.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 5 Feb 2014 18:55:37 +0000 (18:55 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 5 Feb 2014 18:57:25 +0000 (18:57 +0000)
ssl/s3_lib.c

index d97082e..4531f46 100644 (file)
@@ -3908,9 +3908,10 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
                break;
 
        case SSL_CTRL_GET_EXTRA_CHAIN_CERTS:
                break;
 
        case SSL_CTRL_GET_EXTRA_CHAIN_CERTS:
-               *(STACK_OF(X509) **)parg =  ctx->extra_certs;
-               if (parg == NULL && larg == 0)
+               if (ctx->extra_certs == NULL && larg == 0)
                        *(STACK_OF(X509) **)parg =  ctx->cert->key->chain;
                        *(STACK_OF(X509) **)parg =  ctx->cert->key->chain;
+               else
+                       *(STACK_OF(X509) **)parg =  ctx->extra_certs;
                break;
 
        case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS:
                break;
 
        case SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS: