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

« back to all changes in this revision

Viewing changes to subversion/libsvn_client/externals.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:
151
151
                    const svn_opt_revision_t *revision,
152
152
                    const char *defining_abspath,
153
153
                    svn_boolean_t *timestamp_sleep,
 
154
                    svn_ra_session_t *ra_session,
154
155
                    svn_client_ctx_t *ctx,
155
156
                    apr_pool_t *pool)
156
157
{
170
171
  if (revision->kind == svn_opt_revision_number)
171
172
    external_rev = revision->value.number;
172
173
 
173
 
  /* 
 
174
  /*
174
175
   * The code below assumes existing versioned paths are *not* part of
175
176
   * the external's defining working copy.
176
177
   * The working copy library does not support registering externals
186
187
                                &repos_root_url, &repos_uuid,
187
188
                                NULL, ctx->wc_ctx, local_abspath,
188
189
                                TRUE, /* ignore_enoent */
189
 
                                TRUE, /* show hidden */
190
190
                                pool, pool));
191
191
  if (kind != svn_node_unknown)
192
192
    {
236
236
             externals definition, perform an update. */
237
237
          if (strcmp(node_url, url) == 0)
238
238
            {
239
 
              SVN_ERR(svn_client__update_internal(NULL, local_abspath,
 
239
              SVN_ERR(svn_client__update_internal(NULL, timestamp_sleep,
 
240
                                                  local_abspath,
240
241
                                                  revision, svn_depth_unknown,
241
242
                                                  FALSE, FALSE, FALSE, TRUE,
242
243
                                                  FALSE, TRUE,
243
 
                                                  timestamp_sleep,
244
 
                                                  ctx, subpool));
 
244
                                                  ra_session, ctx, subpool));
245
245
 
246
246
              /* We just decided that this existing directory is an external,
247
247
                 so update the external registry with this information, like
372
372
    }
373
373
 
374
374
  /* ... Hello, new hotness. */
375
 
  SVN_ERR(svn_client__checkout_internal(NULL, url, local_abspath, peg_revision,
 
375
  SVN_ERR(svn_client__checkout_internal(NULL, timestamp_sleep,
 
376
                                        url, local_abspath, peg_revision,
376
377
                                        revision, svn_depth_infinity,
377
 
                                        FALSE, FALSE, timestamp_sleep,
 
378
                                        FALSE, FALSE,
 
379
                                        ra_session,
378
380
                                        ctx, pool));
379
381
 
380
382
  SVN_ERR(svn_wc__node_get_repos_info(NULL, NULL,
401
403
  return SVN_NO_ERROR;
402
404
}
403
405
 
404
 
/* Try to update a file external at LOCAL_ABSPATH to URL at REVISION using a
405
 
   access baton that has a write lock.  Use SCRATCH_POOL for temporary
 
406
/* Try to update a file external at LOCAL_ABSPATH to SWITCH_LOC. This function
 
407
   assumes caller has a write lock in CTX.  Use SCRATCH_POOL for temporary
406
408
   allocations, and use the client context CTX. */
407
409
static svn_error_t *
408
410
switch_file_external(const char *local_abspath,
409
 
                     const char *url,
410
 
                     const svn_opt_revision_t *peg_revision,
411
 
                     const svn_opt_revision_t *revision,
 
411
                     const svn_client__pathrev_t *switch_loc,
 
412
                     const char *record_url,
 
413
                     const svn_opt_revision_t *record_peg_revision,
 
414
                     const svn_opt_revision_t *record_revision,
412
415
                     const char *def_dir_abspath,
413
416
                     svn_ra_session_t *ra_session,
414
417
                     svn_client_ctx_t *ctx,
485
488
              SVN_ERR_CLIENT_FILE_EXTERNAL_OVERWRITE_VERSIONED, 0,
486
489
             _("The file external from '%s' cannot overwrite the existing "
487
490
               "versioned item at '%s'"),
488
 
             url, svn_dirent_local_style(local_abspath, scratch_pool));
 
491
             switch_loc->url,
 
492
             svn_dirent_local_style(local_abspath, scratch_pool));
489
493
        }
490
494
    }
491
495
  else
507
511
    void *report_baton;
508
512
    const svn_delta_editor_t *switch_editor;
509
513
    void *switch_baton;
510
 
    svn_client__pathrev_t *switch_loc;
511
514
    svn_revnum_t revnum;
512
515
    apr_array_header_t *inherited_props;
513
 
    const char *dir_abspath;
514
 
    const char *target;
515
 
 
516
 
    svn_dirent_split(&dir_abspath, &target, local_abspath, scratch_pool);
517
 
 
518
 
    /* ### Why do we open a new session?  RA_SESSION is a valid
519
 
       ### session -- the caller used it to call svn_ra_check_path on
520
 
       ### this very URL, the caller also did the resolving and
521
 
       ### reparenting that is repeated here. */
522
 
    SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &switch_loc,
523
 
                                              url, dir_abspath,
524
 
                                              peg_revision, revision,
525
 
                                              ctx, scratch_pool));
 
516
    const char *target = svn_dirent_basename(local_abspath, scratch_pool);
 
517
 
526
518
    /* Get the external file's iprops. */
527
519
    SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props, "",
528
520
                                       switch_loc->rev,
529
521
                                       scratch_pool, scratch_pool));
530
522
 
531
 
    SVN_ERR(svn_ra_reparent(ra_session, svn_uri_dirname(url, scratch_pool),
 
523
    SVN_ERR(svn_ra_reparent(ra_session,
 
524
                            svn_uri_dirname(switch_loc->url, scratch_pool),
532
525
                            scratch_pool));
533
526
 
534
527
    SVN_ERR(svn_wc__get_file_external_editor(&switch_editor, &switch_baton,
542
535
                                             use_commit_times,
543
536
                                             diff3_cmd, preserved_exts,
544
537
                                             def_dir_abspath,
545
 
                                             url, peg_revision, revision,
546
 
                                             ctx->conflict_func2,
547
 
                                             ctx->conflict_baton2,
 
538
                                             record_url,
 
539
                                             record_peg_revision,
 
540
                                             record_revision,
548
541
                                             ctx->cancel_func,
549
542
                                             ctx->cancel_baton,
550
543
                                             ctx->notify_func2,
578
571
          = svn_wc_notify_state_inapplicable;
579
572
        notify->lock_state = svn_wc_notify_lock_state_inapplicable;
580
573
        notify->revision = revnum;
581
 
        (*ctx->notify_func2)(ctx->notify_baton2, notify, scratch_pool);
 
574
        ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
582
575
      }
583
576
  }
584
577
 
691
684
      notify->kind = kind;
692
685
      notify->err = err;
693
686
 
694
 
      (ctx->notify_func2)(ctx->notify_baton2, notify, scratch_pool);
 
687
      ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
695
688
 
696
689
      if (err && err->apr_err == SVN_ERR_WC_LEFT_LOCAL_MOD)
697
690
        {
701
694
          notify->kind = svn_node_dir;
702
695
          notify->err = err;
703
696
 
704
 
          (ctx->notify_func2)(ctx->notify_baton2, notify, scratch_pool);
 
697
          ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
705
698
        }
706
699
    }
707
700
 
722
715
                            const char *local_abspath,
723
716
                            const char *old_defining_abspath,
724
717
                            const svn_wc_external_item2_t *new_item,
 
718
                            svn_ra_session_t *ra_session,
725
719
                            svn_boolean_t *timestamp_sleep,
726
720
                            apr_pool_t *scratch_pool)
727
721
{
728
 
  svn_ra_session_t *ra_session;
729
722
  svn_client__pathrev_t *new_loc;
730
723
  const char *new_url;
731
724
  svn_node_kind_t ext_kind;
746
739
                                                scratch_pool, scratch_pool));
747
740
 
748
741
  /* Determine if the external is a file or directory. */
749
 
  /* Get the RA connection. */
750
 
  SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &new_loc,
751
 
                                            new_url, NULL,
752
 
                                            &(new_item->peg_revision),
753
 
                                            &(new_item->revision), ctx,
754
 
                                            scratch_pool));
 
742
  /* Get the RA connection, if needed. */
 
743
  if (ra_session)
 
744
    {
 
745
      svn_error_t *err = svn_ra_reparent(ra_session, new_url, scratch_pool);
 
746
 
 
747
      if (err)
 
748
        {
 
749
          if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
 
750
            {
 
751
              svn_error_clear(err);
 
752
              ra_session = NULL;
 
753
            }
 
754
          else
 
755
            return svn_error_trace(err);
 
756
        }
 
757
      else
 
758
        {
 
759
          SVN_ERR(svn_client__resolve_rev_and_url(&new_loc,
 
760
                                                  ra_session, new_url,
 
761
                                                  &(new_item->peg_revision),
 
762
                                                  &(new_item->revision), ctx,
 
763
                                                  scratch_pool));
 
764
 
 
765
          SVN_ERR(svn_ra_reparent(ra_session, new_loc->url, scratch_pool));
 
766
        }
 
767
    }
 
768
 
 
769
  if (!ra_session)
 
770
    SVN_ERR(svn_client__ra_session_from_path2(&ra_session, &new_loc,
 
771
                                              new_url, NULL,
 
772
                                              &(new_item->peg_revision),
 
773
                                              &(new_item->revision), ctx,
 
774
                                              scratch_pool));
755
775
 
756
776
  SVN_ERR(svn_ra_check_path(ra_session, "", new_loc->rev, &ext_kind,
757
777
                            scratch_pool));
775
795
  /* First notify that we're about to handle an external. */
776
796
  if (ctx->notify_func2)
777
797
    {
778
 
      (*ctx->notify_func2)(
 
798
      ctx->notify_func2(
779
799
         ctx->notify_baton2,
780
800
         svn_wc_create_notify(local_abspath,
781
801
                              svn_wc_notify_update_external,
800
820
                                    &(new_item->peg_revision),
801
821
                                    &(new_item->revision),
802
822
                                    parent_dir_abspath,
803
 
                                    timestamp_sleep, ctx,
 
823
                                    timestamp_sleep, ra_session, ctx,
804
824
                                    scratch_pool));
805
825
        break;
806
826
      case svn_node_file:
858
878
          }
859
879
 
860
880
        SVN_ERR(switch_file_external(local_abspath,
 
881
                                     new_loc,
861
882
                                     new_url,
862
883
                                     &new_item->peg_revision,
863
884
                                     &new_item->revision,
908
929
                        apr_hash_t *old_externals,
909
930
                        svn_depth_t ambient_depth,
910
931
                        svn_depth_t requested_depth,
 
932
                        svn_ra_session_t *ra_session,
911
933
                        apr_pool_t *scratch_pool)
912
934
{
913
935
  apr_array_header_t *new_desc;
976
998
                                                  local_abspath, url,
977
999
                                                  target_abspath,
978
1000
                                                  old_defining_abspath,
979
 
                                                  new_item,
 
1001
                                                  new_item, ra_session,
980
1002
                                                  timestamp_sleep,
981
1003
                                                  iterpool),
982
1004
                      iterpool));
999
1021
                             const char *target_abspath,
1000
1022
                             svn_depth_t requested_depth,
1001
1023
                             svn_boolean_t *timestamp_sleep,
 
1024
                             svn_ra_session_t *ra_session,
1002
1025
                             svn_client_ctx_t *ctx,
1003
1026
                             apr_pool_t *scratch_pool)
1004
1027
{
1018
1041
       hi;
1019
1042
       hi = apr_hash_next(hi))
1020
1043
    {
1021
 
      const char *local_abspath = svn__apr_hash_index_key(hi);
1022
 
      const char *desc_text = svn__apr_hash_index_val(hi);
 
1044
      const char *local_abspath = apr_hash_this_key(hi);
 
1045
      const char *desc_text = apr_hash_this_val(hi);
1023
1046
      svn_depth_t ambient_depth = svn_depth_infinity;
1024
1047
 
1025
1048
      svn_pool_clear(iterpool);
1029
1052
          const char *ambient_depth_w;
1030
1053
 
1031
1054
          ambient_depth_w = apr_hash_get(ambient_depths, local_abspath,
1032
 
                                         svn__apr_hash_index_klen(hi));
 
1055
                                         apr_hash_this_key_len(hi));
1033
1056
 
1034
1057
          if (ambient_depth_w == NULL)
1035
1058
            {
1048
1071
                                      local_abspath,
1049
1072
                                      desc_text, old_external_defs,
1050
1073
                                      ambient_depth, requested_depth,
1051
 
                                      iterpool));
 
1074
                                      ra_session, iterpool));
1052
1075
    }
1053
1076
 
1054
1077
  /* Remove the remaining externals */
1056
1079
       hi;
1057
1080
       hi = apr_hash_next(hi))
1058
1081
    {
1059
 
      const char *item_abspath = svn__apr_hash_index_key(hi);
1060
 
      const char *defining_abspath = svn__apr_hash_index_val(hi);
 
1082
      const char *item_abspath = apr_hash_this_key(hi);
 
1083
      const char *defining_abspath = apr_hash_this_val(hi);
1061
1084
      const char *parent_abspath;
1062
1085
 
1063
1086
      svn_pool_clear(iterpool);
1131
1154
       hi;
1132
1155
       hi = apr_hash_next(hi))
1133
1156
    {
1134
 
      const char *local_abspath = svn__apr_hash_index_key(hi);
1135
 
      const char *desc_text = svn__apr_hash_index_val(hi);
 
1157
      const char *local_abspath = apr_hash_this_key(hi);
 
1158
      const char *desc_text = apr_hash_this_val(hi);
1136
1159
      const char *local_relpath;
1137
1160
      const char *dir_url;
1138
1161
      apr_array_header_t *items;
1188
1211
                                                                 sub_iterpool),
1189
1212
                                              sub_iterpool));
1190
1213
 
 
1214
          /* First notify that we're about to handle an external. */
 
1215
          if (ctx->notify_func2)
 
1216
            {
 
1217
              ctx->notify_func2(
 
1218
                       ctx->notify_baton2,
 
1219
                       svn_wc_create_notify(item_abspath,
 
1220
                                            svn_wc_notify_update_external,
 
1221
                                            sub_iterpool),
 
1222
                       sub_iterpool);
 
1223
            }
 
1224
 
1191
1225
          SVN_ERR(wrap_external_error(
1192
1226
                          ctx, item_abspath,
1193
1227
                          svn_client_export5(NULL, new_url, item_abspath,