Skip to content

Commit 89e80e0

Browse files
lxinchucklever
authored andcommitted
tlshd: fix a couple of compiling errors with QUIC enabled
This patch fixes these compiling errors with QUIC enabled: client.c: In function ‘tlshd_quic_client_set_x509_session’: client.c:489:43: error: ‘xcred’ undeclared (first use in this function); did you mean ‘cred’? 489 | ret = tlshd_client_get_truststore(xcred); | ^~~~~ | cred client.c:489:43: note: each undeclared identifier is reported only once for each function it appears in client.c: In function ‘tlshd_quic_client_set_psk_session’: client.c:544:31: error: incompatible types when initializing type ‘key_serial_t’ {aka ‘int’} using type ‘GArray’ {aka ‘struct _GArray’} 544 | key_serial_t peerid = conn->parms->peerids[0]; | ^~~~ server.c: In function ‘tlshd_quic_server_set_x509_session’: server.c:481:15: error: unused variable ‘cafile’ [-Werror=unused-variable] 481 | char *cafile; | ^~~~~~ Commit fe3a78a ("tlshd: Refactor trust store management") passed incorrect 'xcred' to tlshd_client_get_truststore(), while it should be 'cred'. The unused variable 'cafile' should also be cleaned in tlshd_quic_server_set_x509_session(). Commit 18b04a6 ("tlshd: Store peer IDs in a GArray") forgot to fix the parms->peerids access in tlshd_quic_client_set_psk_session(). Fixes: fe3a78a ("tlshd: Refactor trust store management") Fixes: 18b04a6 ("tlshd: Store peer IDs in a GArray") Signed-off-by: Xin Long <lucien.xin@gmail.com>
1 parent 98c3e0d commit 89e80e0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/tlshd/client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static int tlshd_quic_client_set_x509_session(struct tlshd_quic_conn *conn)
513513
ret = gnutls_certificate_allocate_credentials(&cred);
514514
if (ret)
515515
goto err;
516-
ret = tlshd_client_get_truststore(xcred);
516+
ret = tlshd_client_get_truststore(cred);
517517
if (ret != GNUTLS_E_SUCCESS)
518518
goto err_cred;
519519

@@ -568,7 +568,7 @@ static int tlshd_quic_client_set_anon_session(struct tlshd_quic_conn *conn)
568568

569569
static int tlshd_quic_client_set_psk_session(struct tlshd_quic_conn *conn)
570570
{
571-
key_serial_t peerid = conn->parms->peerids[0];
571+
key_serial_t peerid = g_array_index(conn->parms->peerids, key_serial_t, 0);
572572
gnutls_psk_client_credentials_t cred;
573573
gnutls_session_t session;
574574
char *identity = NULL;

src/tlshd/server.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ static int tlshd_quic_server_set_x509_session(struct tlshd_quic_conn *conn)
505505
gnutls_datum_t ticket_key;
506506
gnutls_session_t session;
507507
int ret = -EINVAL;
508-
char *cafile;
509508

510509
if (!tlshd_x509_server_get_certs(parms) || !tlshd_x509_server_get_privkey(parms)) {
511510
tlshd_log_error("cert/privkey get error %d", -ret);

0 commit comments

Comments
 (0)