Develop and Download Open Source Software

Browse Subversion Repository

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

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

revision 5839 by yutakapon, Wed Apr 29 16:23:18 2015 UTC revision 5841 by yutakapon, Thu Apr 30 16:27:29 2015 UTC
# Line 1849  static void hostkeys_update_ctx_free(str Line 1849  static void hostkeys_update_ctx_free(str
1849          free(ctx);          free(ctx);
1850  }  }
1851    
1852    
1853    // 許可されたホスト鍵アルゴリズムかをチェックする。
1854    //
1855    // return 1: matched
1856    //        0: not matched
1857    //
1858    static int check_hostkey_algorithm(PTInstVar pvar, Key *key)
1859    {
1860            int ret = 0;
1861            int i, index;
1862    
1863            for (i = 0; pvar->settings.HostKeyOrder[i] != 0; i++) {
1864                    index = pvar->settings.HostKeyOrder[i] - '0';
1865                    if (index == KEY_NONE) // disabled line
1866                            break;
1867    
1868                    if (strcmp(get_sshname_from_key(key), get_ssh_keytype_name(index)) == 0)
1869                            return 1;
1870            }
1871    
1872            return (ret);
1873    }
1874    
1875  //  //
1876  // SSHサーバホスト鍵(known_hosts)の自動更新(OpenSSH 6.8 or later: host key rotation support)  // SSHサーバホスト鍵(known_hosts)の自動更新(OpenSSH 6.8 or later: host key rotation support)
1877  //  //
# Line 1892  int update_client_input_hostkeys(PTInstV Line 1915  int update_client_input_hostkeys(PTInstV
1915                  blob = buffer_get_string_msg(b, &len);                  blob = buffer_get_string_msg(b, &len);
1916                  key = key_from_blob(blob, len);                  key = key_from_blob(blob, len);
1917                  if (key == NULL) {                  if (key == NULL) {
1918                          _snprintf_s(msg, sizeof(msg), _TRUNCATE, "Not found key into blob %p (%d)", blob, len);                          _snprintf_s(msg, sizeof(msg), _TRUNCATE, "Not found host key into blob %p (%d)", blob, len);
1919                          notify_verbose_message(pvar, msg, LOG_LEVEL_VERBOSE);                          notify_verbose_message(pvar, msg, LOG_LEVEL_VERBOSE);
1920                          goto error;                          goto error;
1921                  }                  }
# Line 1900  int update_client_input_hostkeys(PTInstV Line 1923  int update_client_input_hostkeys(PTInstV
1923                  blob = NULL;                  blob = NULL;
1924    
1925                  fp = key_fingerprint(key, SSH_FP_HEX);                  fp = key_fingerprint(key, SSH_FP_HEX);
1926                  _snprintf_s(msg, sizeof(msg), _TRUNCATE, "SSH2_MSG_GLOBAL_REQUEST: received %s key %s",                  _snprintf_s(msg, sizeof(msg), _TRUNCATE, "Received %s host key %s",
1927                          get_sshname_from_key(key), fp);                          get_sshname_from_key(key), fp);
1928                  notify_verbose_message(pvar, msg, LOG_LEVEL_VERBOSE);                  notify_verbose_message(pvar, msg, LOG_LEVEL_VERBOSE);
1929                  free(fp);                  free(fp);
1930    
1931                    // 許可されたホストキーアルゴリズムかをチェックする。
1932                    if (check_hostkey_algorithm(pvar, key) == 0) {
1933                            _snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s host key is not permitted by ts.HostKeyOrder",
1934                                    get_sshname_from_key(key));
1935                            notify_verbose_message(pvar, msg, LOG_LEVEL_VERBOSE);
1936                            continue;
1937                    }
1938    
1939    
1940          }          }
1941    
1942          success = 1;          success = 1;

Legend:
Removed from v.5839  
changed lines
  Added in v.5841

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