CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
net/sf/sshapi/util/BatchHostKeyValidator.java53
net/sf/sshapi/util/ConsoleHostKeyValidator.java57
		this.keyManager = keyManager;
	}

	public int verifyHost(SshHostKey hostKey) throws SshException {
		String type = hostKey.getType().substring(4).toUpperCase();
		if (keyManager != null) {
			SshHostKey[] keys = keyManager.getKeysForHost(hostKey.getHost(), hostKey.getType());
			if (keys != null && keys.length > 0) {
				for (int i = 0; i < keys.length; i++) {
					if (Arrays.equals(keys[i].getKey(), hostKey.getKey())) {
						return SshHostKeyValidator.STATUS_HOST_KEY_VALID;
					}
				}
				System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
				System.out.println("@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @");
				System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
				System.out.println("IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!");
				System.out.println("Someone could be eavesdropping on you right now (man-in-the-middle attack)!");
				System.out.println("It is also possible that the " + type + " host key has just been changed.");
				System.out.println("The fingerprint for the " + type + " key sent by the remote host is");
				System.out.println(hostKey.getFingerprint() + ".");
				System.out.println("Please contact your system administrator.");
				System.out.println("Add correct host key to your known hosts database");
				return SshHostKeyValidator.STATUS_HOST_CHANGED;
			}
		}