Skip to content

Commit

Permalink
direct_tcpip: bring back inclusion of libssh2_config.h
Browse files Browse the repository at this point in the history
In order to increase portability of this example, I'm bringing
the inclusion of libssh2_config.h back, and I also added an
require that header for this example to compile.

I also made all code lines fit within 80 columns.
  • Loading branch information
bagder committed Jun 3, 2010
1 parent 81912f6 commit f285438
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions example/direct_tcpip.c
@@ -1,3 +1,4 @@
#include "libssh2_config.h"
#include <libssh2.h>

#ifdef WIN32
Expand All @@ -18,6 +19,10 @@
#include <unistd.h>
#include <sys/types.h>

#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif

#ifndef INADDR_NONE
#define INADDR_NONE (in_addr_t)-1
#endif
Expand Down Expand Up @@ -150,7 +155,8 @@ int main(int argc, char *argv[])
goto shutdown;
}
} else if (auth & AUTH_PUBLICKEY) {
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1,
keyfile2, password)) {
printf("\tAuthentication by public key failed!\n");
goto shutdown;
}
Expand Down Expand Up @@ -197,8 +203,9 @@ int main(int argc, char *argv[])
channel = libssh2_channel_direct_tcpip_ex(session, remote_desthost,
remote_destport, shost, sport);
if (!channel) {
fprintf(stderr, "Could not open the direct-tcpip channel!\n");
fprintf(stderr, "(Note that this can be a problem at the server! Please review the server logs.)\n");
fprintf(stderr, "Could not open the direct-tcpip channel!\n"
"(Note that this can be a problem at the server!"
" Please review the server logs.)\n");
goto shutdown;
}

Expand Down

0 comments on commit f285438

Please sign in to comment.