Branch: Tag:

2018-02-06

2018-02-06 10:13:00 by Henrik Grubbström (Grubba) <grubba@grubba.org>

WebDAV: Fix time-out based unlocking of DAVLocks.

Fixes "Bad argument 1 to get_iterator(). Expected
multiset|array|string|mapping|object."

Fixes [WS-169].

1095:    if (id) {    removed_lock = m_delete(prefix_locks[path], auth_user);    } else { -  foreach(prefix_locks[path]; mixed user; DAVLock l) { +  foreach(prefix_locks[path]||([]); mixed user; DAVLock l) {    if (l == lock) {    removed_lock = m_delete(prefix_locks[path], user);    }
1107:    if (id) {    removed_lock = m_delete (file_locks[path], auth_user);    } else { -  foreach(file_locks[path]; mixed user; DAVLock l) { +  foreach(file_locks[path]||([]); mixed user; DAVLock l) {    if (l == lock) {    removed_lock = m_delete(file_locks[path], user);    }
1115:    }    if (!sizeof (file_locks[path])) m_delete (file_locks, path);    } -  ASSERT_IF_DEBUG (lock /*%O*/ == removed_lock /*%O*/, lock, removed_lock); +  // NB: The lock may have already been removed in the !id case. +  ASSERT_IF_DEBUG (!(id || removed_lock) || +  (lock /*%O*/ == removed_lock /*%O*/), +  lock, removed_lock);    TRACE_LEAVE("Ok.");    return 0;   }