diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-11-05 11:11:29 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-11-05 11:11:29 +0100 |
commit | b8323e4f4724a2b62f3be71e5d2a16ea6856af1f (patch) | |
tree | 8ea97a7206928184a284ef9198a16544ef3376f8 /src/socket.c | |
parent | 8b1315d58fab8dcd1e8b7cae060ec06ddfa37b7a (diff) | |
download | gnutls-b8323e4f4724a2b62f3be71e5d2a16ea6856af1f.tar.gz |
tools: better ftp auth tls negotiation
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/socket.c b/src/socket.c index 65cf735205..8991089a8c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -125,8 +125,8 @@ ssize_t send_line(socket_st * socket, const char *txt) int len = strlen(txt); int ret; - if (socket->verbose > 2) - fprintf(stderr, "starttls: sending: \"%s\"\n", txt); + if (socket->verbose) + fprintf(stderr, "starttls: sending: %s\n", txt); ret = send(socket->fd, txt, len, 0); @@ -141,13 +141,13 @@ ssize_t send_line(socket_st * socket, const char *txt) static ssize_t wait_for_text(socket_st * socket, const char *txt, unsigned txt_size) { - char buf[512]; + char buf[1024]; char *p; int ret; fd_set read_fds; struct timeval tv; - if (socket->verbose > 2 && txt != NULL) + if (socket->verbose && txt != NULL) fprintf(stderr, "starttls: waiting for: \"%.*s\"\n", txt_size, txt); do { @@ -170,7 +170,7 @@ ssize_t wait_for_text(socket_st * socket, const char *txt, unsigned txt_size) break; if (socket->verbose) - fprintf(stderr, "starttls: received: \"%s\"\n", buf); + fprintf(stderr, "starttls: received: %s\n", buf); p = memmem(buf, ret, txt, txt_size); if (p != NULL && p != buf) { @@ -231,9 +231,9 @@ socket_starttls(socket_st * socket, const char *app_proto) if (socket->verbose) printf("Negotiating FTP STARTTLS\n"); - send_line(socket, "FEAT\n"); + send_line(socket, "FEAT\r\n"); wait_for_text(socket, "211 ", 4); - send_line(socket, "AUTH TLS\n"); + send_line(socket, "AUTH TLS\r\n"); wait_for_text(socket, "234", 3); } else { if (!c_isdigit(app_proto[0])) { |