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

« back to all changes in this revision

Viewing changes to subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.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:
23
23
/* Tell swigutil_rb.h that we're inside the implementation */
24
24
#define SVN_SWIG_SWIGUTIL_RB_C
25
25
 
 
26
/* Windows hack: Allow overriding some <ruby.h> defaults */
 
27
#include "swigutil_rb__pre_ruby.h"
26
28
#include "swig_ruby_external_runtime.swg"
27
29
#include "swigutil_rb.h"
 
30
 
 
31
#ifdef HAVE_RUBY_ST_H
 
32
#include <ruby/st.h>
 
33
#else
28
34
#include <st.h>
 
35
#endif
29
36
 
30
37
#undef PACKAGE_BUGREPORT
31
38
#undef PACKAGE_NAME
474
481
check_apr_status(apr_status_t status, VALUE exception_class, const char *format)
475
482
{
476
483
    if (status != APR_SUCCESS) {
477
 
        char buffer[1024];
478
 
        apr_strerror(status, buffer, sizeof(buffer) - 1);
479
 
        rb_raise(exception_class, format, buffer);
 
484
        char buffer[1024];
 
485
        apr_strerror(status, buffer, sizeof(buffer) - 1);
 
486
        rb_raise(exception_class, format, buffer);
480
487
    }
481
488
}
482
489
 
519
526
 
520
527
    objects[0] = target;
521
528
    if (find_swig_type_object(1, objects) && DATA_PTR(target)) {
522
 
        svn_swig_rb_destroy_internal_pool(target);
523
 
        DATA_PTR(target) = NULL;
 
529
        svn_swig_rb_destroy_internal_pool(target);
 
530
        DATA_PTR(target) = NULL;
524
531
    }
525
532
 
526
533
    return Qnil;
538
545
  }
539
546
 
540
547
  check_apr_status(apr_allocator_create(&swig_rb_allocator),
541
 
                   rb_eLoadError, "failed to create allocator: %s");
 
548
                   rb_eLoadError, "failed to create allocator: %s");
542
549
  apr_allocator_max_free_set(swig_rb_allocator,
543
 
                             SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
 
550
                             SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
544
551
 
545
552
  swig_rb_pool = svn_pool_create_ex(NULL, swig_rb_allocator);
546
553
  apr_pool_tag(swig_rb_pool, "svn-ruby-pool");
549
556
    apr_thread_mutex_t *mutex;
550
557
 
551
558
    check_apr_status(apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT,
552
 
                                             swig_rb_pool),
553
 
                     rb_eLoadError, "failed to create allocator: %s");
 
559
                                             swig_rb_pool),
 
560
                                             rb_eLoadError, "failed to create allocator: %s");
554
561
    apr_allocator_mutex_set(swig_rb_allocator, mutex);
555
562
  }
556
563
#endif
583
590
 
584
591
  mSvnDestroyer = rb_define_module_under(rb_svn(), "Destroyer");
585
592
  rb_define_module_function(mSvnDestroyer, "destroy",
586
 
                            svn_swig_rb_destroyer_destroy, 1);
 
593
                            svn_swig_rb_destroyer_destroy, 1);
587
594
}
588
595
 
589
596
apr_pool_t *
736
743
rb_set_pool_if_swig_type_object(VALUE target, VALUE pool)
737
744
{
738
745
  VALUE targets[1];
739
 
  
 
746
 
740
747
  targets[0] = target;
741
748
 
742
749
  if (!NIL_P(find_swig_type_object(1, targets))) {
862
869
 
863
870
VALUE
864
871
svn_swig_rb_svn_error_new(VALUE code, VALUE message, VALUE file, VALUE line,
865
 
                          VALUE child)
 
872
                          VALUE child)
866
873
{
867
874
  return rb_funcall(rb_svn_error_svn_error(),
868
875
                    id_new_corresponding_error,
1598
1605
} callback_handle_error_baton_t;
1599
1606
 
1600
1607
static VALUE
1601
 
callback(VALUE baton)
 
1608
callback(VALUE baton, ...)
1602
1609
{
1603
1610
  callback_baton_t *cbb = (callback_baton_t *)baton;
1604
1611
  VALUE result;
1610
1617
}
1611
1618
 
1612
1619
static VALUE
1613
 
callback_rescue(VALUE baton)
 
1620
callback_rescue(VALUE baton, ...)
1614
1621
{
1615
1622
  callback_rescue_baton_t *rescue_baton = (callback_rescue_baton_t*)baton;
1616
1623
 
1627
1634
}
1628
1635
 
1629
1636
static VALUE
1630
 
callback_ensure(VALUE pool)
 
1637
callback_ensure(VALUE pool, ...)
1631
1638
{
1632
1639
  svn_swig_rb_pop_pool(pool);
1633
1640
 
1638
1645
invoke_callback(VALUE baton, VALUE pool)
1639
1646
{
1640
1647
  callback_baton_t *cbb = (callback_baton_t *)baton;
1641
 
  VALUE sub_pool;
 
1648
  VALUE subpool;
1642
1649
  VALUE argv[1];
1643
1650
 
1644
1651
  argv[0] = pool;
1645
 
  svn_swig_rb_get_pool(1, argv, Qnil, &sub_pool, NULL);
1646
 
  cbb->pool = sub_pool;
1647
 
  return rb_ensure(callback, baton, callback_ensure, sub_pool);
 
1652
  svn_swig_rb_get_pool(1, argv, Qnil, &subpool, NULL);
 
1653
  cbb->pool = subpool;
 
1654
  return rb_ensure(callback, baton, callback_ensure, subpool);
1648
1655
}
1649
1656
 
1650
1657
static VALUE
1651
 
callback_handle_error(VALUE baton)
 
1658
callback_handle_error(VALUE baton, ...)
1652
1659
{
1653
1660
  callback_handle_error_baton_t *handle_error_baton;
1654
1661
  handle_error_baton = (callback_handle_error_baton_t *)baton;
3231
3238
    pool_wrapper_p = &pool_wrapper;
3232
3239
    r2c_swig_type2(rb_pool, "apr_pool_wrapper_t *", (void **)pool_wrapper_p);
3233
3240
    stream = svn_stream_create((void *)io, pool_wrapper->pool);
3234
 
    svn_stream_set_read(stream, read_handler_rbio);
 
3241
    svn_stream_set_read2(stream, NULL /* only full read support */,
 
3242
                         read_handler_rbio);
3235
3243
    svn_stream_set_write(stream, write_handler_rbio);
3236
3244
  }
3237
3245
 
4025
4033
  svn_swig_rb_ra_reporter_abort_report
4026
4034
};
4027
4035
 
4028
 
svn_ra_reporter3_t *svn_swig_rb_ra_reporter3 = &rb_ra_reporter3;
 
4036
svn_ra_reporter3_t *svn_swig_rb_get_ra_reporter3()
 
4037
{
 
4038
  return &rb_ra_reporter3;
 
4039
}