static void ts_report(struct timeval *tv, const char *fmt, ...)
CHECK_PRINTF(2, 3);
+static void imap_negotiate_tls(netsec_context *);
static void add_msg(bool queue, const char *fmt, ...) CHECK_PRINTF(2, 3);
if (netsec_set_tls(nsc, 1, 0, &errstr) != OK)
die("%s", errstr);
- if (initialtls && netsec_negotiate_tls(nsc, &errstr) != OK)
- die("%s", errstr);
+ if (initialtls)
+ imap_negotiate_tls(nsc);
}
if (sasl) {
fprintf(stderr, "STARTTLS failed: %s\n", errstr);
goto finish;
}
- if (netsec_negotiate_tls(nsc, &errstr) != OK) {
- die("%s", errstr);
- }
+
+ imap_negotiate_tls(nsc);
}
if (sasl) {
}
}
+/*
+ * Negotiate TLS connection, with optional timestamp
+ */
+
+static void
+imap_negotiate_tls(netsec_context *nsc)
+{
+ char *errstr;
+ struct timeval tv;
+
+ if (timestamp)
+ gettimeofday(&tv, NULL);
+
+ if (netsec_negotiate_tls(nsc, &errstr) != OK)
+ die("%s", errstr);
+
+ if (timestamp)
+ ts_report(&tv, "TLS negotation time");
+}
+
/*
* Give a timestamp report.
*/