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

« back to all changes in this revision

Viewing changes to subversion/libsvn_ra_serf/blame.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:
47
47
 * This enum represents the current state of our XML parsing for a REPORT.
48
48
 */
49
49
typedef enum blame_state_e {
50
 
  INITIAL = 0,
 
50
  INITIAL = XML_STATE_INITIAL,
51
51
  FILE_REVS_REPORT,
52
52
  FILE_REV,
53
53
  REV_PROP,
111
111
  { 0 }
112
112
};
113
113
 
114
 
 
115
114
/* Conforms to svn_ra_serf__xml_opened_t  */
116
115
static svn_error_t *
117
116
blame_opened(svn_ra_serf__xml_estate_t *xes,
140
139
      apr_pool_t *state_pool = svn_ra_serf__xml_state_pool(xes);
141
140
      apr_hash_t *gathered = svn_ra_serf__xml_gather_since(xes, FILE_REV);
142
141
      const char *path;
143
 
      const char *rev;
 
142
      const char *rev_str;
144
143
      const char *merged_revision;
145
144
      svn_txdelta_window_handler_t txdelta;
146
145
      void *txdelta_baton;
 
146
      apr_int64_t rev;
147
147
 
148
148
      path = svn_hash_gets(gathered, "path");
149
 
      rev = svn_hash_gets(gathered, "rev");
 
149
      rev_str = svn_hash_gets(gathered, "rev");
 
150
 
 
151
      SVN_ERR(svn_cstring_atoi64(&rev, rev_str));
150
152
      merged_revision = svn_hash_gets(gathered, "merged-revision");
151
153
 
152
154
      SVN_ERR(blame_ctx->file_rev(blame_ctx->file_rev_baton,
153
 
                                  path, SVN_STR_TO_REV(rev),
 
155
                                  path, (svn_revnum_t)rev,
154
156
                                  blame_ctx->rev_props,
155
157
                                  merged_revision != NULL,
156
158
                                  &txdelta, &txdelta_baton,
278
280
create_file_revs_body(serf_bucket_t **body_bkt,
279
281
                      void *baton,
280
282
                      serf_bucket_alloc_t *alloc,
281
 
                      apr_pool_t *pool)
 
283
                      apr_pool_t *pool /* request pool */,
 
284
                      apr_pool_t *scratch_pool)
282
285
{
283
286
  serf_bucket_t *buckets;
284
287
  blame_context_t *blame_ctx = baton;
288
291
  svn_ra_serf__add_open_tag_buckets(buckets, alloc,
289
292
                                    "S:file-revs-report",
290
293
                                    "xmlns:S", SVN_XML_NAMESPACE,
291
 
                                    NULL);
 
294
                                    SVN_VA_NULL);
292
295
 
293
296
  svn_ra_serf__add_tag_buckets(buckets,
294
297
                               "S:start-revision", apr_ltoa(pool, blame_ctx->start),
300
303
 
301
304
  if (blame_ctx->include_merged_revisions)
302
305
    {
303
 
      svn_ra_serf__add_tag_buckets(buckets,
304
 
                                   "S:include-merged-revisions", NULL,
305
 
                                   alloc);
 
306
      svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
 
307
                                         "S:include-merged-revisions", SVN_VA_NULL);
306
308
    }
307
309
 
308
310
  svn_ra_serf__add_tag_buckets(buckets,
331
333
  svn_ra_serf__handler_t *handler;
332
334
  svn_ra_serf__xml_context_t *xmlctx;
333
335
  const char *req_url;
334
 
  svn_error_t *err;
 
336
  svn_revnum_t peg_rev;
335
337
 
336
338
  blame_ctx = apr_pcalloc(pool, sizeof(*blame_ctx));
337
339
  blame_ctx->pool = pool;
342
344
  blame_ctx->end = end;
343
345
  blame_ctx->include_merged_revisions = include_merged_revisions;
344
346
 
 
347
  /* Since Subversion 1.8 we allow retrieving blames backwards. So we can't
 
348
     just unconditionally use end_rev as the peg revision as before */
 
349
  if (end > start)
 
350
    peg_rev = end;
 
351
  else
 
352
    peg_rev = start;
 
353
 
345
354
  SVN_ERR(svn_ra_serf__get_stable_url(&req_url, NULL /* latest_revnum */,
346
 
                                      session, NULL /* conn */,
347
 
                                      NULL /* url */, end,
 
355
                                      session,
 
356
                                      NULL /* url */, peg_rev,
348
357
                                      pool, pool));
349
358
 
350
359
  xmlctx = svn_ra_serf__xml_context_create(blame_ttable,
353
362
                                           blame_cdata,
354
363
                                           blame_ctx,
355
364
                                           pool);
356
 
  handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
 
365
  handler = svn_ra_serf__create_expat_handler(session, xmlctx, NULL, pool);
357
366
 
358
367
  handler->method = "REPORT";
359
368
  handler->path = req_url;
360
369
  handler->body_type = "text/xml";
361
370
  handler->body_delegate = create_file_revs_body;
362
371
  handler->body_delegate_baton = blame_ctx;
363
 
  handler->conn = session->conns[0];
364
 
  handler->session = session;
365
 
 
366
 
  err = svn_ra_serf__context_run_one(handler, pool);
367
 
 
368
 
  err = svn_error_compose_create(
369
 
            svn_ra_serf__error_on_status(handler->sline,
370
 
                                         handler->path,
371
 
                                         handler->location),
372
 
            err);
373
 
 
374
 
  return svn_error_trace(err);
 
372
 
 
373
  SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
 
374
 
 
375
  if (handler->sline.code != 200)
 
376
    return svn_error_trace(svn_ra_serf__unexpected_status(handler));
 
377
 
 
378
  return SVN_NO_ERROR;
375
379
}