Index: branches/pap/Nebulous/nebclient/configure.ac
===================================================================
--- branches/pap/Nebulous/nebclient/configure.ac	(revision 23948)
+++ branches/pap/Nebulous/nebclient/configure.ac	(revision 25027)
@@ -5,5 +5,5 @@
 AC_PREREQ(2.61)
 
-AC_INIT([nebclient], [0.08], [jhoblitt@cpan.org])
+AC_INIT([nebclient], [0.17], [jhoblitt@cpan.org])
 AC_CONFIG_SRCDIR([nebulous.wsdl])
 
Index: branches/pap/Nebulous/nebclient/nebulous.wsdl
===================================================================
--- branches/pap/Nebulous/nebclient/nebulous.wsdl	(revision 23948)
+++ branches/pap/Nebulous/nebclient/nebulous.wsdl	(revision 25027)
@@ -140,4 +140,21 @@
     </message>
 
+    <message name="chmod_objectRequest">
+        <part name="key" type="xsd:string" />
+        <part name="mode" type="xsd:int" />
+    </message>
+    <message name="chmod_objectResponse">
+        <!-- fixme -->
+        <part name="result" type="xsd:int" />
+    </message>
+
+    <message name="prune_objectRequest">
+        <part name="key" type="xsd:string" />
+    </message>
+    <message name="prune_objectResponse">
+        <!-- fixme -->
+        <part name="result" type="xsd:int" />
+    </message>
+
 
     <portType name="Nebulous/Server/SOAPPort">
@@ -240,4 +257,18 @@
             -->
         </operation>
+        <operation name="chmod_object">
+            <input  message="tns:chmod_objectRequest" />
+            <output message="tns:chmod_objectResponse" />
+            <!--
+                <fault name="" message="" />
+            -->
+        </operation>
+        <operation name="prune_object">
+            <input  message="tns:prune_objectRequest" />
+            <output message="tns:prune_objectResponse" />
+            <!--
+                <fault name="" message="" />
+            -->
+        </operation>
     </portType>
 
@@ -390,4 +421,26 @@
         <operation name="stat_object">
             <soap:operation soapAction="urn:Nebulous/Server/SOAP#stat_object" />
+            <input>
+                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+            </input>
+            <output>
+                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+            </output>
+        </operation>
+        <operation name="chmod_object">
+            <soap:operation soapAction="urn:Nebulous/Server/SOAP#chmod_object" />
+            <input>
+                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+            </input>
+            <output>
+                <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
+                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+            </output>
+        </operation>
+        <operation name="prune_object">
+            <soap:operation soapAction="urn:Nebulous/Server/SOAP#prune_object" />
             <input>
                 <soap:body use="encoded" namespace="urn:Nebulous/Server/SOAP"
Index: branches/pap/Nebulous/nebclient/src/nebclient.c
===================================================================
--- branches/pap/Nebulous/nebclient/src/nebclient.c	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/nebclient.c	(revision 25027)
@@ -51,9 +51,8 @@
 static char *nullstrncpy(char *dest, const char *src, size_t n);
 
+
 nebServer *nebServerAlloc(const char *endpoint)
 {
-    nebServer       *server;
-
-    server          = xmalloc(sizeof(nebServer));
+    nebServer *server = xmalloc(sizeof(nebServer));
 
     if (endpoint) {
@@ -77,4 +76,5 @@
 }
 
+
 void nebServerFree(nebServer *server)
 {
@@ -92,17 +92,16 @@
 }
 
+
 char *nebCreate(nebServer *server, const char *key, const char *volume, char **URI)
 {
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return NULL;
+    }
+
     struct ns1__create_USCOREobjectResponse response;
-    char            *filename;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return NULL;
-    }
-
     if (soap_call_ns1__create_USCOREobject(server->soap, server->endpoint, NULL,
             (char *)key, (char *)volume, (char **)&response) != SOAP_OK) {
@@ -117,6 +116,9 @@
     }
 
+    char *filename;
     if (!nebParseURI(server, (char *)response.result, &filename)) {
         nebSetErr(server, "can not parse URI");
+        nebFree(filename);
+
         return NULL;
     }
@@ -131,20 +133,21 @@
 }
 
+
 int nebOpenCreate(nebServer *server, const char *key, const char *volume, char **URI)
 {
-    char            *filename;
-    int             file;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return -1;
-    }
-
-    filename = nebCreate(server, key, volume, URI);
-
-    file = open(filename, O_RDWR|O_TRUNC, 0660);
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return -1;
+    }
+
+    char *filename = nebCreate(server, key, volume, URI);
+    if (!filename) {
+        return -1;
+    }
+
+    int file = open(filename, O_RDWR|O_TRUNC, 0660);
     if (file == -1) {
         nebSetErr(server, "can not open %s: %s", filename, strerror(errno));
@@ -159,10 +162,7 @@
 }
 
+
 bool nebReplicate(nebServer *server, const char *key, const char *volume, char **URI)
 {
-    struct ns1__replicate_USCOREobjectResponse response;
-    char            *filename;
-    int             sourceFH, destFH;
-
     REQUIRE_SERVER;
 
@@ -177,8 +177,7 @@
     // we don't do this, it's possible that open will find & open the new
     // instance that we're in the process of creating
-    sourceFH = nebOpen(server, (char *)key, NEB_READ);
+    int sourceFH = nebOpen(server, (char *)key, NEB_READ);
     if (sourceFH == -1) {
         nebSetErr(server, "can not open key %s", key);
-        nebFree(filename);
 
         return false;
@@ -186,4 +185,5 @@
 
     // ask the server for a new instance attached to our key
+    struct ns1__replicate_USCOREobjectResponse response;
     if (soap_call_ns1__replicate_USCOREobject(server->soap, server->endpoint,
             NULL, (char *)key, (char *)volume, (char **)&response) != SOAP_OK) {
@@ -193,4 +193,5 @@
     }
 
+    char *filename = NULL;
     if (!nebParseURI(server, (char *)response.result, &filename)) {
         nebSetErr(server, "can not parse URI");
@@ -199,5 +200,5 @@
     }
 
-    destFH = open(filename, O_RDWR|O_TRUNC, 0660);
+    int destFH = open(filename, O_RDWR|O_TRUNC, 0660);
     if (destFH == -1) {
         nebSetErr(server, "can not open %s: %s\n", filename, strerror(errno));
@@ -234,19 +235,21 @@
 }
 
+
 bool nebCull(nebServer *server, const char *key)
 {
-    nebObjectInstances *locations;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return false;
-    }
-
-    locations = nebFindInstances(server, key, NULL);
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return false;
+    }
+
+    nebObjectInstances *locations = nebFindInstances(server, key, NULL);
     if (!locations || locations->n <= 1) {
         nebSetErr(server, "can not cull - not enough instances");
+        if (locations) {
+            nebObjectInstancesFree(locations);
+        }
 
         return false;
@@ -264,23 +267,21 @@
 }
 
+
 bool nebLock(nebServer *server, const char *key, nebRW flag)
 {
-    time_t          endtime;
-    char            *type;
-    int             response;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return false;
-    }
-
-    type = flag == NEB_READ ? "read" : "write";
-
-    endtime = time(NULL) + LOCK_TIMEOUT;
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return false;
+    }
+
+    char *type = flag == NEB_READ ? "read" : "write";
+
+    time_t endtime = time(NULL) + LOCK_TIMEOUT;
 
     while (time(NULL) < endtime) {
+        int response;
         if (soap_call_ns1__lock_USCOREobject(server->soap, server->endpoint,
             NULL, (char *)key, type, &response) != SOAP_OK) {
@@ -302,19 +303,18 @@
 }
 
+
 bool nebUnlock(nebServer *server, const char *key, nebRW flag)
 {
-    char            *type;
-    int             response;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return false;
-    }
-
-    type = flag == NEB_READ ? "read" : "write";
-
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return false;
+    }
+
+    char *type = flag == NEB_READ ? "read" : "write";
+
+    int response;
     if (soap_call_ns1__unlock_USCOREobject(server->soap, server->endpoint,
         NULL, (char *)key, type, &response) != SOAP_OK) {
@@ -466,17 +466,13 @@
 nebObjectInstances *nebFindInstances(nebServer *server, const char *key, const char *volume)
 {
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return NULL;
+    }
+
     struct ns1__find_USCOREinstancesResponse response;
-    int             resultElements = 0;
-    char            **resultArray;
-    nebObjectInstances *locations = NULL;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return NULL;
-    }
-
     // FIXME is this leaking memory when response goes out of scope?  the gsoap
     // manual seems to 'suggest' that this is temporary data that gets cleaed
@@ -488,11 +484,12 @@
     }
 
-    resultElements = response.result->__size;
-
+    int resultElements = response.result->__size;
+
+    nebObjectInstances *locations = NULL;
     if (resultElements) {
         locations = xmalloc(sizeof(nebObjectInstances));
         locations->n = resultElements;
         
-        resultArray    = response.result->__ptr;
+        char **resultArray = response.result->__ptr;
 
         locations->URI = xmalloc(sizeof(char*) * resultElements);
@@ -508,4 +505,5 @@
 }
 
+
 void nebObjectInstancesFree(nebObjectInstances *locations)
 {
@@ -521,9 +519,7 @@
 }
 
+
 char *nebFind(nebServer *server, const char *key)
 {
-    nebObjectInstances *locations;
-    char            *filename;
-
     REQUIRE_SERVER;
 
@@ -534,5 +530,5 @@
     }
     
-    locations = nebFindInstances(server, key, NULL);
+    nebObjectInstances *locations = nebFindInstances(server, key, NULL);
     if (!locations) {
         if (!strstr(nebErr(server), "no instances on storage volume")) {
@@ -548,4 +544,5 @@
     }
 
+    char *filename;
     if (!nebParseURI(server, locations->URI[0], &filename)) {
         nebSetErr(server, "can not parse URI");
@@ -560,19 +557,16 @@
 }
 
+
 int nebOpen(nebServer *server, const char *key, nebRW flag)
 {
-    nebObjectInstances *locations;
-    char            *filename;
-    int             fh;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return -1;
-    }
-
-    locations = nebFindInstances(server, key, NULL);
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return -1;
+    }
+
+    nebObjectInstances *locations = nebFindInstances(server, key, NULL);
     if (!locations) {
         nebSetErr(server, "no instances found");
@@ -581,4 +575,5 @@
     }
 
+    char *filename;
     if (!nebParseURI(server, locations->URI[0], &filename)) {
         nebSetErr(server, "can not parse URI");
@@ -588,4 +583,5 @@
     }
 
+    int fh = 0;
     if (flag == NEB_WRITE) {
         if (locations->n > 1) {
@@ -613,17 +609,16 @@
 }
 
+
 bool nebDelete(nebServer *server, const char *key)
 {
-    nebObjectInstances *locations;
-
-    REQUIRE_SERVER;
-
-    if (!key) {
-        nebSetErr(server, "parameter 'key' may not be NULL");
-
-        return false;
-    }
-
-    locations = nebFindInstances(server, key, "any");
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return false;
+    }
+
+    nebObjectInstances *locations = nebFindInstances(server, key, "any");
     if (!locations) {
         nebSetErr(server, "no instances found");
@@ -646,9 +641,7 @@
 }
 
+
 bool nebCopy(nebServer *server, const char *key, const char *newKey)
 {
-    int             sourceFH;
-    int             destFH;
-
     REQUIRE_SERVER;
 
@@ -665,5 +658,5 @@
     }
 
-    sourceFH = nebOpen(server, (char *)key, NEB_READ);
+    int sourceFH = nebOpen(server, (char *)key, NEB_READ);
     if (sourceFH < 0) {
         // propigate nebOpen() error
@@ -672,5 +665,5 @@
     }
 
-    destFH = nebOpenCreate(server, newKey, NULL, NULL);
+    int destFH = nebOpenCreate(server, newKey, NULL, NULL);
     if (destFH < 0) {
         // propigate nebCreate() error
@@ -696,4 +689,5 @@
 }
 
+
 bool nebMove(nebServer *server, const char *key, const char *newKey)
 {
@@ -723,8 +717,7 @@
 }
 
+
 bool nebSwap(nebServer *server, const char *key1, const char *key2)
 {
-    struct ns1__create_USCOREobjectResponse response;
-
     REQUIRE_SERVER;
 
@@ -741,4 +734,5 @@
     }
 
+    struct ns1__create_USCOREobjectResponse response;
     if (soap_call_ns1__swap_USCOREobjects(server->soap, server->endpoint,
             NULL, (char *)key1, (char *)key2, (char **)&response) != SOAP_OK) {
@@ -749,10 +743,7 @@
 }
 
+
 bool nebDeleteInstance(nebServer *server, const char *key, const char *URI)
 {
-    int             response;
-    char            *filename;
-    bool            status;
-
     REQUIRE_SERVER;
 
@@ -763,4 +754,5 @@
     }
 
+    char *filename;
     if (!nebParseURI(server, URI, &filename)) {
         nebSetErr(server, "can not parse URI");
@@ -769,4 +761,5 @@
     }
 
+    int response;
     if (soap_call_ns1__delete_USCOREinstance(server->soap, server->endpoint,
         NULL, (char *)key, (char *)URI, &response) != SOAP_OK) {
@@ -776,4 +769,5 @@
     }
 
+    bool status;
     if (response > 0) {
         status = nebNukeFile(server, filename);
@@ -787,11 +781,7 @@
 }
 
+
 nebObjectStat *nebStat(nebServer *server, const char *key)
 {
-    struct ns1__stat_USCOREobjectResponse response;
-    nebObjectStat   *stat;
-    int             resultElements = 0;
-    char            **resultArray = NULL;
-
     REQUIRE_SERVER;
 
@@ -802,9 +792,10 @@
     }
 
-    stat = xmalloc(sizeof(nebObjectStat));
+    nebObjectStat *stat = xmalloc(sizeof(nebObjectStat));
 
     // FIXME is this leaking memory when response goes out of scope?  the gsoap
     // manual seems to 'suggest' that this is temporary data that gets cleaed
     // up on the next soap function call
+    struct ns1__stat_USCOREobjectResponse response;
     if (soap_call_ns1__stat_USCOREobject(server->soap, server->endpoint,
             NULL, (char *)key, &response) != SOAP_OK) {
@@ -813,23 +804,147 @@
     }
 
-    resultElements = response.result->__size;
-    resultArray    = response.result->__ptr;
-
-    if (resultElements != 7) {
+    int resultElements = response.result->__size;
+    char **resultArray    = response.result->__ptr;
+
+    if (resultElements != 8) {
         nebSetErr(server, "server didn't return the proper number of stat elements");
         return NULL;
     }
 
-    nullstrncpy(stat->so_id, resultArray[0], 256);
-    nullstrncpy(stat->ext_id, resultArray[1], 256);
-    nullstrncpy(stat->read_lock, resultArray[2], 256);
+    stat->so_id     = atol(resultArray[0]);
+    stat->ext_id    = atol(resultArray[1]);
+    stat->read_lock = atoi(resultArray[2]);
     nullstrncpy(stat->write_lock, resultArray[3], 256);
     nullstrncpy(stat->epoch, resultArray[4], 256);
     nullstrncpy(stat->mtime, resultArray[5], 256);
-    stat->instances = atoi(resultArray[6]);
+    stat->available = atoi(resultArray[6]);
+    stat->instances = atoi(resultArray[7]);
 
     return stat;
 }
 
+
+void nebObjectStatFree(nebObjectStat *stat)
+{
+    if (!stat) {
+        return;
+    }
+
+    nebFree(stat);
+}
+
+
+int nebChmod(nebServer *server, const char *key, mode_t mode)
+{
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return -1;
+    }
+
+    // FIXME is this leaking memory when response goes out of scope?  the gsoap
+    // manual seems to 'suggest' that this is temporary data that gets cleaed
+    // up on the next soap function call
+    int response;
+    if (soap_call_ns1__chmod_USCOREobject(server->soap, server->endpoint,
+            NULL, (char *)key, mode, &response) != SOAP_OK) {
+        nebSetServerErr(server);
+        return -1;
+    }
+
+    return 0;
+}
+
+
+int nebPrune(nebServer *server, const char *key)
+{
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return -1;
+    }
+
+    // FIXME is this leaking memory when response goes out of scope?  the gsoap
+    // manual seems to 'suggest' that this is temporary data that gets cleaed
+    // up on the next soap function call
+    int response;
+    if (soap_call_ns1__prune_USCOREobject(server->soap, server->endpoint,
+            NULL, (char *)key, &response) != SOAP_OK) {
+        nebSetServerErr(server);
+        return -1;
+    }
+
+    return response;
+}
+
+
+int nebThereCanBeOnlyOne(nebServer *server, const char *key, const char *volume)
+{
+    REQUIRE_SERVER;
+
+    if (!key) {
+        nebSetErr(server, "parameter 'key' may not be NULL");
+
+        return -1;
+    }
+
+    // first - strip off any inaccesible instances
+    if (nebPrune(server, key) < 0 ) {
+        // use the prune() method to also determine if $key is valid
+        return -1;
+    }
+
+    // check to see if there is an instance on $vol_name that should be the
+    // sole survivor
+    nebObjectInstances *locations = NULL;
+    if (volume) {
+        locations = nebFindInstances(server, key, NULL);
+    }
+
+    long removed = 0;
+    if (locations && locations->n) {
+        nebObjectInstances *instances = nebFindInstances(server, key, NULL);
+        for (long i = 0; i < instances->n; i++) {
+            if (strcmp(locations->URI[0], instances->URI[i]) == 0) {
+                continue;
+            }
+            if (!nebDeleteInstance(server, key, instances->URI[i])) {
+                nebObjectInstancesFree(instances);
+                nebObjectInstancesFree(locations);
+                return -1;
+            }
+            removed++;
+        }
+        nebObjectInstancesFree(instances);
+        nebObjectInstancesFree(locations);
+    } else {
+        nebObjectInstancesFree(locations);
+        // nuke whatever
+        nebObjectStat *stat = nebStat(server, key);
+        if (!stat) {
+            return -1;
+        }
+
+        int available = stat->available;
+        nebObjectStatFree(stat);
+
+        // start at one so cull() is called one less time then the # of
+        // instances
+        for (long i = 1; i < available; i++) {
+            if (!nebCull(server, key)) {
+                return -1;
+            }
+            removed++;
+        }
+    }
+
+    return removed;
+}
+
+
 char *nebErr(nebServer *server)
 {
@@ -837,5 +952,7 @@
 }
 
+
 void nebFree(void *ptr) {
+    if (!ptr) { return; }
     xfree(ptr);
 }
@@ -844,10 +961,6 @@
 static void p_nebSetErr(const char * filename, unsigned long lineno, const char *function, nebServer *server, const char *format, ...)
 {
-    va_list         args;
-    size_t          err_size;
-    char            err_location[ERRBUF_SIZE];
-    size_t          err_location_size; 
-
-    err_location_size = snprintf(err_location, ERRBUF_SIZE, "%s:%lu %s() - ",
+    char err_location[ERRBUF_SIZE];
+    size_t err_location_size = snprintf(err_location, ERRBUF_SIZE, "%s:%lu %s() - ",
             filename, lineno, function);
 
@@ -862,7 +975,8 @@
 
     while (1) {
+        va_list args;
         va_start(args, format);
         // append error string after error location info
-        err_size = vsnprintf(
+        size_t err_size = vsnprintf(
                 server->err_buf + err_location_size,
                 server->err_buf_size - err_location_size,
@@ -888,27 +1002,22 @@
 }
 
+
 static void nebSetServerErr(nebServer *server)
 {
-    const char      **code;
-    const char      **string;
-
-    REQUIRE_SERVER;
-
-    code   = soap_faultcode(server->soap);
-    string = soap_faultstring(server->soap);
+    REQUIRE_SERVER;
+
+    const char **code   = soap_faultcode(server->soap);
+    const char **string = soap_faultstring(server->soap);
 
     nebSetErr(server, "%s - %s", *code, *string);
 }
+
 
 #if NEBCOPYFILE
 static off_t nebCopyFile(nebServer *server, const char *source, const char *dest)
 {
-    int             sourceFH;
-    int             destFH; 
-    off_t           bytesCopied;
-
-    REQUIRE_SERVER;
-
-    sourceFH = open(source, O_RDONLY);
+    REQUIRE_SERVER;
+
+    int sourceFH = open(source, O_RDONLY);
     if (sourceFH == -1) {
         nebSetErr(server, "can not open %s: %s", source, strerror(errno));
@@ -917,5 +1026,5 @@
     }
 
-    destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
+    int destFH = open(dest, O_WRONLY|O_CREAT|O_CREAT, 0600);
     if (destFH == -1) {
         nebSetErr(server, "can not open %s: %s", dest, strerror(errno));
@@ -924,5 +1033,5 @@
     }
 
-    bytesCopied = nebCopyFilehandle(server, sourceFH, destFH);
+    off_t bytesCopied = nebCopyFilehandle(server, sourceFH, destFH);
     if (bytesCopied < 0) {
         return -1;
@@ -945,14 +1054,10 @@
 #endif
 
+
 static off_t nebCopyFilehandle(nebServer *server, int sourceFH, int destFH)
 {
-    off_t           bytesTotal;
-    off_t           bytesRemaining;
-    off_t           writeSize;
-    char            writeBuf[64 * 1024];
+    REQUIRE_SERVER;
+
     struct stat     sourceStat;
-
-    REQUIRE_SERVER;
-
     if(fstat(sourceFH, &sourceStat)) {
         nebSetErr(server, "can not stat filehandles: %s", strerror(errno));
@@ -962,5 +1067,5 @@
 
     // the size of the file to copied
-    bytesTotal = sourceStat.st_size;
+    off_t bytesTotal = sourceStat.st_size;
 
     /*
@@ -970,7 +1075,9 @@
     */
 
-    bytesRemaining = bytesTotal;
+    off_t bytesRemaining = bytesTotal;
 
     while (bytesRemaining) {
+        off_t writeSize;
+        char writeBuf[64 * 1024];
         if (bytesRemaining <= sizeof(writeBuf)) {
             writeSize = bytesRemaining;
@@ -997,15 +1104,7 @@
 }
 
+
 static size_t nebParseURI(nebServer *server, const char *URI, char **filename)
 {
-    regex_t         myregex;
-    regmatch_t      mymatch[2];
-    char            errbuf[ERRBUF_SIZE];
-    char            *pattern = "^file://(.*)$";
-    int             status;
-    size_t          matchStart, matchEnd;
-    size_t          matchLength;
-    size_t          filename_size;
-
     REQUIRE_SERVER;
 
@@ -1022,5 +1121,10 @@
     }
 
-    status = regcomp(&myregex, pattern, REG_EXTENDED);
+    regex_t myregex;
+    regmatch_t mymatch[2];
+    char *pattern = "^file://(.*)$";
+    char errbuf[ERRBUF_SIZE];
+
+    int status = regcomp(&myregex, pattern, REG_EXTENDED);
     if (status != 0) {
         regerror(status, &myregex, errbuf, ERRBUF_SIZE);
@@ -1040,7 +1144,7 @@
     regfree(&myregex);
 
-    matchStart = (size_t)mymatch[1].rm_so;
-    matchEnd   = (size_t)mymatch[1].rm_eo;
-    matchLength = matchEnd - matchStart;
+    size_t matchStart = (size_t)mymatch[1].rm_so;
+    size_t matchEnd   = (size_t)mymatch[1].rm_eo;
+    size_t matchLength = matchEnd - matchStart;
 
     if (matchStart == -1) {
@@ -1048,5 +1152,5 @@
     }
 
-    filename_size = matchLength + 1;
+    size_t filename_size = matchLength + 1;
     *filename = xmalloc(filename_size);
 
@@ -1055,4 +1159,5 @@
     return strlen(*filename);
 }
+
 
 static bool nebNukeFile(nebServer *server, const char *filename)
@@ -1074,4 +1179,5 @@
     return true;
 }
+
 
 static char *nullstrncpy(char *dest, const char *src, size_t n) {
@@ -1081,4 +1187,8 @@
     }
 
+    if (!dest) {
+        dest = xmalloc(n + 1);
+    }
+
     return strncpy(dest, src, n);
 }
Index: branches/pap/Nebulous/nebclient/src/nebclient.h
===================================================================
--- branches/pap/Nebulous/nebclient/src/nebclient.h	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/nebclient.h	(revision 25027)
@@ -11,4 +11,6 @@
 #ifndef NEBCLIENT_H
 #define NEBCLIENT_H 1
+
+// #include <sys/stat.h>
 
 #ifdef __cplusplus
@@ -36,11 +38,12 @@
 
 typedef struct {
-    char            so_id[256];         ///< storage object ID
-    char            ext_id[256];        ///< storage object key (name)
-    char            read_lock[256];     ///< read lock value
+    long            so_id;              ///< storage object ID
+    long            ext_id;             ///< storage object key (name)
+    int             read_lock;          ///< read lock value
     char            write_lock[256];    ///< write lock value
     char            epoch[256];         ///< creation time stamp
     char            mtime[256];         ///< modification time stamp
-    int             instances;          ///< number of instances
+    int             available;          ///< number of available instances
+    int             instances;          ///< total number of instances
 } nebObjectStat;
 
@@ -293,5 +296,47 @@
 nebObjectStat *nebStat(
     nebServer *server,                  ///< nebServer object
-    const char *key                     /// storage object key (name)
+    const char *key                     ///< storage object key (name)
+);
+
+
+/** Deallocates a stat object
+ */
+void nebObjectStatFree(
+    nebObjectStat *stat                 ///< nebObjectStat object
+);
+
+/** Change permissions of a storage objects
+ *
+ * This function will change the file permissions of all currently on disk
+ * instances of a storage object.
+ *
+ * @return the new mode or NULL on failure.
+ */
+
+int nebChmod(
+    nebServer *server,                  ///< nebServer object
+    const char *key,                    ///< storage object key (name)
+    mode_t mode                         ///< chmod(2) compatible mode (mode_t)
+);
+
+/** Removes all of the inaccessible instances from an object
+ *
+ * @return the number of inaccessible instances removed
+ */
+
+int nebPrune(
+    nebServer *server,                  ///< nebServer object
+    const char *key                     ///< storage object key (name)
+);
+
+/** Removes all but one instances of an object
+ *
+ * @return the number of available instances removed
+ */
+
+int nebThereCanBeOnlyOne(
+    nebServer *server,                  ///< nebServer object
+    const char *key,                    ///< storage object key (name)
+    const char *volume                  ///< leave remain instance on this volume
 );
 
Index: branches/pap/Nebulous/nebclient/src/nebulous.h
===================================================================
--- branches/pap/Nebulous/nebclient/src/nebulous.h	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/nebulous.h	(revision 25027)
@@ -1,5 +1,5 @@
 /* src/nebulous.h
    Generated by wsdl2h 1.2.12 from nebulous.wsdl and typemap.dat
-   2009-04-20 22:15:21 GMT
+   2009-07-25 01:30:29 GMT
    Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved.
    This part of the software is released under one of the following licenses:
@@ -119,4 +119,6 @@
   - @ref ns1__delete_USCOREinstance
   - @ref ns1__stat_USCOREobject
+  - @ref ns1__chmod_USCOREobject
+  - @ref ns1__prune_USCOREobject
 
 @section SOAP_ports Endpoints of Binding  "SOAP"
@@ -893,3 +895,106 @@
 );
 
+/******************************************************************************\
+ *                                                                            *
+ * ns1__chmod_USCOREobject                                                    *
+ *                                                                            *
+\******************************************************************************/
+
+
+/// Operation "ns1__chmod_USCOREobject" of service binding "SOAP"
+
+/**
+
+Operation details:
+
+  - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+  - SOAP action="urn:Nebulous/Server/SOAP#chmod_object"
+
+C stub function (defined in soapClient.c[pp] generated by soapcpp2):
+@code
+  int soap_call_ns1__chmod_USCOREobject(
+    struct soap *soap,
+    NULL, // char *endpoint = NULL selects default endpoint for this operation
+    NULL, // char *action = NULL selects default action for this operation
+    // request parameters:
+    char*                               key,
+    int                                 mode,
+    // response parameters:
+    int                                *result
+  );
+@endcode
+
+C server function (called from the service dispatcher defined in soapServer.c[pp]):
+@code
+  int ns1__chmod_USCOREobject(
+    struct soap *soap,
+    // request parameters:
+    char*                               key,
+    int                                 mode,
+    // response parameters:
+    int                                *result
+  );
+@endcode
+
+*/
+
+//gsoap ns1  service method-style:	chmod_USCOREobject rpc
+//gsoap ns1  service method-encoding:	chmod_USCOREobject http://schemas.xmlsoap.org/soap/encoding/
+//gsoap ns1  service method-action:	chmod_USCOREobject urn:Nebulous/Server/SOAP#chmod_object
+int ns1__chmod_USCOREobject(
+    char*                               key,	///< Request parameter
+    int                                 mode,	///< Request parameter
+    int                                *result	///< Response parameter
+);
+
+/******************************************************************************\
+ *                                                                            *
+ * ns1__prune_USCOREobject                                                    *
+ *                                                                            *
+\******************************************************************************/
+
+
+/// Operation "ns1__prune_USCOREobject" of service binding "SOAP"
+
+/**
+
+Operation details:
+
+  - SOAP RPC encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+  - SOAP action="urn:Nebulous/Server/SOAP#prune_object"
+
+C stub function (defined in soapClient.c[pp] generated by soapcpp2):
+@code
+  int soap_call_ns1__prune_USCOREobject(
+    struct soap *soap,
+    NULL, // char *endpoint = NULL selects default endpoint for this operation
+    NULL, // char *action = NULL selects default action for this operation
+    // request parameters:
+    char*                               key,
+    // response parameters:
+    int                                *result
+  );
+@endcode
+
+C server function (called from the service dispatcher defined in soapServer.c[pp]):
+@code
+  int ns1__prune_USCOREobject(
+    struct soap *soap,
+    // request parameters:
+    char*                               key,
+    // response parameters:
+    int                                *result
+  );
+@endcode
+
+*/
+
+//gsoap ns1  service method-style:	prune_USCOREobject rpc
+//gsoap ns1  service method-encoding:	prune_USCOREobject http://schemas.xmlsoap.org/soap/encoding/
+//gsoap ns1  service method-action:	prune_USCOREobject urn:Nebulous/Server/SOAP#prune_object
+int ns1__prune_USCOREobject(
+    char*                               key,	///< Request parameter
+    int                                *result	///< Response parameter
+);
+
 /* End of src/nebulous.h */
Index: branches/pap/Nebulous/nebclient/src/soapC.c
===================================================================
--- branches/pap/Nebulous/nebclient/src/soapC.c	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/soapC.c	(revision 25027)
@@ -12,5 +12,5 @@
 #endif
 
-SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-04-20 22:15:22 GMT")
+SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-07-25 01:30:29 GMT")
 
 
@@ -161,4 +161,12 @@
 	case SOAP_TYPE_int:
 		return soap_in_int(soap, NULL, NULL, "xsd:int");
+	case SOAP_TYPE_ns1__prune_USCOREobject:
+		return soap_in_ns1__prune_USCOREobject(soap, NULL, NULL, "ns1:prune_object");
+	case SOAP_TYPE_ns1__prune_USCOREobjectResponse:
+		return soap_in_ns1__prune_USCOREobjectResponse(soap, NULL, NULL, "ns1:prune_objectResponse");
+	case SOAP_TYPE_ns1__chmod_USCOREobject:
+		return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, "ns1:chmod_object");
+	case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
+		return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, "ns1:chmod_objectResponse");
 	case SOAP_TYPE_ns1__stat_USCOREobject:
 		return soap_in_ns1__stat_USCOREobject(soap, NULL, NULL, "ns1:stat_object");
@@ -250,4 +258,20 @@
 			return soap_in_int(soap, NULL, NULL, NULL);
 		}
+		if (!soap_match_tag(soap, t, "ns1:prune_object"))
+		{	*type = SOAP_TYPE_ns1__prune_USCOREobject;
+			return soap_in_ns1__prune_USCOREobject(soap, NULL, NULL, NULL);
+		}
+		if (!soap_match_tag(soap, t, "ns1:prune_objectResponse"))
+		{	*type = SOAP_TYPE_ns1__prune_USCOREobjectResponse;
+			return soap_in_ns1__prune_USCOREobjectResponse(soap, NULL, NULL, NULL);
+		}
+		if (!soap_match_tag(soap, t, "ns1:chmod_object"))
+		{	*type = SOAP_TYPE_ns1__chmod_USCOREobject;
+			return soap_in_ns1__chmod_USCOREobject(soap, NULL, NULL, NULL);
+		}
+		if (!soap_match_tag(soap, t, "ns1:chmod_objectResponse"))
+		{	*type = SOAP_TYPE_ns1__chmod_USCOREobjectResponse;
+			return soap_in_ns1__chmod_USCOREobjectResponse(soap, NULL, NULL, NULL);
+		}
 		if (!soap_match_tag(soap, t, "ns1:stat_object"))
 		{	*type = SOAP_TYPE_ns1__stat_USCOREobject;
@@ -440,4 +464,12 @@
 	case SOAP_TYPE_int:
 		return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int");
+	case SOAP_TYPE_ns1__prune_USCOREobject:
+		return soap_out_ns1__prune_USCOREobject(soap, tag, id, (const struct ns1__prune_USCOREobject *)ptr, "ns1:prune_object");
+	case SOAP_TYPE_ns1__prune_USCOREobjectResponse:
+		return soap_out_ns1__prune_USCOREobjectResponse(soap, tag, id, (const struct ns1__prune_USCOREobjectResponse *)ptr, "ns1:prune_objectResponse");
+	case SOAP_TYPE_ns1__chmod_USCOREobject:
+		return soap_out_ns1__chmod_USCOREobject(soap, tag, id, (const struct ns1__chmod_USCOREobject *)ptr, "ns1:chmod_object");
+	case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
+		return soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, (const struct ns1__chmod_USCOREobjectResponse *)ptr, "ns1:chmod_objectResponse");
 	case SOAP_TYPE_ns1__stat_USCOREobject:
 		return soap_out_ns1__stat_USCOREobject(soap, tag, id, (const struct ns1__stat_USCOREobject *)ptr, "ns1:stat_object");
@@ -527,4 +559,16 @@
 	switch (type)
 	{
+	case SOAP_TYPE_ns1__prune_USCOREobject:
+		soap_serialize_ns1__prune_USCOREobject(soap, (const struct ns1__prune_USCOREobject *)ptr);
+		break;
+	case SOAP_TYPE_ns1__prune_USCOREobjectResponse:
+		soap_serialize_ns1__prune_USCOREobjectResponse(soap, (const struct ns1__prune_USCOREobjectResponse *)ptr);
+		break;
+	case SOAP_TYPE_ns1__chmod_USCOREobject:
+		soap_serialize_ns1__chmod_USCOREobject(soap, (const struct ns1__chmod_USCOREobject *)ptr);
+		break;
+	case SOAP_TYPE_ns1__chmod_USCOREobjectResponse:
+		soap_serialize_ns1__chmod_USCOREobjectResponse(soap, (const struct ns1__chmod_USCOREobjectResponse *)ptr);
+		break;
 	case SOAP_TYPE_ns1__stat_USCOREobject:
 		soap_serialize_ns1__stat_USCOREobject(soap, (const struct ns1__stat_USCOREobject *)ptr);
@@ -1195,4 +1239,310 @@
 #endif
 
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobject(struct soap *soap, struct ns1__prune_USCOREobject *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_default_string(soap, &a->key);
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobject(struct soap *soap, const struct ns1__prune_USCOREobject *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_serialize_string(soap, &a->key);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobject(struct soap *soap, const struct ns1__prune_USCOREobject *a, const char *tag, const char *type)
+{
+	register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__prune_USCOREobject);
+	if (soap_out_ns1__prune_USCOREobject(soap, tag, id, a, type))
+		return soap->error;
+	return soap_putindependent(soap);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__prune_USCOREobject *a, const char *type)
+{
+	if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__prune_USCOREobject), type))
+		return soap->error;
+	if (soap_out_string(soap, "key", -1, &a->key, ""))
+		return soap->error;
+	return soap_element_end_out(soap, tag);
+}
+
+SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_get_ns1__prune_USCOREobject(struct soap *soap, struct ns1__prune_USCOREobject *p, const char *tag, const char *type)
+{
+	if ((p = soap_in_ns1__prune_USCOREobject(soap, tag, p, type)))
+		if (soap_getindependent(soap))
+			return NULL;
+	return p;
+}
+
+SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_in_ns1__prune_USCOREobject(struct soap *soap, const char *tag, struct ns1__prune_USCOREobject *a, const char *type)
+{
+	size_t soap_flag_key = 1;
+	if (soap_element_begin_in(soap, tag, 0, type))
+		return NULL;
+	a = (struct ns1__prune_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__prune_USCOREobject, sizeof(struct ns1__prune_USCOREobject), 0, NULL, NULL, NULL);
+	if (!a)
+		return NULL;
+	soap_default_ns1__prune_USCOREobject(soap, a);
+	if (soap->body && !*soap->href)
+	{
+		for (;;)
+		{	soap->error = SOAP_TAG_MISMATCH;
+			if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
+				if (soap_in_string(soap, "key", &a->key, "xsd:string"))
+				{	soap_flag_key--;
+					continue;
+				}
+			if (soap->error == SOAP_TAG_MISMATCH)
+				soap->error = soap_ignore_element(soap);
+			if (soap->error == SOAP_NO_TAG)
+				break;
+			if (soap->error)
+				return NULL;
+		}
+		if (soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	else
+	{	a = (struct ns1__prune_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__prune_USCOREobject, 0, sizeof(struct ns1__prune_USCOREobject), 0, NULL);
+		if (soap->body && soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	return a;
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobjectResponse(struct soap *soap, struct ns1__prune_USCOREobjectResponse *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	a->result = NULL;
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobjectResponse(struct soap *soap, const struct ns1__prune_USCOREobjectResponse *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_serialize_PointerToint(soap, &a->result);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobjectResponse(struct soap *soap, const struct ns1__prune_USCOREobjectResponse *a, const char *tag, const char *type)
+{
+	register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__prune_USCOREobjectResponse);
+	if (soap_out_ns1__prune_USCOREobjectResponse(soap, tag, id, a, type))
+		return soap->error;
+	return soap_putindependent(soap);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__prune_USCOREobjectResponse *a, const char *type)
+{
+	if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__prune_USCOREobjectResponse), type))
+		return soap->error;
+	if (soap_out_PointerToint(soap, "result", -1, &a->result, ""))
+		return soap->error;
+	return soap_element_end_out(soap, tag);
+}
+
+SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__prune_USCOREobjectResponse(struct soap *soap, struct ns1__prune_USCOREobjectResponse *p, const char *tag, const char *type)
+{
+	if ((p = soap_in_ns1__prune_USCOREobjectResponse(soap, tag, p, type)))
+		if (soap_getindependent(soap))
+			return NULL;
+	return p;
+}
+
+SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__prune_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__prune_USCOREobjectResponse *a, const char *type)
+{
+	size_t soap_flag_result = 1;
+	if (soap_element_begin_in(soap, tag, 0, type))
+		return NULL;
+	a = (struct ns1__prune_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__prune_USCOREobjectResponse, sizeof(struct ns1__prune_USCOREobjectResponse), 0, NULL, NULL, NULL);
+	if (!a)
+		return NULL;
+	soap_default_ns1__prune_USCOREobjectResponse(soap, a);
+	if (soap->body && !*soap->href)
+	{
+		for (;;)
+		{	soap->error = SOAP_TAG_MISMATCH;
+			if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH)
+				if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int"))
+				{	soap_flag_result--;
+					continue;
+				}
+			if (soap->error == SOAP_TAG_MISMATCH)
+				soap->error = soap_ignore_element(soap);
+			if (soap->error == SOAP_NO_TAG)
+				break;
+			if (soap->error)
+				return NULL;
+		}
+		if (soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	else
+	{	a = (struct ns1__prune_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__prune_USCOREobjectResponse, 0, sizeof(struct ns1__prune_USCOREobjectResponse), 0, NULL);
+		if (soap->body && soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	return a;
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_default_string(soap, &a->key);
+	soap_default_int(soap, &a->mode);
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_serialize_string(soap, &a->key);
+	soap_embedded(soap, &a->mode, SOAP_TYPE_int);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap *soap, const struct ns1__chmod_USCOREobject *a, const char *tag, const char *type)
+{
+	register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobject);
+	if (soap_out_ns1__chmod_USCOREobject(soap, tag, id, a, type))
+		return soap->error;
+	return soap_putindependent(soap);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobject *a, const char *type)
+{
+	if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobject), type))
+		return soap->error;
+	if (soap_out_string(soap, "key", -1, &a->key, ""))
+		return soap->error;
+	if (soap_out_int(soap, "mode", -1, &a->mode, ""))
+		return soap->error;
+	return soap_element_end_out(soap, tag);
+}
+
+SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap *soap, struct ns1__chmod_USCOREobject *p, const char *tag, const char *type)
+{
+	if ((p = soap_in_ns1__chmod_USCOREobject(soap, tag, p, type)))
+		if (soap_getindependent(soap))
+			return NULL;
+	return p;
+}
+
+SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobject *a, const char *type)
+{
+	size_t soap_flag_key = 1;
+	size_t soap_flag_mode = 1;
+	if (soap_element_begin_in(soap, tag, 0, type))
+		return NULL;
+	a = (struct ns1__chmod_USCOREobject *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobject, sizeof(struct ns1__chmod_USCOREobject), 0, NULL, NULL, NULL);
+	if (!a)
+		return NULL;
+	soap_default_ns1__chmod_USCOREobject(soap, a);
+	if (soap->body && !*soap->href)
+	{
+		for (;;)
+		{	soap->error = SOAP_TAG_MISMATCH;
+			if (soap_flag_key && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG))
+				if (soap_in_string(soap, "key", &a->key, "xsd:string"))
+				{	soap_flag_key--;
+					continue;
+				}
+			if (soap_flag_mode && soap->error == SOAP_TAG_MISMATCH)
+				if (soap_in_int(soap, "mode", &a->mode, "xsd:int"))
+				{	soap_flag_mode--;
+					continue;
+				}
+			if (soap->error == SOAP_TAG_MISMATCH)
+				soap->error = soap_ignore_element(soap);
+			if (soap->error == SOAP_NO_TAG)
+				break;
+			if (soap->error)
+				return NULL;
+		}
+		if (soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	else
+	{	a = (struct ns1__chmod_USCOREobject *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobject, 0, sizeof(struct ns1__chmod_USCOREobject), 0, NULL);
+		if (soap->body && soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_mode > 0))
+	{	soap->error = SOAP_OCCURS;
+		return NULL;
+	}
+	return a;
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	a->result = NULL;
+}
+
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a)
+{
+	(void)soap; (void)a; /* appease -Wall -Werror */
+	soap_serialize_PointerToint(soap, &a->result);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap *soap, const struct ns1__chmod_USCOREobjectResponse *a, const char *tag, const char *type)
+{
+	register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__chmod_USCOREobjectResponse);
+	if (soap_out_ns1__chmod_USCOREobjectResponse(soap, tag, id, a, type))
+		return soap->error;
+	return soap_putindependent(soap);
+}
+
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, int id, const struct ns1__chmod_USCOREobjectResponse *a, const char *type)
+{
+	if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse), type))
+		return soap->error;
+	if (soap_out_PointerToint(soap, "result", -1, &a->result, ""))
+		return soap->error;
+	return soap_element_end_out(soap, tag);
+}
+
+SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap *soap, struct ns1__chmod_USCOREobjectResponse *p, const char *tag, const char *type)
+{
+	if ((p = soap_in_ns1__chmod_USCOREobjectResponse(soap, tag, p, type)))
+		if (soap_getindependent(soap))
+			return NULL;
+	return p;
+}
+
+SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap *soap, const char *tag, struct ns1__chmod_USCOREobjectResponse *a, const char *type)
+{
+	size_t soap_flag_result = 1;
+	if (soap_element_begin_in(soap, tag, 0, type))
+		return NULL;
+	a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL, NULL, NULL);
+	if (!a)
+		return NULL;
+	soap_default_ns1__chmod_USCOREobjectResponse(soap, a);
+	if (soap->body && !*soap->href)
+	{
+		for (;;)
+		{	soap->error = SOAP_TAG_MISMATCH;
+			if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH)
+				if (soap_in_PointerToint(soap, "result", &a->result, "xsd:int"))
+				{	soap_flag_result--;
+					continue;
+				}
+			if (soap->error == SOAP_TAG_MISMATCH)
+				soap->error = soap_ignore_element(soap);
+			if (soap->error == SOAP_NO_TAG)
+				break;
+			if (soap->error)
+				return NULL;
+		}
+		if (soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	else
+	{	a = (struct ns1__chmod_USCOREobjectResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__chmod_USCOREobjectResponse, 0, sizeof(struct ns1__chmod_USCOREobjectResponse), 0, NULL);
+		if (soap->body && soap_element_end_in(soap, tag))
+			return NULL;
+	}
+	return a;
+}
+
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__stat_USCOREobject(struct soap *soap, struct ns1__stat_USCOREobject *a)
 {
Index: branches/pap/Nebulous/nebclient/src/soapClient.c
===================================================================
--- branches/pap/Nebulous/nebclient/src/soapClient.c	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/soapClient.c	(revision 25027)
@@ -10,5 +10,5 @@
 #endif
 
-SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-04-20 22:15:21 GMT")
+SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-07-25 01:30:29 GMT")
 
 
@@ -812,4 +812,119 @@
 }
 
+SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result)
+{	struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject;
+	struct ns1__chmod_USCOREobjectResponse *soap_tmp_ns1__chmod_USCOREobjectResponse;
+	if (!soap_endpoint)
+		soap_endpoint = "http://localhost:80/nebulous";
+	if (!soap_action)
+		soap_action = "urn:Nebulous/Server/SOAP#chmod_object";
+	soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
+	soap_tmp_ns1__chmod_USCOREobject.key = key;
+	soap_tmp_ns1__chmod_USCOREobject.mode = mode;
+	soap_begin(soap);
+	soap_serializeheader(soap);
+	soap_serialize_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject);
+	if (soap_begin_count(soap))
+		return soap->error;
+	if (soap->mode & SOAP_IO_LENGTH)
+	{	if (soap_envelope_begin_out(soap)
+		 || soap_putheader(soap)
+		 || soap_body_begin_out(soap)
+		 || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "")
+		 || soap_body_end_out(soap)
+		 || soap_envelope_end_out(soap))
+			 return soap->error;
+	}
+	if (soap_end_count(soap))
+		return soap->error;
+	if (soap_connect(soap, soap_endpoint, soap_action)
+	 || soap_envelope_begin_out(soap)
+	 || soap_putheader(soap)
+	 || soap_body_begin_out(soap)
+	 || soap_put_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", "")
+	 || soap_body_end_out(soap)
+	 || soap_envelope_end_out(soap)
+	 || soap_end_send(soap))
+		return soap_closesock(soap);
+	if (!result)
+		return soap_closesock(soap);
+	soap_default_int(soap, result);
+	if (soap_begin_recv(soap)
+	 || soap_envelope_begin_in(soap)
+	 || soap_recv_header(soap)
+	 || soap_body_begin_in(soap))
+		return soap_closesock(soap);
+	soap_tmp_ns1__chmod_USCOREobjectResponse = soap_get_ns1__chmod_USCOREobjectResponse(soap, NULL, "ns1:chmod_objectResponse", "");
+	if (soap->error)
+	{	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
+			return soap_recv_fault(soap);
+		return soap_closesock(soap);
+	}
+	if (soap_body_end_in(soap)
+	 || soap_envelope_end_in(soap)
+	 || soap_end_recv(soap))
+		return soap_closesock(soap);
+	if (result && soap_tmp_ns1__chmod_USCOREobjectResponse->result)
+		*result = *soap_tmp_ns1__chmod_USCOREobjectResponse->result;
+	return soap_closesock(soap);
+}
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__prune_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int *result)
+{	struct ns1__prune_USCOREobject soap_tmp_ns1__prune_USCOREobject;
+	struct ns1__prune_USCOREobjectResponse *soap_tmp_ns1__prune_USCOREobjectResponse;
+	if (!soap_endpoint)
+		soap_endpoint = "http://localhost:80/nebulous";
+	if (!soap_action)
+		soap_action = "urn:Nebulous/Server/SOAP#prune_object";
+	soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
+	soap_tmp_ns1__prune_USCOREobject.key = key;
+	soap_begin(soap);
+	soap_serializeheader(soap);
+	soap_serialize_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject);
+	if (soap_begin_count(soap))
+		return soap->error;
+	if (soap->mode & SOAP_IO_LENGTH)
+	{	if (soap_envelope_begin_out(soap)
+		 || soap_putheader(soap)
+		 || soap_body_begin_out(soap)
+		 || soap_put_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", "")
+		 || soap_body_end_out(soap)
+		 || soap_envelope_end_out(soap))
+			 return soap->error;
+	}
+	if (soap_end_count(soap))
+		return soap->error;
+	if (soap_connect(soap, soap_endpoint, soap_action)
+	 || soap_envelope_begin_out(soap)
+	 || soap_putheader(soap)
+	 || soap_body_begin_out(soap)
+	 || soap_put_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", "")
+	 || soap_body_end_out(soap)
+	 || soap_envelope_end_out(soap)
+	 || soap_end_send(soap))
+		return soap_closesock(soap);
+	if (!result)
+		return soap_closesock(soap);
+	soap_default_int(soap, result);
+	if (soap_begin_recv(soap)
+	 || soap_envelope_begin_in(soap)
+	 || soap_recv_header(soap)
+	 || soap_body_begin_in(soap))
+		return soap_closesock(soap);
+	soap_tmp_ns1__prune_USCOREobjectResponse = soap_get_ns1__prune_USCOREobjectResponse(soap, NULL, "ns1:prune_objectResponse", "");
+	if (soap->error)
+	{	if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2)
+			return soap_recv_fault(soap);
+		return soap_closesock(soap);
+	}
+	if (soap_body_end_in(soap)
+	 || soap_envelope_end_in(soap)
+	 || soap_end_recv(soap))
+		return soap_closesock(soap);
+	if (result && soap_tmp_ns1__prune_USCOREobjectResponse->result)
+		*result = *soap_tmp_ns1__prune_USCOREobjectResponse->result;
+	return soap_closesock(soap);
+}
+
 #ifdef __cplusplus
 }
Index: branches/pap/Nebulous/nebclient/src/soapH.h
===================================================================
--- branches/pap/Nebulous/nebclient/src/soapH.h	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/soapH.h	(revision 25027)
@@ -42,5 +42,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Fault
-#define SOAP_TYPE_SOAP_ENV__Fault (64)
+#define SOAP_TYPE_SOAP_ENV__Fault (70)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *);
@@ -56,5 +56,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Reason
-#define SOAP_TYPE_SOAP_ENV__Reason (63)
+#define SOAP_TYPE_SOAP_ENV__Reason (69)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *);
@@ -70,5 +70,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Detail
-#define SOAP_TYPE_SOAP_ENV__Detail (60)
+#define SOAP_TYPE_SOAP_ENV__Detail (66)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *);
@@ -84,5 +84,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Code
-#define SOAP_TYPE_SOAP_ENV__Code (58)
+#define SOAP_TYPE_SOAP_ENV__Code (64)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *);
@@ -98,5 +98,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Header
-#define SOAP_TYPE_SOAP_ENV__Header (57)
+#define SOAP_TYPE_SOAP_ENV__Header (63)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *);
@@ -109,4 +109,44 @@
 #endif
 
+#ifndef SOAP_TYPE_ns1__prune_USCOREobject
+#define SOAP_TYPE_ns1__prune_USCOREobject (62)
+#endif
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *);
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *);
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobject(struct soap*, const struct ns1__prune_USCOREobject *, const char*, const char*);
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobject(struct soap*, const char*, int, const struct ns1__prune_USCOREobject *, const char*);
+SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_get_ns1__prune_USCOREobject(struct soap*, struct ns1__prune_USCOREobject *, const char*, const char*);
+SOAP_FMAC3 struct ns1__prune_USCOREobject * SOAP_FMAC4 soap_in_ns1__prune_USCOREobject(struct soap*, const char*, struct ns1__prune_USCOREobject *, const char*);
+
+#ifndef SOAP_TYPE_ns1__prune_USCOREobjectResponse
+#define SOAP_TYPE_ns1__prune_USCOREobjectResponse (61)
+#endif
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *);
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *);
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__prune_USCOREobjectResponse(struct soap*, const struct ns1__prune_USCOREobjectResponse *, const char*, const char*);
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__prune_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__prune_USCOREobjectResponse *, const char*);
+SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__prune_USCOREobjectResponse(struct soap*, struct ns1__prune_USCOREobjectResponse *, const char*, const char*);
+SOAP_FMAC3 struct ns1__prune_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__prune_USCOREobjectResponse(struct soap*, const char*, struct ns1__prune_USCOREobjectResponse *, const char*);
+
+#ifndef SOAP_TYPE_ns1__chmod_USCOREobject
+#define SOAP_TYPE_ns1__chmod_USCOREobject (59)
+#endif
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *);
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *);
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobject(struct soap*, const struct ns1__chmod_USCOREobject *, const char*, const char*);
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobject(struct soap*, const char*, int, const struct ns1__chmod_USCOREobject *, const char*);
+SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobject(struct soap*, struct ns1__chmod_USCOREobject *, const char*, const char*);
+SOAP_FMAC3 struct ns1__chmod_USCOREobject * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobject(struct soap*, const char*, struct ns1__chmod_USCOREobject *, const char*);
+
+#ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse
+#define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58)
+#endif
+SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *);
+SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *);
+SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__chmod_USCOREobjectResponse(struct soap*, const struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
+SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, int, const struct ns1__chmod_USCOREobjectResponse *, const char*);
+SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_get_ns1__chmod_USCOREobjectResponse(struct soap*, struct ns1__chmod_USCOREobjectResponse *, const char*, const char*);
+SOAP_FMAC3 struct ns1__chmod_USCOREobjectResponse * SOAP_FMAC4 soap_in_ns1__chmod_USCOREobjectResponse(struct soap*, const char*, struct ns1__chmod_USCOREobjectResponse *, const char*);
+
 #ifndef SOAP_TYPE_ns1__stat_USCOREobject
 #define SOAP_TYPE_ns1__stat_USCOREobject (56)
@@ -402,5 +442,5 @@
 
 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason
-#define SOAP_TYPE_PointerToSOAP_ENV__Reason (66)
+#define SOAP_TYPE_PointerToSOAP_ENV__Reason (72)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*);
@@ -415,5 +455,5 @@
 
 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail
-#define SOAP_TYPE_PointerToSOAP_ENV__Detail (65)
+#define SOAP_TYPE_PointerToSOAP_ENV__Detail (71)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*);
@@ -428,5 +468,5 @@
 
 #ifndef SOAP_TYPE_PointerToSOAP_ENV__Code
-#define SOAP_TYPE_PointerToSOAP_ENV__Code (59)
+#define SOAP_TYPE_PointerToSOAP_ENV__Code (65)
 #endif
 SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*);
Index: branches/pap/Nebulous/nebclient/src/soapServer.c
===================================================================
--- branches/pap/Nebulous/nebclient/src/soapServer.c	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/soapServer.c	(revision 25027)
@@ -10,5 +10,5 @@
 #endif
 
-SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-04-20 22:15:21 GMT")
+SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-07-25 01:30:29 GMT")
 
 
@@ -105,4 +105,8 @@
 	if (!soap_match_tag(soap, soap->tag, "ns1:stat_object"))
 		return soap_serve_ns1__stat_USCOREobject(soap);
+	if (!soap_match_tag(soap, soap->tag, "ns1:chmod_object"))
+		return soap_serve_ns1__chmod_USCOREobject(soap);
+	if (!soap_match_tag(soap, soap->tag, "ns1:prune_object"))
+		return soap_serve_ns1__prune_USCOREobject(soap);
 	return soap->error = SOAP_NO_METHOD;
 }
@@ -713,4 +717,92 @@
 }
 
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap *soap)
+{	struct ns1__chmod_USCOREobject soap_tmp_ns1__chmod_USCOREobject;
+	struct ns1__chmod_USCOREobjectResponse soap_tmp_ns1__chmod_USCOREobjectResponse;
+	int soap_tmp_int;
+	soap_default_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse);
+	soap_default_int(soap, &soap_tmp_int);
+	soap_tmp_ns1__chmod_USCOREobjectResponse.result = &soap_tmp_int;
+	soap_default_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject);
+	soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
+	if (!soap_get_ns1__chmod_USCOREobject(soap, &soap_tmp_ns1__chmod_USCOREobject, "ns1:chmod_object", NULL))
+		return soap->error;
+	if (soap_body_end_in(soap)
+	 || soap_envelope_end_in(soap)
+	 || soap_end_recv(soap))
+		return soap->error;
+	soap->error = ns1__chmod_USCOREobject(soap, soap_tmp_ns1__chmod_USCOREobject.key, soap_tmp_ns1__chmod_USCOREobject.mode, &soap_tmp_int);
+	if (soap->error)
+		return soap->error;
+	soap_serializeheader(soap);
+	soap_serialize_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse);
+	if (soap_begin_count(soap))
+		return soap->error;
+	if (soap->mode & SOAP_IO_LENGTH)
+	{	if (soap_envelope_begin_out(soap)
+		 || soap_putheader(soap)
+		 || soap_body_begin_out(soap)
+		 || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "")
+		 || soap_body_end_out(soap)
+		 || soap_envelope_end_out(soap))
+			 return soap->error;
+	};
+	if (soap_end_count(soap)
+	 || soap_response(soap, SOAP_OK)
+	 || soap_envelope_begin_out(soap)
+	 || soap_putheader(soap)
+	 || soap_body_begin_out(soap)
+	 || soap_put_ns1__chmod_USCOREobjectResponse(soap, &soap_tmp_ns1__chmod_USCOREobjectResponse, "ns1:chmod_objectResponse", "")
+	 || soap_body_end_out(soap)
+	 || soap_envelope_end_out(soap)
+	 || soap_end_send(soap))
+		return soap->error;
+	return soap_closesock(soap);
+}
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__prune_USCOREobject(struct soap *soap)
+{	struct ns1__prune_USCOREobject soap_tmp_ns1__prune_USCOREobject;
+	struct ns1__prune_USCOREobjectResponse soap_tmp_ns1__prune_USCOREobjectResponse;
+	int soap_tmp_int;
+	soap_default_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse);
+	soap_default_int(soap, &soap_tmp_int);
+	soap_tmp_ns1__prune_USCOREobjectResponse.result = &soap_tmp_int;
+	soap_default_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject);
+	soap->encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/";
+	if (!soap_get_ns1__prune_USCOREobject(soap, &soap_tmp_ns1__prune_USCOREobject, "ns1:prune_object", NULL))
+		return soap->error;
+	if (soap_body_end_in(soap)
+	 || soap_envelope_end_in(soap)
+	 || soap_end_recv(soap))
+		return soap->error;
+	soap->error = ns1__prune_USCOREobject(soap, soap_tmp_ns1__prune_USCOREobject.key, &soap_tmp_int);
+	if (soap->error)
+		return soap->error;
+	soap_serializeheader(soap);
+	soap_serialize_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse);
+	if (soap_begin_count(soap))
+		return soap->error;
+	if (soap->mode & SOAP_IO_LENGTH)
+	{	if (soap_envelope_begin_out(soap)
+		 || soap_putheader(soap)
+		 || soap_body_begin_out(soap)
+		 || soap_put_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse, "ns1:prune_objectResponse", "")
+		 || soap_body_end_out(soap)
+		 || soap_envelope_end_out(soap))
+			 return soap->error;
+	};
+	if (soap_end_count(soap)
+	 || soap_response(soap, SOAP_OK)
+	 || soap_envelope_begin_out(soap)
+	 || soap_putheader(soap)
+	 || soap_body_begin_out(soap)
+	 || soap_put_ns1__prune_USCOREobjectResponse(soap, &soap_tmp_ns1__prune_USCOREobjectResponse, "ns1:prune_objectResponse", "")
+	 || soap_body_end_out(soap)
+	 || soap_envelope_end_out(soap)
+	 || soap_end_send(soap))
+		return soap->error;
+	return soap_closesock(soap);
+}
+
 #ifdef __cplusplus
 }
Index: branches/pap/Nebulous/nebclient/src/soapStub.h
===================================================================
--- branches/pap/Nebulous/nebclient/src/soapStub.h	(revision 23948)
+++ branches/pap/Nebulous/nebclient/src/soapStub.h	(revision 25027)
@@ -306,6 +306,43 @@
 #endif
 
+#ifndef SOAP_TYPE_ns1__chmod_USCOREobjectResponse
+#define SOAP_TYPE_ns1__chmod_USCOREobjectResponse (58)
+/* ns1:chmod_objectResponse */
+struct ns1__chmod_USCOREobjectResponse
+{
+	int *result;	/* SOAP 1.2 RPC return element (when namespace qualified) */	/* optional element of type xsd:int */
+};
+#endif
+
+#ifndef SOAP_TYPE_ns1__chmod_USCOREobject
+#define SOAP_TYPE_ns1__chmod_USCOREobject (59)
+/* ns1:chmod_object */
+struct ns1__chmod_USCOREobject
+{
+	char *key;	/* optional element of type xsd:string */
+	int mode;	/* required element of type xsd:int */
+};
+#endif
+
+#ifndef SOAP_TYPE_ns1__prune_USCOREobjectResponse
+#define SOAP_TYPE_ns1__prune_USCOREobjectResponse (61)
+/* ns1:prune_objectResponse */
+struct ns1__prune_USCOREobjectResponse
+{
+	int *result;	/* SOAP 1.2 RPC return element (when namespace qualified) */	/* optional element of type xsd:int */
+};
+#endif
+
+#ifndef SOAP_TYPE_ns1__prune_USCOREobject
+#define SOAP_TYPE_ns1__prune_USCOREobject (62)
+/* ns1:prune_object */
+struct ns1__prune_USCOREobject
+{
+	char *key;	/* optional element of type xsd:string */
+};
+#endif
+
 #ifndef SOAP_TYPE_SOAP_ENV__Header
-#define SOAP_TYPE_SOAP_ENV__Header (57)
+#define SOAP_TYPE_SOAP_ENV__Header (63)
 /* SOAP Header: */
 struct SOAP_ENV__Header
@@ -318,5 +355,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Code
-#define SOAP_TYPE_SOAP_ENV__Code (58)
+#define SOAP_TYPE_SOAP_ENV__Code (64)
 /* SOAP Fault Code: */
 struct SOAP_ENV__Code
@@ -328,5 +365,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Detail
-#define SOAP_TYPE_SOAP_ENV__Detail (60)
+#define SOAP_TYPE_SOAP_ENV__Detail (66)
 /* SOAP-ENV:Detail */
 struct SOAP_ENV__Detail
@@ -339,5 +376,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Reason
-#define SOAP_TYPE_SOAP_ENV__Reason (63)
+#define SOAP_TYPE_SOAP_ENV__Reason (69)
 /* SOAP-ENV:Reason */
 struct SOAP_ENV__Reason
@@ -348,5 +385,5 @@
 
 #ifndef SOAP_TYPE_SOAP_ENV__Fault
-#define SOAP_TYPE_SOAP_ENV__Fault (64)
+#define SOAP_TYPE_SOAP_ENV__Fault (70)
 /* SOAP Fault: */
 struct SOAP_ENV__Fault
@@ -437,4 +474,8 @@
 SOAP_FMAC5 int SOAP_FMAC6 ns1__stat_USCOREobject(struct soap*, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
 
+SOAP_FMAC5 int SOAP_FMAC6 ns1__chmod_USCOREobject(struct soap*, char *key, int mode, int *result);
+
+SOAP_FMAC5 int SOAP_FMAC6 ns1__prune_USCOREobject(struct soap*, char *key, int *result);
+
 /******************************************************************************\
  *                                                                            *
@@ -472,4 +513,8 @@
 SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__stat_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, struct ns1__stat_USCOREobjectResponse *_param_4);
 
+SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__chmod_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int mode, int *result);
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__prune_USCOREobject(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *key, int *result);
+
 /******************************************************************************\
  *                                                                            *
@@ -509,4 +554,8 @@
 
 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__stat_USCOREobject(struct soap*);
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__chmod_USCOREobject(struct soap*);
+
+SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__prune_USCOREobject(struct soap*);
 
 #ifdef __cplusplus
Index: branches/pap/Nebulous/nebclient/tests/tests.c
===================================================================
--- branches/pap/Nebulous/nebclient/tests/tests.c	(revision 23948)
+++ branches/pap/Nebulous/nebclient/tests/tests.c	(revision 25027)
@@ -20,5 +20,5 @@
     char            *key = "foobarbaz";
 
-    plan_tests(28);
+    plan_tests(31);
 
     if (getenv("NEB_SERVER")) {
@@ -98,10 +98,9 @@
 
     char *copies = nebGetXattr(server, key, "user.copies");
-    neb_ok(server, strcmp(copies, "2") == 0, "get user.copies xattr");
+    neb_ok(server, copies != NULL && strcmp(copies, "2") == 0, "get user.copies xattr");
     char **xattrs = NULL;
     int n_xattrs = nebListXattr(server, key, &xattrs);
-    printf("# %s\n\n", xattrs[0]);
-    neb_ok(server, n_xattrs == 1, "count of xattrs");
-    neb_ok(server, strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists");
+    neb_ok(server, xattrs != NULL && n_xattrs == 1, "count of xattrs");
+    neb_ok(server, xattrs != NULL && strcmp(xattrs[0], "user.copies") == 0, "user.copies xattr exists");
     neb_ok(server, nebRemoveXattr(server, key, "user.copies"), "remove user.copies xattr");
 
@@ -136,4 +135,12 @@
     neb_ok(server, nebMove(server, "copyiedfile", "movedfile"), "move object");
 
+    neb_ok(server, nebChmod(server, "movedfile", 0440) == 0, "chmod object");
+
+    // no dead instances to remove
+    neb_ok(server, nebPrune(server, "movedfile") == 0, "prune object");
+
+    nebReplicate(server, key, NULL, NULL);
+    neb_ok(server, nebThereCanBeOnlyOne(server, "movedfile", NULL) == 0, "reduce instances to only 1");
+
     if (!nebDelete(server, "movedfile")) {
         diag( "cleanup failed %s\n", nebErr(server));
