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

« back to all changes in this revision

Viewing changes to subversion/tests/libsvn_subr/path-test.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:
315
315
    const char *path;
316
316
    const char *result;
317
317
  } tests[] = {
318
 
    { "http://c.r.a/s%\0008me",
 
318
    { "http://c.r.a/s%\0" "8me",
319
319
         "http://c.r.a/s%"},
320
 
    { "http://c.r.a/s%6\000me",
 
320
    { "http://c.r.a/s%6\0" "me",
321
321
         "http://c.r.a/s%6" },
322
322
    { "http://c.r.a/s%68me",
323
323
         "http://c.r.a/shme" },
489
489
      if (svn_path_is_url(base))
490
490
        continue;
491
491
 
492
 
      result = svn_path_join_many(pool, base, comp, NULL);
 
492
      result = svn_path_join_many(pool, base, comp, SVN_VA_NULL);
493
493
      if (strcmp(result, expect))
494
494
        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
495
495
                                 "svn_path_join_many(\"%s\", \"%s\") returned "
505
505
                             "expected \"%s\"", \
506
506
                             result, expect);
507
507
 
508
 
  TEST_MANY((pool, "abc", NULL), "abc");
509
 
  TEST_MANY((pool, "/abc", NULL), "/abc");
510
 
  TEST_MANY((pool, "/", NULL), "/");
511
 
 
512
 
  TEST_MANY((pool, "abc", "def", "ghi", NULL), "abc/def/ghi");
513
 
  TEST_MANY((pool, "abc", "/def", "ghi", NULL), "/def/ghi");
514
 
  TEST_MANY((pool, "/abc", "def", "ghi", NULL), "/abc/def/ghi");
515
 
  TEST_MANY((pool, "abc", "def", "/ghi", NULL), "/ghi");
516
 
  TEST_MANY((pool, "/", "def", "/ghi", NULL), "/ghi");
517
 
  TEST_MANY((pool, "/", "/def", "/ghi", NULL), "/ghi");
518
 
 
519
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", "ghi", NULL), "def/ghi");
520
 
  TEST_MANY((pool, "abc", SVN_EMPTY_PATH, "ghi", NULL), "abc/ghi");
521
 
  TEST_MANY((pool, "abc", "def", SVN_EMPTY_PATH, NULL), "abc/def");
522
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", SVN_EMPTY_PATH, NULL), "def");
523
 
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "ghi", NULL), "ghi");
524
 
  TEST_MANY((pool, "abc", SVN_EMPTY_PATH, SVN_EMPTY_PATH, NULL), "abc");
525
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", "/ghi", NULL), "/ghi");
526
 
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "/ghi", NULL), "/ghi");
527
 
 
528
 
  TEST_MANY((pool, "/", "def", "ghi", NULL), "/def/ghi");
529
 
  TEST_MANY((pool, "abc", "/", "ghi", NULL), "/ghi");
530
 
  TEST_MANY((pool, "abc", "def", "/", NULL), "/");
531
 
  TEST_MANY((pool, "/", "/", "ghi", NULL), "/ghi");
532
 
  TEST_MANY((pool, "/", "/", "/", NULL), "/");
533
 
  TEST_MANY((pool, "/", SVN_EMPTY_PATH, "ghi", NULL), "/ghi");
534
 
  TEST_MANY((pool, "/", "def", SVN_EMPTY_PATH, NULL), "/def");
535
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "/", "ghi", NULL), "/ghi");
536
 
  TEST_MANY((pool, "/", SVN_EMPTY_PATH, SVN_EMPTY_PATH, NULL), "/");
537
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "/", SVN_EMPTY_PATH, NULL), "/");
538
 
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "/", NULL), "/");
 
508
  TEST_MANY((pool, "abc", SVN_VA_NULL), "abc");
 
509
  TEST_MANY((pool, "/abc", SVN_VA_NULL), "/abc");
 
510
  TEST_MANY((pool, "/", SVN_VA_NULL), "/");
 
511
 
 
512
  TEST_MANY((pool, "abc", "def", "ghi", SVN_VA_NULL), "abc/def/ghi");
 
513
  TEST_MANY((pool, "abc", "/def", "ghi", SVN_VA_NULL), "/def/ghi");
 
514
  TEST_MANY((pool, "/abc", "def", "ghi", SVN_VA_NULL), "/abc/def/ghi");
 
515
  TEST_MANY((pool, "abc", "def", "/ghi", SVN_VA_NULL), "/ghi");
 
516
  TEST_MANY((pool, "/", "def", "/ghi", SVN_VA_NULL), "/ghi");
 
517
  TEST_MANY((pool, "/", "/def", "/ghi", SVN_VA_NULL), "/ghi");
 
518
 
 
519
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", "ghi", SVN_VA_NULL), "def/ghi");
 
520
  TEST_MANY((pool, "abc", SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "abc/ghi");
 
521
  TEST_MANY((pool, "abc", "def", SVN_EMPTY_PATH, SVN_VA_NULL), "abc/def");
 
522
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", SVN_EMPTY_PATH, SVN_VA_NULL), "def");
 
523
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "ghi");
 
524
  TEST_MANY((pool, "abc", SVN_EMPTY_PATH, SVN_EMPTY_PATH, SVN_VA_NULL), "abc");
 
525
  TEST_MANY((pool, SVN_EMPTY_PATH, "def", "/ghi", SVN_VA_NULL), "/ghi");
 
526
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "/ghi", SVN_VA_NULL), "/ghi");
 
527
 
 
528
  TEST_MANY((pool, "/", "def", "ghi", SVN_VA_NULL), "/def/ghi");
 
529
  TEST_MANY((pool, "abc", "/", "ghi", SVN_VA_NULL), "/ghi");
 
530
  TEST_MANY((pool, "abc", "def", "/", SVN_VA_NULL), "/");
 
531
  TEST_MANY((pool, "/", "/", "ghi", SVN_VA_NULL), "/ghi");
 
532
  TEST_MANY((pool, "/", "/", "/", SVN_VA_NULL), "/");
 
533
  TEST_MANY((pool, "/", SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "/ghi");
 
534
  TEST_MANY((pool, "/", "def", SVN_EMPTY_PATH, SVN_VA_NULL), "/def");
 
535
  TEST_MANY((pool, SVN_EMPTY_PATH, "/", "ghi", SVN_VA_NULL), "/ghi");
 
536
  TEST_MANY((pool, "/", SVN_EMPTY_PATH, SVN_EMPTY_PATH, SVN_VA_NULL), "/");
 
537
  TEST_MANY((pool, SVN_EMPTY_PATH, "/", SVN_EMPTY_PATH, SVN_VA_NULL), "/");
 
538
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "/", SVN_VA_NULL), "/");
539
539
 
540
540
#ifdef SVN_USE_DOS_PATHS
541
541
/* These will fail, see issue #2028
542
 
  TEST_MANY((pool, "X:", "def", "ghi", NULL), "X:def/ghi");
543
 
  TEST_MANY((pool, "X:", SVN_EMPTY_PATH, "ghi", NULL), "X:ghi");
544
 
  TEST_MANY((pool, "X:", "def", SVN_EMPTY_PATH, NULL), "X:def");
545
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:", "ghi", NULL), "X:ghi");
546
 
  TEST_MANY((pool, "X:/", "def", "ghi", NULL), "X:/def/ghi");
547
 
  TEST_MANY((pool, "abc", "X:/", "ghi", NULL), "X:/ghi");
548
 
  TEST_MANY((pool, "abc", "def", "X:/", NULL), "X:/");
549
 
  TEST_MANY((pool, "X:/", "X:/", "ghi", NULL), "X:/ghi");
550
 
  TEST_MANY((pool, "X:/", "X:/", "/", NULL), "/");
551
 
  TEST_MANY((pool, "X:/", SVN_EMPTY_PATH, "ghi", NULL), "X:/ghi");
552
 
  TEST_MANY((pool, "X:/", "def", SVN_EMPTY_PATH, NULL), "X:/def");
553
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:/", "ghi", NULL), "X:/ghi");
554
 
  TEST_MANY((pool, "X:/", SVN_EMPTY_PATH, SVN_EMPTY_PATH, NULL), "X:/");
555
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:/", SVN_EMPTY_PATH, NULL), "X:/");
556
 
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "X:/", NULL), "X:/");
557
 
  TEST_MANY((pool, "X:", "X:/", "ghi", NULL), "X:/ghi");
558
 
  TEST_MANY((pool, "X:", "X:/", "/", NULL), "/");
 
542
  TEST_MANY((pool, "X:", "def", "ghi", SVN_VA_NULL), "X:def/ghi");
 
543
  TEST_MANY((pool, "X:", SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "X:ghi");
 
544
  TEST_MANY((pool, "X:", "def", SVN_EMPTY_PATH, SVN_VA_NULL), "X:def");
 
545
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:", "ghi", SVN_VA_NULL), "X:ghi");
 
546
  TEST_MANY((pool, "X:/", "def", "ghi", SVN_VA_NULL), "X:/def/ghi");
 
547
  TEST_MANY((pool, "abc", "X:/", "ghi", SVN_VA_NULL), "X:/ghi");
 
548
  TEST_MANY((pool, "abc", "def", "X:/", SVN_VA_NULL), "X:/");
 
549
  TEST_MANY((pool, "X:/", "X:/", "ghi", SVN_VA_NULL), "X:/ghi");
 
550
  TEST_MANY((pool, "X:/", "X:/", "/", SVN_VA_NULL), "/");
 
551
  TEST_MANY((pool, "X:/", SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "X:/ghi");
 
552
  TEST_MANY((pool, "X:/", "def", SVN_EMPTY_PATH, SVN_VA_NULL), "X:/def");
 
553
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:/", "ghi", SVN_VA_NULL), "X:/ghi");
 
554
  TEST_MANY((pool, "X:/", SVN_EMPTY_PATH, SVN_EMPTY_PATH, SVN_VA_NULL), "X:/");
 
555
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:/", SVN_EMPTY_PATH, SVN_VA_NULL), "X:/");
 
556
  TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "X:/", SVN_VA_NULL), "X:/");
 
557
  TEST_MANY((pool, "X:", "X:/", "ghi", SVN_VA_NULL), "X:/ghi");
 
558
  TEST_MANY((pool, "X:", "X:/", "/", SVN_VA_NULL), "/");
559
559
 
560
 
  TEST_MANY((pool, "//srv/shr", "def", "ghi", NULL), "//srv/shr/def/ghi");
561
 
  TEST_MANY((pool, "//srv", "shr", "def", "ghi", NULL), "//srv/shr/def/ghi");
562
 
  TEST_MANY((pool, "//srv/shr/fld", "def", "ghi", NULL),
563
 
            "//srv/shr/fld/def/ghi");
564
 
  TEST_MANY((pool, "//srv/shr/fld", "def", "//srv/shr", NULL), "//srv/shr");
565
 
  TEST_MANY((pool, "//srv", "shr", "//srv/shr", NULL), "//srv/shr");
566
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "//srv/shr/fld", "def", "ghi", NULL),
567
 
            "//srv/shr/fld/def/ghi");
568
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "//srv/shr/fld", "def", "//srv/shr", NULL),
 
560
  TEST_MANY((pool, "//srv/shr", "def", "ghi", SVN_VA_NULL), "//srv/shr/def/ghi");
 
561
  TEST_MANY((pool, "//srv", "shr", "def", "ghi", SVN_VA_NULL), "//srv/shr/def/ghi");
 
562
  TEST_MANY((pool, "//srv/shr/fld", "def", "ghi", SVN_VA_NULL),
 
563
            "//srv/shr/fld/def/ghi");
 
564
  TEST_MANY((pool, "//srv/shr/fld", "def", "//srv/shr", SVN_VA_NULL), "//srv/shr");
 
565
  TEST_MANY((pool, "//srv", "shr", "//srv/shr", SVN_VA_NULL), "//srv/shr");
 
566
  TEST_MANY((pool, SVN_EMPTY_PATH, "//srv/shr/fld", "def", "ghi", SVN_VA_NULL),
 
567
            "//srv/shr/fld/def/ghi");
 
568
  TEST_MANY((pool, SVN_EMPTY_PATH, "//srv/shr/fld", "def", "//srv/shr", SVN_VA_NULL),
569
569
            "//srv/shr");
570
570
*/
571
571
#else /* WIN32 or Cygwin */
572
 
  TEST_MANY((pool, "X:", "def", "ghi", NULL), "X:/def/ghi");
573
 
  TEST_MANY((pool, "X:", SVN_EMPTY_PATH, "ghi", NULL), "X:/ghi");
574
 
  TEST_MANY((pool, "X:", "def", SVN_EMPTY_PATH, NULL), "X:/def");
575
 
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:", "ghi", NULL), "X:/ghi");
 
572
  TEST_MANY((pool, "X:", "def", "ghi", SVN_VA_NULL), "X:/def/ghi");
 
573
  TEST_MANY((pool, "X:", SVN_EMPTY_PATH, "ghi", SVN_VA_NULL), "X:/ghi");
 
574
  TEST_MANY((pool, "X:", "def", SVN_EMPTY_PATH, SVN_VA_NULL), "X:/def");
 
575
  TEST_MANY((pool, SVN_EMPTY_PATH, "X:", "ghi", SVN_VA_NULL), "X:/ghi");
576
576
#endif /* non-WIN32 */
577
577
 
578
578
  /* ### probably need quite a few more tests... */
1210
1210
    { "yep.still/no-ext",          "yep.still/no-ext",       "" },
1211
1211
    { "folder.with/period.log",    "folder.with/period.",    "log" },
1212
1212
    { "period.",                   "period.",                "" },
 
1213
    { "dir/period.",               "dir/period.",            "" },
1213
1214
    { "file.ends-with/period.",    "file.ends-with/period.", "" },
1214
1215
    { "two-periods..txt",          "two-periods..",          "txt" },
1215
1216
    { ".dot-file",                 ".dot-file",              "" },
1527
1528
 
1528
1529
  /* Verify the common part with the expected (prefix with cwd). */
1529
1530
  if (*exp_common == '%')
1530
 
    exp_common_abs = apr_pstrcat(pool, curdir, exp_common + 1, (char *)NULL);
 
1531
    exp_common_abs = apr_pstrcat(pool, curdir, exp_common + 1, SVN_VA_NULL);
1531
1532
 
1532
1533
  if (strcmp(common_path, exp_common_abs) != 0)
1533
1534
    {
1544
1545
    {
1545
1546
      const char * target = APR_ARRAY_IDX(condensed_targets, i, const char*);
1546
1547
      if (token && (*token == '%'))
1547
 
        token = apr_pstrcat(pool, curdir, token + 1, (char *)NULL);
 
1548
        token = apr_pstrcat(pool, curdir, token + 1, SVN_VA_NULL);
1548
1549
      if (! token ||
1549
1550
          (target && (strcmp(target, token) != 0)))
1550
1551
        {
1700
1701
 
1701
1702
/* The test table.  */
1702
1703
 
1703
 
struct svn_test_descriptor_t test_funcs[] =
 
1704
static int max_threads = 1;
 
1705
 
 
1706
static struct svn_test_descriptor_t test_funcs[] =
1704
1707
  {
1705
1708
    SVN_TEST_NULL,
1706
1709
    SVN_TEST_PASS2(test_path_is_child,
1759
1762
                   "test svn_path_resolve_repos_relative_url"),
1760
1763
    SVN_TEST_NULL
1761
1764
  };
 
1765
 
 
1766
SVN_TEST_MAIN