Changeset d87d4eb


Ignore:
Timestamp:
Dec 5, 2013 4:14:51 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
46e7e9b
Parents:
88ea451
Message:

I2CP: Disconnect client on attempt to publish invalid leaseset

Location:
router/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/client/ClientMessageEventListener.java

    r88ea451 rd87d4eb  
    290290            if (_log.shouldLog(Log.ERROR))
    291291                _log.error("Null lease set granted: " + message);
    292             return;
    293         }
    294 
     292            _runner.disconnectClient("Invalid CreateLeaseSetMessage");
     293            return;
     294        }
     295
     296        _context.keyManager().registerKeys(message.getLeaseSet().getDestination(), message.getSigningPrivateKey(), message.getPrivateKey());
     297        try {
     298            _context.netDb().publish(message.getLeaseSet());
     299        } catch (IllegalArgumentException iae) {
     300            if (_log.shouldLog(Log.ERROR))
     301                _log.error("Invalid leaseset from client", iae);
     302            _runner.disconnectClient("Invalid leaseset: " + iae);
     303            return;
     304        }
    295305        if (_log.shouldLog(Log.INFO))
    296306            _log.info("New lease set granted for destination "
    297307                      + message.getLeaseSet().getDestination().calculateHash().toBase64());
    298         _context.keyManager().registerKeys(message.getLeaseSet().getDestination(), message.getSigningPrivateKey(), message.getPrivateKey());
    299         _context.netDb().publish(message.getLeaseSet());
    300308
    301309        // leaseSetCreated takes care of all the LeaseRequestState stuff (including firing any jobs)
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r88ea451 rd87d4eb  
    528528    private static final long PUBLISH_DELAY = 3*1000;
    529529
    530     public void publish(LeaseSet localLeaseSet) {
     530    /**
     531     * @throws IllegalArgumentException if the leaseSet is not valid
     532     */
     533    public void publish(LeaseSet localLeaseSet) throws IllegalArgumentException {
    531534        if (!_initialized) return;
    532535        Hash h = localLeaseSet.getDestination().calculateHash();
     
    535538        } catch (IllegalArgumentException iae) {
    536539            _log.error("wtf, locally published leaseSet is not valid?", iae);
    537             return;
     540            throw iae;
    538541        }
    539542        if (!_context.clientManager().shouldPublishLeaseSet(h))
Note: See TracChangeset for help on using the changeset viewer.