summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-01-12 23:14:35 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-01-12 23:14:35 +0100
commit82a9120112a723a6317352135beb125bbe4c6fc3 (patch)
tree164151803319b8b9e223a25c02a214a3e93230a0 /src/socket.c
parentae5474c0568dae799b337bcd9c5da8fe1e48ae25 (diff)
downloadgnutls-82a9120112a723a6317352135beb125bbe4c6fc3.tar.gz
gnutls-cli: added --starttls-proto option
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 7f17eedc47..262c91dcd4 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -180,18 +180,25 @@ socket_starttls(socket_st * socket, const char *app_proto)
return;
if (strcasecmp(app_proto, "smtp") == 0 || strcasecmp(app_proto, "submission") == 0) {
+ if (socket->verbose)
+ printf("Negotiating SMTP STARTTLS\n");
+
wait_for_text(socket->fd, "220 ", 4);
send_line(socket->fd, "EHLO mail.example.com\n");
wait_for_text(socket->fd, "250 ", 4);
send_line(socket->fd, "STARTTLS\n");
wait_for_text(socket->fd, "220 ", 4);
} else if (strcasecmp(app_proto, "imap") == 0 || strcasecmp(app_proto, "imap2") == 0) {
+ if (socket->verbose)
+ printf("Negotiating IMAP STARTTLS\n");
+
send_line(socket->fd, "a CAPABILITY\r\n");
wait_for_text(socket->fd, "a OK", 4);
send_line(socket->fd, "a STARTTLS\r\n");
wait_for_text(socket->fd, "a OK", 4);
} else {
- /*fprintf(stderr, "unknown protocol %s\n", app_proto);*/
+ if (socket->verbose)
+ fprintf(stderr, "unknown protocol %s\n", app_proto);
}
return;