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

Function dav_fs_append_locks

modules/dav/fs/lock.c:1162–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160}
1161
1162static dav_error * dav_fs_append_locks(dav_lockdb *lockdb,
1163 const dav_resource *resource,
1164 int make_indirect,
1165 const dav_lock *lock)
1166{
1167 apr_pool_t *p = lockdb->info->pool;
1168 dav_error *err;
1169 dav_lock_indirect *ip;
1170 dav_lock_discovery *dp;
1171 apr_datum_t key;
1172
1173 key = dav_fs_build_key(lockdb->info->pool, resource);
1174 if ((err = dav_fs_load_lock_record(lockdb, key, 0, &dp, &ip)) != NULL) {
1175 /* ### maybe add in a higher-level description */
1176 return err;
1177 }
1178
1179 /*
1180 ** ### when we store the lock more directly, we need to update
1181 ** ### lock->rectype and lock->is_locknull
1182 */
1183
1184 if (make_indirect) {
1185 for (; lock != NULL; lock = lock->next) {
1186
1187 /* ### this works for any <lock> rectype */
1188 dav_lock_indirect *newi = apr_pcalloc(p, sizeof(*newi));
1189
1190 /* ### shut off the const warning for now */
1191 newi->locktoken = (dav_locktoken *)lock->locktoken;
1192 newi->timeout = lock->timeout;
1193 newi->key = lock->info->key;
1194 newi->next = ip;
1195 ip = newi;
1196 }
1197 }
1198 else {
1199 for (; lock != NULL; lock = lock->next) {
1200 /* create and link in the right kind of lock */
1201
1202 if (lock->rectype == DAV_LOCKREC_DIRECT) {
1203 dav_lock_discovery *newd = apr_pcalloc(p, sizeof(*newd));
1204
1205 newd->f.scope = lock->scope;
1206 newd->f.type = lock->type;
1207 newd->f.depth = lock->depth;
1208 newd->f.timeout = lock->timeout;
1209 /* ### shut off the const warning for now */
1210 newd->locktoken = (dav_locktoken *)lock->locktoken;
1211 newd->owner = lock->owner;
1212 newd->auth_user = lock->auth_user;
1213 newd->next = dp;
1214 dp = newd;
1215 }
1216 else {
1217 /* DAV_LOCKREC_INDIRECT(_PARTIAL) */
1218
1219 dav_lock_indirect *newi = apr_pcalloc(p, sizeof(*newi));

Callers

nothing calls this directly

Calls 4

dav_fs_build_keyFunction · 0.85
dav_fs_load_lock_recordFunction · 0.85
dav_fs_save_lock_recordFunction · 0.85

Tested by

no test coverage detected