diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-07-23 11:01:06 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-07-23 11:01:06 +0200 |
commit | e721c122d3f453094d4ab27040765974620f15ef (patch) | |
tree | 5ef53f6dbd202e07c1b01748b76d76dff292c4ec /libssh/client.c | |
parent | 8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f (diff) | |
download | libssh-e721c122d3f453094d4ab27040765974620f15ef.tar.gz libssh-e721c122d3f453094d4ab27040765974620f15ef.tar.xz libssh-e721c122d3f453094d4ab27040765974620f15ef.zip |
Continue removing old flushing code
Diffstat (limited to 'libssh/client.c')
-rw-r--r-- | libssh/client.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libssh/client.c b/libssh/client.c index a7d803b..42c896a 100644 --- a/libssh/client.c +++ b/libssh/client.c @@ -204,6 +204,7 @@ static int ssh_analyze_banner(ssh_session session, int *ssh1, int *ssh2) { int ssh_send_banner(ssh_session session, int server) { const char *banner = NULL; char buffer[128] = {0}; + int err=SSH_ERROR; enter_function(); @@ -216,30 +217,31 @@ int ssh_send_banner(ssh_session session, int server) { if (server) { session->serverbanner = strdup(banner); if (session->serverbanner == NULL) { - leave_function(); - return -1; + goto end; } } else { session->clientbanner = strdup(banner); if (session->clientbanner == NULL) { - leave_function(); - return -1; + goto end; } } snprintf(buffer, 128, "%s\n", banner); if (ssh_socket_write(session->socket, buffer, strlen(buffer)) == SSH_ERROR) { - leave_function(); - return -1; + goto end; + } + if (ssh_socket_nonblocking_flush(session->socket) == SSH_ERROR){ + goto end; } - #ifdef WITH_PCAP if(session->pcap_ctx) ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_OUT,buffer,strlen(buffer),strlen(buffer)); #endif + err=SSH_OK; +end: leave_function(); - return 0; + return err; } @@ -510,7 +512,7 @@ int ssh_service_request(ssh_session session, const char *service) { } ssh_string_free(service_s); - if (packet_send(session) != SSH_OK) { + if (packet_send(session) == SSH_ERROR) { ssh_set_error(session, SSH_FATAL, "Sending SSH2_MSG_SERVICE_REQUEST failed."); break; |