~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_fs_fs/load-index.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* load-index-cmd.c -- implements the dump-index sub-command.
 
2
 *
 
3
 * ====================================================================
 
4
 *    Licensed to the Apache Software Foundation (ASF) under one
 
5
 *    or more contributor license agreements.  See the NOTICE file
 
6
 *    distributed with this work for additional information
 
7
 *    regarding copyright ownership.  The ASF licenses this file
 
8
 *    to you under the Apache License, Version 2.0 (the
 
9
 *    "License"); you may not use this file except in compliance
 
10
 *    with the License.  You may obtain a copy of the License at
 
11
 *
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 *    Unless required by applicable law or agreed to in writing,
 
15
 *    software distributed under the License is distributed on an
 
16
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
 *    KIND, either express or implied.  See the License for the
 
18
 *    specific language governing permissions and limitations
 
19
 *    under the License.
 
20
 * ====================================================================
 
21
 */
 
22
 
 
23
#include "svn_pools.h"
 
24
 
 
25
#include "private/svn_fs_fs_private.h"
 
26
 
 
27
#include "index.h"
 
28
#include "util.h"
 
29
#include "transaction.h"
 
30
 
 
31
svn_error_t *
 
32
svn_fs_fs__load_index(svn_fs_t *fs,
 
33
                      svn_revnum_t revision,
 
34
                      apr_array_header_t *entries,
 
35
                      apr_pool_t *scratch_pool)
 
36
{
 
37
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
38
 
 
39
  /* Check the FS format number. */
 
40
  if (! svn_fs_fs__use_log_addressing(fs))
 
41
    return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, NULL);
 
42
 
 
43
  /* Treat an empty array as a no-op instead error. */
 
44
  if (entries->nelts != 0)
 
45
    {
 
46
      const char *l2p_proto_index;
 
47
      const char *p2l_proto_index;
 
48
      svn_fs_fs__revision_file_t *rev_file;
 
49
 
 
50
      /* Open rev / pack file & trim indexes + footer off it. */
 
51
      SVN_ERR(svn_fs_fs__open_pack_or_rev_file_writable(&rev_file, fs,
 
52
                                                        revision, iterpool,
 
53
                                                        iterpool));
 
54
      SVN_ERR(svn_fs_fs__auto_read_footer(rev_file));
 
55
      SVN_ERR(svn_io_file_trunc(rev_file->file, rev_file->l2p_offset,
 
56
                                iterpool));
 
57
 
 
58
      /* Create proto index files for the new index data
 
59
       * (will be cleaned up automatically with iterpool). */
 
60
      SVN_ERR(svn_fs_fs__p2l_index_from_p2l_entries(&p2l_proto_index, fs,
 
61
                                                    rev_file, entries,
 
62
                                                    iterpool, iterpool));
 
63
      SVN_ERR(svn_fs_fs__l2p_index_from_p2l_entries(&l2p_proto_index, fs,
 
64
                                                    entries, iterpool,
 
65
                                                    iterpool));
 
66
 
 
67
      /* Combine rev data with new index data. */
 
68
      SVN_ERR(svn_fs_fs__add_index_data(fs, rev_file->file, l2p_proto_index,
 
69
                                        p2l_proto_index, revision, iterpool));
 
70
    }
 
71
 
 
72
  svn_pool_destroy(iterpool);
 
73
 
 
74
  return SVN_NO_ERROR;
 
75
}