mix 'listen * port 80' and 'listen * tls port 443' in one server block.
Also the last argument of server_tls_cmp - match_keypair - is always 0
so remove this code.
OK florian@ tb@ some long time ago
-/* $OpenBSD: httpd.h,v 1.154 2021/01/27 07:21:52 deraadt Exp $ */
+/* $OpenBSD: httpd.h,v 1.155 2021/04/10 10:10:07 claudio Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
/* server.c */
void server(struct privsep *, struct privsep_proc *);
-int server_tls_cmp(struct server *, struct server *, int);
+int server_tls_cmp(struct server *, struct server *);
int server_tls_load_ca(struct server *);
int server_tls_load_crl(struct server *);
int server_tls_load_keypair(struct server *);
-/* $OpenBSD: parse.y,v 1.124 2021/01/22 13:07:17 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.125 2021/04/10 10:10:07 claudio Exp $ */
/*
* Copyright (c) 2020 Matthias Pressfreund <mpfr@fn.de>
free(srv);
YYERROR;
}
- if (server_tls_cmp(s, srv, 0) != 0) {
+ if (srv->srv_conf.flags & SRVFLAG_TLS &&
+ server_tls_cmp(s, srv) != 0) {
yyerror("server \"%s\": tls "
"configuration mismatch on same "
"address/port",
-/* $OpenBSD: server.c,v 1.124 2021/01/02 18:35:07 tb Exp $ */
+/* $OpenBSD: server.c,v 1.125 2021/04/10 10:10:07 claudio Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
}
int
-server_tls_cmp(struct server *s1, struct server *s2, int match_keypair)
+server_tls_cmp(struct server *s1, struct server *s2)
{
struct server_config *sc1, *sc2;
if (strcmp(sc1->tls_ecdhe_curves, sc2->tls_ecdhe_curves) != 0)
return (-1);
- if (match_keypair) {
- if (strcmp(sc1->tls_cert_file, sc2->tls_cert_file) != 0)
- return (-1);
- if (strcmp(sc1->tls_key_file, sc2->tls_key_file) != 0)
- return (-1);
- }
-
return (0);
}