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

Function dav_fs_find_lock

modules/dav/fs/lock.c:1070–1132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068}
1069
1070static dav_error * dav_fs_find_lock(dav_lockdb *lockdb,
1071 const dav_resource *resource,
1072 const dav_locktoken *locktoken,
1073 int partial_ok,
1074 dav_lock **lock)
1075{
1076 dav_error *err;
1077 apr_datum_t key;
1078 dav_lock_discovery *dp;
1079 dav_lock_indirect *ip;
1080
1081 *lock = NULL;
1082
1083 key = dav_fs_build_key(lockdb->info->pool, resource);
1084 if ((err = dav_fs_load_lock_record(lockdb, key, DAV_CREATE_LIST,
1085 &dp, &ip)) != NULL) {
1086 /* ### push a higher-level desc? */
1087 return err;
1088 }
1089
1090 for (; dp != NULL; dp = dp->next) {
1091 if (!dav_compare_locktoken(locktoken, dp->locktoken)) {
1092 *lock = dav_fs_alloc_lock(lockdb, key, locktoken);
1093 (*lock)->is_locknull = !resource->exists;
1094 (*lock)->scope = dp->f.scope;
1095 (*lock)->type = dp->f.type;
1096 (*lock)->depth = dp->f.depth;
1097 (*lock)->timeout = dp->f.timeout;
1098 (*lock)->owner = dp->owner;
1099 (*lock)->auth_user = dp->auth_user;
1100 return NULL;
1101 }
1102 }
1103
1104 for (; ip != NULL; ip = ip->next) {
1105 if (!dav_compare_locktoken(locktoken, ip->locktoken)) {
1106 *lock = dav_fs_alloc_lock(lockdb, ip->key, locktoken);
1107 (*lock)->is_locknull = !resource->exists;
1108
1109 /* ### nobody uses the resolving right now! */
1110 if (partial_ok) {
1111 (*lock)->rectype = DAV_LOCKREC_INDIRECT_PARTIAL;
1112 }
1113 else {
1114 (*lock)->rectype = DAV_LOCKREC_INDIRECT;
1115 if ((err = dav_fs_resolve(lockdb, ip, &dp,
1116 NULL, NULL)) != NULL) {
1117 /* ### push a higher-level desc? */
1118 return err;
1119 }
1120 (*lock)->scope = dp->f.scope;
1121 (*lock)->type = dp->f.type;
1122 (*lock)->depth = dp->f.depth;
1123 (*lock)->timeout = dp->f.timeout;
1124 (*lock)->owner = dp->owner;
1125 (*lock)->auth_user = dp->auth_user;
1126 }
1127 return NULL;

Callers

nothing calls this directly

Calls 4

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