| 236 |
if (size >= c->remote_window) |
if (size >= c->remote_window) |
| 237 |
break; |
break; |
| 238 |
|
|
| 239 |
SSH_channel_send(pvar, c->local_num, -1, buffer_ptr(ch->msg), size); |
if (c->local_num == -1) { // shell or SCP |
| 240 |
|
SSH2_send_channel_data(pvar, c, buffer_ptr(ch->msg), size); |
| 241 |
|
} else { // port-forwarding |
| 242 |
|
SSH_channel_send(pvar, c->local_num, -1, buffer_ptr(ch->msg), size); |
| 243 |
|
} |
| 244 |
|
|
| 245 |
c->bufchain = ch->next; |
c->bufchain = ch->next; |
| 246 |
|
|
| 3414 |
|
|
| 3415 |
strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE); |
strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE); |
| 3416 |
strncpy_s(c->scp.sendfile, sizeof(c->scp.sendfile), sendfile, _TRUNCATE); |
strncpy_s(c->scp.sendfile, sizeof(c->scp.sendfile), sendfile, _TRUNCATE); |
| 3417 |
|
c->scp.sendfp = fp; // file pointer |
| 3418 |
} |
} |
| 3419 |
|
|
| 3420 |
// setup SCP data |
// setup SCP data |
| 3451 |
int SSH_start_scp(PTInstVar pvar, char *sendfile) |
int SSH_start_scp(PTInstVar pvar, char *sendfile) |
| 3452 |
{ |
{ |
| 3453 |
return SSH_scp_transaction(pvar, sendfile, TOLOCAL); |
return SSH_scp_transaction(pvar, sendfile, TOLOCAL); |
| 3454 |
|
//return SSH_scp_transaction(pvar, "remote5.bin", FROMREMOTE); |
| 3455 |
} |
} |
| 3456 |
|
|
| 3457 |
|
|
| 6913 |
|
|
| 6914 |
notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_REQUEST was sent at handle_SSH2_open_confirm().", LOG_LEVEL_VERBOSE); |
notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_REQUEST was sent at handle_SSH2_open_confirm().", LOG_LEVEL_VERBOSE); |
| 6915 |
|
|
| 6916 |
if (wantconfirm == 0) { |
if (c->type == TYPE_SHELL) { |
| 6917 |
handle_SSH2_channel_success(pvar); |
if (wantconfirm == 0) { |
| 6918 |
|
handle_SSH2_channel_success(pvar); |
| 6919 |
|
} |
| 6920 |
|
|
| 6921 |
|
} else if (c->type == TYPE_SCP) { |
| 6922 |
|
// SCPで remote-to-local の場合は、サーバからのファイル送信要求を出す。 |
| 6923 |
|
// この時点では remote window size が"0"なので、すぐには送られないが、遅延送信処理で送られる。 |
| 6924 |
|
// (2007.12.27 yutaka) |
| 6925 |
|
if (c->scp.dir == FROMREMOTE) { |
| 6926 |
|
char ch = '\0'; |
| 6927 |
|
SSH2_send_channel_data(pvar, c, &ch, 1); |
| 6928 |
|
} |
| 6929 |
} |
} |
| 6930 |
|
|
| 6931 |
return TRUE; |
return TRUE; |
| 7135 |
} |
} |
| 7136 |
} |
} |
| 7137 |
|
|
| 7138 |
|
|
| 7139 |
#define WM_SENDING_FILE (WM_USER + 1) |
#define WM_SENDING_FILE (WM_USER + 1) |
| 7140 |
|
|
| 7141 |
typedef struct scp_dlg_parm { |
typedef struct scp_dlg_parm { |
| 7313 |
} |
} |
| 7314 |
} |
} |
| 7315 |
|
|
| 7316 |
|
static void SSH2_scp_fromremote(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen) |
| 7317 |
|
{ |
| 7318 |
|
|
| 7319 |
|
} |
| 7320 |
|
|
| 7321 |
|
|
| 7322 |
static void SSH2_scp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen) |
static void SSH2_scp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen) |
| 7323 |
{ |
{ |
| 7324 |
if (buflen == 1 && data[0] == '\0') { // OK |
if (c->scp.dir == FROMREMOTE) { |
| 7325 |
if (c->scp.dir == TOLOCAL) { |
SSH2_scp_fromremote(pvar, c, data, buflen); |
| 7326 |
|
|
| 7327 |
|
} else if (c->scp.dir == TOLOCAL) { |
| 7328 |
|
if (buflen == 1 && data[0] == '\0') { // OK |
| 7329 |
SSH2_scp_tolocal(pvar, c, data, buflen); |
SSH2_scp_tolocal(pvar, c, data, buflen); |
| 7330 |
} else { |
} else { |
| 7331 |
//SSH2_scp_fromremote(pvar, c, data, buflen); |
goto error; |
| 7332 |
} |
} |
| 7333 |
|
} |
| 7334 |
|
return; |
| 7335 |
|
|
| 7336 |
} else { // error |
error: |
| 7337 |
|
{ // error |
| 7338 |
char msg[2048]; |
char msg[2048]; |
| 7339 |
unsigned int i, max; |
unsigned int i, max; |
| 7340 |
|
|
| 7510 |
// TODO: |
// TODO: |
| 7511 |
return FALSE; |
return FALSE; |
| 7512 |
} |
} |
| 7513 |
if (c->type != TYPE_SHELL) { |
if (c->type == TYPE_PORTFWD) { |
| 7514 |
FWD_channel_input_eof(pvar, c->local_num); |
FWD_channel_input_eof(pvar, c->local_num); |
| 7515 |
} |
} |
| 7516 |
|
|