Example #1
0
 protected void sendInitialServiceRequest() throws IOException {
   if (initialServiceRequestSent) {
     return;
   }
   initialServiceRequestSent = true;
   log.debug("Send SSH_MSG_SERVICE_REQUEST for {}", currentServiceFactory.getName());
   Buffer request = createBuffer(SshConstants.SSH_MSG_SERVICE_REQUEST);
   request.putString(currentServiceFactory.getName());
   writePacket(request);
   // Assuming that MINA-SSHD only implements "explicit server authentication" it is permissible
   // for the client's service to start sending data before the service-accept has been received.
   // If "implicit authentication" were to ever be supported, then this would need to be
   // called after service-accept comes back.  See SSH-TRANSPORT.
   currentService.start();
 }
Example #2
0
 public ClientSessionImpl(ClientFactoryManager client, IoSession session) throws Exception {
   super(false, client, session);
   log.info("Client session created");
   // Need to set the initial service early as calling code likes to start trying to
   // manipulate it before the connection has even been established.  For instance, to
   // set the authPassword.
   List<ServiceFactory> factories = client.getServiceFactories();
   if (factories == null || factories.isEmpty() || factories.size() > 2) {
     throw new IllegalArgumentException("One or two services must be configured");
   }
   currentServiceFactory = factories.get(0);
   currentService = currentServiceFactory.create(this);
   if (factories.size() > 1) {
     nextServiceFactory = factories.get(1);
     nextService = nextServiceFactory.create(this);
   } else {
     nextServiceFactory = null;
   }
   authFuture = new DefaultAuthFuture(lock);
   authFuture.setAuthed(false);
   sendClientIdentification();
   kexState.set(KEX_STATE_INIT);
   sendKexInit();
 }
Example #3
0
 private String nextServiceName() {
   synchronized (lock) {
     return nextServiceFactory.getName();
   }
 }