Package org.apache.sshd.server.session

Examples of org.apache.sshd.server.session.ServerSession


    }

    protected boolean handleAgentForwarding(Buffer buffer) throws IOException {
        boolean wantReply = buffer.getBoolean();

        final ServerSession server = (ServerSession) session;
        final ForwardingFilter filter = server.getServerFactoryManager().getForwardingFilter();
        final SshAgentFactory factory = server.getServerFactoryManager().getAgentFactory();
        if (factory == null || (filter != null && !filter.canForwardAgent(server))) {
            if (wantReply) {
                buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_FAILURE, 0);
                buffer.putInt(recipient);
                session.writePacket(buffer);
View Full Code Here


    }

    protected boolean handleX11Forwarding(Buffer buffer) throws IOException {
        boolean wantReply = buffer.getBoolean();

        final ServerSession server = (ServerSession) session;
        final ForwardingFilter filter = server.getServerFactoryManager().getForwardingFilter();
        if (filter == null || !filter.canForwardX11(server)) {
            if (wantReply) {
                buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_FAILURE, 0);
                buffer.putInt(recipient);
                session.writePacket(buffer);
View Full Code Here

            address = new InetSocketAddress(hostToConnect, portToConnect);
        } catch (RuntimeException e) {
            address = null;
        }

        final ServerSession serverSession = (ServerSession)getSession();
        final TcpIpForwardFilter filter = serverSession.getServerFactoryManager().getTcpIpForwardFilter();
        if (address == null || filter == null || !filter.canConnect(address, serverSession)) {
            super.close(true);
            f.setException(new OpenChannelException(SshConstants.SSH_OPEN_ADMINISTRATIVELY_PROHIBITED, "connect denied"));
            return f;
        }
View Full Code Here

            address = new InetSocketAddress(hostToConnect, portToConnect);
        } catch (RuntimeException e) {
            address = null;
        }

        final ServerSession serverSession = (ServerSession)getSession();
        final ForwardingFilter filter = serverSession.getServerFactoryManager().getForwardingFilter();
        if (address == null || filter == null || !filter.canConnect(address, serverSession)) {
            super.close(true);
            f.setException(new OpenChannelException(SshConstants.SSH_OPEN_ADMINISTRATIVELY_PROHIBITED, "connect denied"));
            return f;
        }
View Full Code Here

    public void setServer(SshServer server) {
        this.server = server;
    }

    protected AbstractSession createSession(IoSession ioSession) throws Exception {
        return new ServerSession(server, ioSession);
    }
View Full Code Here

    }

    protected boolean handleAgentForwarding(Buffer buffer) throws IOException {
        boolean wantReply = buffer.getBoolean();

        final ServerSession server = (ServerSession) session;
        final ForwardingFilter filter = server.getServerFactoryManager().getForwardingFilter();
        if (filter == null || !filter.canForwardAgent(server)) {
            if (wantReply) {
                buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_FAILURE, 0);
                buffer.putInt(recipient);
                session.writePacket(buffer);
View Full Code Here

    }

    protected boolean handleX11Forwarding(Buffer buffer) throws IOException {
        boolean wantReply = buffer.getBoolean();

        final ServerSession server = (ServerSession) session;
        final ForwardingFilter filter = server.getServerFactoryManager().getForwardingFilter();
        if (filter == null || !filter.canForwardX11(server)) {
            if (wantReply) {
                buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_FAILURE, 0);
                buffer.putInt(recipient);
                session.writePacket(buffer);
View Full Code Here

    public void setServer(SshServer server) {
        this.server = server;
    }

    protected AbstractSession createSession(IoSession ioSession) throws Exception {
        return new ServerSession(server, ioSession);
    }
View Full Code Here

        if (io.getConfig() instanceof SocketSessionConfig) {
          final SocketSessionConfig c = (SocketSessionConfig) io.getConfig();
          c.setKeepAlive(keepAlive);
        }

        final ServerSession s = (ServerSession) super.createSession(io);
        final int id = idGenerator.next();
        final SocketAddress peer = io.getRemoteAddress();
        final SshSession sd = new SshSession(id, peer);
        s.setAttribute(SshSession.KEY, sd);

        // Log a session close without authentication as a failure.
        //
        io.getCloseFuture().addListener(new IoFutureListener<IoFuture>() {
          @Override
View Full Code Here

    final long now = System.currentTimeMillis();
    stdout.print(String.format("%-8s %8s %8s   %-15s %s\n", //
        "Session", "Start", "Idle", "User", "Remote Host"));
    stdout.print("--------------------------------------------------------------\n");
    for (final IoSession io : list) {
      ServerSession s = (ServerSession) ServerSession.getSession(io, true);
      SshSession sd = s != null ? s.getAttribute(SshSession.KEY) : null;

      final SocketAddress remoteAddress = io.getRemoteAddress();
      final long start = io.getCreationTime();
      final long idle = now - io.getLastIoTime();
View Full Code Here

TOP

Related Classes of org.apache.sshd.server.session.ServerSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.