Diff

Differences From Artifact [7ae554165e]:

To Artifact [5112f71eb9]:


159
160
161
162
163
164
165

166
167
168
169
170
171
172
static struct ssh_compress *cscomp = NULL;
static struct ssh_compress *sccomp = NULL;
static struct ssh_kex *kex = NULL;
static struct ssh_hostkey *hostkey = NULL;
int (*ssh_get_password)(const char *prompt, char *str, int maxlen) = NULL;

static char *savedhost;


static enum {
    SSH_STATE_BEFORE_SIZE,
    SSH_STATE_INTERMED,
    SSH_STATE_SESSION,
    SSH_STATE_CLOSED
} ssh_state = SSH_STATE_BEFORE_SIZE;







>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
static struct ssh_compress *cscomp = NULL;
static struct ssh_compress *sccomp = NULL;
static struct ssh_kex *kex = NULL;
static struct ssh_hostkey *hostkey = NULL;
int (*ssh_get_password)(const char *prompt, char *str, int maxlen) = NULL;

static char *savedhost;
static int ssh_send_ok;

static enum {
    SSH_STATE_BEFORE_SIZE,
    SSH_STATE_INTERMED,
    SSH_STATE_SESSION,
    SSH_STATE_CLOSED
} ssh_state = SSH_STATE_BEFORE_SIZE;
986
987
988
989
990
991
992

993
994
995
996
997
998
999
        logevent(vlog);
        logevent("Using SSH protocol version 1");
        s_write(vstring, strlen(vstring));
        ssh_protocol = ssh1_protocol;
        ssh_version = 1;
        s_rdpkt = ssh1_rdpkt;
    }

    return 1;
}

/*
 * Handle the key exchange and user authentication phases.
 */
static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)







>







987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
        logevent(vlog);
        logevent("Using SSH protocol version 1");
        s_write(vstring, strlen(vstring));
        ssh_protocol = ssh1_protocol;
        ssh_version = 1;
        s_rdpkt = ssh1_rdpkt;
    }
    ssh_send_ok = 0;
    return 1;
}

/*
 * Handle the key exchange and user authentication phases.
 */
static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
1407
1408
1409
1410
1411
1412
1413

1414
1415
1416
1417
1418
1419
1420
        send_packet(SSH1_CMSG_EXEC_SHELL, PKT_END);
    logevent("Started session");

    ssh_state = SSH_STATE_SESSION;
    if (size_needed)
	ssh_size();


    while (1) {
	crReturnV;
	if (ispkt) {
	    if (pktin.type == SSH1_SMSG_STDOUT_DATA ||
                pktin.type == SSH1_SMSG_STDERR_DATA) {
		long len = GET_32BIT(pktin.body);
		c_write(pktin.body+4, len);







>







1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
        send_packet(SSH1_CMSG_EXEC_SHELL, PKT_END);
    logevent("Started session");

    ssh_state = SSH_STATE_SESSION;
    if (size_needed)
	ssh_size();

    ssh_send_ok = 1;
    while (1) {
	crReturnV;
	if (ispkt) {
	    if (pktin.type == SSH1_SMSG_STDOUT_DATA ||
                pktin.type == SSH1_SMSG_STDERR_DATA) {
		long len = GET_32BIT(pktin.body);
		c_write(pktin.body+4, len);
1972
1973
1974
1975
1976
1977
1978

1979
1980
1981
1982
1983
1984
1985
    } else {
        logevent("Started a shell");
    }

    /*
     * Transfer data!
     */

    while (1) {
	crReturnV;
	if (ispkt) {
	    if (pktin.type == SSH2_MSG_CHANNEL_DATA ||
                pktin.type == SSH2_MSG_CHANNEL_EXTENDED_DATA) {
                char *data;
                int length;







>







1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
    } else {
        logevent("Started a shell");
    }

    /*
     * Transfer data!
     */
    ssh_send_ok = 1;
    while (1) {
	crReturnV;
	if (ispkt) {
	    if (pktin.type == SSH2_MSG_CHANNEL_DATA ||
                pktin.type == SSH2_MSG_CHANNEL_EXTENDED_DATA) {
                char *data;
                int length;
2308
2309
2310
2311
2312
2313
2314
2315


2316
2317
2318
2319
2320
2321
2322
2323

2324
    sprintf(buf, "Sending command: %.100s", cmd);
    logevent(buf);
    send_packet(SSH1_CMSG_EXEC_CMD, PKT_STR, cmd, PKT_END);

    return NULL;
}

SOCKET ssh_socket(void) { return s; }



Backend ssh_backend = {
    ssh_init,
    ssh_msg,
    ssh_send,
    ssh_size,
    ssh_special,
    ssh_socket

};







|
>
>







|
>

2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
    sprintf(buf, "Sending command: %.100s", cmd);
    logevent(buf);
    send_packet(SSH1_CMSG_EXEC_CMD, PKT_STR, cmd, PKT_END);

    return NULL;
}

static SOCKET ssh_socket(void) { return s; }

static int ssh_sendok(void) { return ssh_send_ok; }

Backend ssh_backend = {
    ssh_init,
    ssh_msg,
    ssh_send,
    ssh_size,
    ssh_special,
    ssh_socket,
    ssh_sendok
};