Skip to content

session.forward_listen_ex bound_port access #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
caryfitzhugh opened this issue Feb 21, 2019 · 4 comments
Closed

session.forward_listen_ex bound_port access #63

caryfitzhugh opened this issue Feb 21, 2019 · 4 comments

Comments

@caryfitzhugh
Copy link

When calling forward_listen_ex the third parameter is "bound_port" which is passed by reference in the pyx file to libssh2

With python not having pointers to int values, how would one get access to that resulting port value?

I have tried

session.forward_listen_ex('localhost', 0 , bound_port, 10)

And the forward is created, but bound_port is not updated.

I could add a PR for a forward_listen_ex2 which returns the tuple of the port and Listener? Or is there a way to do this?

@pkittenis
Copy link
Member

Hi there,

Thanks for the interest and report. Yes, it looks like that function should return port as well in a tuple and not take bound_port as argument.

PR is welcome. Can change the existing function, don't make a new one please. Changing the API while in 0.x.y version is ok.

@caryfitzhugh
Copy link
Author

Hello @pkittenis - that sounds fine.

The modifications to the .pyx file went smoothly, but building things again - what are the instructions?
I am using cython 0.29.5 as well.

I am trying the following to test locally, but seems I am missing something.

rm -rf ./ssh2/*.c
export EMBEDDED_LIB=1; export HAVE_AGENT_FWD=1; python2 setup.py build
rm -rf ./src
pip install .

@pkittenis
Copy link
Member

There are instructions on the contribution guide. Broadly:

pip install -r requirements_dev.txt
python setup.py build_ext -i

Best not to change env variables from their defaults unless sure what that means - particularly HAVE_AGENT_FWD.

build needs a separate install for the code to apply. The above installs modules in-place. Modified pyx files cause automatic C file re-generation, no manual steps needed. There are cases where the rest of the C code needs re-generating though, like when definitions in the pxd files are changed.

caryfitzhugh added a commit to greenfrylabs/ssh2-python that referenced this issue Feb 27, 2019
Returns bound_port for forward_listen_ex
@caryfitzhugh
Copy link
Author

Here's my first attempt at making this work. @pkittenis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants