@Override public void handle(Message msg, SSHPacket buf) throws SSHException { if (msg.in(91, 100)) { getChannel(buf).handle(msg, buf); } else if (msg.in(80, 90)) { switch (msg) { case GLOBAL_REQUEST: gotGlobalRequest(buf); break; case REQUEST_SUCCESS: gotGlobalReqResponse(buf); break; case REQUEST_FAILURE: gotGlobalReqResponse(null); break; case CHANNEL_OPEN: gotChannelOpen(buf); break; default: super.handle(msg, buf); break; } } else { super.handle(msg, buf); } }
@Override public void notifyError(SSHException error) { super.notifyError(error); authenticated.deliverError(error); }
@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; this.nextService = nextService; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); } else { log.debug("`{}` auth failed", method.getName()); } } finally { // Clear the internal state. currentMethod = null; this.nextService = null; authenticated.unlock(); } return outcome; }
@Override public void notifyError(SSHException error) { super.notifyError(error); synchronized (globalReqPromises) { ErrorDeliveryUtil.alertPromises(error, globalReqPromises); globalReqPromises.clear(); } keepAlive.interrupt(); ErrorNotifiable.Util.alertAll(error, channels.values()); channels.clear(); }
@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; this.nextService = nextService; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); } else { log.debug("`{}` auth failed", method.getName()); } } finally { // Clear the internal state. currentMethod = null; this.nextService = null; authenticated.unlock(); } return outcome; }
@Override public void handle(Message msg, SSHPacket buf) throws SSHException { if (msg.in(91, 100)) getChannel(buf).handle(msg, buf); else if (msg.in(80, 90)) switch (msg) { case REQUEST_SUCCESS: gotGlobalReqResponse(buf); break; case REQUEST_FAILURE: gotGlobalReqResponse(null); break; case CHANNEL_OPEN: gotChannelOpen(buf); break; default: super.handle(msg, buf); } else super.handle(msg, buf); }
@Override public void notifyError(SSHException error) { super.notifyError(error); authenticated.deliverError(error); }
@Override public boolean authenticate(String username, Service nextService, AuthMethod method, int timeoutMs) throws UserAuthException, TransportException { final boolean outcome; authenticated.lock(); try { super.request(); // Request "ssh-userauth" service (if not already active) currentMethod = method; currentMethod.init(makeAuthParams(username, nextService)); authenticated.clear(); log.debug("Trying `{}` auth...", method.getName()); currentMethod.request(); outcome = authenticated.retrieve(timeoutMs, TimeUnit.MILLISECONDS); if (outcome) { log.debug("`{}` auth successful", method.getName()); trans.setAuthenticated(); // So it can put delayed compression into force if applicable trans.setService(nextService); // We aren't in charge anymore, next service is } else { log.debug("`{}` auth failed", method.getName()); } } finally { currentMethod = null; authenticated.unlock(); } return outcome; }
@Override public void handle(Message msg, SSHPacket buf) throws SSHException { if (msg.in(91, 100)) { getChannel(buf).handle(msg, buf); } else if (msg.in(80, 90)) { switch (msg) { case GLOBAL_REQUEST: gotGlobalRequest(buf); break; case REQUEST_SUCCESS: gotGlobalReqResponse(buf); break; case REQUEST_FAILURE: gotGlobalReqResponse(null); break; case CHANNEL_OPEN: gotChannelOpen(buf); break; default: super.handle(msg, buf); break; } } else { super.handle(msg, buf); } }
@Override public void notifyError(SSHException error) { super.notifyError(error); authenticated.deliverError(error); }
@Override public void notifyError(SSHException error) { super.notifyError(error); synchronized (globalReqPromises) { ErrorDeliveryUtil.alertPromises(error, globalReqPromises); globalReqPromises.clear(); } ErrorNotifiable.Util.alertAll(error, channels.values()); channels.clear(); }
@Override public void notifyError(SSHException error) { super.notifyError(error); synchronized (globalReqPromises) { ErrorDeliveryUtil.alertPromises(error, globalReqPromises); globalReqPromises.clear(); } keepAlive.interrupt(); ErrorNotifiable.Util.alertAll(error, channels.values()); channels.clear(); }