diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-05-03 18:27:45 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-05-03 18:27:45 +0000 |
commit | b23c68264db4b6d0c436587c332bcaecf79ef29d (patch) | |
tree | 78d76e9bbe087531b64186add591853c08fa405f | |
parent | 095775ef1be7ebd4d76045b4c7481148f7fe05e6 (diff) | |
download | libssh-b23c68264db4b6d0c436587c332bcaecf79ef29d.tar.gz libssh-b23c68264db4b6d0c436587c332bcaecf79ef29d.tar.xz libssh-b23c68264db4b6d0c436587c332bcaecf79ef29d.zip |
Improve channel_open_forward().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@685 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r-- | libssh/channels.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/libssh/channels.c b/libssh/channels.c index c61aa4aa..e2a52348 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -647,15 +647,23 @@ int channel_open_session(CHANNEL *channel) { return channel_open(channel,"session",64000,32000,NULL); } -/** \brief open a TCP/IP forwarding channel. - * \param channel an allocated channel (see channel_new()) - * \param remotehost remote host to be connected (host name or IP) - * \param remoteport remote port - * \param sourcehost source host (your local computer). It's facultative and for logging purpose - * \param localport source port (your local computer). It's facultative and for logging purpose - * \return SSH_ERROR on error\n - * SSH_OK on success - * \warning API changed from 0.11 +/** + * @brief Open a TCP/IP forwarding channel. + * + * @param channel An allocated channel. + * + * @param remotehost The remote host to connected (host name or IP). + * + * @param remoteport The remote port. + * + * @param sourcehost The source host (your local computer). It's facultative + * and for logging purpose. + * + * @param localport The source port (your local computer). It's facultative + * and for logging purpose. + * + * @return SSH_OK on success\n + * SSH_ERROR on error */ int channel_open_forward(CHANNEL *channel, const char *remotehost, int remoteport, const char *sourcehost, int localport) { @@ -675,10 +683,8 @@ int channel_open_forward(CHANNEL *channel, const char *remotehost, goto error; } - if (buffer_add_ssh_string(payload,str) < 0) { - goto error; - } - if (buffer_add_u32(payload,htonl(remoteport)) < 0) { + if (buffer_add_ssh_string(payload, str) < 0 || + buffer_add_u32(payload,htonl(remoteport)) < 0) { goto error; } @@ -688,10 +694,8 @@ int channel_open_forward(CHANNEL *channel, const char *remotehost, goto error; } - if (buffer_add_ssh_string(payload, str) < 0) { - goto error; - } - if (buffer_add_u32(payload,htonl(localport)) < 0) { + if (buffer_add_ssh_string(payload, str) < 0 || + buffer_add_u32(payload,htonl(localport)) < 0) { goto error; } |