/* check that locks don't follow copies. */ static int copy(void) { char *dest; int count = 0; PRECOND(gotlock); dest = ne_concat(res, "-copydest", NULL); ne_delete(i_session2, dest); ONNREQ2("could not COPY locked resource", ne_copy(i_session2, 1, NE_DEPTH_ZERO, res, dest)); ONNREQ2("LOCK discovery failed", ne_lock_discover(i_session2, dest, count_discover, &count)); ONV(count != 0, ("found %d locks on copied resource", count)); ONNREQ2("could not delete copy of locked resource", ne_delete(i_session2, dest)); free(dest); return OK; }
static int unlock_on_no_file(void) { //FIXME: After Lock Null is created, Do Unlock it to maintain integrity of tests ONNREQ2("unlock of second shared lock",ne_unlock(i_session, gotlock)); return OK; }
/* take out another shared lock on the resource. */ static int double_sharedlock(void) { struct ne_lock dummy; PRECOND(gotlock); memcpy(&dummy, &reslock, sizeof(reslock)); dummy.token = NULL; dummy.owner = ne_strdup("litmus: notowner_sharedlock"); dummy.scope = ne_lockscope_shared; ONNREQ2("shared LOCK on locked resource", ne_lock(i_session2, &dummy)); ONNREQ2("unlock of second shared lock", ne_unlock(i_session2, &dummy)); return OK; }
static int lock_collection(void) { struct ne_lock dummy; char *tmp,*tmp2; CALL(getlock(ne_lockscope_exclusive, NE_DEPTH_INFINITE)); PRECOND(gotlock); memcpy(&dummy, &reslock, sizeof(reslock)); dummy.token = NULL; dummy.uri.path = collZ; dummy.owner = ne_strdup("litmus: owner lock"); dummy.depth = NE_DEPTH_INFINITE; dummy.type = ne_locktype_write; dummy.scope = ne_lockscope_exclusive; ONNREQ2("LOCK on second collection for further tests", ne_lock(i_session, &dummy)); gotlock = ne_lock_copy(&dummy); ne_lockstore_add(store, gotlock); /* Testing creation of directories under a collection */ ONV(ne_mkcol(i_session, collX), ("MKCOL %s: %s", collX, ne_get_error(i_session))); ONV(ne_mkcol(i_session, collY), ("MKCOL %s: %s", collY, ne_get_error(i_session))); upload_foo("lockcoll/collX/temp"); tmp = ne_concat(collY,"copy-temp",NULL); ONV(ne_copy(i_session, 0, NE_DEPTH_INFINITE, res3,tmp), ("collection COPY `%s' to `%s': %s", res2, tmp, ne_get_error(i_session))); free(tmp); tmp2=ne_concat(collZ,"testing",NULL); ONV(ne_copy(i_session, 0, NE_DEPTH_INFINITE, res3,tmp2), ("collection COPY `%s' to `%s': %s", res2, tmp2, ne_get_error(i_session))); ne_free(res3); res3 = ne_concat(i_path,"not-existing",NULL); /* change res to point to a normal resource for subsequent * {not_,}owner_modify tests */ res = ne_concat(coll, "lockme.txt", NULL); return upload_foo("lockcoll/lockme.txt"); }