From 47c05b10018f5ec7493e4bd9f521aaa18d96f1e2 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 22 May 2011 22:50:58 +0200 Subject: Fix socket timeout handling. Fixes STARTTLS hangs reported by Thomas Jarosch. --- smtp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'smtp.c') diff --git a/smtp.c b/smtp.c index 1c99c696..90c35173 100644 --- a/smtp.c +++ b/smtp.c @@ -313,10 +313,12 @@ int SMTP_ok(int sock, char smtp_mode, int mintimeout) { SIGHANDLERTYPE alrmsave; char reply[MSGBUFSIZE], *i; + int tmo = (mytimeout >= mintimeout) ? mytimeout : mintimeout; /* set an alarm for smtp ok */ alrmsave = set_signal_handler(SIGALRM, null_signal_handler); - set_timeout(mytimeout >= mintimeout ? mytimeout : mintimeout); + set_timeout(tmo); + SockTimeout(sock, tmo); smtp_response[0] = '\0'; -- cgit v1.2.3