forked from mkj/dropbear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR mkj#199
- Loading branch information
Showing
7 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ void recv_msg_global_request_remotetcp() { | |
static int svr_cancelremotetcp(void); | ||
static int svr_remotetcpreq(int *allocated_listen_port); | ||
static int newtcpdirect(struct Channel * channel); | ||
static int newstreamlocal(struct Channel * channel); | ||
|
||
#if DROPBEAR_SVR_REMOTETCPFWD | ||
static const struct ChanType svr_chan_tcpremote = { | ||
|
@@ -309,3 +310,57 @@ static int newtcpdirect(struct Channel * channel) { | |
} | ||
|
||
#endif /* DROPBEAR_SVR_LOCALTCPFWD */ | ||
|
||
|
||
#if DROPBEAR_SVR_LOCALSTREAMFWD | ||
|
||
const struct ChanType svr_chan_streamlocal = { | ||
"[email protected]", | ||
newstreamlocal, /* init */ | ||
NULL, /* checkclose */ | ||
NULL, /* reqhandler */ | ||
NULL, /* closehandler */ | ||
NULL /* cleanup */ | ||
}; | ||
|
||
/* Called upon creating a new stream local channel (ie we connect out to an | ||
* address */ | ||
static int newstreamlocal(struct Channel * channel) { | ||
|
||
/* | ||
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL#rev1.30 | ||
byte SSH_MSG_CHANNEL_OPEN | ||
string "[email protected]" | ||
uint32 sender channel | ||
uint32 initial window size | ||
uint32 maximum packet size | ||
string socket path | ||
string reserved | ||
uint32 reserved | ||
*/ | ||
|
||
char* destsocket = NULL; | ||
unsigned int len; | ||
int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; | ||
|
||
TRACE(("streamlocal channel %d", channel->index)) | ||
|
||
destsocket = buf_getstring(ses.payload, &len); | ||
if (len > MAX_HOST_LEN) { | ||
TRACE(("leave streamlocal: destsocket too long")) | ||
goto out; | ||
} | ||
|
||
channel->conn_pending = connect_streamlocal(destsocket, channel_connect_done, | ||
channel, DROPBEAR_PRIO_NORMAL); | ||
|
||
err = SSH_OPEN_IN_PROGRESS; | ||
|
||
out: | ||
m_free(destsocket); | ||
TRACE(("leave streamlocal: err %d", err)) | ||
return err; | ||
} | ||
|
||
#endif /* DROPBEAR_SVR_LOCALSTREAMFWD */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters