mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
we're nearly there yet
--HG-- extra : convert_revision : ab7e63234f2c134c2321406598ae67038e0ca576
This commit is contained in:
parent
bf785cbcec
commit
b601f68cda
@ -27,7 +27,7 @@ SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
|
|||||||
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o
|
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o
|
||||||
|
|
||||||
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
||||||
cli-session.o cli-service.o cli-runopts.o
|
cli-session.o cli-service.o cli-runopts.o cli-chansession.o
|
||||||
|
|
||||||
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
|
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
|
||||||
common-channel.o common-chansession.o termcodes.o loginrec.o \
|
common-channel.o common-chansession.o termcodes.o loginrec.o \
|
||||||
|
@ -96,6 +96,7 @@ void recv_msg_userauth_failure() {
|
|||||||
void recv_msg_userauth_success() {
|
void recv_msg_userauth_success() {
|
||||||
TRACE(("received msg_userauth_success"));
|
TRACE(("received msg_userauth_success"));
|
||||||
ses.authstate.authdone = 1;
|
ses.authstate.authdone = 1;
|
||||||
|
cli_ses.state = USERAUTH_SUCCESS_RCVD;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cli_auth_try() {
|
void cli_auth_try() {
|
||||||
|
@ -37,7 +37,6 @@ static const packettype cli_packettypes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct ChanType *cli_chantypes[] = {
|
static const struct ChanType *cli_chantypes[] = {
|
||||||
// &clichansess,
|
|
||||||
/* &chan_tcpdirect etc, though need to only allow if we've requested
|
/* &chan_tcpdirect etc, though need to only allow if we've requested
|
||||||
* that forwarding */
|
* that forwarding */
|
||||||
NULL /* Null termination */
|
NULL /* Null termination */
|
||||||
@ -148,6 +147,20 @@ static void cli_sessionloop() {
|
|||||||
TRACE(("leave cli_sessionloop: cli_auth_try"));
|
TRACE(("leave cli_sessionloop: cli_auth_try"));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
case USERAUTH_SUCCESS_RCVD:
|
||||||
|
send_msg_service_request(SSH_SERVICE_CONNECTION);
|
||||||
|
cli_ses.state = SERVICE_CONN_REQ_SENT;
|
||||||
|
TRACE(("leave cli_sessionloop: sent ssh-connection service req"));
|
||||||
|
return;
|
||||||
|
*/
|
||||||
|
|
||||||
|
case USERAUTH_SUCCESS_RCVD:
|
||||||
|
cli_send_chansess_request();
|
||||||
|
TRACE(("leave cli_sessionloop: cli_send_chansess_request"));
|
||||||
|
cli_ses.state = SESSION_RUNNING;
|
||||||
|
return;
|
||||||
|
|
||||||
/* XXX more here needed */
|
/* XXX more here needed */
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ void chaninitialise(const struct ChanType *chantypes[]) {
|
|||||||
ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*));
|
ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*));
|
||||||
ses.chansize = 1;
|
ses.chansize = 1;
|
||||||
ses.channels[0] = NULL;
|
ses.channels[0] = NULL;
|
||||||
|
ses.chancount = 0;
|
||||||
|
|
||||||
ses.chantypes = chantypes;
|
ses.chantypes = chantypes;
|
||||||
|
|
||||||
@ -153,6 +154,7 @@ struct Channel* newchannel(unsigned int remotechan,
|
|||||||
newchan->recvmaxpacket = RECV_MAXPACKET;
|
newchan->recvmaxpacket = RECV_MAXPACKET;
|
||||||
|
|
||||||
ses.channels[i] = newchan;
|
ses.channels[i] = newchan;
|
||||||
|
ses.chancount++;
|
||||||
|
|
||||||
TRACE(("leave newchannel"));
|
TRACE(("leave newchannel"));
|
||||||
|
|
||||||
@ -515,6 +517,7 @@ static void deletechannel(struct Channel *channel) {
|
|||||||
|
|
||||||
ses.channels[channel->index] = NULL;
|
ses.channels[channel->index] = NULL;
|
||||||
m_free(channel);
|
m_free(channel);
|
||||||
|
ses.chancount--;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,6 +937,7 @@ void recv_msg_channel_open_confirmation() {
|
|||||||
|
|
||||||
unsigned int chan;
|
unsigned int chan;
|
||||||
struct Channel * channel;
|
struct Channel * channel;
|
||||||
|
int ret;
|
||||||
|
|
||||||
TRACE(("enter recv_msg_channel_open_confirmation"));
|
TRACE(("enter recv_msg_channel_open_confirmation"));
|
||||||
chan = buf_getint(ses.payload);
|
chan = buf_getint(ses.payload);
|
||||||
@ -949,6 +953,15 @@ void recv_msg_channel_open_confirmation() {
|
|||||||
|
|
||||||
TRACE(("new chan remote %d localho %d", channel->remotechan, chan));
|
TRACE(("new chan remote %d localho %d", channel->remotechan, chan));
|
||||||
|
|
||||||
|
/* Run the inithandler callback */
|
||||||
|
if (channel->type->inithandler) {
|
||||||
|
ret = channel->type->inithandler(channel);
|
||||||
|
if (ret > 0) {
|
||||||
|
removechannel(channel);
|
||||||
|
TRACE(("inithandler returned failure %d", ret));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TRACE(("leave recv_msg_channel_open_confirmation"));
|
TRACE(("leave recv_msg_channel_open_confirmation"));
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,9 @@ typedef struct cli_runopts {
|
|||||||
char *remoteport;
|
char *remoteport;
|
||||||
|
|
||||||
char *username;
|
char *username;
|
||||||
|
|
||||||
|
char *cmd;
|
||||||
|
int wantpty;
|
||||||
/* XXX TODO */
|
/* XXX TODO */
|
||||||
|
|
||||||
} cli_runopts;
|
} cli_runopts;
|
||||||
|
@ -152,6 +152,7 @@ struct sshsession {
|
|||||||
/* Channel related */
|
/* Channel related */
|
||||||
struct Channel ** channels; /* these pointers may be null */
|
struct Channel ** channels; /* these pointers may be null */
|
||||||
unsigned int chansize; /* the number of Channel*s allocated for channels */
|
unsigned int chansize; /* the number of Channel*s allocated for channels */
|
||||||
|
unsigned int chancount; /* the number of Channel*s in use */
|
||||||
const struct ChanType **chantypes; /* The valid channel types */
|
const struct ChanType **chantypes; /* The valid channel types */
|
||||||
|
|
||||||
|
|
||||||
@ -194,6 +195,8 @@ typedef enum {
|
|||||||
USERAUTH_METHODS_SENT,
|
USERAUTH_METHODS_SENT,
|
||||||
USERAUTH_REQ_SENT,
|
USERAUTH_REQ_SENT,
|
||||||
USERAUTH_FAIL_RCVD,
|
USERAUTH_FAIL_RCVD,
|
||||||
|
USERAUTH_SUCCESS_RCVD,
|
||||||
|
SESSION_RUNNING,
|
||||||
|
|
||||||
} cli_state;
|
} cli_state;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user