2
* version.c: mod_dav_svn versioning provider functions for Subversion
2
* get-locks.c: mod_dav_svn REPORT handler for querying filesystem locks
4
4
* ====================================================================
5
* Copyright (c) 2000-2006 CollabNet. All rights reserved.
7
* This software is licensed as described in the file COPYING, which
8
* you should have received as part of this distribution. The terms
9
* are also available at http://subversion.tigris.org/license-1.html.
10
* If newer versions of this license are posted there, you may use a
11
* newer version instead, at your option.
13
* This software consists of voluntary contributions made by many
14
* individuals. For exact contribution history, see the revision
15
* history and logs, available at http://subversion.tigris.org/.
5
* Licensed to the Apache Software Foundation (ASF) under one
6
* or more contributor license agreements. See the NOTICE file
7
* distributed with this work for additional information
8
* regarding copyright ownership. The ASF licenses this file
9
* to you under the Apache License, Version 2.0 (the
10
* "License"); you may not use this file except in compliance
11
* with the License. You may obtain a copy of the License at
13
* http://www.apache.org/licenses/LICENSE-2.0
15
* Unless required by applicable law or agreed to in writing,
16
* software distributed under the License is distributed on an
17
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
* KIND, either express or implied. See the License for the
19
* specific language governing permissions and limitations
16
21
* ====================================================================
181
186
apr_status_t apr_err;
182
187
apr_hash_t *locks;
183
188
dav_svn__authz_read_baton arb;
189
svn_depth_t depth = svn_depth_unknown;
190
apr_xml_attr *this_attr;
185
192
/* The request URI should be a public one representing an fs path. */
186
193
if ((! resource->info->repos_path)
187
194
|| (! resource->info->repos->repos))
188
return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
189
"get-locks-report run on resource which doesn't "
190
"represent a path within a repository.");
195
return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
196
"get-locks-report run on resource which doesn't "
197
"represent a path within a repository.");
192
199
arb.r = resource->info->r;
193
200
arb.repos = resource->info->repos;
202
/* See if the client provided additional information for this request. */
203
for (this_attr = doc->root->attr; this_attr; this_attr = this_attr->next)
205
if (strcmp(this_attr->name, "depth") == 0)
207
depth = svn_depth_from_word(this_attr->value);
208
if ((depth != svn_depth_empty) &&
209
(depth != svn_depth_files) &&
210
(depth != svn_depth_immediates) &&
211
(depth != svn_depth_infinity))
212
return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
213
"Invalid 'depth' specified in "
214
"get-locks-report request.");
219
/* For compatibility, our default depth is infinity. */
220
if (depth == svn_depth_unknown)
221
depth = svn_depth_infinity;
195
223
/* Fetch the locks, but allow authz_read checks to happen on each. */
196
if ((err = svn_repos_fs_get_locks(&locks,
197
resource->info->repos->repos,
198
resource->info->repos_path,
199
dav_svn__authz_read_func(&arb), &arb,
200
resource->pool)) != SVN_NO_ERROR)
224
if ((err = svn_repos_fs_get_locks2(&locks,
225
resource->info->repos->repos,
226
resource->info->repos_path, depth,
227
dav_svn__authz_read_func(&arb), &arb,
228
resource->pool)) != SVN_NO_ERROR)
201
229
return dav_svn__convert_err(err, HTTP_INTERNAL_SERVER_ERROR,
202
230
err->message, resource->pool);