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

« back to all changes in this revision

Viewing changes to subversion/libsvn_fs_fs/dump-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
/* dump-index.c -- implements the svn_fs_fs__dump_index private API
 
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
#include "private/svn_fs_fs_private.h"
 
25
 
 
26
#include "index.h"
 
27
#include "rev_file.h"
 
28
#include "util.h"
 
29
 
 
30
#include "../libsvn_fs/fs-loader.h"
 
31
 
 
32
svn_error_t *
 
33
svn_fs_fs__dump_index(svn_fs_t *fs,
 
34
                      svn_revnum_t revision,
 
35
                      svn_fs_fs__dump_index_func_t callback_func,
 
36
                      void *callback_baton,
 
37
                      svn_cancel_func_t cancel_func,
 
38
                      void *cancel_baton,
 
39
                      apr_pool_t *scratch_pool)
 
40
{
 
41
  fs_fs_data_t *ffd = fs->fsap_data;
 
42
  svn_fs_fs__revision_file_t *rev_file;
 
43
  int i;
 
44
  apr_off_t offset, max_offset;
 
45
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
46
 
 
47
  /* Check the FS format. */
 
48
  if (! svn_fs_fs__use_log_addressing(fs))
 
49
    return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, NULL);
 
50
 
 
51
  /* Revision & index file access object. */
 
52
  SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, revision,
 
53
                                           scratch_pool, iterpool));
 
54
 
 
55
  /* Offset range to cover. */
 
56
  SVN_ERR(svn_fs_fs__p2l_get_max_offset(&max_offset, fs, rev_file, revision,
 
57
                                        scratch_pool));
 
58
 
 
59
  /* Walk through all P2L index entries in offset order. */
 
60
  for (offset = 0; offset < max_offset; )
 
61
    {
 
62
      apr_array_header_t *entries;
 
63
 
 
64
      /* Read entries for the next block.  There will be no overlaps since
 
65
       * we start at the first offset not covered. */
 
66
      svn_pool_clear(iterpool);
 
67
      SVN_ERR(svn_fs_fs__p2l_index_lookup(&entries, fs, rev_file, revision,
 
68
                                          offset, ffd->p2l_page_size,
 
69
                                          iterpool, iterpool));
 
70
 
 
71
      /* Print entries for this block, one line per entry. */
 
72
      for (i = 0; i < entries->nelts && offset < max_offset; ++i)
 
73
        {
 
74
          const svn_fs_fs__p2l_entry_t *entry
 
75
            = &APR_ARRAY_IDX(entries, i, const svn_fs_fs__p2l_entry_t);
 
76
          offset = entry->offset + entry->size;
 
77
 
 
78
          /* Cancellation support */
 
79
          if (cancel_func)
 
80
            SVN_ERR(cancel_func(cancel_baton));
 
81
 
 
82
          /* Invoke processing callback. */
 
83
          SVN_ERR(callback_func(entry, callback_baton, iterpool));
 
84
        }
 
85
    }
 
86
 
 
87
  svn_pool_destroy(iterpool);
 
88
 
 
89
  return SVN_NO_ERROR;
 
90
}