@Override public void notifyUnimplemented(long seqNum) throws SSHException { throw new SSHException(DisconnectReason.PROTOCOL_ERROR, "Unexpected: SSH_MSG_UNIMPLEMENTED"); }
public void die(Exception ex) { close.lock(); try { if (!close.isSet()) { log.error("Dying because - {}", ex.getMessage(), ex); final SSHException causeOfDeath = SSHException.chainer.chain(ex); disconnectListener.notifyDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); ErrorDeliveryUtil.alertEvents(causeOfDeath, close, serviceAccept); kexer.notifyError(causeOfDeath); getService().notifyError(causeOfDeath); setService(nullService); { // Perhaps can send disconnect packet to server final boolean didNotReceiveDisconnect = msg != Message.DISCONNECT; final boolean gotRequiredInfo = causeOfDeath.getDisconnectReason() != DisconnectReason.UNKNOWN; if (didNotReceiveDisconnect && gotRequiredInfo) sendDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); } finishOff(); close.set(); } } finally { close.unlock(); } }
@Override public void notifyError(SSHException error) { log.debug("Notified of {}", error.toString()); }
final DisconnectReason reason = failure.getDisconnectReason(); return this.map(e, buffer, reason);
@Override public String toString() { final String cls = getClass().getName(); final String code = reason != DisconnectReason.UNKNOWN ? "[" + reason + "] " : ""; final String msg = getMessage() != null ? getMessage() : ""; return cls + (code.isEmpty() && msg.isEmpty() ? "" : ": ") + code + msg; }
public SSHException(DisconnectReason code, String message, Throwable cause) { super(message); this.reason = code; if (cause != null) initCause(cause); }
@Override public void notifyError(SSHException error) { log.debug("Got notified of {}", error.toString()); ErrorDeliveryUtil.alertEvents(error, kexInitSent, done); }
@Override public String toString() { final String cls = getClass().getName(); final String code = reason != DisconnectReason.UNKNOWN ? "[" + reason + "] " : ""; final String msg = getMessage() != null ? getMessage() : ""; return cls + (code.isEmpty() && msg.isEmpty() ? "" : ": ") + code + msg; }
public SSHException(DisconnectReason code, String message, Throwable cause) { super(message); this.reason = code; if (cause != null) initCause(cause); }
@Override public SSHException chain(Throwable t) { if (t instanceof SSHException) return (SSHException) t; else return new SSHException(t); }
public void die(Exception ex) { close.lock(); try { if (!close.isSet()) { log.error("Dying because - {}", ex.getMessage(), ex); final SSHException causeOfDeath = SSHException.chainer.chain(ex); disconnectListener.notifyDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); ErrorDeliveryUtil.alertEvents(causeOfDeath, close, serviceAccept); kexer.notifyError(causeOfDeath); getService().notifyError(causeOfDeath); setService(nullService); { // Perhaps can send disconnect packet to server final boolean didNotReceiveDisconnect = msg != Message.DISCONNECT; final boolean gotRequiredInfo = causeOfDeath.getDisconnectReason() != DisconnectReason.UNKNOWN; if (didNotReceiveDisconnect && gotRequiredInfo) sendDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); } finishOff(); close.set(); } } finally { close.unlock(); } }
public OpenSSHKnownHosts(File khFile, LoggerFactory loggerFactory) throws IOException { this.khFile = khFile; log = loggerFactory.getLogger(getClass()); if (khFile.exists()) { final EntryFactory entryFactory = new EntryFactory(); final BufferedReader br = new BufferedReader(new FileReader(khFile)); try { // Read in the file, storing each line as an entry String line; while ((line = br.readLine()) != null) { try { KnownHostEntry entry = entryFactory.parseEntry(line); if (entry != null) { entries.add(entry); } } catch (SSHException ignore) { log.debug("Bad line ({}): {} ", ignore.toString(), line); } catch (SSHRuntimeException ignore) { log.debug("Failed to process line ({}): {} ", ignore.toString(), line); } } } finally { IOUtils.closeQuietly(br); } } }
@Override public String toString() { final String cls = getClass().getName(); final String code = reason != DisconnectReason.UNKNOWN ? "[" + reason + "] " : ""; final String msg = getMessage() != null ? getMessage() : ""; return cls + (code.isEmpty() && msg.isEmpty() ? "" : ": ") + code + msg; }
public SSHException(DisconnectReason code, String message, Throwable cause) { super(message); this.reason = code; if (cause != null) initCause(cause); }
HashedHostMatcher(String hash) throws SSHException { this.hash = hash; final String[] hostParts = hash.split("\\|"); if (hostParts.length != 4) { throw new SSHException("Unrecognized format for hashed hostname"); } salt = hostParts[2]; }
void die(Exception ex) { close.lock(); try { if (!close.isSet()) { log.error("Dying because - {}", ex); final SSHException causeOfDeath = SSHException.chainer.chain(ex); disconnectListener.notifyDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); ErrorDeliveryUtil.alertEvents(causeOfDeath, close, serviceAccept); kexer.notifyError(causeOfDeath); getService().notifyError(causeOfDeath); setService(nullService); { // Perhaps can send disconnect packet to server final boolean didNotReceiveDisconnect = msg != Message.DISCONNECT; final boolean gotRequiredInfo = causeOfDeath.getDisconnectReason() != DisconnectReason.UNKNOWN; if (didNotReceiveDisconnect && gotRequiredInfo) sendDisconnect(causeOfDeath.getDisconnectReason(), causeOfDeath.getMessage()); } finishOff(); close.set(); } } finally { close.unlock(); } }
@Override public void notifyError(SSHException error) { log.debug("Channel #{} got notified of {}", getID(), error.toString()); ErrorDeliveryUtil.alertEvents(error, openEvent, closeEvent); ErrorDeliveryUtil.alertEvents(error, chanReqResponseEvents); in.notifyError(error); if (out != null) out.notifyError(error); finishOff(); }