Revision: 7649 https://osdn.net/projects/ttssh2/scm/svn/commits/7649 Author: zmatsuo Date: 2019-05-06 22:42:01 +0900 (Mon, 06 May 2019) Log Message: ----------- __FUNCTION__ が文字列マクロではない場合でも正しくビルドできるよう修正 Modified Paths: -------------- trunk/ttssh2/ttxssh/buffer.c trunk/ttssh2/ttxssh/fwd-socks.c trunk/ttssh2/ttxssh/fwd.c trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/buffer.c =================================================================== --- trunk/ttssh2/ttxssh/buffer.c 2019-05-06 13:41:50 UTC (rev 7648) +++ trunk/ttssh2/ttxssh/buffer.c 2019-05-06 13:42:01 UTC (rev 7649) @@ -38,10 +38,6 @@ #include <openssl/ec.h> #include <zlib.h> -#if defined(__MINGW32__) -#define __FUNCTION__ -#endif - // \x83o\x83b\x83t\x83@\x82̃I\x83t\x83Z\x83b\x83g\x82\xF0\x8F\x89\x8A\x{227B0B5}\x81A\x82܂\xBE\x93ǂ\xF1\x82ł\xA2\x82Ȃ\xA2\x8F\xF3\x91Ԃɂ\xB7\x82\xE9\x81B // Tera Term(TTSSH)\x83I\x83\x8A\x83W\x83i\x83\x8B\x8A\x94\x81B void buffer_rewind(buffer_t *buf) @@ -251,7 +247,7 @@ ptr = malloc(buflen + 1); if (ptr == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": malloc failed."); + logprintf(LOG_LEVEL_ERROR, "%s: malloc failed.", __FUNCTION__); if (buflen_ptr != NULL) *buflen_ptr = 0; return NULL; Modified: trunk/ttssh2/ttxssh/fwd-socks.c =================================================================== --- trunk/ttssh2/ttxssh/fwd-socks.c 2019-05-06 13:41:50 UTC (rev 7648) +++ trunk/ttssh2/ttxssh/fwd-socks.c 2019-05-06 13:42:01 UTC (rev 7649) @@ -65,10 +65,6 @@ #define SOCKS5_ERROR_COMMAND 129 #define SOCKS5_ERROR_ADDRTYPE 130 -#if defined(__MINGW32__) -#define __FUNCTION__ -#endif - typedef struct { PTInstVar pvar; @@ -88,7 +84,7 @@ FWDDynamicFilterClosure *closure = malloc(sizeof(FWDDynamicFilterClosure)); if (closure == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": Can't allocate memory for closure."); + logprintf(LOG_LEVEL_ERROR, "%s: Can't allocate memory for closure.", __FUNCTION__); return NULL; } @@ -125,7 +121,7 @@ PTInstVar pvar = closure->pvar; FWDChannel *c = pvar->fwd_state.channels + closure->channel_num; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending %d bytes.", len); + logprintf(LOG_LEVEL_VERBOSE, "%s: sending %d bytes.", __FUNCTION__, len); return UTIL_sock_buffered_write(pvar, &c->writebuf, dummy_blocking_write, c->local_socket, data, len); } @@ -420,9 +416,9 @@ if (newlen > SOCKS_REQUEST_MAXLEN || *len < 0) { // \x83\x8A\x83N\x83G\x83X\x83g\x82\xAA\x91傫\x82\xB7\x82\xAC\x82\xE9\x8Fꍇ\x82͐ؒf\x82\xB7\x82\xE9 - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ - ": request too large: state=%d, buflen=%d, reqlen=%d", - closure->status, closure->buflen, *len); + logprintf(LOG_LEVEL_ERROR, + "%s: request too large: state=%d, buflen=%d, reqlen=%d", + __FUNCTION__, closure->status, closure->buflen, *len); return FWD_FILTER_CLOSECHANNEL; } @@ -446,7 +442,7 @@ } else { // Invalid request - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": Invalid request. protocol-version=%d", buf[0]); + logprintf(LOG_LEVEL_ERROR, "%s: Invalid request. protocol-version=%d", __FUNCTION__, buf[0]); result = -1; } break; @@ -456,7 +452,7 @@ } else { // Invalid request - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": Invalid request. protocol-version=%d", buf[0]); + logprintf(LOG_LEVEL_ERROR, "%s: Invalid request. protocol-version=%d", __FUNCTION__, buf[0]); result = -1; } break; @@ -482,7 +478,7 @@ FWDDynamicFilterClosure *closure = (FWDDynamicFilterClosure *)void_closure; if (closure == NULL) { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": closure does not available. event=%d", event); + logprintf(LOG_LEVEL_VERBOSE, "%s: closure does not available. event=%d", __FUNCTION__, event); return FWD_FILTER_REMOVE; } @@ -489,7 +485,7 @@ switch (event) { case FWD_FILTER_CLEANUP: // FWD_FILTER_REMOVE \x82\xF0\x95Ԃ\xB7\x82ƁA\x83\x8A\x83\\x81[\x83X\x8AJ\x95\xFA\x82ׂ̈ɂ\xB1\x82\xEA\x82ōēx\x8CĂ\xEA\x82\xE9 - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": closure cleanup. channel=%d", closure->channel_num); + logprintf(LOG_LEVEL_VERBOSE, "%s: closure cleanup. channel=%d", __FUNCTION__, closure->channel_num); free(closure->peer_name); free(closure); return FWD_FILTER_REMOVE; @@ -496,7 +492,7 @@ case FWD_FILTER_OPENCONFIRM: // SSH_open_channel() \x82\xAA\x90\xAC\x8C\xF7 - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": OpenConfirmation received"); + logprintf(LOG_LEVEL_VERBOSE, "%s: OpenConfirmation received", __FUNCTION__ ); if (closure->socks_ver == 4) { send_socks4_reply(closure, SOCKS4_RESULT_OK); } @@ -504,13 +500,13 @@ send_socks5_open_success(closure); } else { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": protocol version missmatch. version=%d", closure->socks_ver); + logprintf(LOG_LEVEL_VERBOSE, "%s: protocol version missmatch. version=%d", __FUNCTION__, closure->socks_ver); } return FWD_FILTER_REMOVE; case FWD_FILTER_OPENFAILURE: // SSH_open_channel() \x82\xAA\x8E\xB8\x94s - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": Open Failure. reason=%d", *len); + logprintf(LOG_LEVEL_VERBOSE, "%s: Open Failure. reason=%d", __FUNCTION__, *len); if (closure->socks_ver == 4) { send_socks4_reply(closure, SOCKS4_RESULT_NG); } @@ -518,7 +514,7 @@ send_socks5_open_failure(closure, *len); } else { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": protocol version missmatch. version=%d", closure->socks_ver); + logprintf(LOG_LEVEL_VERBOSE, "%s: protocol version missmatch. version=%d", __FUNCTION__, closure->socks_ver); } return FWD_FILTER_CLOSECHANNEL; @@ -525,12 +521,12 @@ case FWD_FILTER_FROM_SERVER: // \x82\xB1\x82̃t\x83B\x83\x8B\x83^\x82\xAA\x97L\x8C\xF8\x82Ȏ\x9E\x93_\x82ł̓T\x81[\x83o\x82ւ̃`\x83\x83\x83l\x83\x8B\x82͊J\x82\xA2\x82Ă\xA2\x82Ȃ\xA2\x82̂\xC5 // \x82\xB1\x82\xB1\x82ɂ͂\xB1\x82Ȃ\xA2\x82͂\xB8 - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": data received from server. (bug?)"); + logprintf(LOG_LEVEL_VERBOSE, "%s: data received from server. (bug?)", __FUNCTION__); return FWD_FILTER_RETAIN; case FWD_FILTER_FROM_CLIENT: // \x83N\x83\x89\x83C\x83A\x83\x93\x83g\x82\xA9\x82\xE7\x82̗v\x8B\x81\x82\xF0\x8F\x88\x97\x9D\x82\xB7\x82\xE9 - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": data received from client. size=%d", *len); + logprintf(LOG_LEVEL_VERBOSE, "%s: data received from client. size=%d", __FUNCTION__, *len); return parse_client_request(closure, len, buf); } Modified: trunk/ttssh2/ttxssh/fwd.c =================================================================== --- trunk/ttssh2/ttxssh/fwd.c 2019-05-06 13:41:50 UTC (rev 7648) +++ trunk/ttssh2/ttxssh/fwd.c 2019-05-06 13:42:01 UTC (rev 7649) @@ -47,10 +47,6 @@ #define CHANNEL_READ_BUF_SIZE 8192 -#if defined(__MINGW32__) -#define __FUNCTION__ -#endif - static LRESULT CALLBACK accept_wnd_proc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -634,8 +630,8 @@ channel->local_socket = s; if (request->spec.type == FWD_LOCAL_TO_REMOTE) { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ - ": Host %s(%d) connecting to port %d; forwarding to %s:%d; type=LtoR", + logprintf(LOG_LEVEL_VERBOSE, + "%s: Host %s(%d) connecting to port %d; forwarding to %s:%d; type=LtoR", __FUNCTION__, hname, port, request->spec.from_port, request->spec.to_host, request->spec.to_port); channel->filter_closure = NULL; @@ -644,9 +640,9 @@ request->spec.to_port, hname, port); } else { // FWD_LOCAL_DYNAMIC - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ - ": Host %s(%d) connecting to port %d; type=dynamic", - hname, port, request->spec.from_port); + logprintf(LOG_LEVEL_VERBOSE, + "%s: Host %s(%d) connecting to port %d; type=dynamic", + __FUNCTION__, hname, port, request->spec.from_port); // SOCKS \x82̃\x8A\x83N\x83G\x83X\x83g\x82\xF0\x8F\x88\x97\x9D\x82\xB7\x82\xE9\x88ׂ\xCC filter \x82\xF0\x93o\x98^ channel->filter_closure = SOCKS_init_filter(pvar, channel_num, hname, port); @@ -656,7 +652,7 @@ channel->status |= FWD_BOTH_CONNECTED; } - logprintf(150, __FUNCTION__ ": channel info: %s", dump_fwdchannel(channel)); + logprintf(150, "%s: channel info: %s", __FUNCTION__, dump_fwdchannel(channel)); } static void write_local_connection_buffer(PTInstVar pvar, int channel_num) @@ -675,7 +671,7 @@ { FWDChannel *channel = pvar->fwd_state.channels + channel_num; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": channel=%d", channel_num); + logprintf(LOG_LEVEL_VERBOSE, "%s: channel=%d", __FUNCTION__, channel_num); if ((channel->status & FWD_BOTH_CONNECTED) != FWD_BOTH_CONNECTED) { return; @@ -1214,20 +1210,20 @@ // \x91\xBC\x82̂\xE0\x8A܂߂\xC4 LOG_LEVEL \x82\x9D\x82\xB5\x82\xBD\x82\xA2\x81c\x81c // if (LogLevel(pvar, 150)) { - logprintf(150, __FUNCTION__ ": old specs: %d", pvar->fwd_state.num_requests); + logprintf(150, "%s: old specs: %d", __FUNCTION__, pvar->fwd_state.num_requests); for (i=0; i < pvar->fwd_state.num_requests; i++) { - logprintf(150, __FUNCTION__ ": #%d: %s", i, + logprintf(150, "%s: #%d: %s", __FUNCTION__, i, dump_fwdspec(&pvar->fwd_state.requests[i].spec, pvar->fwd_state.requests[i].status)); } - logprintf(150, __FUNCTION__ ": new specs: %d", num_specs); + logprintf(150, "%s: new specs: %d", __FUNCTION__, num_specs); for (i=0; i < num_specs; i++) { - logprintf(150, __FUNCTION__ ": #%d: %s", i, dump_fwdspec(new_specs+i, 0)); + logprintf(150, "%s: #%d: %s", __FUNCTION__, i, dump_fwdspec(new_specs+i, 0)); } - logprintf(150, __FUNCTION__ ": listening specs: %d", num_cur_listening); + logprintf(150, "%s: listening specs: %d", __FUNCTION__, num_cur_listening); for (i=0; i < num_cur_listening; i++) { - logprintf(150, __FUNCTION__ ": #%d: %s", i, + logprintf(150, "%s: #%d: %s", __FUNCTION__, i, dump_fwdspec(&server_listening_specs[i], 0)); } } @@ -1369,14 +1365,14 @@ } if (LogLevel(pvar, 150)) { - logprintf(150, __FUNCTION__ ": updated specs: %d", pvar->fwd_state.num_requests); + logprintf(150, "%s: updated specs: %d", __FUNCTION__, pvar->fwd_state.num_requests); for (i=0; i < pvar->fwd_state.num_requests; i++) { - logprintf(150, __FUNCTION__ ": #%d: %s", i, + logprintf(150, "%s: #%d: %s", __FUNCTION__, i, dump_fwdspec(&pvar->fwd_state.requests[i].spec, pvar->fwd_state.requests[i].status)); } - logprintf(150, __FUNCTION__ ": new listening specs: %d", pvar->fwd_state.num_server_listening_specs); + logprintf(150, "%s: new listening specs: %d", __FUNCTION__, pvar->fwd_state.num_server_listening_specs); for (i=0; i < pvar->fwd_state.num_server_listening_specs; i++) { - logprintf(150, __FUNCTION__ ": #%d: %s", i, + logprintf(150, "%s: #%d: %s", __FUNCTION__, i, dump_fwdspec(&pvar->fwd_state.server_listening_specs[i], 0)); } } Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2019-05-06 13:41:50 UTC (rev 7648) +++ trunk/ttssh2/ttxssh/ssh.c 2019-05-06 13:42:01 UTC (rev 7649) @@ -84,10 +84,6 @@ // #define NonNull(msg) ((msg)?(msg):"(null)") -#if defined(__MINGW32__) -#define __FUNCTION__ -#endif - typedef enum { GetPayloadError = 0, GetPayloadOK = 1, @@ -360,12 +356,12 @@ Channel_t *c; if (id < 0 || id >= CHANNEL_MAX) { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": invalid channel id. (%d)", id); + logprintf(LOG_LEVEL_VERBOSE, "%s: invalid channel id. (%d)", __FUNCTION__, id); return (NULL); } c = &channels[id]; if (c->used == 0) { // already freed - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": channel was already freed. id:%d", id); + logprintf(LOG_LEVEL_VERBOSE, "%s: channel was already freed. id:%d", __FUNCTION__, id); return (NULL); } return (c); @@ -1180,7 +1176,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } @@ -1260,9 +1256,10 @@ data_length = encryption_size + aadlen + maclen; - logprintf(150, __FUNCTION__ - ": built packet info: aadlen:%d, enclen:%d, padlen:%d, datalen:%d, maclen:%d, mode:%s", - aadlen, encryption_size, padding, data_length, maclen, aadlen ? "EtM" : "E&M"); + logprintf(150, + "%s: built packet info: aadlen:%d, enclen:%d, padlen:%d, datalen:%d, maclen:%d, mode:%s", + __FUNCTION__, + aadlen, encryption_size, padding, data_length, maclen, aadlen ? "EtM" : "E&M"); } send_packet_blocking(pvar, data, data_length); @@ -2209,7 +2206,7 @@ if (handle_message_count >= HANDLE_MESSAGE_MAX) { // TODO: error check - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": too many handlers. handlers:%d, max:%d", + logprintf(LOG_LEVEL_ERROR, "%s: too many handlers. handlers:%d, max:%d", __FUNCTION__, handle_message_count, HANDLE_MESSAGE_MAX); return; } @@ -2281,7 +2278,7 @@ set_uint32(outmsg, pvar->ssh_state.receiver_sequence_number - 1); finish_send_packet(pvar); - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_UNIMPLEMENTED was sent."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_UNIMPLEMENTED was sent.", __FUNCTION__); /* XXX need to decompress incoming packet, but how? */ } else { if (!handler(pvar)) { @@ -2888,7 +2885,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, SSH2_DISCONNECT_BY_APPLICATION); @@ -2949,8 +2946,8 @@ set_uint32(outmsg + 8, x); // window width (pixels) set_uint32(outmsg + 12, y); // window height (pixels) finish_send_packet(pvar); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH_CMSG_WINDOW_SIZE. " - "cols: %d, rows: %d, x: %d, y: %d", cols, rows, x, y); + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH_CMSG_WINDOW_SIZE. " + "cols: %d, rows: %d, x: %d, y: %d", __FUNCTION__, cols, rows, x, y); } } else if (SSHv2(pvar)) { @@ -2964,7 +2961,7 @@ c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); return; } @@ -2972,7 +2969,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); @@ -2988,8 +2985,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_REQUEST. " - "local: %d, remote: %d, request-type: %s, cols: %d, rows: %d, x: %d, y: %d", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_CHANNEL_REQUEST. " + "local: %d, remote: %d, request-type: %s, cols: %d, rows: %d, x: %d, y: %d", __FUNCTION__, c->self_id, c->remote_id, req_type, cols, rows, x, y); } else { @@ -3013,13 +3010,13 @@ c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); goto error; } msg = buffer_init(); if (msg == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); goto error; } buffer_put_int(msg, c->remote_id); @@ -3032,8 +3029,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_REQUEST. " - "local: %d, remote: %d, request-type: %s, break-length: %d", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_CHANNEL_REQUEST. " + "local: %d, remote: %d, request-type: %s, break-length: %d", __FUNCTION__, c->self_id, c->remote_id, req_type, 1000); ret = 1; @@ -3166,7 +3163,7 @@ } else { // for SSH2(yutaka) Channel_t *c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); } else { SSH2_send_channel_data(pvar, c, (unsigned char *)buf, buflen, 0); @@ -3429,7 +3426,7 @@ if (pvar->rekeying) { // TODO: \x97\x9D\x91z\x82Ƃ\xB5\x82Ă̓p\x83P\x83b\x83g\x94j\x8A\xFC\x82ł͂Ȃ\xAD\x81A\x83p\x83P\x83b\x83g\x93ǂݎ\xE6\x82\xE8\x92x\x89\x84\x82ɂ\xB5\x82\xBD\x82\xA2\x82Ƃ\xB1\x82낾\x82\xAA\x81A // \x8F\xAB\x97\x88\x92\xBC\x82\xB7\x82\xB1\x82Ƃɂ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_INFO, __FUNCTION__ ": now rekeying. data is not sent."); + logprintf(LOG_LEVEL_INFO, "%s: now rekeying. data is not sent.", __FUNCTION__); c = NULL; @@ -3459,7 +3456,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); @@ -3472,8 +3469,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_SSHDUMP, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_DATA. " - "local:%d remote:%d len:%d", c->self_id, c->remote_id, buflen); + logprintf(LOG_LEVEL_SSHDUMP, "%s: sending SSH2_MSG_CHANNEL_DATA. " + "local:%d remote:%d len:%d", __FUNCTION__, c->self_id, c->remote_id, buflen); // remote window size\x82̒\xB2\x90\xAE if (buflen <= c->remote_window) { @@ -3558,7 +3555,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, remote_channel_num); @@ -3588,7 +3585,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); @@ -3657,7 +3654,7 @@ if (pvar->rekeying) { // TODO: \x97\x9D\x91z\x82Ƃ\xB5\x82Ă̓p\x83P\x83b\x83g\x94j\x8A\xFC\x82ł͂Ȃ\xAD\x81A\x83p\x83P\x83b\x83g\x93ǂݎ\xE6\x82\xE8\x92x\x89\x84\x82ɂ\xB5\x82\xBD\x82\xA2\x82Ƃ\xB1\x82낾\x82\xAA\x81A // \x8F\xAB\x97\x88\x92\xBC\x82\xB7\x82\xB1\x82Ƃɂ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_INFO, __FUNCTION__ ": now rekeying. data is not sent."); + logprintf(LOG_LEVEL_INFO, "%s: now rekeying. data is not sent.", __FUNCTION__); c = NULL; @@ -3667,7 +3664,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); // remote ID @@ -3710,8 +3707,8 @@ unsigned char *outmsg = begin_send_packet(pvar, SSH_CMSG_PORT_FORWARD_REQUEST, 12 + host_len); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": Forwarding request (SSH1 RtoL): " - "remote_port=%d, to_host=%s, to_port=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: Forwarding request (SSH1 RtoL): " + "remote_port=%d, to_host=%s, to_port=%d", __FUNCTION__, from_server_port, to_local_host, to_local_port); set_uint32(outmsg, from_server_port); @@ -3722,8 +3719,8 @@ enque_forwarding_request_handlers(pvar); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH_CMSG_PORT_FORWARD_REQUEST." - "remote_port=%d, to_host=%s, to_port=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH_CMSG_PORT_FORWARD_REQUEST." + "remote_port=%d, to_host=%s, to_port=%d", __FUNCTION__, from_server_port, to_local_host, to_local_port); } else { @@ -3733,14 +3730,14 @@ unsigned char *outmsg; int len; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": Forwarding request (SSH2 RtoL): " - "bind_addr=%s, remote_port=%d, to_host=%s, to_port=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: Forwarding request (SSH2 RtoL): " + "bind_addr=%s, remote_port=%d, to_host=%s, to_port=%d", __FUNCTION__, bind_address, from_server_port, to_local_host, to_local_port); msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } req = "tcpip-forward"; @@ -3756,8 +3753,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_GLOBAL_REQUEST. " - "request=%s, want_reply=%d, bind_address=%s, remote_port=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_GLOBAL_REQUEST. " + "request=%s, want_reply=%d, bind_address=%s, remote_port=%d", __FUNCTION__, req, 1, bind_address, from_server_port); } } @@ -3773,7 +3770,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } s = "cancel-tcpip-forward"; @@ -3836,13 +3833,13 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); return; } @@ -3872,8 +3869,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_REQUEST. " - "local: %d, remote: %d, request-type: %s, proto: %s, cookie: %s, screen: %d", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_CHANNEL_REQUEST. " + "local: %d, remote: %d, request-type: %s, proto: %s, cookie: %s, screen: %d", __FUNCTION__, c->self_id, c->remote_id, req_type, auth_protocol, newdata, screen_num); free(newdata); @@ -3929,7 +3926,7 @@ if (pvar->rekeying) { // TODO: \x97\x9D\x91z\x82Ƃ\xB5\x82Ă̓p\x83P\x83b\x83g\x94j\x8A\xFC\x82ł͂Ȃ\xAD\x81A\x83p\x83P\x83b\x83g\x93ǂݎ\xE6\x82\xE8\x92x\x89\x84\x82ɂ\xB5\x82\xBD\x82\xA2\x82Ƃ\xB1\x82낾\x82\xAA\x81A // \x8F\xAB\x97\x88\x92\xBC\x82\xB7\x82\xB1\x82Ƃɂ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_INFO, __FUNCTION__ ": now rekeying. channel open request is not sent."); + logprintf(LOG_LEVEL_INFO, "%s: now rekeying. channel open request is not sent.", __FUNCTION__); c = NULL; @@ -3951,7 +3948,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } s = "direct-tcpip"; @@ -4733,7 +4730,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } if (pvar->my_kex != NULL) @@ -5003,7 +5000,9 @@ else { pvar->peer_kex = buffer_init(); if (pvar->peer_kex == NULL) { - msg = __FUNCTION__ ": Out of memory"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: Out of memory", __FUNCTION__); + msg = tmp; goto error; } } @@ -5013,7 +5012,9 @@ // cookie; \x82\xB1\x82\xB1\x82ł͎g\x82\xED\x82Ȃ\xA2\x82̂œǂݔ\xF2\x82\xB7 if (! grab_payload(pvar, SSH2_COOKIE_LENGTH)) { - msg = __FUNCTION__ ": truncated packet (cookie)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (cookie)", __FUNCTION__); + msg = tmp; goto error; } @@ -5025,10 +5026,12 @@ // \x8C\xAE\x8C\xF0\x8A\xB7\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80 switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (kex algorithms)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (kex algorithms)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed kex algorithms is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed kex algorithms is too long.", __FUNCTION__); break; } @@ -5045,10 +5048,12 @@ // \x83z\x83X\x83g\x8C\xAE\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80 switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (hostkey algorithms)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (hostkey algorithms)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed hostkey algorithms is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed hostkey algorithms is too long.", __FUNCTION__); break; } @@ -5073,10 +5078,12 @@ // \x88Í\x86\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (encryption algorithms client to server)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (encryption algorithms client to server)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed encryption algorithms (client to server) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed encryption algorithms (client to server) is too long.", __FUNCTION__); break; } @@ -5093,10 +5100,12 @@ // \x88Í\x86\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83T\x81[\x83o -> \x83N\x83\x89\x83C\x83A\x83\x93\x83g) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (encryption algorithms server to client)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (encryption algorithms server to client)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed encryption algorithms (server to client) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed encryption algorithms (server to client) is too long.", __FUNCTION__); break; } @@ -5113,10 +5122,12 @@ // MAC\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (MAC algorithms client to server)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (MAC algorithms client to server)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed MAC algorithms (client to server) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed MAC algorithms (client to server) is too long.", __FUNCTION__); break; } @@ -5139,10 +5150,12 @@ // MAC\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83T\x81[\x83o -> \x83N\x83\x89\x83C\x83A\x83\x93\x83g) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (MAC algorithms server to client)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (MAC algorithms server to client)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed MAC algorithms (server to client) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed MAC algorithms (server to client) is too long.", __FUNCTION__); break; } @@ -5165,10 +5178,12 @@ // \x88\xB3\x8Fk\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (compression algorithms client to server)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (compression algorithms client to server)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed compression algorithms (client to server) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed compression algorithms (client to server) is too long.", __FUNCTION__); break; } @@ -5185,10 +5200,12 @@ // \x88\xB3\x8Fk\x83A\x83\x8B\x83S\x83\x8A\x83Y\x83\x80(\x83T\x81[\x83o -> \x83N\x83\x89\x83C\x83A\x83\x93\x83g) switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: - msg = __FUNCTION__ ": truncated packet (compression algorithms server to client)"; + _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, + "%s: truncated packet (compression algorithms server to client)", __FUNCTION__); + msg = tmp; goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed compression algorithms (server to client) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed compression algorithms (server to client) is too long.", __FUNCTION__); break; } @@ -5209,10 +5226,10 @@ // \x8C\xBE\x8C\xEA\x82\xCC name-list \x82\xAA\x8E\xE6\x82\xEA\x82Ȃ\xA2\x82Ƃ\xA2\x82\xA4\x8E\x96\x82\xCD KEXINIT \x83p\x83P\x83b\x83g\x82̃t\x83H\x81[\x83}\x83b\x83g\x8E\xA9\x91̂\xAA\x91z\x92\xE8\x8AO\x82ł\xA0\x82\xE8 // \x88ُ\xED\x82ȏ\xF3\x91Ԃł\xA0\x82邪\x81A\x92ʐM\x82ɕK\x97v\x82ȃA\x83\x8B\x83S\x83\x8A\x83Y\x83\x80\x82͂\xB7\x82łɃl\x83S\x8Dς݂ŒʐM\x8E\xA9\x91͍̂s\x82\xA6\x82\xE9\x81B // \x8D\xA1\x82܂ł͂\xB1\x82̕\x94\x95\xAA\x82̃`\x83F\x83b\x83N\x82\xF0\x8Ds\x82\xC1\x82Ă\xA2\x82Ȃ\xA9\x82\xC1\x82\xBD\x82̂ŁA\x8Cx\x8D\x90\x82\xF0\x8BL\x98^\x82\xB7\x82\xE9\x82݂̂ŏ\x88\x97\x9D\x82s\x82\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": truncated packet (language client to server)"); + logprintf(LOG_LEVEL_WARNING, "%s: truncated packet (language client to server)", __FUNCTION__); goto skip; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed language (client to server) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed language (client to server) is too long.", __FUNCTION__); break; } @@ -5223,10 +5240,10 @@ switch (get_namelist_from_payload(pvar, buf, sizeof(buf), &size)) { case GetPayloadError: // \x8C\xBE\x8C\xEA(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) \x82Ɠ\xAF\x97l\x82ɁA\x96\xE2\x91肪\x82\xA0\x82\xC1\x82Ă\xE0\x8Cx\x8D\x90\x82݂̂Ƃ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": truncated packet (language server to client)"); + logprintf(LOG_LEVEL_WARNING, "%s: truncated packet (language server to client)", __FUNCTION__); goto error; case GetPayloadTruncate: - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": server proposed language (server to client) is too long."); + logprintf(LOG_LEVEL_WARNING, "%s: server proposed language (server to client) is too long.", __FUNCTION__); break; } @@ -5237,22 +5254,22 @@ // SSH_MSG_KEXINIT \x82̌\xE3\x82̌\xAE\x8C\xF0\x8A\xB7\x82̓N\x83\x89\x83C\x83A\x83\x93\x83g\x91\xA4\x82\xA9\x82瑗\x82\xE9\x82̂ŃT\x81[\x83o\x91\xA4\x82\xAA 1 \x82ɂ\xB7\x82鎖\x82͂Ȃ\xA2\x82͂\xB8\x81B if (!get_boolean_from_payload(pvar, buf)) { // \x8C\xBE\x8C\xEA(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) \x82Ɠ\xAF\x97l\x82ɁA\x96\xE2\x91肪\x82\xA0\x82\xC1\x82Ă\xE0\x8Cx\x8D\x90\x82݂̂Ƃ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": truncated packet (first_kex_packet_follows)"); + logprintf(LOG_LEVEL_WARNING, "%s: truncated packet (first_kex_packet_follows)", __FUNCTION__); goto skip; } if (buf[0] != 0) { // \x91O\x8Fq\x82̂悤\x82ɃT\x81[\x83o\x91\xA4\x82\xCD 0 \x88ȊO\x82ɂ\xB7\x82鎖\x82͂Ȃ\xA2\x82͂\xB8\x82Ȃ̂ŁA\x8Cx\x8D\x90\x82\xF0\x8BL\x98^\x82\xB7\x82\xE9\x81B - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": first_kex_packet_follows is not 0. (%d)", buf[0]); + logprintf(LOG_LEVEL_WARNING, "%s: first_kex_packet_follows is not 0. (%d)", __FUNCTION__, buf[0]); } // reserved: \x8C\xBB\x8F\xF3\x82͏\xED\x82\xC9 0 \x82ƂȂ\xE9\x81B if (!get_uint32_from_payload(pvar, &size)) { // \x8C\xBE\x8C\xEA(\x83N\x83\x89\x83C\x83A\x83\x93\x83g -> \x83T\x81[\x83o) \x82Ɠ\xAF\x97l\x82ɁA\x96\xE2\x91肪\x82\xA0\x82\xC1\x82Ă\xE0\x8Cx\x8D\x90\x82݂̂Ƃ\xB7\x82\xE9\x81B - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": truncated packet (reserved)"); + logprintf(LOG_LEVEL_WARNING, "%s: truncated packet (reserved)", __FUNCTION__ ); goto skip; } if (size != 0) { - logprintf(LOG_LEVEL_INFO, __FUNCTION__ ": reserved data is not 0. (%d)", size); + logprintf(LOG_LEVEL_INFO, "%s: reserved data is not 0. (%d)", __FUNCTION__, size); } skip: @@ -5357,7 +5374,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } @@ -5421,13 +5438,13 @@ else if (pvar->settings.GexMinimalGroupSize < GEX_GRP_LIMIT_MIN) { min = GEX_GRP_LIMIT_MIN; logprintf(LOG_LEVEL_NOTICE, - __FUNCTION__ ": small GexMinimalGroupSize is too small (%d), use minimum limit (%d)", + "%s: small GexMinimalGroupSize is too small (%d), use minimum limit (%d)", __FUNCTION__, pvar->settings.GexMinimalGroupSize, GEX_GRP_LIMIT_MIN); } else if (pvar->settings.GexMinimalGroupSize > GEX_GRP_LIMIT_MAX) { min = GEX_GRP_LIMIT_MAX; logprintf(LOG_LEVEL_NOTICE, - __FUNCTION__ ": small GexMinimalGroupSize is too larse (%d), use maximum limit (%d)", + "%s: small GexMinimalGroupSize is too larse (%d), use maximum limit (%d)", __FUNCTION__, pvar->settings.GexMinimalGroupSize, GEX_GRP_LIMIT_MAX); } else { @@ -5512,7 +5529,9 @@ goto error; if (!get_mpint_from_payload(pvar, p) || !get_mpint_from_payload(pvar, g)) { - notify_fatal_error(pvar, __FUNCTION__ ":truncated packet (mpint)", FALSE); + _snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, + "%s:truncated packet (mpint)", __FUNCTION__); + notify_fatal_error(pvar, tmpbuf, FALSE); return FALSE; } @@ -5651,7 +5670,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } @@ -5727,8 +5746,8 @@ if ((ret = key_verify(hostkey, signature, siglen, hash, hashlen)) != 1) { if (ret == -3 && hostkey->type == KEY_RSA) { if (!pvar->settings.EnableRsaShortKeyServer) { - _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, __FUNCTION__ - ": key verify error. remote rsa key length is too short (%d-bit)", + _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, + "%s: key verify error. remote rsa key length is too short (%d-bit)", __FUNCTION__, BN_num_bits(hostkey->rsa->n)); } else { @@ -5736,7 +5755,7 @@ } } else { - _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, __FUNCTION__ ": key verify error (%d)\r\n%s", ret, SENDTOME); + _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, "%s: key verify error (%d)\r\n%s", __FUNCTION__, ret, SENDTOME); } save_memdump(LOGDUMP); @@ -5751,7 +5770,7 @@ begin_send_packet(pvar, SSH2_MSG_NEWKEYS, 0); finish_send_packet(pvar); - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_NEWKEYS was sent."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_NEWKEYS was sent.", __FUNCTION__); // SSH2_MSG_NEWKEYS\x82𑗂\xE8\x8FI\x82\xED\x82\xC1\x82\xBD\x82\xA0\x82ƂɃL\x81[\x82̐ݒ肨\x82\xE6\x82эĐݒ\xE8\x82\xF0\x8Ds\x82\xA4 // \x91\x97\x90M\x97p\x82̈Í\x86\x8C\xAE\x82\xCD SSH2_MSG_NEWKEYS \x82̑\x97\x90M\x8C\xE3\x82ɁA\x8E\xF3\x90M\x97p\x82̂\xCD SSH2_MSG_NEWKEYS \x82\xCC @@ -5830,7 +5849,9 @@ hostkey = key_from_blob(data, bloblen); if (hostkey == NULL) { - emsg = __FUNCTION__ ": key_from_blob error"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: key_from_blob error", __FUNCTION__); + emsg = emsg_tmp; goto error; } data += bloblen; @@ -5845,13 +5866,17 @@ } HOSTS_check_host_key(pvar, pvar->ssh_state.hostname, pvar->ssh_state.tcpport, hostkey); if (pvar->socket == INVALID_SOCKET) { - emsg = __FUNCTION__ ": Server disconnected"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Server disconnected", __FUNCTION__); + emsg = emsg_tmp; goto error; } server_public = BN_new(); if (server_public == NULL) { - emsg = __FUNCTION__ ": Out of memory (1)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (1)", __FUNCTION__); + emsg = emsg_tmp; goto error; } @@ -5866,7 +5891,9 @@ // check public key if (!dh_pub_is_valid(pvar->kexdh, server_public)) { - emsg = __FUNCTION__ ": invalid server public key"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: invalid server public key", __FUNCTION__); + emsg = emsg_tmp; goto error; } // \x8B\xA4\x92ʌ\xAE\x82̐\xB6\x90\xAC @@ -5873,13 +5900,17 @@ dh_len = DH_size(pvar->kexdh); dh_buf = malloc(dh_len); if (dh_buf == NULL) { - emsg = __FUNCTION__ ": Out of memory (2)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (2)", __FUNCTION__); + emsg = emsg_tmp; goto error; } share_len = DH_compute_key(dh_buf, server_public, pvar->kexdh); share_key = BN_new(); if (share_key == NULL) { - emsg = __FUNCTION__ ": Out of memory (3)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (3)", __FUNCTION__); + emsg = emsg_tmp; goto error; } // 'share_key'\x82\xAA\x83T\x81[\x83o\x82ƃN\x83\x89\x83C\x83A\x83\x93\x83g\x82ŋ\xA4\x97L\x82\xB7\x82錮\x81iG^A\x81~B mod P\x81j\x82ƂȂ\xE9\x81B @@ -5973,7 +6004,9 @@ hostkey = key_from_blob(data, bloblen); if (hostkey == NULL) { - emsg = __FUNCTION__ ": key_from_blob error"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: key_from_blob error", __FUNCTION__); + emsg = emsg_tmp; goto error; } data += bloblen; @@ -5988,13 +6021,17 @@ } HOSTS_check_host_key(pvar, pvar->ssh_state.hostname, pvar->ssh_state.tcpport, hostkey); if (pvar->socket == INVALID_SOCKET) { - emsg = __FUNCTION__ ": Server disconnected"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Server disconnected", __FUNCTION__); + emsg = emsg_tmp; goto error; } server_public = BN_new(); if (server_public == NULL) { - emsg = __FUNCTION__ ": Out of memory (1)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (1)", __FUNCTION__); + emsg = emsg_tmp; goto error; } @@ -6009,7 +6046,9 @@ // check public key if (!dh_pub_is_valid(pvar->kexdh, server_public)) { - emsg = __FUNCTION__ ": invalid server public key"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: invalid server public key", __FUNCTION__); + emsg = emsg_tmp; goto error; } // \x8B\xA4\x92ʌ\xAE\x82̐\xB6\x90\xAC @@ -6016,13 +6055,17 @@ dh_len = DH_size(pvar->kexdh); dh_buf = malloc(dh_len); if (dh_buf == NULL) { - emsg = __FUNCTION__ ": Out of memory (2)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (2)", __FUNCTION__); + emsg = emsg_tmp; goto error; } share_len = DH_compute_key(dh_buf, server_public, pvar->kexdh); share_key = BN_new(); if (share_key == NULL) { - emsg = __FUNCTION__ ": Out of memory (3)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (3)", __FUNCTION__); + emsg = emsg_tmp; goto error; } // 'share_key'\x82\xAA\x83T\x81[\x83o\x82ƃN\x83\x89\x83C\x83A\x83\x93\x83g\x82ŋ\xA4\x97L\x82\xB7\x82錮\x81iG^A\x81~B mod P\x81j\x82ƂȂ\xE9\x81B @@ -6122,7 +6165,9 @@ hostkey = key_from_blob(data, bloblen); if (hostkey == NULL) { - emsg = __FUNCTION__ ": key_from_blob error"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: key_from_blob error", __FUNCTION__); + emsg = emsg_tmp; goto error; } data += bloblen; @@ -6137,7 +6182,9 @@ } HOSTS_check_host_key(pvar, pvar->ssh_state.hostname, pvar->ssh_state.tcpport, hostkey); if (pvar->socket == INVALID_SOCKET) { - emsg = __FUNCTION__ ": Server disconnected"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Server disconnected", __FUNCTION__); + emsg = emsg_tmp; goto error; } @@ -6145,7 +6192,9 @@ group = EC_KEY_get0_group(pvar->ecdh_client_key); server_public = EC_POINT_new(group); if (server_public == NULL) { - emsg = __FUNCTION__ ": Out of memory (1)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (1)", __FUNCTION__); + emsg = emsg_tmp; goto error; } @@ -6160,7 +6209,9 @@ // check public key if (key_ec_validate_public(group, server_public) != 0) { - emsg = __FUNCTION__ ": invalid server public key"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: invalid server public key", __FUNCTION__); + emsg = emsg_tmp; goto error; } // \x8B\xA4\x92ʌ\xAE\x82̐\xB6\x90\xAC @@ -6167,17 +6218,23 @@ ecdh_len = (EC_GROUP_get_degree(group) + 7) / 8; ecdh_buf = malloc(ecdh_len); if (ecdh_buf == NULL) { - emsg = __FUNCTION__ ": Out of memory (2)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (2)", __FUNCTION__); + emsg = emsg_tmp; goto error; } if (ECDH_compute_key(ecdh_buf, ecdh_len, server_public, pvar->ecdh_client_key, NULL) != (int)ecdh_len) { - emsg = __FUNCTION__ ": Out of memory (3)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (3)", __FUNCTION__); + emsg = emsg_tmp; goto error; } share_key = BN_new(); if (share_key == NULL) { - emsg = __FUNCTION__ ": Out of memory (4)"; + _snprintf_s(emsg_tmp, sizeof(emsg_tmp), _TRUNCATE, + "%s: Out of memory (4)", __FUNCTION__); + emsg = emsg_tmp; goto error; } // 'share_key'\x82\xAA\x83T\x81[\x83o\x82ƃN\x83\x89\x83C\x83A\x83\x93\x83g\x82ŋ\xA4\x97L\x82\xB7\x82錮\x81iG^A\x81~B mod P\x81j\x82ƂȂ\xE9\x81B @@ -6383,7 +6440,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } s = "ssh-userauth"; @@ -6412,7 +6469,7 @@ data = pvar->ssh_state.payload; if ((svc = buffer_get_string(&data, NULL)) == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL.", __FUNCTION__); } logprintf(LOG_LEVEL_VERBOSE, "SSH2_MSG_SERVICE_ACCEPT was received. service-name=%s", NonNull(svc)); free(svc); @@ -6448,7 +6505,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } @@ -6641,7 +6698,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } s = "ssh-heartbeat"; @@ -6813,7 +6870,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } s = "session"; @@ -7011,7 +7068,7 @@ logputs(LOG_LEVEL_INFO, "SSH2_MSG_USERAUTH_BANNER was received."); if (!get_string_from_payload(pvar, buff, sizeof(buff), &msglen, TRUE)) { - logputs(LOG_LEVEL_WARNING, __FUNCTION__ ": banner payload corrupted."); + logprintf(LOG_LEVEL_WARNING, "%s: banner payload corrupted.", __FUNCTION__); return TRUE; } @@ -7064,7 +7121,7 @@ } if (!get_string_from_payload(pvar, buff, sizeof(buff), <aglen, TRUE)) { - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": langtag payload corrupted."); + logprintf(LOG_LEVEL_WARNING, "%s: langtag payload corrupted.", __FUNCTION__); return TRUE; } @@ -7141,7 +7198,7 @@ lang = buffer_get_string(&data, NULL); lprompt[0] = 0; if (inst == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL. (inst)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL. (inst)", __FUNCTION__); } else if (strlen(inst) > 0) { strncat_s(lprompt, sizeof(lprompt), inst, _TRUNCATE); @@ -7148,7 +7205,7 @@ strncat_s(lprompt, sizeof(lprompt), "\r\n", _TRUNCATE); } if (lang == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL. (lang)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL. (lang)", __FUNCTION__); } else if (strlen(lang) > 0) { strncat_s(lprompt, sizeof(lprompt), lang, _TRUNCATE); @@ -7155,7 +7212,7 @@ strncat_s(lprompt, sizeof(lprompt), "\r\n", _TRUNCATE); } - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": user=%s, inst=%s, lang=%s", + logprintf(LOG_LEVEL_VERBOSE, "%s: user=%s, inst=%s, lang=%s", __FUNCTION__, NonNull(name), NonNull(inst), NonNull(lang)); free(name); @@ -7166,7 +7223,7 @@ num = get_uint32_MSBfirst(data); data += 4; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": prompts=%d", num); + logprintf(LOG_LEVEL_VERBOSE, "%s: prompts=%d", __FUNCTION__, num); ///////// step2 // \x83T\x81[\x83o\x82փp\x83X\x83t\x83\x8C\x81[\x83Y\x82𑗂\xE9 @@ -7173,7 +7230,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } buffer_put_int(msg, num); @@ -7196,7 +7253,7 @@ echo = data[0]; data[0] = '\0'; // \x83\x8D\x83O\x8Fo\x97ׁ͂̈A\x88ꎞ\x93I\x82\xC9 NUL Terminate \x82\xB7\x82\xE9 - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": prompt[%d]=\"%s\", echo=%d, pass-state=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: prompt[%d]=\"%s\", echo=%d, pass-state=%d", __FUNCTION__, i, prompt, slen, pvar->keyboard_interactive_password_input); data[0] = echo; // \x83\x8D\x83O\x8Fo\x97͂\xF0\x8Ds\x82\xC1\x82\xBD\x82̂ŁA\x8C\xB3\x82̒l\x82ɏ\x91\x82\xAB\x96߂\xB7 @@ -7227,7 +7284,7 @@ finish_send_packet(pvar); buffer_free(msg); - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_USERAUTH_INFO_RESPONSE."); + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_USERAUTH_INFO_RESPONSE.", __FUNCTION__); return TRUE; } @@ -7330,7 +7387,7 @@ finish_send_packet(pvar); buffer_free(msg); - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_USERAUTH_REQUEST method=publickey"); + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_USERAUTH_REQUEST method=publickey", __FUNCTION__); pvar->pageant_keyfinal = TRUE; @@ -7468,11 +7525,11 @@ ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SSHPASSWD_INPUT), pvar->cv->HWin, passwd_change_dialog, (LPARAM)&cp); if (ret == -1) { - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": DialogBoxParam failed."); + logprintf(LOG_LEVEL_WARNING, "%s: DialogBoxParam failed.", __FUNCTION__); return FALSE; } else if (ret == 0) { - logprintf(LOG_LEVEL_NOTICE, __FUNCTION__ ": dialog cancelled."); + logprintf(LOG_LEVEL_NOTICE, "%s: dialog cancelled.", __FUNCTION__); return FALSE; } @@ -7485,11 +7542,11 @@ lang = buffer_get_string(&data, NULL); if (info == NULL || lang == NULL) { logprintf(LOG_LEVEL_ERROR, - __FUNCTION__ ": buffer_get_string returns NULL. info=%s, lang=%s", + "%s: buffer_get_string returns NULL. info=%s, lang=%s", __FUNCTION__, NonNull(info), NonNull(lang)); } else { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": info=%s, lang=%s\n", info, lang); + logprintf(LOG_LEVEL_VERBOSE, "%s: info=%s, lang=%s\n", __FUNCTION__, info, lang); } free(info); free(lang); @@ -7497,7 +7554,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } @@ -7564,8 +7621,8 @@ finish_send_packet(pvar); buffer_free(msg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_REQUEST. " - "local: %d, remote: %d, request-type: %s, msg1=%s, msg2=%s", + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_CHANNEL_REQUEST. " + "local: %d, remote: %d, request-type: %s, msg1=%s, msg2=%s", __FUNCTION__, c->self_id, c->remote_id, req, msg1 ? msg1 : "none", msg2 ? msg2 : "none"); return TRUE; } @@ -7586,13 +7643,13 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL. (msg)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL. (msg)", __FUNCTION__); return FALSE; } ttymsg = buffer_init(); if (ttymsg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL. (ttymsg)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL. (ttymsg)", __FUNCTION__); buffer_free(msg); return FALSE; } @@ -7647,10 +7704,10 @@ buffer_free(msg); buffer_free(ttymsg); - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": sending SSH2_MSG_CHANNEL_REQUEST. " + logprintf(LOG_LEVEL_VERBOSE, "%s: sending SSH2_MSG_CHANNEL_REQUEST. " "local: %d, remote: %d, request-type: %s, " "term: %s, cols: %d, rows: %d, x: %d, y: %d, " - "out-speed: %d, in-speed: %d, verase: %s, onlcr: %s", + "out-speed: %d, in-speed: %d, verase: %s, onlcr: %s", __FUNCTION__, c->self_id, c->remote_id, req_type, pvar->ts->TermType, pvar->ssh_state.win_cols, pvar->ssh_state.win_rows, x, y, pvar->ts->TerminalOutputSpeed, pvar->ts->TerminalInputSpeed, @@ -7692,7 +7749,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -7775,7 +7832,7 @@ break; default: // NOT REACHED - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": Invalid channel-type. (%d)", c->type); + logprintf(LOG_LEVEL_ERROR, "%s: Invalid channel-type. (%d)", __FUNCTION__, c->type); return FALSE; } return TRUE; @@ -7806,7 +7863,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: SSH2_MSG_DISCONNECT\x82𑗂\xE9 - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -7828,7 +7885,7 @@ cstring = buffer_get_string(&data, NULL); if (cstring == NULL) { - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL", __FUNCTION__); } UTIL_get_lang_msg("MSG_SSH_CHANNEL_OPEN_ERROR", pvar, "SSH2_MSG_CHANNEL_OPEN_FAILURE was received.\r\nchannel [%d]: reason: %s(%d) message: %s"); @@ -7885,7 +7942,7 @@ if (rtype == NULL) { // rtype \x82\xAA NULL \x82Ŗ\xB3\x82\xA2\x8E\x96\x82̕ۏ\xD8 - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL.", __FUNCTION__); } else if (strcmp(rtype, "hostk****@opens*****") == 0) { // OpenSSH 6.8\x82ł́A\x83T\x81[\x83o\x82̃z\x83X\x83g\x8C\xAE\x82\xAA\x8DX\x90V\x82\xB3\x82\xEA\x82\xE9\x82ƁA\x82\xB1\x82̒ʒm\x82\xAA\x97\x88\x82\xE9\x81B @@ -7952,7 +8009,7 @@ c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); return FALSE; } pvar->agentfwd_enable = TRUE; @@ -7965,7 +8022,7 @@ c = ssh2_channel_lookup(pvar->shell_id); if (c == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": shell channel not found."); + logprintf(LOG_LEVEL_ERROR, "%s: shell channel not found.", __FUNCTION__); return FALSE; } @@ -8001,7 +8058,7 @@ c = ssh2_channel_lookup(channel_id); if (c == NULL) { // TODO: error check - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", channel_id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, channel_id); return FALSE; } @@ -8050,7 +8107,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); @@ -8086,7 +8143,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return; } buffer_put_int(msg, c->remote_id); @@ -8764,7 +8821,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -8780,14 +8837,14 @@ // \x83o\x83b\x83t\x83@\x83T\x83C\x83Y\x82̃`\x83F\x83b\x83N if (str_len > c->local_maxpacket) { - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": Data length is larger than local_maxpacket. " - "len:%d local_maxpacket:%d", str_len, c->local_maxpacket); + logprintf(LOG_LEVEL_WARNING, "%s: Data length is larger than local_maxpacket. " + "len:%d local_maxpacket:%d", __FUNCTION__, str_len, c->local_maxpacket); } if (str_len > c->local_window) { // TODO: logging // local window size\x82\xE6\x82\xE8\x91傫\x82ȃp\x83P\x83b\x83g\x82͎̂Ă\xE9 - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": Data length is larger than local_window. " - "len:%d local_window:%d", str_len, c->local_window); + logprintf(LOG_LEVEL_WARNING, "%s: Data length is larger than local_window. " + "len:%d local_window:%d", __FUNCTION__, str_len, c->local_window); return FALSE; } @@ -8849,7 +8906,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -8864,14 +8921,14 @@ // \x83o\x83b\x83t\x83@\x83T\x83C\x83Y\x82̃`\x83F\x83b\x83N if (strlen > c->local_maxpacket) { // TODO: logging - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": Data length is larger than local_maxpacket. " - "len:%d local_maxpacket:%d", strlen, c->local_maxpacket); + logprintf(LOG_LEVEL_WARNING, "%s: Data length is larger than local_maxpacket. " + "len:%d local_maxpacket:%d", __FUNCTION__, strlen, c->local_maxpacket); } if (strlen > c->local_window) { // TODO: logging // local window size\x82\xE6\x82\xE8\x91傫\x82ȃp\x83P\x83b\x83g\x82͎̂Ă\xE9 - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": Data length is larger than local_window. " - "len:%d local_window:%d", strlen, c->local_window); + logprintf(LOG_LEVEL_WARNING, "%s: Data length is larger than local_window. " + "len:%d local_window:%d", __FUNCTION__, strlen, c->local_window); return FALSE; } @@ -8927,7 +8984,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -8960,7 +9017,7 @@ buffer_t *msg; unsigned char *outmsg; - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_CHANNEL_OPEN was received."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_CHANNEL_OPEN was received.", __FUNCTION__); // 6byte\x81i\x83T\x83C\x83Y\x81{\x83p\x83f\x83B\x83\x93\x83O\x81{\x83^\x83C\x83v\x81j\x82\xF0\x8E\xE6\x82菜\x82\xA2\x82\xBD\x88ȍ~\x82̃y\x83C\x83\x8D\x81[\x83h data = pvar->ssh_state.payload; @@ -8978,14 +9035,14 @@ remote_maxpacket = get_uint32_MSBfirst(data); data += 4; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ - ": type=%s, channel=%d, init_winsize=%d, max_packetsize:%d", + logprintf(LOG_LEVEL_VERBOSE, + "%s: type=%s, channel=%d, init_winsize=%d, max_packetsize:%d", __FUNCTION__, NonNull(ctype), remote_id, remote_window, remote_maxpacket); // check Channel Type(string) if (ctype == NULL) { // ctype \x82\xAA NULL \x82Ŗ\xB3\x82\xA2\x8E\x96\x82̕ۏׁ̈A\x90\xE6\x82Ƀ`\x83F\x83b\x83N\x82\xB7\x82\xE9 - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL. (ctype)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL. (ctype)", __FUNCTION__); } else if (strcmp(ctype, "forwarded-tcpip") == 0) { // port-forwarding(remote to local) char *listen_addr, *orig_addr; @@ -9000,8 +9057,8 @@ data += 4; if (listen_addr && orig_addr) { - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ - ": %s: listen_addr=%s, listen_port=%d, orig_addr=%s, orig_port=%d", + logprintf(LOG_LEVEL_VERBOSE, + "%s: %s: listen_addr=%s, listen_port=%d, orig_addr=%s, orig_port=%d", __FUNCTION__, ctype, listen_addr, listen_port, orig_addr, orig_port); // searching request entry by listen_port & create_local_channel FWD_open(pvar, remote_id, listen_addr, listen_port, orig_addr, orig_port, &chan_num); @@ -9023,8 +9080,8 @@ c->remote_maxpacket = remote_maxpacket; } else { - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": %s: buffer_get_string returns NULL. " - "linsten_addr=%s, orig_addr=%s", + logprintf(LOG_LEVEL_ERROR, "%s: %s: buffer_get_string returns NULL. " + "linsten_addr=%s, orig_addr=%s", __FUNCTION__, ctype, NonNull(listen_addr), NonNull(orig_addr)); } free(listen_addr); @@ -9039,7 +9096,7 @@ orig_port = get_uint32_MSBfirst(data); data += 4; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": %s: orig_addr=%s, orig_port=%d", + logprintf(LOG_LEVEL_VERBOSE, "%s: %s: orig_addr=%s, orig_port=%d", __FUNCTION__, ctype, orig_str, orig_port); free(orig_str); @@ -9083,7 +9140,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } buffer_put_int(msg, remote_id); @@ -9097,7 +9154,7 @@ finish_send_packet(pvar); buffer_free(msg); - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_CHANNEL_OPEN_FAILURE was sent."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_CHANNEL_OPEN_FAILURE was sent.", __FUNCTION__ ); } } else { @@ -9133,7 +9190,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -9193,7 +9250,7 @@ c = ssh2_channel_lookup(id); if (c == NULL) { // TODO: - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_ERROR, "%s: channel not found. (%d)", __FUNCTION__, id); return FALSE; } @@ -9202,19 +9259,19 @@ want_reply = data[0]; data += 1; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ - ": local=%d, remote=%d, request=%s, want_reply=%d", + logprintf(LOG_LEVEL_VERBOSE, + "%s: local=%d, remote=%d, request=%s, want_reply=%d", __FUNCTION__, c->self_id, c->remote_id, NonNull(request), want_reply); if (request == NULL) { // request \x82\xAA NULL \x82Ŗ\xB3\x82\xA2\x8E\x96\x82̕ۏ\xD8 - logprintf(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_get_string returns NULL. (request)"); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_get_string returns NULL. (request)", __FUNCTION__); } else if (strcmp(request, "exit-status") == 0) { // \x8FI\x97\xB9\x83R\x81[\x83h\x82\xAA\x8A܂܂\xEA\x82Ă\xA2\x82\xE9\x82Ȃ\xE7\x82\xCE int estat = get_uint32_MSBfirst(data); success = 1; - logprintf(LOG_LEVEL_VERBOSE, __FUNCTION__ ": exit-status=%d", estat); + logprintf(LOG_LEVEL_VERBOSE, "%s: exit-status=%d", __FUNCTION__, estat); } else if (strcmp(request, "keepa****@opens*****") == 0) { // \x8CÂ\xA2 OpenSSH \x82ł\xCD SUCCESS \x82\xF0\x95Ԃ\xB5\x82Ă\xE0 keepalive \x82\xC9 @@ -9239,7 +9296,7 @@ msg = buffer_init(); if (msg == NULL) { // TODO: error check - logputs(LOG_LEVEL_ERROR, __FUNCTION__ ": buffer_init returns NULL."); + logprintf(LOG_LEVEL_ERROR, "%s: buffer_init returns NULL.", __FUNCTION__); return FALSE; } buffer_put_int(msg, c->remote_id); @@ -9251,9 +9308,9 @@ buffer_free(msg); if (success) { - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_CHANNEL_SUCCESS was sent."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_CHANNEL_SUCCESS was sent.", __FUNCTION__); } else { - logputs(LOG_LEVEL_VERBOSE, __FUNCTION__ ": SSH2_MSG_CHANNEL_FAILURE was sent."); + logprintf(LOG_LEVEL_VERBOSE, "%s: SSH2_MSG_CHANNEL_FAILURE was sent.", __FUNCTION__); } } @@ -9286,7 +9343,7 @@ if (c == NULL) { // channel close\x8C\xE3\x82\xC9adjust message\x82\xAA\x92x\x82\xEA\x82Ă\xE2\x82\xC1\x82Ă\xAD\x82\xE9\x83P\x81[\x83X\x82\xE0\x82\xA0\x82邽\x82߁A // FALSE\x82ł͕Ԃ\xB3\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B(2007.12.26 yutaka) - logprintf(LOG_LEVEL_WARNING, __FUNCTION__ ": channel not found. (%d)", id); + logprintf(LOG_LEVEL_WARNING, "%s: channel not found. (%d)", __FUNCTION__, id); return TRUE; } @@ -9330,8 +9387,8 @@ req_len = get_uint32_MSBfirst(data); if (req_len > AGENT_MAX_MSGLEN - 4) { logprintf(LOG_LEVEL_NOTICE, - __FUNCTION__ ": Agent Forwarding Error: server request is too large. " - "size=%u, allowd max=%u.", req_len, AGENT_MAX_MSGLEN-4); + "%s: Agent Forwarding Error: server request is too large. size=%u, allowd max=%u.", + __FUNCTION__ , req_len, AGENT_MAX_MSGLEN-4); if (pvar->session_settings.ForwardAgentNotify) { char title[MAX_UIMSG]; UTIL_get_lang_msg("MSG_SSH_AGENTERROR_TITLE", pvar, "Bad agent request"); @@ -9361,7 +9418,7 @@ agent_query(data, *agent_request_len, &response, &resplen, NULL, NULL); if (response == NULL || resplen < 5) { - logprintf(LOG_LEVEL_NOTICE, __FUNCTION__ "Agent Forwarding Error: agent_query is failed."); + logprintf(LOG_LEVEL_NOTICE, "%s Agent Forwarding Error: agent_query is failed.", __FUNCTION__); goto error; }