| 78 |
#define CHANNEL_MAX 100 |
#define CHANNEL_MAX 100 |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
static struct global_confirm global_confirms; |
| 82 |
|
|
| 83 |
static Channel_t channels[CHANNEL_MAX]; |
static Channel_t channels[CHANNEL_MAX]; |
| 84 |
|
|
| 85 |
static char ssh_ttymodes[] = "\x01\x03\x02\x1c\x03\x08\x04\x15\x05\x04"; |
static char ssh_ttymodes[] = "\x01\x03\x02\x1c\x03\x08\x04\x15\x05\x04"; |
| 124 |
static BOOL SSH_agent_response(PTInstVar pvar, Channel_t *c, int local_channel_num, unsigned char *data, unsigned int buflen); |
static BOOL SSH_agent_response(PTInstVar pvar, Channel_t *c, int local_channel_num, unsigned char *data, unsigned int buflen); |
| 125 |
|
|
| 126 |
// |
// |
| 127 |
|
// Global request confirm |
| 128 |
|
// |
| 129 |
|
static void client_init_global_confirm(void) |
| 130 |
|
{ |
| 131 |
|
memset(&global_confirms, 0, sizeof(global_confirms)); |
| 132 |
|
global_confirms.ref_count = 0; |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
void client_register_global_confirm(global_confirm_cb *cb, void *ctx) |
| 136 |
|
{ |
| 137 |
|
struct global_confirm *gc = &global_confirms; |
| 138 |
|
|
| 139 |
|
if (gc->ref_count == 0) { |
| 140 |
|
gc->cb = cb; |
| 141 |
|
gc->ctx = ctx; |
| 142 |
|
gc->ref_count = 1; |
| 143 |
|
} |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
static int client_global_request_reply(PTInstVar pvar, int type, unsigned int seq, void *ctxt) |
| 147 |
|
{ |
| 148 |
|
struct global_confirm *gc = &global_confirms; |
| 149 |
|
|
| 150 |
|
if (gc->ref_count >= 1) { |
| 151 |
|
if (gc->cb) |
| 152 |
|
gc->cb(pvar, type, seq, gc->ctx); |
| 153 |
|
gc->ref_count = 0; |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
return 0; |
| 157 |
|
} |
| 158 |
|
|
| 159 |
|
// |
| 160 |
// channel function |
// channel function |
| 161 |
// |
// |
| 162 |
static Channel_t *ssh2_channel_new(unsigned int window, unsigned int maxpack, |
static Channel_t *ssh2_channel_new(unsigned int window, unsigned int maxpack, |
| 1709 |
enque_handler(pvar, SSH2_MSG_REQUEST_FAILURE, handle_SSH2_request_failure); |
enque_handler(pvar, SSH2_MSG_REQUEST_FAILURE, handle_SSH2_request_failure); |
| 1710 |
enque_handler(pvar, SSH2_MSG_REQUEST_SUCCESS, handle_SSH2_request_success); |
enque_handler(pvar, SSH2_MSG_REQUEST_SUCCESS, handle_SSH2_request_success); |
| 1711 |
|
|
| 1712 |
|
client_init_global_confirm(); |
| 1713 |
|
|
| 1714 |
} |
} |
| 1715 |
} |
} |
| 1716 |
|
|
| 7532 |
// 必要であればログを取る。特に何もしなくてもよい。 |
// 必要であればログを取る。特に何もしなくてもよい。 |
| 7533 |
notify_verbose_message(pvar, "SSH2_MSG_REQUEST_SUCCESS was received.", LOG_LEVEL_VERBOSE); |
notify_verbose_message(pvar, "SSH2_MSG_REQUEST_SUCCESS was received.", LOG_LEVEL_VERBOSE); |
| 7534 |
|
|
| 7535 |
|
client_global_request_reply(pvar, SSH2_MSG_REQUEST_SUCCESS, 0, NULL); |
| 7536 |
|
|
| 7537 |
return TRUE; |
return TRUE; |
| 7538 |
} |
} |
| 7539 |
|
|
| 7543 |
// 必要であればログを取る。特に何もしなくてもよい。 |
// 必要であればログを取る。特に何もしなくてもよい。 |
| 7544 |
notify_verbose_message(pvar, "SSH2_MSG_REQUEST_FAILURE was received.", LOG_LEVEL_VERBOSE); |
notify_verbose_message(pvar, "SSH2_MSG_REQUEST_FAILURE was received.", LOG_LEVEL_VERBOSE); |
| 7545 |
|
|
| 7546 |
|
client_global_request_reply(pvar, SSH2_MSG_REQUEST_FAILURE, 0, NULL); |
| 7547 |
|
|
| 7548 |
return TRUE; |
return TRUE; |
| 7549 |
} |
} |
| 7550 |
|
|