direct_tcpip: bring back inclusion of libssh2_config.h
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.
This commit is contained in:
parent
81912f67e7
commit
f285438022
@ -1,3 +1,4 @@
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@ -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
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user