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

« back to all changes in this revision

Viewing changes to subversion/svn/propget-cmd.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:
44
44
#include "cl.h"
45
45
 
46
46
#include "private/svn_cmdline_private.h"
47
 
 
 
47
#include "private/svn_opt_private.h"
 
48
#include "private/svn_sorts_private.h"
48
49
#include "svn_private_config.h"
49
50
 
50
51
 
88
89
          const char *name_local;
89
90
          svn_prop_inherited_item_t *iprop =
90
91
           APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
91
 
          svn_string_t *propval = svn__apr_hash_index_val(
 
92
          svn_string_t *propval = apr_hash_this_val(
92
93
            apr_hash_first(pool, iprop->prop_hash));
93
94
 
94
95
          sb = NULL;
100
101
            name_local = svn_dirent_local_style(iprop->path_or_url, iterpool);
101
102
 
102
103
          svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
103
 
                            "path", name_local, NULL);
 
104
                            "path", name_local, SVN_VA_NULL);
104
105
 
105
106
          svn_cmdline__print_xml_prop(&sb, pname, propval, TRUE, iterpool);
106
107
          svn_xml_make_close_tag(&sb, iterpool, "target");
123
124
      svn_pool_clear(iterpool);
124
125
 
125
126
      svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
126
 
                        "path", filename, NULL);
 
127
                        "path", filename, SVN_VA_NULL);
127
128
      svn_cmdline__print_xml_prop(&sb, pname, propval, FALSE, iterpool);
128
129
      svn_xml_make_close_tag(&sb, iterpool, "target");
129
130
 
277
278
        {
278
279
          svn_prop_inherited_item_t *iprop =
279
280
            APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
280
 
          svn_string_t *propval = svn__apr_hash_index_val(apr_hash_first(pool,
 
281
          svn_string_t *propval = apr_hash_this_val(apr_hash_first(pool,
281
282
                                                          iprop->prop_hash));
282
283
          SVN_ERR(print_single_prop(propval, target_abspath_or_url,
283
284
                                    iprop->path_or_url,
319
320
  const char *pname, *pname_utf8;
320
321
  apr_array_header_t *args, *targets;
321
322
  svn_stream_t *out;
 
323
  svn_boolean_t warned = FALSE;
322
324
 
323
 
  if (opt_state->verbose && (opt_state->revprop || opt_state->strict
 
325
  if (opt_state->verbose && (opt_state->revprop || opt_state->no_newline
324
326
                             || opt_state->xml))
325
327
    return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
326
328
                            _("--verbose cannot be used with --revprop or "
327
 
                              "--strict or --xml"));
 
329
                              "--no-newline or --xml"));
328
330
 
329
331
  /* PNAME is first argument (and PNAME_UTF8 will be a UTF-8 version
330
332
     thereof) */
365
367
                                     URL, &(opt_state->start_revision),
366
368
                                     &rev, ctx, pool));
367
369
 
368
 
      if (propval != NULL)
 
370
      if (propval == NULL)
 
371
        {
 
372
          return svn_error_createf(SVN_ERR_PROPERTY_NOT_FOUND, NULL,
 
373
                                   _("Property '%s' not found on "
 
374
                                     "revision %s"),
 
375
                                   pname_utf8,
 
376
                                   svn_opt__revision_to_string(
 
377
                                     &opt_state->start_revision,
 
378
                                     pool));
 
379
        }
 
380
      else
369
381
        {
370
382
          if (opt_state->xml)
371
383
            {
376
388
 
377
389
              svn_xml_make_open_tag(&sb, pool, svn_xml_normal,
378
390
                                    "revprops",
379
 
                                    "rev", revstr, NULL);
 
391
                                    "rev", revstr, SVN_VA_NULL);
380
392
 
381
393
              svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, FALSE,
382
394
                                          pool);
399
411
 
400
412
              SVN_ERR(stream_write(out, printable_val->data,
401
413
                                   printable_val->len));
402
 
              if (! opt_state->strict)
 
414
              if (! opt_state->no_newline)
403
415
                SVN_ERR(stream_write(out, APR_EOL_STR, strlen(APR_EOL_STR)));
404
416
            }
405
417
        }
415
427
      if (opt_state->depth == svn_depth_unknown)
416
428
        opt_state->depth = svn_depth_empty;
417
429
 
418
 
      /* Strict mode only makes sense for a single target.  So make
 
430
      /* No-newline mode only makes sense for a single target.  So make
419
431
         sure we have only a single target, and that we're not being
420
432
         asked to recurse on that target. */
421
 
      if (opt_state->strict
422
 
          && ((targets->nelts > 1) || (opt_state->depth != svn_depth_empty)))
 
433
      if (opt_state->no_newline
 
434
          && ((targets->nelts > 1) || (opt_state->depth != svn_depth_empty)
 
435
              || (opt_state->show_inherited_props)))
423
436
        return svn_error_create
424
437
          (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
425
 
           _("Strict output of property values only available for single-"
426
 
             "target, non-recursive propget operations"));
 
438
           _("--no-newline is only available for single-target,"
 
439
             " non-recursive propget operations"));
427
440
 
428
441
      for (i = 0; i < targets->nelts; i++)
429
442
        {
459
472
          /* Any time there is more than one thing to print, or where
460
473
             the path associated with a printed thing is not obvious,
461
474
             we'll print filenames.  That is, unless we've been told
462
 
             not to do so with the --strict option. */
 
475
             not to do so with the --no-newline option. */
463
476
          print_filenames = ((opt_state->depth > svn_depth_empty
464
477
                              || targets->nelts > 1
465
478
                              || apr_hash_count(props) > 1
466
479
                              || opt_state->verbose
467
480
                              || opt_state->show_inherited_props)
468
 
                             && (! opt_state->strict));
469
 
          omit_newline = opt_state->strict;
470
 
          like_proplist = opt_state->verbose && !opt_state->strict;
 
481
                             && (! opt_state->no_newline));
 
482
          omit_newline = opt_state->no_newline;
 
483
          like_proplist = opt_state->verbose && !opt_state->no_newline;
 
484
 
 
485
          /* If there are no properties, and exactly one node was queried,
 
486
             then warn. */
 
487
          if (opt_state->depth == svn_depth_empty
 
488
              && !opt_state->show_inherited_props
 
489
              && apr_hash_count(props) == 0)
 
490
            {
 
491
              svn_error_t *err;
 
492
              err = svn_error_createf(SVN_ERR_PROPERTY_NOT_FOUND, NULL,
 
493
                                      _("Property '%s' not found on '%s'"),
 
494
                                      pname_utf8, target);
 
495
              svn_handle_warning2(stderr, err, "svn: ");
 
496
              svn_error_clear(err);
 
497
              warned = TRUE;
 
498
            }
471
499
 
472
500
          if (opt_state->xml)
473
501
            SVN_ERR(print_properties_xml(
489
517
      svn_pool_destroy(subpool);
490
518
    }
491
519
 
 
520
  if (warned)
 
521
    return svn_error_create(SVN_ERR_BASE, NULL, NULL);
 
522
 
492
523
  return SVN_NO_ERROR;
493
524
}