7d1228
commit 9e885a707d604e9528b5491b78fb9c00f41193fc
7d1228
Author: Tomas Mraz <tmraz@fedoraproject.org>
7d1228
Date:   Thu Mar 26 15:59:00 2020 +0100
7d1228
7d1228
    s_server: Properly indicate ALPN protocol mismatch
7d1228
    
7d1228
    Return SSL_TLSEXT_ERR_ALERT_FATAL from alpn_select_cb so that
7d1228
    an alert is sent to the client on ALPN protocol mismatch.
7d1228
    
7d1228
    Fixes: #2708
7d1228
    
7d1228
    Reviewed-by: Matt Caswell <matt@openssl.org>
7d1228
    (Merged from https://github.com/openssl/openssl/pull/11415)
7d1228
7d1228
diff --git a/apps/s_server.c b/apps/s_server.c
7d1228
index bcc83e562c..591c6c19c5 100644
7d1228
--- a/apps/s_server.c
7d1228
+++ b/apps/s_server.c
7d1228
@@ -707,7 +707,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
7d1228
     if (SSL_select_next_proto
7d1228
         ((unsigned char **)out, outlen, alpn_ctx->data, alpn_ctx->len, in,
7d1228
          inlen) != OPENSSL_NPN_NEGOTIATED) {
7d1228
-        return SSL_TLSEXT_ERR_NOACK;
7d1228
+        return SSL_TLSEXT_ERR_ALERT_FATAL;
7d1228
     }
7d1228
 
7d1228
     if (!s_quiet) {