Code Monkey home page Code Monkey logo

libssh2-tunnel-example's People

Contributors

marianafranco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

libssh2-tunnel-example's Issues

Make it multiuser

Hi,

Have you tried to make this multiuser so you can spin up several SSH sessions back to the original server?

Right now if you try to do: ssh localhost -p 4000 twice it won't work.

I've tried to create a thread right after libssh2_channel_forward_accept so forward_tunnel is handled by treads independently. The problem is that since libssh2_session_set_blocking gets the argument session which is common among threads there are block problems and it doesn't work.

Any help here?

Btw, great work with it! ;)

Very nice, but fails with public keys

Hi,
libssh2_userauth_publickey_fromfile (sess, user, psrv_key.pub, psrv_key.priv, 0) and or
ibssh2_userauth_publickey_fromfile_ex and or
ibssh2_userauth_publickey_frommemory all fails
with -18. while the at the shell the: ssh -i ./psrv_key.priv user@server works fine.

Error when compiling

Thank you a lot for this example, it may be very useful for me, but I get error when try to compile.
I get the next output after make command:

gcc -O3 -Wall -std=c89 -o libssh2-tunnel-example -lssh2	 libssh2-tunnel-example.c
libssh2-tunnel-example.c: In function ‘main’:
libssh2-tunnel-example.c:238:40: warning: implicit declaration of function ‘strcasecmp’; did you mean ‘strncmp’? [-Wimplicit-function-declaration]
         if ((auth & AUTH_PASSWORD) && !strcasecmp(argv[8], "-p"))
                                        ^~~~~~~~~~
                                        strncmp
/tmp/ccStiW1D.o: In function `forward_tunnel':
libssh2-tunnel-example.c:(.text+0x10b): undefined reference to `libssh2_session_set_blocking'
libssh2-tunnel-example.c:(.text+0x1da): undefined reference to `libssh2_channel_read_ex'
libssh2-tunnel-example.c:(.text+0x27d): undefined reference to `libssh2_session_set_blocking'
libssh2-tunnel-example.c:(.text+0x2b5): undefined reference to `libssh2_channel_eof'
libssh2-tunnel-example.c:(.text+0x33b): undefined reference to `libssh2_channel_write_ex'
/tmp/ccStiW1D.o: In function `main':
libssh2-tunnel-example.c:(.text.startup+0xb3): undefined reference to `libssh2_init'
libssh2-tunnel-example.c:(.text.startup+0x134): undefined reference to `libssh2_session_init_ex'
libssh2-tunnel-example.c:(.text.startup+0x14c): undefined reference to `libssh2_session_handshake'
libssh2-tunnel-example.c:(.text.startup+0x168): undefined reference to `libssh2_hostkey_hash'
libssh2-tunnel-example.c:(.text.startup+0x1ef): undefined reference to `libssh2_userauth_list'
libssh2-tunnel-example.c:(.text.startup+0x2b9): undefined reference to `libssh2_userauth_publickey_fromfile_ex'
libssh2-tunnel-example.c:(.text.startup+0x2f6): undefined reference to `libssh2_session_disconnect_ex'
libssh2-tunnel-example.c:(.text.startup+0x2fe): undefined reference to `libssh2_session_free'
libssh2-tunnel-example.c:(.text.startup+0x30c): undefined reference to `libssh2_exit'
libssh2-tunnel-example.c:(.text.startup+0x3c4): undefined reference to `libssh2_userauth_password_ex'
libssh2-tunnel-example.c:(.text.startup+0x416): undefined reference to `libssh2_channel_forward_listen_ex'
libssh2-tunnel-example.c:(.text.startup+0x46f): undefined reference to `libssh2_channel_free'
libssh2-tunnel-example.c:(.text.startup+0x48d): undefined reference to `libssh2_channel_forward_accept'
libssh2-tunnel-example.c:(.text.startup+0x4b7): undefined reference to `libssh2_channel_forward_cancel'
collect2: error: ld returned 1 exit status
Makefile:6: recipe for target 'example' failed
make: *** [example] Error 1

I have ubuntu 18.04.

Info about libssh installed:

ii libssh-4:amd64 0.8.020170825.94fa1e38-1ubuntu0.2 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh-gcrypt-4:amd64 0.8.0
20170825.94fa1e38-1ubuntu0.2 amd64 tiny C SSH library (gcrypt flavor)
ii libssh2-1:amd64 1.8.0-1 amd64 SSH2 client-side library
ii libssh2-1-dev:amd64 1.8.0-1 amd64 SSH2 client-side library (development headers)
ii php-ssh2 1.1.2+0.13-3+ubuntu18.04.1+deb.sury.org+10 amd64 Bindings for the libssh2 library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.