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

Function dav_fs_get_locks

modules/dav/fs/lock.c:993–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

991}
992
993static dav_error * dav_fs_get_locks(dav_lockdb *lockdb,
994 const dav_resource *resource,
995 int calltype,
996 dav_lock **locks)
997{
998 apr_pool_t *p = lockdb->info->pool;
999 apr_datum_t key;
1000 dav_error *err;
1001 dav_lock *lock = NULL;
1002 dav_lock *newlock;
1003 dav_lock_discovery *dp;
1004 dav_lock_indirect *ip;
1005
1006#if DAV_DEBUG
1007 if (calltype == DAV_GETLOCKS_COMPLETE) {
1008 return dav_new_error(lockdb->info->pool,
1009 HTTP_INTERNAL_SERVER_ERROR, 0, 0,
1010 "INTERNAL DESIGN ERROR: DAV_GETLOCKS_COMPLETE "
1011 "is not yet supported");
1012 }
1013#endif
1014
1015 key = dav_fs_build_key(p, resource);
1016 if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST,
1017 &dp, &ip)) != NULL) {
1018 /* ### push a higher-level desc? */
1019 return err;
1020 }
1021
1022 /* copy all direct locks to the result list */
1023 for (; dp != NULL; dp = dp->next) {
1024 newlock = dav_fs_alloc_lock(lockdb, key, dp->locktoken);
1025 newlock->is_locknull = !resource->exists;
1026 newlock->scope = dp->f.scope;
1027 newlock->type = dp->f.type;
1028 newlock->depth = dp->f.depth;
1029 newlock->timeout = dp->f.timeout;
1030 newlock->owner = dp->owner;
1031 newlock->auth_user = dp->auth_user;
1032
1033 /* hook into the result list */
1034 newlock->next = lock;
1035 lock = newlock;
1036 }
1037
1038 /* copy all the indirect locks to the result list. resolve as needed. */
1039 for (; ip != NULL; ip = ip->next) {
1040 newlock = dav_fs_alloc_lock(lockdb, ip->key, ip->locktoken);
1041 newlock->is_locknull = !resource->exists;
1042
1043 if (calltype == DAV_GETLOCKS_RESOLVED) {
1044 if ((err = dav_fs_resolve(lockdb, ip, &dp, NULL, NULL)) != NULL) {
1045 /* ### push a higher-level desc? */
1046 return err;
1047 }
1048
1049 newlock->scope = dp->f.scope;
1050 newlock->type = dp->f.type;

Callers

nothing calls this directly

Calls 5

dav_new_errorFunction · 0.85
dav_fs_build_keyFunction · 0.85
dav_fs_load_lock_recordFunction · 0.85
dav_fs_alloc_lockFunction · 0.85
dav_fs_resolveFunction · 0.85

Tested by

no test coverage detected