Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3137 by yutakapon, Fri Jul 25 15:48:44 2008 UTC revision 3142 by yutakapon, Fri Aug 15 12:28:47 2008 UTC
# Line 374  void ssh_heartbeat_unlock(void) Line 374  void ssh_heartbeat_unlock(void)
374  // (2005.3.7 yutaka)  // (2005.3.7 yutaka)
375  //  //
376  #define MEMTAG_MAX 300  #define MEMTAG_MAX 300
377  #define LOGDUMP "ssh2dump.log"  #define LOGDUMP "ssh2connect.log"
378    #define LOG_PACKET_DUMP "ssh2packet.log"
379  #define SENDTOME "Please send '"LOGDUMP"' file to Tera Term developer team."  #define SENDTOME "Please send '"LOGDUMP"' file to Tera Term developer team."
380    
381  typedef struct memtag {  typedef struct memtag {
# Line 410  static void displine_memdump(FILE *fp, i Line 411  static void displine_memdump(FILE *fp, i
411          /* ASCII表示 */          /* ASCII表示 */
412          for (i = 0 ; i < byte_cnt ; i++) {          for (i = 0 ; i < byte_cnt ; i++) {
413                  c = bytes[i];                  c = bytes[i];
414                  if (c >= 0x20 && c <= 0x7f) {                  if (isprint(c)) {
415                          fprintf(fp, "%c", c);                          fprintf(fp, "%c", c);
416                  } else {                  } else {
417                          fprintf(fp, ".");                          fprintf(fp, ".");
# Line 455  void init_memdump(void) Line 456  void init_memdump(void)
456  {  {
457          int i;          int i;
458    
459            if (memtag_use > 0)
460                    return;
461    
462          for (i = 0 ; i < MEMTAG_MAX ; i++) {          for (i = 0 ; i < MEMTAG_MAX ; i++) {
463                  memtags[i].name = NULL;                  memtags[i].name = NULL;
464                  memtags[i].desc = NULL;                  memtags[i].desc = NULL;
# Line 479  void finish_memdump(void) Line 483  void finish_memdump(void)
483                  free(memtags[i].data);                  free(memtags[i].data);
484                  memtags[i].len = 0;                  memtags[i].len = 0;
485          }          }
486            memtag_count = 0;
487  }  }
488    
489  void save_memdump(char *filename)  void save_memdump(char *filename)
# Line 2731  void SSH_notify_cred(PTInstVar pvar) Line 2736  void SSH_notify_cred(PTInstVar pvar)
2736    
2737  void SSH_send(PTInstVar pvar, unsigned char const FAR * buf, unsigned int buflen)  void SSH_send(PTInstVar pvar, unsigned char const FAR * buf, unsigned int buflen)
2738  {  {
2739            // RAWパケットダンプを追加 (2008.8.15 yutaka)
2740            if (LOG_LEVEL_SSHDUMP <= pvar->session_settings.LogLevel) {
2741                    init_memdump();
2742                    push_memdump("SSH sending packet", "SSH_send", (char *)buf, buflen);
2743            }
2744    
2745          if (SSHv1(pvar)) {          if (SSHv1(pvar)) {
2746                  if (get_handler(pvar, SSH_SMSG_STDOUT_DATA) != handle_data) {                  if (get_handler(pvar, SSH_SMSG_STDOUT_DATA) != handle_data) {
2747                          return;                          return;
# Line 6279  static BOOL handle_SSH2_newkeys(PTInstVa Line 6290  static BOOL handle_SSH2_newkeys(PTInstVa
6290          notify_verbose_message(pvar, "SSH2_MSG_NEWKEYS is received(DH key generation is completed).", LOG_LEVEL_VERBOSE);          notify_verbose_message(pvar, "SSH2_MSG_NEWKEYS is received(DH key generation is completed).", LOG_LEVEL_VERBOSE);
6291    
6292          // ログ採取の終了 (2005.3.7 yutaka)          // ログ採取の終了 (2005.3.7 yutaka)
6293            if (LOG_LEVEL_SSHDUMP <= pvar->session_settings.LogLevel) {
6294                    save_memdump(LOGDUMP);
6295            }
6296          finish_memdump();          finish_memdump();
6297    
6298          // finish key exchange          // finish key exchange
# Line 8052  static BOOL handle_SSH2_channel_data(PTI Line 8066  static BOOL handle_SSH2_channel_data(PTI
8066          str_len = get_uint32_MSBfirst(data);          str_len = get_uint32_MSBfirst(data);
8067          data += 4;          data += 4;
8068    
8069            // RAWパケットダンプを追加 (2008.8.15 yutaka)
8070            if (LOG_LEVEL_SSHDUMP <= pvar->session_settings.LogLevel) {
8071                    init_memdump();
8072                    push_memdump("SSH receiving packet", "PKT_recv", (char *)data, str_len);
8073            }
8074    
8075          // バッファサイズのチェック          // バッファサイズのチェック
8076          if (str_len > c->local_maxpacket) {          if (str_len > c->local_maxpacket) {
8077                  // TODO: logging                  // TODO: logging
# Line 8304  static BOOL handle_SSH2_channel_close(PT Line 8324  static BOOL handle_SSH2_channel_close(PT
8324          char *s;          char *s;
8325          unsigned char *outmsg;          unsigned char *outmsg;
8326    
8327            // コネクション切断時に、パケットダンプをファイルへ掃き出す。
8328            if (LOG_LEVEL_SSHDUMP <= pvar->session_settings.LogLevel) {
8329                    save_memdump(LOG_PACKET_DUMP);
8330                    finish_memdump();
8331            }
8332    
8333          // 6byte(サイズ+パディング+タイプ)を取り除いた以降のペイロード          // 6byte(サイズ+パディング+タイプ)を取り除いた以降のペイロード
8334          data = pvar->ssh_state.payload;          data = pvar->ssh_state.payload;
8335          // パケットサイズ - (パディングサイズ+1);真のパケットサイズ          // パケットサイズ - (パディングサイズ+1);真のパケットサイズ

Legend:
Removed from v.3137  
changed lines
  Added in v.3142

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26