Changeset 6826c1eb


Ignore:
Timestamp:
Dec 14, 2010 8:30:00 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5ed8be2
Parents:
e772107
Message:

disable I2CP auth in-JVM

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/I2PSessionImpl.java

    re772107 r6826c1eb  
    201201        }
    202202
    203         // auto-add auth if required, not set in the options, and we are in the same JVM
    204         // TODO bypass this on router side for internal connections
    205         if (_context.isRouterContext() &&
     203        // auto-add auth if required, not set in the options, and we are not in the same JVM
     204        if ((!_context.isRouterContext()) &&
    206205            Boolean.valueOf(_context.getProperty("i2cp.auth")).booleanValue() &&
    207206            ((!options.containsKey("i2cp.username")) || (!options.containsKey("i2cp.password")))) {
  • router/java/src/net/i2p/router/client/ClientConnectionRunner.java

    re772107 r6826c1eb  
    110110    public void startRunning() {
    111111        try {
    112             _reader = new I2CPMessageReader(_socket.getInputStream(), new ClientMessageEventListener(_context, this));
     112            _reader = new I2CPMessageReader(_socket.getInputStream(), new ClientMessageEventListener(_context, this, true));
    113113            _writer = new ClientWriterRunner(_context, this);
    114114            I2PThread t = new I2PThread(_writer);
  • router/java/src/net/i2p/router/client/ClientMessageEventListener.java

    re772107 r6826c1eb  
    4343 */
    4444class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventListener {
    45     private Log _log;
    46     private RouterContext _context;
    47     private ClientConnectionRunner _runner;
    48    
    49     public ClientMessageEventListener(RouterContext context, ClientConnectionRunner runner) {
     45    private final Log _log;
     46    private final RouterContext _context;
     47    private final ClientConnectionRunner _runner;
     48    private final boolean  _enforceAuth;
     49   
     50    /**
     51     *  @param enforceAuth set false for in-JVM, true for socket access
     52     */
     53    public ClientMessageEventListener(RouterContext context, ClientConnectionRunner runner, boolean enforceAuth) {
    5054        _context = context;
    5155        _log = _context.logManager().getLog(ClientMessageEventListener.class);
    5256        _runner = runner;
     57        _enforceAuth = enforceAuth;
    5358        _context.statManager().createRateStat("client.distributeTime", "How long it took to inject the client message into the router", "ClientMessages", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    5459    }
     
    154159
    155160        // Auth, since 0.8.2
    156         // In-JVM accesses have access to the same context properties, so
    157         // they will be set on the client side... therefore we don't need to pass in
    158         // some indication of (socket instanceof InternalSocket)
    159         if (Boolean.valueOf(_context.getProperty("i2cp.auth")).booleanValue()) {
     161        if (_enforceAuth && Boolean.valueOf(_context.getProperty("i2cp.auth")).booleanValue()) {
    160162            String configUser = _context.getProperty("i2cp.username");
    161163            String configPW = _context.getProperty("i2cp.password");
  • router/java/src/net/i2p/router/client/QueuedClientConnectionRunner.java

    re772107 r6826c1eb  
    3636    @Override
    3737    public void startRunning() {
    38         _reader = new QueuedI2CPMessageReader(this.queue, new ClientMessageEventListener(_context, this));
     38        _reader = new QueuedI2CPMessageReader(this.queue, new ClientMessageEventListener(_context, this, false));
    3939        _reader.startReading();
    4040    }
Note: See TracChangeset for help on using the changeset viewer.