MCPcopy Create free account
hub / github.com/apache/httpd / dav_fs_load_lock_record

Function dav_fs_load_lock_record

modules/dav/fs/lock.c:521–661  ·  view source on GitHub ↗

** dav_load_lock_record: Reads lock information about key from lock db; ** creates linked lists of the direct and indirect locks. ** ** If add_method = DAV_APPEND_LIST, the result will be appended to the ** head of the direct and indirect lists supplied. ** ** Passive lock removal: If lock has timed out, it will not be returned. ** ### How much "logging" does RFC 2518 require? */

Source from the content-addressed store, hash-verified

519** ### How much "logging" does RFC 2518 require?
520*/
521static dav_error * dav_fs_load_lock_record(dav_lockdb *lockdb, apr_datum_t key,
522 int add_method,
523 dav_lock_discovery **direct,
524 dav_lock_indirect **indirect)
525{
526 apr_pool_t *p = lockdb->info->pool;
527 dav_error *err;
528 apr_size_t offset = 0;
529 int need_save = DAV_FALSE;
530 apr_datum_t val = { 0 };
531 dav_lock_discovery *dp;
532 dav_lock_indirect *ip;
533 dav_buffer buf = { 0 };
534
535 if (add_method != DAV_APPEND_LIST) {
536 *direct = NULL;
537 *indirect = NULL;
538 }
539
540 if ((err = dav_fs_really_open_lockdb(lockdb)) != NULL) {
541 /* ### add a higher-level error? */
542 return err;
543 }
544
545 /*
546 ** If we opened readonly and the db wasn't there, then there are no
547 ** locks for this resource. Just exit.
548 */
549 if (lockdb->info->db == NULL)
550 return NULL;
551
552 if ((err = dav_dbm_fetch(lockdb->info->db, key, &val)) != NULL)
553 return err;
554
555 if (!val.dsize)
556 return NULL;
557
558 while (offset < val.dsize) {
559 switch (*(val.dptr + offset++)) {
560 case DAV_LOCK_DIRECT:
561 /* Create and fill a dav_lock_discovery structure */
562
563 dp = apr_pcalloc(p, sizeof(*dp));
564 memcpy(dp, val.dptr + offset, sizeof(dp->f));
565 offset += sizeof(dp->f);
566 dp->locktoken = apr_pmemdup(p, val.dptr + offset, sizeof(*dp->locktoken));
567 offset += sizeof(*dp->locktoken);
568 if (*(val.dptr + offset) == '\0') {
569 ++offset;
570 }
571 else {
572 dp->owner = apr_pstrdup(p, val.dptr + offset);
573 offset += strlen(dp->owner) + 1;
574 }
575
576 if (*(val.dptr + offset) == '\0') {
577 ++offset;
578 }

Callers 6

dav_fs_resolveFunction · 0.85
dav_fs_get_locksFunction · 0.85
dav_fs_find_lockFunction · 0.85
dav_fs_append_locksFunction · 0.85
dav_fs_remove_lockFunction · 0.85
dav_fs_refresh_locksFunction · 0.85

Calls 7

dav_dbm_fetchFunction · 0.85
dav_fs_lock_expiredFunction · 0.85
dav_dbm_freedatumFunction · 0.85
dav_new_errorFunction · 0.85
dav_fs_save_lock_recordFunction · 0.85

Tested by

no test coverage detected