#include "http_log.h"
#include "apr_file_io.h"
#include "apr_strings.h"
+#include "apr_uuid.h"
#include "mod_dav.h"
-#include "dav_opaquelock.h"
#include "repos.h"
** VALUE
**
** The value consists of a list of elements.
-** DIRECT LOCK: [char (DAV_LOCK_DIRECT),
-** char (dav_lock_scope),
-** char (dav_lock_type),
-** int depth,
-** time_t expires,
-** uuid_t locktoken,
-** char[] owner,
-** char[] auth_user]
+** DIRECT LOCK: [char (DAV_LOCK_DIRECT),
+** char (dav_lock_scope),
+** char (dav_lock_type),
+** int depth,
+** time_t expires,
+** apr_uuid_t locktoken,
+** char[] owner,
+** char[] auth_user]
**
-** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT),
-** uuid_t locktoken,
-** time_t expires,
-** int key_size,
-** char[] key]
+** INDIRECT LOCK: [char (DAV_LOCK_INDIRECT),
+** apr_uuid_t locktoken,
+** time_t expires,
+** int key_size,
+** char[] key]
** The key is to the collection lock that resulted in this indirect lock
*/
** Use the opaquelock scheme for locktokens
*/
struct dav_locktoken {
- uuid_t uuid;
+ apr_uuid_t uuid;
};
+#define dav_compare_locktoken(plt1, plt2) \
+ memcmp(&(plt1)->uuid, &(plt2)->uuid, sizeof((plt1)->uuid))
/* #################################################################
** prefix + Fixed length + lock token + 2 strings + 2 nulls (one for each string)
*/
#define dav_size_direct(a) (1 + sizeof(dav_lock_discovery_fixed) \
- + sizeof(uuid_t) \
+ + sizeof(apr_uuid_t) \
+ ((a)->owner ? strlen((a)->owner) : 0) \
+ ((a)->auth_user ? strlen((a)->auth_user) : 0) \
+ 2)
/* Stored indirect lock info - lock token and dav_datum */
-#define dav_size_indirect(a) (1 + sizeof(uuid_t) \
+#define dav_size_indirect(a) (1 + sizeof(apr_uuid_t) \
+ sizeof(time_t) \
+ sizeof(int) + (a)->key.dsize)
if (locktoken == NULL) {
comb->pub.locktoken = &comb->token;
- dav_create_opaquelocktoken(dav_get_uuid_state(lockdb->info->r),
- &comb->token.uuid);
+ apr_get_uuid(&comb->token.uuid);
}
else {
comb->pub.locktoken = locktoken;
char_token += 16;
locktoken = apr_pcalloc(p, sizeof(*locktoken));
- if (dav_parse_opaquelocktoken(char_token, &locktoken->uuid)) {
+ if (apr_parse_uuid(&locktoken->uuid, char_token)) {
return dav_new_error(p, HTTP_BAD_REQUEST, DAV_ERR_LOCK_PARSE_TOKEN,
"The opaquelocktoken has an incorrect format "
"and could not be parsed.");
apr_pool_t *p,
const dav_locktoken *locktoken)
{
- const char *uuid_token = dav_format_opaquelocktoken(p, &locktoken->uuid);
- return apr_pstrcat(p, "opaquelocktoken:", uuid_token, NULL);
+ char buf[APR_UUID_FORMATTED_LENGTH + 1];
+
+ apr_format_uuid(buf, &locktoken->uuid);
+ return apr_pstrcat(p, "opaquelocktoken:", buf, NULL);
}
/*
const dav_locktoken *lt1,
const dav_locktoken *lt2)
{
- return dav_compare_opaquelocktoken(lt1->uuid, lt2->uuid);
+ return dav_compare_locktoken(lt1, lt2);
}
/*
}
for (; dir != NULL; dir = dir->next) {
- if (!dav_compare_opaquelocktoken(indirect->locktoken->uuid,
- dir->locktoken->uuid)) {
+ if (!dav_compare_locktoken(indirect->locktoken, dir->locktoken)) {
*direct = dir;
return NULL;
}
}
for (; dp != NULL; dp = dp->next) {
- if (!dav_compare_opaquelocktoken(locktoken->uuid,
- dp->locktoken->uuid)) {
+ if (!dav_compare_locktoken(locktoken, dp->locktoken)) {
*lock = dav_fs_alloc_lock(lockdb, key, locktoken);
(*lock)->is_locknull = !resource->exists;
(*lock)->scope = dp->f.scope;
}
for (; ip != NULL; ip = ip->next) {
- if (!dav_compare_opaquelocktoken(locktoken->uuid,
- ip->locktoken->uuid)) {
+ if (!dav_compare_locktoken(locktoken, ip->locktoken)) {
*lock = dav_fs_alloc_lock(lockdb, ip->key, locktoken);
(*lock)->is_locknull = !resource->exists;
}
for (dp = dh; dp != NULL; dp = dp->next) {
- if (dav_compare_opaquelocktoken(locktoken->uuid,
- dp->locktoken->uuid) == 0) {
+ if (dav_compare_locktoken(locktoken, dp->locktoken) == 0) {
if (dprev)
dprev->next = dp->next;
else
}
for (ip = ih; ip != NULL; ip = ip->next) {
- if (dav_compare_opaquelocktoken(locktoken->uuid,
- ip->locktoken->uuid) == 0) {
+ if (dav_compare_locktoken(locktoken, ip->locktoken) == 0) {
if (iprev)
iprev->next = ip->next;
else
int dirty = 0;
for (; ltl != NULL; ltl = ltl->next) {
- if (dav_compare_opaquelocktoken(dp->locktoken->uuid,
- ltl->locktoken->uuid) == 0)
+ if (dav_compare_locktoken(dp->locktoken, ltl->locktoken) == 0)
{
dp->f.timeout = new_time;
dirty = 1;
#include "mod_dav.h"
-#include "dav_opaquelock.h"
-
/* ### what is the best way to set this? */
#define DAV_DEFAULT_PROVIDER "filesystem"
/* per-server configuration */
typedef struct {
- uuid_state st; /* UUID state for opaquelocktoken */
+ int unused;
} dav_server_conf;
newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf));
- dav_create_uuid_state(&newconf->st);
+ /* ### this isn't used at the moment... */
return newconf;
}
static void *dav_merge_server_config(apr_pool_t *p, void *base, void *overrides)
{
+#if 0
dav_server_conf *child = overrides;
+#endif
dav_server_conf *newconf;
newconf = (dav_server_conf *) apr_pcalloc(p, sizeof(*newconf));
- /* ### hmm. we should share the uuid state rather than copy it. if we
- ### do another merge, then we'll just get the old one, rather than
- ### an updated state.
- ### of course... the UUID generation should move into APR
- */
- memcpy(&newconf->st, &child->st, sizeof(newconf->st));
+ /* ### nothing to merge right now... */
return newconf;
}
return newconf;
}
-uuid_state *dav_get_uuid_state(const request_rec *r)
-{
- dav_server_conf *conf;
-
- conf = ap_get_module_config(r->server->module_config, &dav_module);
-
- return &conf->st;
-}
-
apr_table_t *dav_get_dir_params(const request_rec *r)
{
dav_dir_conf *conf;