mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
Rearrange preprocessor parts so that compilation with various options
disabled works OK. --HG-- extra : convert_revision : cc92f744e34125062d052b757967e167f19d6db5
This commit is contained in:
parent
7dfb2bfcda
commit
e7677a5e8d
@ -122,7 +122,7 @@ void common_recv_msg_channel_data(struct Channel *channel, int fd,
|
||||
const struct ChanType clichansess;
|
||||
#endif
|
||||
|
||||
#ifdef USING_LISTENERS
|
||||
#if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT)
|
||||
int send_msg_channel_open_init(int fd, const struct ChanType *type);
|
||||
void recv_msg_channel_open_confirmation();
|
||||
void recv_msg_channel_open_failure();
|
||||
|
13
cli-tcpfwd.c
13
cli-tcpfwd.c
@ -31,8 +31,7 @@
|
||||
#include "session.h"
|
||||
#include "ssh.h"
|
||||
|
||||
static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
|
||||
unsigned int remoteport);
|
||||
#ifdef ENABLE_CLI_REMOTETCPFWD
|
||||
static int newtcpforwarded(struct Channel * channel);
|
||||
|
||||
const struct ChanType cli_chan_tcpremote = {
|
||||
@ -43,6 +42,11 @@ const struct ChanType cli_chan_tcpremote = {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CLI_LOCALTCPFWD
|
||||
static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
|
||||
unsigned int remoteport);
|
||||
static const struct ChanType cli_chan_tcplocal = {
|
||||
1, /* sepfds */
|
||||
"direct-tcpip",
|
||||
@ -51,7 +55,9 @@ static const struct ChanType cli_chan_tcplocal = {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CLI_LOCALTCPFWD
|
||||
void setup_localtcp() {
|
||||
|
||||
int ret;
|
||||
@ -102,7 +108,9 @@ static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
|
||||
TRACE(("leave cli_localtcp: %d", ret));
|
||||
return ret;
|
||||
}
|
||||
#endif /* ENABLE_CLI_LOCALTCPFWD */
|
||||
|
||||
#ifdef ENABLE_CLI_REMOTETCPFWD
|
||||
static void send_msg_global_request_remotetcp(int port) {
|
||||
|
||||
TRACE(("enter send_msg_global_request_remotetcp"));
|
||||
@ -191,3 +199,4 @@ out:
|
||||
TRACE(("leave newtcpdirect: err %d", err));
|
||||
return err;
|
||||
}
|
||||
#endif /* ENABLE_CLI_REMOTETCPFWD */
|
||||
|
@ -921,7 +921,7 @@ static void send_msg_channel_open_confirmation(struct Channel* channel,
|
||||
TRACE(("leave send_msg_channel_open_confirmation"));
|
||||
}
|
||||
|
||||
#ifdef USING_LISTENERS
|
||||
#if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT)
|
||||
/* Create a new channel, and start the open request. This is intended
|
||||
* for X11, agent, tcp forwarding, and should be filled with channel-specific
|
||||
* options, with the calling function calling encrypt_packet() after
|
||||
@ -1006,6 +1006,7 @@ void recv_msg_channel_open_failure() {
|
||||
|
||||
removechannel(channel);
|
||||
}
|
||||
#endif /* USING_LISTENERS */
|
||||
|
||||
/* close a stdout/stderr fd */
|
||||
static void closeoutfd(struct Channel * channel, int fd) {
|
||||
@ -1057,5 +1058,3 @@ static void closechanfd(struct Channel *channel, int fd, int how) {
|
||||
channel->errfd = FD_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* USING_LISTENERS */
|
||||
|
@ -158,12 +158,11 @@ struct sshsession {
|
||||
|
||||
|
||||
/* TCP forwarding - where manage listeners */
|
||||
#ifdef USING_LISTENERS
|
||||
struct Listener ** listeners;
|
||||
unsigned int listensize;
|
||||
|
||||
/* Whether to allow binding to privileged ports (<1024). This doesn't
|
||||
* really belong here, but nowhere else fits nicely */
|
||||
#endif
|
||||
int allowprivport;
|
||||
|
||||
};
|
||||
|
@ -33,8 +33,12 @@ static int listensockets(int *sock, int sockcount, int *maxfd);
|
||||
static void sigchld_handler(int dummy);
|
||||
static void sigsegv_handler(int);
|
||||
static void sigintterm_handler(int fish);
|
||||
#ifdef INETD_MODE
|
||||
static void main_inetd();
|
||||
#endif
|
||||
#ifdef NON_INETD_MODE
|
||||
static void main_noinetd();
|
||||
#endif
|
||||
static void commonsetup();
|
||||
|
||||
static int childpipes[MAX_UNAUTH_CLIENTS];
|
||||
|
@ -52,19 +52,25 @@ static const packettype svr_packettypes[] = {
|
||||
{SSH_MSG_KEXINIT, recv_msg_kexinit},
|
||||
{SSH_MSG_KEXDH_INIT, recv_msg_kexdh_init}, /* server */
|
||||
{SSH_MSG_NEWKEYS, recv_msg_newkeys},
|
||||
#ifdef ENABLE_SVR_REMOTETCPFWD
|
||||
{SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp},
|
||||
#endif
|
||||
{SSH_MSG_CHANNEL_REQUEST, recv_msg_channel_request},
|
||||
{SSH_MSG_CHANNEL_OPEN, recv_msg_channel_open},
|
||||
{SSH_MSG_CHANNEL_EOF, recv_msg_channel_eof},
|
||||
{SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
|
||||
#ifdef USING_LISTENERS
|
||||
{SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
|
||||
{SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
|
||||
#endif
|
||||
{0, 0} /* End */
|
||||
};
|
||||
|
||||
static const struct ChanType *svr_chantypes[] = {
|
||||
&svrchansess,
|
||||
#ifdef ENABLE_SVR_LOCALTCPFWD
|
||||
&svr_chan_tcpdirect,
|
||||
#endif
|
||||
NULL /* Null termination is mandatory. */
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "listener.h"
|
||||
#include "runopts.h"
|
||||
|
||||
#ifndef DISABLE_SVR_REMOTETCPFWD
|
||||
#ifdef ENABLE_SVR_REMOTETCPFWD
|
||||
|
||||
static void send_msg_request_success();
|
||||
static void send_msg_request_failure();
|
||||
|
Loading…
Reference in New Issue
Block a user