~ubuntu-branches/ubuntu/trusty/subversion/trusty-proposed

« back to all changes in this revision

Viewing changes to subversion/mod_dav_svn/reports/get-locks.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft
  • Date: 2012-06-21 15:36:36 UTC
  • mfrom: (0.4.13 sid)
  • Revision ID: package-import@ubuntu.com-20120621153636-amqqmuidgwgxz1ly
Tags: 1.7.5-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Create pot file on build.
  - Build a python-subversion-dbg package.
  - Build-depend on python-dbg.
  - Build-depend on default-jre-headless/-jdk.
  - Do not apply java-build patch.
  - debian/rules: Manually create the doxygen output directory, otherwise
    we get weird build failures when running parallel builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * version.c: mod_dav_svn versioning provider functions for Subversion
 
2
 * get-locks.c: mod_dav_svn REPORT handler for querying filesystem locks
3
3
 *
4
4
 * ====================================================================
5
 
 * Copyright (c) 2000-2006 CollabNet.  All rights reserved.
6
 
 *
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.
12
 
 *
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
 
12
 *
 
13
 *      http://www.apache.org/licenses/LICENSE-2.0
 
14
 *
 
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
 
20
 *    under the License.
16
21
 * ====================================================================
17
22
 */
18
23
 
36
41
#include "../dav_svn.h"
37
42
 
38
43
/* Respond to a get-locks-report request.  See description of this
39
 
   report in libsvn_ra_dav/fetch.c.  */
 
44
   report in libsvn_ra_neon/get_locks.c.  */
40
45
 
41
46
 
42
47
#define SVN_APR_ERR(expr)                       \
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;
184
191
 
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.");
191
198
 
192
199
  arb.r = resource->info->r;
193
200
  arb.repos = resource->info->repos;
194
201
 
 
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)
 
204
    {
 
205
      if (strcmp(this_attr->name, "depth") == 0)
 
206
        {
 
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.");
 
215
          continue;
 
216
        }
 
217
    }
 
218
 
 
219
  /* For compatibility, our default depth is infinity. */
 
220
  if (depth == svn_depth_unknown)
 
221
    depth = svn_depth_infinity;
 
222
 
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);
203
231