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

« back to all changes in this revision

Viewing changes to subversion/libsvn_repos/replay.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:
39
39
#include "private/svn_fspath.h"
40
40
#include "private/svn_repos_private.h"
41
41
#include "private/svn_delta_private.h"
 
42
#include "private/svn_sorts_private.h"
42
43
 
43
44
 
44
45
/*** Backstory ***/
183
184
 
184
185
  for (phi = apr_hash_first(pool, props); phi; phi = apr_hash_next(phi))
185
186
    {
186
 
      const void *key;
187
 
      void *val;
 
187
      const char *key = apr_hash_this_key(phi);
 
188
      svn_string_t *val = apr_hash_this_val(phi);
188
189
 
189
190
      svn_pool_clear(subpool);
190
 
      apr_hash_this(phi, &key, NULL, &val);
191
191
      SVN_ERR(editor->change_dir_prop(*dir_baton, key, val, subpool));
192
192
    }
193
193
 
200
200
    {
201
201
      svn_fs_path_change2_t *change;
202
202
      svn_boolean_t readable = TRUE;
203
 
      svn_fs_dirent_t *dent;
 
203
      svn_fs_dirent_t *dent = apr_hash_this_val(hi);
204
204
      const char *copyfrom_path = NULL;
205
205
      svn_revnum_t copyfrom_rev = SVN_INVALID_REVNUM;
206
206
      const char *new_edit_path;
207
 
      void *val;
208
207
 
209
208
      svn_pool_clear(subpool);
210
209
 
211
 
      apr_hash_this(hi, NULL, NULL, &val);
212
 
 
213
 
      dent = val;
214
 
 
215
210
      new_edit_path = svn_relpath_join(edit_path, dent->name, subpool);
216
211
 
217
212
      /* If a file or subdirectory of the copied directory is listed as a
308
303
 
309
304
          for (phi = apr_hash_first(pool, props); phi; phi = apr_hash_next(phi))
310
305
            {
311
 
              const void *key;
 
306
              const char *key = apr_hash_this_key(phi);
 
307
              svn_string_t *val = apr_hash_this_val(phi);
312
308
 
313
 
              apr_hash_this(phi, &key, NULL, &val);
314
309
              SVN_ERR(editor->change_file_prop(file_baton, key, val, subpool));
315
310
            }
316
311
 
553
548
      svn_boolean_t src_readable;
554
549
      svn_fs_root_t *copyfrom_root;
555
550
 
 
551
      /* E.g. when verifying corrupted repositories, their changed path
 
552
         lists may contain an ADD for "/".  The delta path driver will
 
553
         call us with a NULL parent in that case. */
 
554
      if (*edit_path == 0)
 
555
        return svn_error_create(SVN_ERR_FS_ALREADY_EXISTS, NULL,
 
556
                                _("Root directory already exists."));
 
557
 
 
558
      /* A NULL parent_baton will cause a segfault.  It should never be
 
559
          NULL for non-root paths. */
 
560
      SVN_ERR_ASSERT(parent_baton);
 
561
 
556
562
      /* Was this node copied? */
557
563
      SVN_ERR(fill_copyfrom(&copyfrom_root, &copyfrom_path, &copyfrom_rev,
558
564
                            &src_readable, root, change,
882
888
  changed_paths = apr_hash_make(pool);
883
889
  for (hi = apr_hash_first(pool, fs_changes); hi; hi = apr_hash_next(hi))
884
890
    {
885
 
      const void *key;
886
 
      void *val;
887
 
      apr_ssize_t keylen;
888
 
      const char *path;
889
 
      svn_fs_path_change2_t *change;
 
891
      const char *path = apr_hash_this_key(hi);
 
892
      apr_ssize_t keylen = apr_hash_this_key_len(hi);
 
893
      svn_fs_path_change2_t *change = apr_hash_this_val(hi);
890
894
      svn_boolean_t allowed = TRUE;
891
895
 
892
 
      apr_hash_this(hi, &key, &keylen, &val);
893
 
      path = key;
894
 
      change = val;
895
 
 
896
896
      if (authz_read_func)
897
897
        SVN_ERR(authz_read_func(&allowed, root, path, authz_read_baton,
898
898
                                pool));
1063
1063
    {
1064
1064
      svn_fs_path_change2_t *change;
1065
1065
      svn_boolean_t readable = TRUE;
1066
 
      svn_fs_dirent_t *dent = svn__apr_hash_index_val(hi);
 
1066
      svn_fs_dirent_t *dent = apr_hash_this_val(hi);
1067
1067
      const char *copyfrom_path = NULL;
1068
1068
      svn_revnum_t copyfrom_rev = SVN_INVALID_REVNUM;
1069
1069
      const char *child_relpath;
1457
1457
            }
1458
1458
 
1459
1459
          SVN_ERR(svn_editor_alter_file(editor, repos_relpath,
1460
 
                                        SVN_INVALID_REVNUM, props, checksum,
1461
 
                                        contents));
 
1460
                                        SVN_INVALID_REVNUM,
 
1461
                                        checksum, contents, props));
1462
1462
        }
1463
1463
 
1464
1464
      if (change->node_kind == svn_node_dir
1514
1514
  for (hi = apr_hash_first(scratch_pool, fs_changes); hi;
1515
1515
        hi = apr_hash_next(hi))
1516
1516
    {
1517
 
      const void *key;
1518
 
      void *val;
1519
 
      apr_ssize_t keylen;
1520
 
      const char *path;
1521
 
      svn_fs_path_change2_t *change;
 
1517
      const char *path = apr_hash_this_key(hi);
 
1518
      apr_ssize_t keylen = apr_hash_this_key_len(hi);
 
1519
      svn_fs_path_change2_t *change = apr_hash_this_val(hi);
1522
1520
      svn_boolean_t allowed = TRUE;
1523
1521
 
1524
 
      apr_hash_this(hi, &key, &keylen, &val);
1525
 
      path = key;
1526
 
      change = val;
1527
 
 
1528
1522
      if (authz_read_func)
1529
1523
        SVN_ERR(authz_read_func(&allowed, root, path, authz_read_baton,
1530
1524
                                scratch_pool));
1564
1558
  /* Sort the paths.  Although not strictly required by the API, this has
1565
1559
     the pleasant side effect of maintaining a consistent ordering of
1566
1560
     dumpfile contents. */
1567
 
  qsort(paths->elts, paths->nelts, paths->elt_size, svn_sort_compare_paths);
 
1561
  svn_sort__array(paths, svn_sort_compare_paths);
1568
1562
 
1569
1563
  /* Now actually handle the various paths. */
1570
1564
  iterpool = svn_pool_create(scratch_pool);