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

« back to all changes in this revision

Viewing changes to subversion/svn/util.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:
75
75
                          void *baton,
76
76
                          apr_pool_t *pool)
77
77
{
 
78
  /* Be very careful with returning errors from this callback as those
 
79
     will be returned as errors from editor->close_edit(...), which may
 
80
     cause callers to assume that the commit itself failed.
 
81
 
 
82
     See log message of r1659867 and the svn_ra_get_commit_editor3
 
83
     documentation for details on error scenarios. */
 
84
 
78
85
  if (SVN_IS_VALID_REVNUM(commit_info->revision))
79
 
    SVN_ERR(svn_cmdline_printf(pool, _("\nCommitted revision %ld%s.\n"),
 
86
    SVN_ERR(svn_cmdline_printf(pool, _("Committed revision %ld%s.\n"),
80
87
                               commit_info->revision,
81
88
                               commit_info->revision == 42 &&
82
89
                               getenv("SVN_I_LOVE_PANGALACTIC_GARGLE_BLASTERS")
164
171
     * is OK to continue with the merge.
165
172
     * Any other exit code means there was a real problem. */
166
173
    if (exitcode != 0 && exitcode != 1)
167
 
      return svn_error_createf
168
 
        (SVN_ERR_EXTERNAL_PROGRAM, NULL,
169
 
         _("The external merge tool exited with exit code %d"), exitcode);
 
174
      return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL,
 
175
        _("The external merge tool '%s' exited with exit code %d."),
 
176
        merge_tool, exitcode);
170
177
    else if (remains_in_conflict)
171
178
      *remains_in_conflict = exitcode == 1;
172
179
  }
197
204
                           apr_hash_t *config,
198
205
                           apr_pool_t *pool)
199
206
{
200
 
  struct log_msg_baton *lmb = apr_palloc(pool, sizeof(*lmb));
 
207
  struct log_msg_baton *lmb = apr_pcalloc(pool, sizeof(*lmb));
201
208
 
202
209
  if (opt_state->filedata)
203
210
    {
230
237
                     SVN_CONFIG_OPTION_LOG_ENCODING,
231
238
                     NULL);
232
239
    }
 
240
  else
 
241
    lmb->message_encoding = NULL;
233
242
 
234
 
  lmb->base_dir = base_dir ? base_dir : "";
 
243
  lmb->base_dir = base_dir;
235
244
  lmb->tmpfile_left = NULL;
236
245
  lmb->config = config;
237
246
  lmb->keep_locks = opt_state->no_unlock;
343
352
  *tmp_file = NULL;
344
353
  if (lmb->message)
345
354
    {
346
 
      svn_stringbuf_t *log_msg_buf = svn_stringbuf_create(lmb->message, pool);
347
 
      svn_string_t *log_msg_str = apr_pcalloc(pool, sizeof(*log_msg_str));
348
 
 
349
 
      /* Trim incoming messages of the EOF marker text and the junk
350
 
         that follows it.  */
351
 
      truncate_buffer_at_prefix(&(log_msg_buf->len), log_msg_buf->data,
352
 
                                EDITOR_EOF_PREFIX);
353
 
 
354
 
      /* Make a string from a stringbuf, sharing the data allocation. */
355
 
      log_msg_str->data = log_msg_buf->data;
356
 
      log_msg_str->len = log_msg_buf->len;
357
 
      SVN_ERR_W(svn_subst_translate_string2(&log_msg_str, FALSE, FALSE,
 
355
      svn_string_t *log_msg_str = svn_string_create(lmb->message, pool);
 
356
 
 
357
      SVN_ERR_W(svn_subst_translate_string2(&log_msg_str, NULL, NULL,
358
358
                                            log_msg_str, lmb->message_encoding,
359
359
                                            FALSE, pool, pool),
360
360
                _("Error normalizing log message to internal format"));
361
361
 
 
362
      /* Strip off the EOF marker text and the junk that follows it. */
 
363
      truncate_buffer_at_prefix(&(log_msg_str->len), (char *)log_msg_str->data,
 
364
                                EDITOR_EOF_PREFIX);
 
365
 
362
366
      *log_msg = log_msg_str->data;
363
367
      return SVN_NO_ERROR;
364
368
    }
388
392
 
389
393
          if (! path)
390
394
            path = item->url;
391
 
          else if (! *path)
392
 
            path = ".";
393
 
 
394
 
          if (! svn_path_is_url(path) && lmb->base_dir)
 
395
          else if (lmb->base_dir)
395
396
            path = svn_dirent_is_child(lmb->base_dir, path, pool);
396
397
 
397
398
          /* If still no path, then just use current directory. */
398
 
          if (! path)
 
399
          if (! path || !*path)
399
400
            path = ".";
400
401
 
401
402
          if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
434
435
      if (! lmb->non_interactive)
435
436
        {
436
437
          err = svn_cmdline__edit_string_externally(&msg_string, &lmb->tmpfile_left,
437
 
                                                    lmb->editor_cmd, lmb->base_dir,
 
438
                                                    lmb->editor_cmd,
 
439
                                                    lmb->base_dir ? lmb->base_dir : "",
438
440
                                                    msg_string, "svn-commit",
439
441
                                                    lmb->config, TRUE,
440
442
                                                    lmb->message_encoding,
466
468
      if (msg_string)
467
469
        message = svn_stringbuf_create_from_string(msg_string, pool);
468
470
 
469
 
      /* Strip the prefix from the buffer. */
 
471
      /* Strip off the EOF marker text and the junk that follows it. */
470
472
      if (message)
471
473
        truncate_buffer_at_prefix(&message->len, message->data,
472
474
                                  EDITOR_EOF_PREFIX);
565
567
 
566
568
  if (fputs(string, stream) == EOF)
567
569
    {
568
 
      if (errno)
569
 
        return svn_error_wrap_apr(errno, _("Write error"));
 
570
      if (apr_get_os_error()) /* is errno on POSIX */
 
571
        return svn_error_wrap_apr(apr_get_os_error(), _("Write error"));
570
572
      else
571
573
        return svn_error_create(SVN_ERR_IO_WRITE_ERROR, NULL, NULL);
572
574
    }
631
633
  if (string)
632
634
    {
633
635
      svn_xml_make_open_tag(sb, pool, svn_xml_protect_pcdata,
634
 
                            tagname, NULL);
 
636
                            tagname, SVN_VA_NULL);
635
637
      svn_xml_escape_cdata_cstring(sb, string, pool);
636
638
      svn_xml_make_close_tag(sb, pool, tagname);
637
639
    }
648
650
  /* "<commit ...>" */
649
651
  svn_xml_make_open_tag(sb, pool, svn_xml_normal, "commit",
650
652
                        "revision",
651
 
                        apr_psprintf(pool, "%ld", revision), NULL);
 
653
                        apr_psprintf(pool, "%ld", revision), SVN_VA_NULL);
652
654
 
653
655
  /* "<author>xx</author>" */
654
656
  if (author)
669
671
                       apr_pool_t *pool)
670
672
{
671
673
  /* "<lock>" */
672
 
  svn_xml_make_open_tag(sb, pool, svn_xml_normal, "lock", NULL);
 
674
  svn_xml_make_open_tag(sb, pool, svn_xml_normal, "lock", SVN_VA_NULL);
673
675
 
674
676
  /* "<token>xx</token>" */
675
677
  svn_cl__xml_tagged_cdata(sb, pool, "token", lock->token);
704
706
  svn_xml_make_header2(&sb, "UTF-8", pool);
705
707
 
706
708
  /* "<TAGNAME>" */
707
 
  svn_xml_make_open_tag(&sb, pool, svn_xml_normal, tagname, NULL);
 
709
  svn_xml_make_open_tag(&sb, pool, svn_xml_normal, tagname, SVN_VA_NULL);
708
710
 
709
711
  return svn_cl__error_checked_fputs(sb->data, stdout);
710
712
}