Skip to content

Commit b52ca7c

Browse files
committed
tlshd: Clean up logic in tlshd_start_tls_handshake()
gnutls_handshake() is supposed to return only a GNUTLS_E value, and the session_status field is supposed to contain only a positive errno. GNUTLS_E_PREMATURE_TERMINATION is -110. It turns out that on x86, -ETIMEDOUT is also -110. Make sure the correct symbolic constants and auditing functions are utilized. Fixes: b010190 ("tlshd: Pass ETIMEDOUT from gnutls to kernel") Reviewed-by: Benjamin Coddington <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent a6b8ed2 commit b52ca7c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tlshd/handshake.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ void tlshd_start_tls_handshake(gnutls_session_t session,
9797
case GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR:
9898
tlshd_log_cert_verification_error(session);
9999
break;
100-
case -ETIMEDOUT:
101-
tlshd_log_gnutls_error(ret);
102-
parms->session_status = -ret;
100+
case GNUTLS_E_PREMATURE_TERMINATION:
101+
tlshd_log_error("Handshake timeout, retrying");
102+
parms->session_status = ETIMEDOUT;
103103
break;
104104
default:
105-
tlshd_log_notice("tlshd_start_tls_handshake unhandled error %d, returning EACCES\n", ret);
105+
tlshd_log_gnutls_error(ret);
106106
}
107107
return;
108108
}

0 commit comments

Comments
 (0)