Граф коммитов

43846 Коммитов

Автор SHA1 Сообщение Дата
rhe 102815b046 openssl: add OpenSSL::OCSP::SingleResponse
* ext/openssl/ossl_ocsp.c: Add OCSP::SingleResponse that represents an
  OCSP SingleResponse structure. Also add two new methods #responses
  and #find_response to OCSP::BasicResponse. A BasicResponse has one or
  more SingleResponse. We have OCSP::BasicResponse#status that returns
  them as an array of arrays, each containing the content of a
  SingleResponse, but this is not useful. When validating an OCSP
  response, we need to look into the each SingleResponse and check their
  validity but it is not simple. For example, when validating for a
  certificate 'cert', the code would be like:

    # certid_target is an OpenSSL::OCSP::CertificateId for cert
    basic = res.basic
    result = basic.status.any? do |ary|
      ary[0].cmp(certid_target) &&
        ary[4] <= Time.now && (!ary[5] || Time.now <= ary[5])
    end

  Adding OCSP::SingleResponse at the same time allows exposing
  OCSP_check_validity(). With this, the code above can be rewritten as:

    basic = res.basic
    single = basic.find_response(certid_target)
    result = single.check_validity

* test/openssl/test_ocsp.rb: Test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 12:26:27 +00:00
rhe 830c3a1409 openssl: allow passing absolute times in OCSP::BasicResponse#add_status
* ext/openssl/ossl_ocsp.c (ossl_ocspbres_add_status): Allow specifying
  the times (thisUpdate, nextUpdate and revocationTime) with Time
  objects. Currently they accepts only relative seconds from the current
  time. This is inconvenience, especially for revocationTime. When
  Integer is passed, they are still treated as relative times. Since the
  type check is currently done with rb_Integer(), this is a slightly
  incompatible change. Hope no one passes a relative time as String or
  Time object...
  Also, allow passing nil as nextUpdate. It is optional.

* ext/openssl/ruby_missing.h: Define RB_INTEGER_TYPE_P() if not defined.
  openssl gem will be released before Ruby 2.4.0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:42:30 +00:00
rhe f31f1f1adf openssl: implement initialize_copy for OpenSSL::OCSP::*
* ext/openssl/ossl_ocsp.c: Implement OCSP::{CertificateId,Request,
  BasicResponse,Response}#initialize_copy.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_ocsp.rb: Test them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:42:29 +00:00
rhe be1baf4a9a openssl: implement initialize_copy method for PKey classes
* ext/openssl/ossl_pkey_dh.c, ext/openssl/ossl_pkey_dsa.c,
  ext/openssl/ossl_pkey_ec.c, ext/openssl/ossl_pkey_rsa.c: Implement
  initialize_copy method for OpenSSL::PKey::*.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_pkey_dh.rb, test/openssl/test_pkey_dsa.rb,
  test/openssl/test_pkey_ec.rb, test/openssl/test_pkey_rsa.rb: Test they
  actually copy the OpenSSL objects, and modifications to cloned object
  don't affect the original object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:29:59 +00:00
duerst b67ead1452 * test/ruby/test_dir_m17n.rb: Skip tests with non-UTF-8 encodings
on cygwin. Cygwin can use the Unicode PUA (private use area) to store
  bytes from non-UTF-8 filenames (see
  https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars),
  but we are not supporting this. [Bug #12443]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 07:55:25 +00:00
svn a42466584c * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 06:01:26 +00:00
duerst d282efbeff * localeinit.c: Fix filesystem encoding for cygwin to UTF-8 (see
https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-unusual)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 06:01:25 +00:00
rhe 31388c4a73 openssl: add 'const's required in OpenSSL master
* ext/openssl/ossl_pkey.h, ext/openssl/ossl_pkey_dh.c,
  ext/openssl/ossl_pkey_dsa.c, ext/openssl/ossl_pkey_rsa.c: A few days
  ago, OpenSSL changed {DH,DSA,RSA}_get0_*() to take const BIGNUM **.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=fd809cfdbd6e32b6b67b68c59f6d55fbed7a9327
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 05:31:28 +00:00
nobu 0ce3fab422 variable.c: consider length
* variable.c (rb_path_to_class): consider the string length
  instead of a terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 02:19:45 +00:00
nobu 5707ba30aa variable.c: rb_const_search
* variable.c (rb_path_to_class): search the constant at once
  instead of checking if defined and then getting it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:54:42 +00:00
svn 60857ce1a5 * 2016-06-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:48:27 +00:00
nobu b569971422 Normalization test iff UTF-8 file system
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  normalization is meaningless unless file system encoding is UTF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:48:27 +00:00
rhe c2158dd55e openssl: avoid test crash on Ubuntu 16.04
* test/openssl/test_pkey_ec.rb (setup): Don't call EC#generate_key! for
  Oakley-* curves. This causes an odd error on Ubuntu 16.04 with openssl
  1.0.2g-1ubuntu4.1.

    begin
      OpenSSL::PKey::EC.new("Oakley-EC2N-4").generate_key
    rescue
      p $!
    end
    OpenSSL::PKey::RSA.new(512)

  This sometimes causes:

    #<OpenSSL::PKey::ECError: EC_KEY_generate_key: pairwise test failed>
    fips.c(139): OpenSSL internal error, assertion failed: FATAL FIPS SELFTEST FAILURE

  [ruby-dev:49670] [Bug #12504]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 09:10:19 +00:00
hsbt 7376907959 * test/rubygems/test_gem_installer.rb: Fixed broken test with extension
build. https://github.com/rubygems/rubygems/pull/1645

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:57 +00:00
svn 03141e203a * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:57 +00:00
hsbt f20ad4889d * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems
HEAD(2c6d256). It contains to update vendored Molinillo to 0.5.0.
  https://github.com/rubygems/rubygems/pull/1638

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:55 +00:00
nobu 513345607d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): could occur only
  on sizeof(long) >= sizeof(void*).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:50:14 +00:00
nobu 815e8e992d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): refine the
  conditinon, try to allocate strings until the buffer is located
  in higher half address.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:40:15 +00:00
nobu c79c06fa1c Integer conversion
* ext/bigdecimal/bigdecimal.c: use NUM2INT and NUM2USHORT to
  reject nil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 02:25:28 +00:00
nobu 5065e28809 Suppress false warnings
* vsnprintf.c (BSD_vfprintf): make PRI_EXTRA_MARK_LEN an explicit
  int to suppress type-limits warnings by old gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 02:25:27 +00:00
nobu d8db69e683 Suppress false warnings
* vm_eval.c (rb_eval_cmd): refactor to share common code, and
  suppress false maybe-uninitialized warnings by old gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 01:50:49 +00:00
nobu d0b92e798f Unnecessary volatile
* vm_eval.c (rb_yield_splat, eval_string_with_cref): remove
  unnecessary volatile outside PUSH_TAG/POP_TAG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 01:50:46 +00:00
nobu c15ad4a4ac Fix static-linked-ext encodings
* common.mk (build-ext), ext/extmk.rb: use variable EXTENCS
  different than ENCOBJS, to get rid of circular dependency.
  build libencs when linking encodings statically.
  [ruby-core:75618] [Bug #12401]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 01:13:39 +00:00
svn 9a96068975 * 2016-06-18
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 23:52:49 +00:00
nobu ed4aed86fb stringio.c: fix index overflow
* ext/stringio/stringio.c (strio_getline): fix pointer index
  overflow.  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 23:52:48 +00:00
svn 34eb16651e * 2016-06-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 08:45:06 +00:00
nobu 871472c72b Unnecessary checks
* ext/bigdecimal/bigdecimal.c: FIX2INT and FIX2UINT imply the
  check for Fixnum.

* ext/zlib/zlib.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 08:45:05 +00:00
nobu 81442f903c prevent rb_cObject from GC
* class.c (Init_class_hierarchy): prevent rb_cObject which is the
  class tree root, from GC.  [ruby-dev:49666] [Bug #12492]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-16 07:35:37 +00:00
nobu 1cbc622ea7 string.c: adjust buffer size
* string.c (tr_trans): adjust buffer size by processed and rest
  lengths, instead of doubling repeatedly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-16 03:17:54 +00:00
nobu cc9f1e9195 string.c: fix terminator
* string.c (tr_trans): consider terminator length and fix heap
  overflow.  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-16 02:15:27 +00:00
svn 9b75ddaafb * 2016-06-16
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 15:02:47 +00:00
rhe 9192f253b9 openssl: refactor OpenSSL::OCSP::*#verify
* ext/openssl/ossl_ocsp.c (ossl_ocspreq_verify, ossl_ocspbres_verify):
  Use ossl_clear_error() so that they don't print warnings to stderr and
  leak errors in the OpenSSL error queue. Also, check the return value
  of OCSP_*_verify() correctly. They can return -1 on verification
  failure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 15:02:46 +00:00
rhe 2851f19f49 openssl: allow specifying hash algorithm in OCSP::*#sign
* ext/openssl/ossl_ocsp.c (ossl_ocspreq_sign, ossl_ocspbres_sign): Allow
  specifying hash algorithm used in signing. They are hard coded to use
  SHA-1.
  Based on a patch provided by Tim Shirley <tidoublemy@gmail.com>.
  [ruby-core:70915] [Feature #11552] [GH ruby/openssl#28]

* test/openssl/test_ocsp.rb: Test sign-verify works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 10:52:37 +00:00
nobu ce19b495d1 date_core.c: remove assert
* ext/date/date_core.c (decode_jd): do not assert type of
  argument.  just try to convert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 06:26:52 +00:00
nobu 63be9ed5c0 date_core.c: missing argument
* ext/date/date_core.c (d_lite_initialize): fix missing argument
  for write-barrier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 06:26:51 +00:00
nobu 4060211c96 thread.c: fix thread_id formatting
* thread.c (debug_deadlock_check): fix format specifier for
  thread_id, which may not be a pointer, nor even a scalar value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 01:44:43 +00:00
nobu 6c9ffbf5b3 numeric.c: fix doc of Integer#digits [ci skip]
* numeric.c: [DOC] fix rdoc directive, and an example of negative
  value.  [ruby-core:76025] [Bug #12487]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 16:46:18 +00:00
nobu a7ce662a85 Unicode Version in RbConfig
* tool/mkconfig.rb: provide Unicode Version information as
  RbConfig::CONFIG['UNICODE_VERSION'].
  [ruby-core:75845] [Feature #12460]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 16:44:45 +00:00
svn 06975d613a * 2016-06-15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 15:01:38 +00:00
kazu fb1cee9b6f use \A and \z instead of ^ and $ in regexp
* test/ruby/enc/test_case_comprehensive.rb
  (TestComprehensiveCaseFold::read_data): use \A and \z instead of
  ^ and $ in regexp.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 15:01:37 +00:00
kazu 8f7ddbb0ec fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 14:59:01 +00:00
nobu 5bddb94492 remove backward macros
* include/ruby/backward.h (rb_cFixnum, rb_cBignum): remove the
  backward compatibility macros, to fail incompatible extension
  libraries earily.  [Bug #12427]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 14:43:02 +00:00
nobu 0c22cfd0ce strftime.c: limit result size
* strftime.c (rb_strftime_with_timespec): limit the result string
  size by the format length, to get rid of unlimited memory use.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:22:09 +00:00
rhe 0a97832e6a openssl: add some accessor methods for OCSP::CertificateId
* ext/openssl/ossl_ocsp.c (ossl_ocspcid_get_issuer_name_hash,
  ossl_ocspcid_get_issuer_key_hash, ossl_ocspcid_get_hash_algorithm):
  Add accessor methods OCSP::CertificateId#issuer_name_hash,
  #issuer_key_hash, #hash_algorithm.
  Based on a patch provided by Paul Kehrer <paul.l.kehrer@gmail.com>.
  [ruby-core:48062] [Feature #7181]

* test/openssl/test_ocsp.rb: Test these new methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:12:20 +00:00
nobu 58e8c9c895 date_strftime.c: check precision
* ext/date/date_strftime.c (date_strftime_with_tmx): reject too
  large precision to get rid of buffer overflow.
  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:07:27 +00:00
rhe 40799e5ef9 openssl: add missing #to_der to OCSP::{CertificateId,BasicResponse}
* ext/openssl/ossl_ocsp.c (ossl_ocspbres_to_der, ossl_ocspcid_to_der):
  Implement #to_der methods for OCSP::BasicResponse and
  OCSP::CertificateId.

  (ossl_ocspreq_initialize, ossl_ocspres_initialize): Use GetOCSP*()
  instead of raw DATA_PTR().

  (ossl_ocspbres_initialize, ossl_ocspcid_initialize): Allow
  initializing from DER string.

  (Init_ossl_ocsp): Define new #to_der methods.

* test/openssl/test_ocsp.rb: Test these changes. Also add missing tests
  for OCSP::{Response,Request}#to_der.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 12:40:55 +00:00
rhe 8dd0a046a9 openssl: fix acesssor functions for RSA and DH in openssl_missing.h
* ext/openssl/openssl_missing.h (DH_set0_pqg, RSA_set0_key):
  DH_set0_pqg() allows 'q' to be NULL. Fix a typo in RSA_set0_key().
  Fixes r55285.  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 12:35:28 +00:00
svn 1bec294ba7 * 2016-06-14
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 01:20:08 +00:00
mrkn 78e8e21aea NEWS: describe Integer#digits [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 01:20:07 +00:00
naruse 6965be6896 fix test of r55397
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 12:46:44 +00:00