| 852 | } |
| 853 | |
| 854 | static int dav_find_submitted_locktoken(const dav_if_header *if_header, |
| 855 | const dav_lock *lock_list, |
| 856 | const dav_hooks_locks *locks_hooks) |
| 857 | { |
| 858 | for (; if_header != NULL; if_header = if_header->next) { |
| 859 | const dav_if_state_list *state_list; |
| 860 | |
| 861 | for (state_list = if_header->state; |
| 862 | state_list != NULL; |
| 863 | state_list = state_list->next) { |
| 864 | |
| 865 | if (state_list->type == dav_if_opaquelock) { |
| 866 | const dav_lock *lock; |
| 867 | |
| 868 | /* given state_list->locktoken, match it */ |
| 869 | |
| 870 | /* |
| 871 | ** The resource will have one or more lock tokens. We only |
| 872 | ** need to match one of them against any token in the |
| 873 | ** If: header. |
| 874 | ** |
| 875 | ** One token case: It is an exclusive or shared lock. Either |
| 876 | ** way, we must find it. |
| 877 | ** |
| 878 | ** N token case: They are shared locks. By policy, we need |
| 879 | ** to match only one. The resource's other |
| 880 | ** tokens may belong to somebody else (so we |
| 881 | ** shouldn't see them in the If: header anyway) |
| 882 | */ |
| 883 | for (lock = lock_list; lock != NULL; lock = lock->next) { |
| 884 | |
| 885 | if (!(*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { |
| 886 | return 1; |
| 887 | } |
| 888 | } |
| 889 | } |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | return 0; |
| 894 | } |
| 895 | |
| 896 | /* dav_validate_resource_state: |
| 897 | * Returns NULL if path/uri meets if-header and lock requirements |
no outgoing calls
no test coverage detected