gzz-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Second post: Re: [Gzz] PEG: Attacking against GISP


From: Hermanni Hyytiälä
Subject: Second post: Re: [Gzz] PEG: Attacking against GISP
Date: 09 Jun 2003 15:08:55 +0300

On Mon, 2003-06-09 at 14:04, Benja Fallenstein wrote:
> Hermanni Hyytiälä wrote:
> > On Sat, 2003-06-07 at 21:26, Benja Fallenstein wrote:
> > 
> >>Hermanni Hyytiälä wrote:
> >>
> >>>On Fri, 2003-06-06 at 14:06, Tuomas Lukka wrote:
> >>>
> >>>
> >>>
> >>>>>- A hostile (or faulty) peer(s) stores lot of dummy key-value-pairs with
> >>>>>a certain key
> >>>>
> >>>>Does GISP allow several values per key?
> >>>
> >>>Like DSHT ? No.
> >>
> >>No, like a normal DHT, so that a lookup returns all values associated 
> >>with a key. Yes, it does; we use it all the time.
> > 
> > Sorry, I don't understand your answer completely :).
> > 
> > I understood Tuomas' question like "Does GISP support frequent fetches
> > and frequent *stores* of the same hash table key" (like DSHT supports),
> > not like "Only one value can be stored under a key at any given time in
> > regular DHTs. Thus, frequent retrievals but only one *store* is
> > supported. Does GISP support this ?"
> 
> The point was simply whether different values can, at the same time, be 
> associated with the same key. The answer is yes.
> 


After a brief discussion with Tuomas, I decided to look GISP's source
code and found this:


First GISP.java

/**
 *  Applications' interface to GISP functionality.
 *  GISP, the Global Information Sharing Protocol, provides a      
distributed
 *  database mapping keys to values.
 *  This interface provides methods for querying the database and for
 *  inserting new mappings. An instance of this object represents a
 *  connection to one distributed database; if more than one database is
used,
 *  for example using different JXTA peer groups, <code>GISP</code>
objects
 *  need to be created for each of them.

...

*In each key/value pair, the key is a <code>String</code>. The value,
*on the other hand, can be either a <code>String</code> or an XML
*document,
*stored in a <code>byte[]</code> array. The simplest <code>insert</code>
*methods therefore are <code>insert(String keyword, String
*strdata)</code>
*and <code>insert(String keyword, byte[] xmldata)</code> for publishing
*new key/value pairs with <code>String</code> and XML values,
*respectively.
*Both <code>String</code> and XML values should be small: for example,
*rather than containing a file, they should contain information about
*which peer can be used to download a file.

...

/**
     * publish String data with keyword
     * with ttl
     *
     * @param key: keyword for the data
     * @param str: string data
     * @param ttl: milliseconds to live
     */
    public abstract void insert(String key, String str, long ttl);

- -

Then GISPXML.java (which is used, e.g., with the simulator and UDP-imp):

public void insert(String key, String str, long ttl){
        if(key == null || str == null || ttl <= 0){
            throw new IllegalArgumentException("null argument(s)");
        }
        Element ele = DocumentHelper.createElement(ITEM);
        ele.addAttribute(KEYATTR, key);
        ele.addText(str);
        GInfo info = new GInfo(GHash.fromKey(key), ele,
                               getCurrentTime() + ttl, infoComparator);
        insertGInfo(info);
}

- -

GInfoManagerMemory.java:

...

private List datahouse = new ArrayList();

...

public void insertGInfo(GInfo newInfo){
        if(newInfo == null){
            LOG.error("insertGInfo: newInfo == null");
            return;
        }
        Element ele = (Element)newInfo.getData();
        if(ele.getDocument() == null){
            DocumentHelper.createDocument(ele);
        }
        
        if(LOG.isDebugEnabled()){
            LOG.debug("insertGInfo: element=" + ele.asXML());
        }

        synchronized(datahouse){
            int index = datahouse.indexOf(newInfo);
            if(index == -1){
                datahouse.add(newInfo);
            }else{
                GInfo info = (GInfo)datahouse.get(index);
                if(newInfo.isNewerThan(info)){
                    // update
                    info.update(newInfo);
                }
            }
        }
}


- -
GInfo.java:

public synchronized void update(GInfo newInfo){
        assert newInfo != null;
        assert this.equals(newInfo);

        expirationTime = newInfo.expirationTime;
        lastSentTable = newInfo.lastSentTable;
    }


- -

So it seems that GISP *replaces* the value for a
given key (updates time/date values) rather than appends the value
(e.g., to the end of a list) associated to a given key.

Given this, the answer is still no.



-Hermanni







reply via email to

[Prev in Thread] Current Thread [Next in Thread]