diff options
author | taca <taca> | 2010-09-10 03:29:00 +0000 |
---|---|---|
committer | taca <taca> | 2010-09-10 03:29:00 +0000 |
commit | 6c1ff48bf13c383ef672d0bb614e1ca38f8fe6af (patch) | |
tree | c7618830f9368832f6e69ae1f3408e7242c1fa38 /lang/ruby18-base | |
parent | afe4c3d15a1941ff62eb75eeb63ce5aab533879f (diff) | |
download | pkgsrc-6c1ff48bf13c383ef672d0bb614e1ca38f8fe6af.tar.gz |
Update ruby18-base to 1.8.7.302 (Ruby 1.8.7 patchlevel 302).
Since many changes from previous release, please refer
http://www.ruby-lang.org/en/news/2010/08/16/ruby-1-8-7-p302-is-released/.
Note: Since all security updates are already in previous package,
This update dosen't include any securify fix.
Diffstat (limited to 'lang/ruby18-base')
56 files changed, 2105 insertions, 624 deletions
diff --git a/lang/ruby18-base/Makefile b/lang/ruby18-base/Makefile index 04229a3b8fe..372644f946b 100644 --- a/lang/ruby18-base/Makefile +++ b/lang/ruby18-base/Makefile @@ -1,15 +1,15 @@ -# $NetBSD: Makefile,v 1.57 2010/08/31 16:28:13 taca Exp $ +# $NetBSD: Makefile,v 1.58 2010/09/10 03:29:00 taca Exp $ # DISTNAME= ${RUBY_DISTNAME} PKGNAME= ${RUBY_PKGPREFIX}-base-${RUBY_VERSION_SUFFIX} CATEGORIES= lang ruby MASTER_SITES= ${MASTER_SITE_RUBY} -PKGREVISION= 7 MAINTAINER= taca@NetBSD.org HOMEPAGE= ${RUBY_HOMEPAGE} COMMENT= Ruby 1.8 based release minimum package +LICENSE= gnu-gpl-v2 OR ruby-license RUBY_VERSION= ${RUBY18_VERSION} @@ -112,6 +112,7 @@ FIX_PERM= ${RUBY_ARCHLIB}/digest.h ${RUBY_ARCHLIB}/dl.h \ ${RUBY_ARCHLIB}/dlconfig.h pre-configure: + ${ECHO} >> ${WRKSRC}/version.h # workaround for no EOL. ${RM} -f ${WRKSRC}/ext/curses/extconf.rb ${RM} -f ${WRKSRC}/ext/gdbm/extconf.rb ${RM} -f ${WRKSRC}/ext/readline/extconf.rb diff --git a/lang/ruby18-base/PLIST b/lang/ruby18-base/PLIST index fbb3699fe11..23f2c3fafd0 100644 --- a/lang/ruby18-base/PLIST +++ b/lang/ruby18-base/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.16 2009/06/14 20:34:14 joerg Exp $ +@comment $NetBSD: PLIST,v 1.17 2010/09/10 03:29:00 taca Exp $ bin/erb${RUBY_VER} bin/h2rb${RUBY_VER} bin/irb${RUBY_VER} @@ -7,9 +7,9 @@ bin/ri${RUBY_VER} bin/${RUBY_NAME} bin/testrb${RUBY_VER} lib/libruby${RUBY_VER}-static.a -lib/libruby${RUBY_VER}.so -${RUBY_NOSHLIBMAJOR}lib/libruby${RUBY_VER}.so.${RUBY_SHLIBMAJOR} -lib/libruby${RUBY_VER}.so.${RUBY_SHLIBVER} +lib/libruby${RUBY_VER}.${RUBY_DLEXT} +${RUBY_NOSHLIBMAJOR}lib/libruby${RUBY_VER}.${RUBY_DLEXT}.${RUBY_SHLIBMAJOR} +lib/libruby${RUBY_VER}.${RUBY_DLEXT}.${RUBY_SHLIBVER} ${RUBY_LIB}/English.rb ${RUBY_LIB}/Env.rb ${RUBY_LIB}/abbrev.rb @@ -176,7 +176,9 @@ ${RUBY_LIB}/openssl/buffering.rb ${RUBY_LIB}/openssl/cipher.rb ${RUBY_LIB}/openssl/digest.rb ${RUBY_LIB}/openssl/pkcs7.rb +${RUBY_LIB}/openssl/ssl-internal.rb ${RUBY_LIB}/openssl/ssl.rb +${RUBY_LIB}/openssl/x509-internal.rb ${RUBY_LIB}/openssl/x509.rb ${RUBY_LIB}/optparse.rb ${RUBY_LIB}/optparse/date.rb diff --git a/lang/ruby18-base/distinfo b/lang/ruby18-base/distinfo index 4e836a6368c..0f0563e149a 100644 --- a/lang/ruby18-base/distinfo +++ b/lang/ruby18-base/distinfo @@ -1,28 +1,54 @@ -$NetBSD: distinfo,v 1.44 2010/08/16 07:08:13 taca Exp $ +$NetBSD: distinfo,v 1.45 2010/09/10 03:29:00 taca Exp $ -SHA1 (ruby-1.8.7-p174.tar.bz2) = 9e84b49ad545ad54b8e7dc3c227eaaefeb1041aa -RMD160 (ruby-1.8.7-p174.tar.bz2) = f854d456003af1e31d50330c88c3cb152c434249 -Size (ruby-1.8.7-p174.tar.bz2) = 4144807 bytes -SHA1 (patch-aa) = 88e4a338c4ca40b32f9e3748eb825769631c3e76 -SHA1 (patch-ab) = 93a3dc95ee5e5cd6c7584240a285fa39b6f21efd +SHA1 (ruby-1.8.7-p302.tar.bz2) = d93bd2f1099f3473b496cda2422b27a8da2beb00 +RMD160 (ruby-1.8.7-p302.tar.bz2) = 763bc840316cb1080d46445cdc3ca7722d576591 +Size (ruby-1.8.7-p302.tar.bz2) = 4184764 bytes +SHA1 (patch-aa) = 4c1572b5a1eb65e89a98c60540433a69cb96dd23 +SHA1 (patch-ab) = b56b6c2ba182414492c803d36433730602e0a591 SHA1 (patch-ac) = 0119134d778bb85c58ef5bfe30d337dc76ed47e0 -SHA1 (patch-bd) = fb1a6a6724210c2fd84464d028932e78890ad7da -SHA1 (patch-be) = 79cd592267068820fa2225242034819ba38aa0b1 -SHA1 (patch-dj) = 436c3c0704b878427d947b2e27e5ce0a057eebeb -SHA1 (patch-dk) = 2d436ac4089aa7d818b337de81f405fc5836c9af -SHA1 (patch-dl) = 687803dc966594479467fc4b5e7bd45e767daa2b -SHA1 (patch-dm) = ab3063fecee241420a66d5d6f4ef8bf37440e70d -SHA1 (patch-dn) = f63e0cb7dbd86b4a2c022156fddd22c1ccdd5666 -SHA1 (patch-do) = f9eda9e784da02dff203fd47e8f1ee6871a6a9d4 -SHA1 (patch-dp) = 0b50909072159937c62944a38763fd18ce3181db -SHA1 (patch-dq) = f5a605c49afb29b2c3963a82d844ff4cdf3a8846 -SHA1 (patch-dr) = e0fa1dc8674c6412d73bc4ccd2cfc8b4acad744a -SHA1 (patch-ds) = 5344a63980b88d83e279cee50398312b90d5c2da -SHA1 (patch-dt) = 3dd34a91cbffcb8e432d926c9490372f238e7f2e -SHA1 (patch-du) = 55f021e2eb780743e35ecf70141f7738b04f4b62 -SHA1 (patch-dv) = 25e779444c16717c7aaf800ebf68988878ed636f -SHA1 (patch-dw) = 51ad1f521713af85be9ae192049930285e89be41 -SHA1 (patch-dx) = d25267d700f997b951a65c016f45347a8b1a1517 -SHA1 (patch-dy) = 7c57240a1447346c8e6f2e4e9c7104b1a7d9dbc9 -SHA1 (patch-dz) = 52af1fbf17b6e6df6112d08c291215d54a25af67 -SHA1 (patch-ea) = 85ad73f8bdb59bc78167bde021ce64879d3c234c +SHA1 (patch-ad) = 2b194a26f3a7b9bdf3afcc0819ab239479f47c5b +SHA1 (patch-ae) = 00a74c7bf9578868bc3c0aabc284bbaf1c1d127c +SHA1 (patch-aw) = d3dc491da64426ff72a9417a65eb99bee2d21044 +SHA1 (patch-az) = 55c9cba404add5293168ae7fae7ae7aaf4df6550 +SHA1 (patch-bd) = 4bdf2230fd8a6ea21f28150ba5705ebd0db4af99 +SHA1 (patch-be) = 2286b14b5992686481d1d7a964c43cfc72118a45 +SHA1 (patch-cq) = db4a3927a7e0f8fdf004dd198734ce2a4dc39edd +SHA1 (patch-dj) = 9d67b57daf6111361c478481f39ee8764a861106 +SHA1 (patch-dk) = ee85c9489f6074e6818713746691ce99ef778159 +SHA1 (patch-dl) = 0a5010f57e0f21170530fd4f940e66608c6d9630 +SHA1 (patch-dn) = 3cd429fcd4f48ad0ab784058a4ac8672f6ae17db +SHA1 (patch-do) = d2b190074647a591106797922e2ec907f6b3efde +SHA1 (patch-dp) = ebdc27a84c24d3373769250bf4b7052058f89d9b +SHA1 (patch-dq) = 4cd59c9a965c70ed5ee50dc2e8cebe3bce094fbd +SHA1 (patch-dr) = ed734e802f2d1cb59c2b49952d646849c9226d1e +SHA1 (patch-ds) = e60434cb299d070289a3c80765187e4058a65f99 +SHA1 (patch-dt) = 59c09f6ea19cc02a1d8ca92a99eed7f8c30a5f10 +SHA1 (patch-du) = e3703b678f3b09f2878389a0a0ecbd453bae59d0 +SHA1 (patch-dv) = c3eeeaf6e52e27ce945d29494d42ee4d7b11a14b +SHA1 (patch-dw) = 4c6610b9bfa879b5009fbdb231d13d33900e8664 +SHA1 (patch-dy) = 4daf6f49dbcc4f07dc43df811aec03639d636d8a +SHA1 (patch-eb) = e5105edd12906a5599668e96a424132abe523871 +SHA1 (patch-ec) = 0fcd05fea21d480a6536e2f711021ac4c1448771 +SHA1 (patch-ed) = 70b8ec8b2d466a3868556cbe1c19bf50462bae6d +SHA1 (patch-ee) = 8240954e7f07d94bd3e87abc1946ea5cef2d854a +SHA1 (patch-ef) = ffc28b86ddce44483fcb7967fdc9a4483b61e0a0 +SHA1 (patch-eg) = 12e5fdc31adfc578cdbc3efec5b3d6fae58ad767 +SHA1 (patch-eh) = a6ff0e0baaf03b5bde8c98a91220dfbf4c08fc61 +SHA1 (patch-ei) = 95c921cecd9a6d5d4557066d2a160276a37634b0 +SHA1 (patch-ej) = c8f2c5dbf2ba463d852b94fecf6014bb5ef1e3f8 +SHA1 (patch-ek) = a5de28017bc57d4e01ec986b6a5602cba2b75670 +SHA1 (patch-el) = c071250196cff37c413e724ce4fc149b920e6dde +SHA1 (patch-em) = 13ccef1c981c9bf312a104c9eb0a9e2339f38461 +SHA1 (patch-en) = 5f92c80c321149055b962a4c2ba97105c00706e2 +SHA1 (patch-eo) = 41a1ff4e1037415eb50373eff64322f6e1423e27 +SHA1 (patch-ep) = f881aece8ec0836c75df3be567d57ffc3ad8bce1 +SHA1 (patch-eq) = d9dfa070d1f12de4f5f48f07d5a32d649035a657 +SHA1 (patch-er) = 666fc6c22544c7f74f7c17ffef30563effcb4df7 +SHA1 (patch-es) = 79ca11360ae94753f972a420f7c6968b07b239df +SHA1 (patch-et) = eba90415e5279c9eb8bea67635f5f8cab5d1e7ac +SHA1 (patch-eu) = dbf65258dcdc619d220ab39864389c4ec4c5c625 +SHA1 (patch-ev) = 6178be681ca1cf2647cab9a61c8ef989ff5b23cb +SHA1 (patch-ew) = ddb8066a3e63b049e43c569e8d95b872eea0c247 +SHA1 (patch-ex) = 146eadb2ea1bab3c450f181da986702041912ec9 +SHA1 (patch-ga) = 73f50504baf74ee77d00dcfb5a9446bbaf122726 +SHA1 (patch-gb) = 345ad3e5df6fd9febe7b398f091662fd7c300dc4 diff --git a/lang/ruby18-base/options.mk b/lang/ruby18-base/options.mk index 889d401c526..66e71603902 100644 --- a/lang/ruby18-base/options.mk +++ b/lang/ruby18-base/options.mk @@ -1,4 +1,4 @@ -# $NetBSD: options.mk,v 1.7 2009/09/22 13:32:35 taca Exp $ +# $NetBSD: options.mk,v 1.8 2010/09/10 03:29:00 taca Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.ruby PKG_SUPPORTED_OPTIONS= readline ruby-build-ri-db @@ -9,7 +9,6 @@ PKG_SUGGESTED_OPTIONS= readline ruby-build-ri-db .if !empty(PKG_OPTIONS:Mruby-build-ri-db) BUILD_TARGET= all rdoc CONFIGURE_ARGS+= --enable-install-doc -PRIVILEGED_STAGES+= clean RUBY_DYNAMIC_DIRS+= ${RUBY_SYSRIDIR} # Use huge memory. UNLIMIT_RESOURCES+= datasize diff --git a/lang/ruby18-base/patches/patch-aa b/lang/ruby18-base/patches/patch-aa index 805543a832f..e9f5139ef9e 100644 --- a/lang/ruby18-base/patches/patch-aa +++ b/lang/ruby18-base/patches/patch-aa @@ -1,10 +1,10 @@ -$NetBSD: patch-aa,v 1.13 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-aa,v 1.14 2010/09/10 03:29:00 taca Exp $ * Adding Interix support. ---- configure.in.orig 2008-06-09 03:23:46.000000000 +0900 +--- configure.in.orig 2010-06-08 09:26:34.000000000 +0000 +++ configure.in -@@ -452,6 +452,9 @@ bsdi*) LIBS="-lm $LIBS" +@@ -456,6 +456,9 @@ bsdi*) LIBS="-lm $LIBS" AC_DEFINE(BROKEN_SETREUID, 1) AC_DEFINE(BROKEN_SETREGID, 1) ac_cv_sizeof_rlim_t=8;; @@ -14,7 +14,7 @@ $NetBSD: patch-aa,v 1.13 2009/08/11 14:26:58 taca Exp $ freebsd*) LIBS="-lm $LIBS" AC_CACHE_CHECK([whether -lxpg4 has to be linked], rb_cv_lib_xpg4_needed, -@@ -1165,6 +1168,13 @@ if test "$with_dln_a_out" != yes; then +@@ -1226,6 +1229,13 @@ if test "$with_dln_a_out" != yes; then LDFLAGS="$LDFLAGS -Wl,-export-dynamic" fi rb_cv_dlopen=yes ;; @@ -28,7 +28,7 @@ $NetBSD: patch-aa,v 1.13 2009/08/11 14:26:58 taca Exp $ interix*) : ${LDSHARED="$CC -shared"} XLDFLAGS="$XLDFLAGS -Wl,-E" LIBPATHFLAG=" -L%1\$-s" -@@ -1508,6 +1518,14 @@ if test "$enable_shared" = 'yes'; then +@@ -1575,6 +1585,14 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib' ;; @@ -43,7 +43,7 @@ $NetBSD: patch-aa,v 1.13 2009/08/11 14:26:58 taca Exp $ interix*) LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)' ;; -@@ -1517,6 +1535,7 @@ if test "$enable_shared" = 'yes'; then +@@ -1584,6 +1602,7 @@ if test "$enable_shared" = 'yes'; then fi if test "$enable_rpath" = yes; then LIBRUBYARG_SHARED="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir) $LIBRUBYARG_SHARED" diff --git a/lang/ruby18-base/patches/patch-ab b/lang/ruby18-base/patches/patch-ab index c3a4af0ddcb..32371bd1315 100644 --- a/lang/ruby18-base/patches/patch-ab +++ b/lang/ruby18-base/patches/patch-ab @@ -1,20 +1,20 @@ -$NetBSD: patch-ab,v 1.13 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-ab,v 1.14 2010/09/10 03:29:00 taca Exp $ * Adding Interix support. ---- configure.orig 2008-06-09 18:38:04.000000000 +0900 +--- configure.orig 2010-06-23 05:38:48.000000000 +0000 +++ configure -@@ -10374,6 +10374,9 @@ _ACEOF - _ACEOF +@@ -6212,6 +6212,9 @@ bsdi*) LIBS="-lm $LIBS" + $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h ac_cv_sizeof_rlim_t=8;; +interix3*) LIBS="-lm $LIBS" + ac_cv_func_getpgrp_void=yes + ;; freebsd*) LIBS="-lm $LIBS" - { echo "$as_me:$LINENO: checking whether -lxpg4 has to be linked" >&5 - echo $ECHO_N "checking whether -lxpg4 has to be linked... $ECHO_C" >&6; } -@@ -16591,6 +16594,13 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lxpg4 has to be linked" >&5 + $as_echo_n "checking whether -lxpg4 has to be linked... " >&6; } +@@ -10196,6 +10199,13 @@ fi LDFLAGS="$LDFLAGS -Wl,-export-dynamic" fi rb_cv_dlopen=yes ;; @@ -28,7 +28,7 @@ $NetBSD: patch-ab,v 1.13 2009/08/11 14:26:58 taca Exp $ interix*) : ${LDSHARED="$CC -shared"} XLDFLAGS="$XLDFLAGS -Wl,-E" LIBPATHFLAG=" -L%1\$-s" -@@ -17334,6 +17344,14 @@ if test "$enable_shared" = 'yes'; then +@@ -10724,6 +10734,14 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_SO_NAME).dylib' ;; @@ -43,7 +43,7 @@ $NetBSD: patch-ab,v 1.13 2009/08/11 14:26:58 taca Exp $ interix*) LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)' ;; -@@ -17343,6 +17361,7 @@ if test "$enable_shared" = 'yes'; then +@@ -10733,6 +10751,7 @@ if test "$enable_shared" = 'yes'; then fi if test "$enable_rpath" = yes; then LIBRUBYARG_SHARED="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir) $LIBRUBYARG_SHARED" diff --git a/lang/ruby18-base/patches/patch-ad b/lang/ruby18-base/patches/patch-ad new file mode 100644 index 00000000000..b462b14dfbe --- /dev/null +++ b/lang/ruby18-base/patches/patch-ad @@ -0,0 +1,26 @@ +$NetBSD: patch-ad,v 1.11 2010/09/10 03:29:00 taca Exp $ + +* Fix warnings. +* Fix for pthread: r26440 + +--- eval.c.orig 2010-06-10 04:38:43.000000000 +0000 ++++ eval.c +@@ -779,7 +779,7 @@ static unsigned long frame_unique = 0; + _frame.argc = 0; \ + _frame.flags = 0; \ + _frame.uniq = frame_unique++; \ +- ruby_frame = &_frame ++ ruby_frame = (struct FRAME *)&_frame + + #define POP_FRAME() \ + ruby_current_node = _frame.node; \ +@@ -12250,7 +12250,9 @@ rb_thread_alloc(klass) + return th; + } + ++#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE) + static int thread_init; ++#endif + + #if defined(POSIX_SIGNAL) + #define CATCH_VTALRM() posix_signal(SIGVTALRM, catch_timer) diff --git a/lang/ruby18-base/patches/patch-ae b/lang/ruby18-base/patches/patch-ae new file mode 100644 index 00000000000..6e867ef050d --- /dev/null +++ b/lang/ruby18-base/patches/patch-ae @@ -0,0 +1,15 @@ +$NetBSD: patch-ae,v 1.3 2010/09/10 03:29:00 taca Exp $ + +Suppress warnings. + +--- ext/openssl/ossl_config.c.orig 2010-06-21 09:18:59.000000000 +0000 ++++ ext/openssl/ossl_config.c +@@ -449,7 +449,7 @@ static VALUE + ossl_config_inspect(VALUE self) + { + VALUE str, ary = ossl_config_get_sections(self); +- char *cname = rb_class2name(rb_obj_class(self)); ++ const char *cname = rb_class2name(rb_obj_class(self)); + + str = rb_str_new2("#<"); + rb_str_cat2(str, cname); diff --git a/lang/ruby18-base/patches/patch-aw b/lang/ruby18-base/patches/patch-aw new file mode 100644 index 00000000000..3e4e2b27c5b --- /dev/null +++ b/lang/ruby18-base/patches/patch-aw @@ -0,0 +1,15 @@ +$NetBSD: patch-aw,v 1.3 2010/09/10 03:29:00 taca Exp $ + +* r26786: (get_device_once): raise on error when fail is non-zero. + +--- ext/pty/pty.c.orig 2008-04-15 03:35:55.000000000 +0000 ++++ ext/pty/pty.c +@@ -369,7 +369,7 @@ get_device_once(master, slave, SlaveName + } + close(i); + } +- if (!fail) rb_raise(rb_eRuntimeError, "can't get Master/Slave device"); ++ if (fail) rb_raise(rb_eRuntimeError, "can't get Master/Slave device"); + return -1; + #else + char **p; diff --git a/lang/ruby18-base/patches/patch-az b/lang/ruby18-base/patches/patch-az new file mode 100644 index 00000000000..8470e023cbe --- /dev/null +++ b/lang/ruby18-base/patches/patch-az @@ -0,0 +1,49 @@ +$NetBSD: patch-az,v 1.4 2010/09/10 03:29:00 taca Exp $ + +Fix IO#readpartial test failure. + +--- io.c.orig 2010-06-08 09:02:21.000000000 +0000 ++++ io.c +@@ -120,9 +120,6 @@ extern void Init_File _((void)); + # endif + #endif + +-#define preserving_errno(stmts) \ +- do {int saved_errno = errno; stmts; errno = saved_errno;} while (0) +- + VALUE rb_cIO; + VALUE rb_eEOFError; + VALUE rb_eIOError; +@@ -491,7 +488,16 @@ io_fwrite(str, fptr) + r = write(fileno(f), RSTRING(str)->ptr+offset, l); + TRAP_END; + #if BSD_STDIO +- preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET)); ++ { ++ int saved_errno; ++ off_t pos; ++ ++ saved_errno = errno; ++ pos = lseek(fileno(f), (off_t)0, SEEK_CUR); ++ if (pos != -1) ++ fseeko(f, pos, SEEK_SET); ++ errno = saved_errno; ++ } + #endif + if (r == n) return len; + if (0 <= r) { +@@ -1300,8 +1306,13 @@ io_getpartial(int argc, VALUE *argv, VAL + goto again; + rb_sys_fail(fptr->path); + } +- if (fptr->f) /* update pos in FILE structure [ruby-core:21561] */ ++ if (fptr->f) { /* update pos in FILE structure [ruby-core:21561] */ + fflush(fptr->f); ++#if defined(__SOFF) && defined(__NetBSD__) ++ fptr->f->_flags &= ~__SOFF; ++ (void)io_tell(fptr); ++#endif ++ } + } + rb_str_resize(str, n); + diff --git a/lang/ruby18-base/patches/patch-bd b/lang/ruby18-base/patches/patch-bd index 2e482417c61..a82122d9ae7 100644 --- a/lang/ruby18-base/patches/patch-bd +++ b/lang/ruby18-base/patches/patch-bd @@ -1,33 +1,33 @@ -$NetBSD: patch-bd,v 1.3 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-bd,v 1.4 2010/09/10 03:29:00 taca Exp $ -* Use modern OpenSSL API to catch up OpenSSL 1.0.0 and later. +Suppress warnings. ---- ext/openssl/ossl.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl.c -@@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary) +@@ -15,7 +15,7 @@ + * String to HEXString conversion + */ + int +-string2hex(char *buf, int buf_len, char **hexbuf, int *hexbuf_len) ++string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len) + { + static const char hex[]="0123456789abcdef"; + int i, len = 2 * buf_len; +@@ -464,7 +464,7 @@ Init_openssl() + /* + * Verify callback Proc index for ext-data + */ +- if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, "ossl_verify_cb_idx", 0, 0, 0)) < 0) ++ if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_verify_cb_idx", 0, 0, 0)) < 0) + ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index"); - #define OSSL_IMPL_SK2ARY(name, type) \ - VALUE \ --ossl_##name##_sk2ary(STACK *sk) \ -+ossl_##name##_sk2ary(STACK_OF(type) *sk) \ - { \ - type *t; \ - int i, num; \ -@@ -102,7 +102,7 @@ ossl_##name##_sk2ary(STACK *sk) \ - OSSL_Debug("empty sk!"); \ - return Qnil; \ - } \ -- num = sk_num(sk); \ -+ num = sk_##type##_num(sk); \ - if (num < 0) { \ - OSSL_Debug("items in sk < -1???"); \ - return rb_ary_new(); \ -@@ -110,7 +110,7 @@ ossl_##name##_sk2ary(STACK *sk) \ - ary = rb_ary_new2(num); \ - \ - for (i=0; i<num; i++) { \ -- t = (type *)sk_value(sk, i); \ -+ t = sk_##type##_value(sk, i); \ - rb_ary_push(ary, ossl_##name##_new(t)); \ - } \ - return ary; \ + /* +@@ -506,7 +506,7 @@ Init_openssl() + * Check if all symbols are OK with 'make LDSHARED=gcc all' + */ + int +-main(int argc, char *argv[], char *env[]) ++main(int argc, char *argv[]) + { + return 0; + } diff --git a/lang/ruby18-base/patches/patch-be b/lang/ruby18-base/patches/patch-be index fd454cd51bc..eb7267b30a0 100644 --- a/lang/ruby18-base/patches/patch-be +++ b/lang/ruby18-base/patches/patch-be @@ -1,10 +1,10 @@ -$NetBSD: patch-be,v 1.3 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-be,v 1.4 2010/09/10 03:29:00 taca Exp $ -* Constify. +Suppress warnings. ---- ext/openssl/ossl_cipher.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_cipher.c.orig 2010-05-24 23:58:49.000000000 +0000 +++ ext/openssl/ossl_cipher.c -@@ -186,7 +186,7 @@ ossl_cipher_init(int argc, VALUE *argv, +@@ -188,7 +188,7 @@ ossl_cipher_init(int argc, VALUE *argv, * We deprecated the arguments for this method, but we decided * keeping this behaviour for backward compatibility. */ @@ -13,7 +13,32 @@ $NetBSD: patch-be,v 1.3 2009/08/11 14:26:58 taca Exp $ rb_warn("argumtents for %s#encrypt and %s#decrypt were deprecated; " "use %s#pkcs5_keyivgen to derive key and IV", cname, cname, cname); -@@ -307,7 +307,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VAL +@@ -204,7 +204,7 @@ ossl_cipher_init(int argc, VALUE *argv, + else memcpy(iv, RSTRING_PTR(init_v), sizeof(iv)); + } + EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv, +- RSTRING_PTR(pass), RSTRING_LEN(pass), 1, key, NULL); ++ (unsigned char *)RSTRING_PTR(pass), RSTRING_LEN(pass), 1, key, NULL); + p_key = key; + p_iv = iv; + } +@@ -281,13 +281,13 @@ ossl_cipher_pkcs5_keyivgen(int argc, VAL + StringValue(vsalt); + if(RSTRING_LEN(vsalt) != PKCS5_SALT_LEN) + rb_raise(eCipherError, "salt must be an 8-octet string"); +- salt = RSTRING_PTR(vsalt); ++ salt = (unsigned char *)RSTRING_PTR(vsalt); + } + iter = NIL_P(viter) ? 2048 : NUM2INT(viter); + digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest); + GetCipher(self, ctx); + EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt, +- RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); ++ (unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); + if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1) + ossl_raise(eCipherError, NULL); + OPENSSL_cleanse(key, sizeof key); +@@ -309,7 +309,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VAL static VALUE ossl_cipher_update_deprecated(VALUE self, VALUE data) { @@ -22,3 +47,56 @@ $NetBSD: patch-be,v 1.3 2009/08/11 14:26:58 taca Exp $ cname = rb_class2name(rb_obj_class(self)); rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname); +@@ -329,14 +329,14 @@ static VALUE + ossl_cipher_update(int argc, VALUE *argv, VALUE self) + { + EVP_CIPHER_CTX *ctx; +- char *in; ++ unsigned char *in; + int in_len, out_len; + VALUE data, str; + + rb_scan_args(argc, argv, "11", &data, &str); + + StringValue(data); +- in = RSTRING_PTR(data); ++ in = (unsigned char *)RSTRING_PTR(data); + if ((in_len = RSTRING_LEN(data)) == 0) + rb_raise(rb_eArgError, "data must not be empty"); + GetCipher(self, ctx); +@@ -349,7 +349,7 @@ ossl_cipher_update(int argc, VALUE *argv + rb_str_resize(str, out_len); + } + +- if (!EVP_CipherUpdate(ctx, RSTRING_PTR(str), &out_len, in, in_len)) ++ if (!EVP_CipherUpdate(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len)) + ossl_raise(eCipherError, NULL); + assert(out_len < RSTRING_LEN(str)); + rb_str_set_len(str, out_len); +@@ -374,7 +374,7 @@ ossl_cipher_final(VALUE self) + + GetCipher(self, ctx); + str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx)); +- if (!EVP_CipherFinal_ex(ctx, RSTRING_PTR(str), &out_len)) ++ if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len)) + ossl_raise(eCipherError, NULL); + assert(out_len <= RSTRING_LEN(str)); + rb_str_set_len(str, out_len); +@@ -417,7 +417,7 @@ ossl_cipher_set_key(VALUE self, VALUE ke + if (RSTRING_LEN(key) < EVP_CIPHER_CTX_key_length(ctx)) + ossl_raise(eCipherError, "key length too short"); + +- if (EVP_CipherInit_ex(ctx, NULL, NULL, RSTRING_PTR(key), NULL, -1) != 1) ++ if (EVP_CipherInit_ex(ctx, NULL, NULL, (unsigned char *)RSTRING_PTR(key), NULL, -1) != 1) + ossl_raise(eCipherError, NULL); + + return key; +@@ -442,7 +442,7 @@ ossl_cipher_set_iv(VALUE self, VALUE iv) + if (RSTRING_LEN(iv) < EVP_CIPHER_CTX_iv_length(ctx)) + ossl_raise(eCipherError, "iv length too short"); + +- if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, RSTRING_PTR(iv), -1) != 1) ++ if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, (unsigned char *)RSTRING_PTR(iv), -1) != 1) + ossl_raise(eCipherError, NULL); + + return iv; diff --git a/lang/ruby18-base/patches/patch-cq b/lang/ruby18-base/patches/patch-cq new file mode 100644 index 00000000000..062b93a838c --- /dev/null +++ b/lang/ruby18-base/patches/patch-cq @@ -0,0 +1,80 @@ +$NetBSD: patch-cq,v 1.1 2010/09/10 03:29:00 taca Exp $ + +* r26209: rename {addr,name}info functions to ensure those are used on darwin. + +--- ext/socket/extconf.rb.orig 2009-02-25 06:06:08.000000000 +0000 ++++ ext/socket/extconf.rb +@@ -119,8 +119,8 @@ if have_func("sendmsg") | have_func("rec + have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h']) + end + +-getaddr_info_ok = enable_config("wide-getaddrinfo") do +- checking_for("wide getaddrinfo") {try_run(<<EOF)} ++getaddr_info_ok = (enable_config("wide-getaddrinfo") && :wide) || ++ (checking_for("wide getaddrinfo") {try_run(<<EOF)} && :os) + #{cpp_include(headers)} + #include <stdlib.h> + +@@ -222,7 +222,6 @@ main() + exit(EXIT_FAILURE); + } + EOF +-end + if ipv6 and not getaddr_info_ok + abort <<EOS + +@@ -247,11 +246,32 @@ Fatal: invalid value for --with-lookup-o + EOS + end + ++have_type("struct addrinfo", headers) ++have_func("freehostent") ++have_func("freeaddrinfo") ++if have_func("gai_strerror") ++ if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)} ++#{cpp_include(headers)} ++#include <stdlib.h> ++void ++conftest_gai_strerror_is_const() ++{ ++ *gai_strerror(0) = 0; ++} ++EOF ++ $defs << "-DGAI_STRERROR_CONST" ++ end ++end ++ + $objs = ["socket.#{$OBJEXT}"] + +-unless getaddr_info_ok and have_func("getnameinfo", "netdb.h") and have_func("getaddrinfo", "netdb.h") ++if getaddr_info_ok == :wide or ++ !have_func("getnameinfo", headers) or !have_func("getaddrinfo", headers) + if have_struct_member("struct in6_addr", "s6_addr8", headers) +- $defs[-1] = "-DHAVE_ADDR8" ++ $defs[-1] = "s6_addr=s6_addr8" ++ end ++ if ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers) ++ $defs[-1] = "-DFAITH" + end + $CPPFLAGS="-I. "+$CPPFLAGS + $objs += ["getaddrinfo.#{$OBJEXT}"] +@@ -259,19 +279,6 @@ unless getaddr_info_ok and have_func("ge + have_func("inet_ntop") or have_func("inet_ntoa") + have_func("inet_pton") or have_func("inet_aton") + have_func("getservbyport") +- if have_func("gai_strerror") +- unless checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)} +-#{cpp_include(headers)} +-#include <stdlib.h> +-void +-conftest_gai_strerror_is_const() +-{ +- *gai_strerror(0) = 0; +-} +-EOF +- $defs << "-DGAI_STRERROR_CONST" +- end +- end + have_header("arpa/nameser.h") + have_header("resolv.h") + end diff --git a/lang/ruby18-base/patches/patch-dj b/lang/ruby18-base/patches/patch-dj index 1f7cfcee885..646dea971d1 100644 --- a/lang/ruby18-base/patches/patch-dj +++ b/lang/ruby18-base/patches/patch-dj @@ -1,10 +1,12 @@ -$NetBSD: patch-dj,v 1.4 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-dj,v 1.5 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. +* r18943: (ossl_ocspreq_initialize): fix for initialization of r18168. +* r18975: (ossl_ocspres_initialize): fix for initialization of r18168. ---- ext/openssl/ossl_ocsp.c.orig 2009-03-09 20:59:27.000000000 +0900 +--- ext/openssl/ossl_ocsp.c.orig 2010-05-24 23:58:49.000000000 +0000 +++ ext/openssl/ossl_ocsp.c -@@ -103,7 +103,7 @@ static VALUE +@@ -103,15 +103,17 @@ static VALUE ossl_ocspreq_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; @@ -13,7 +15,37 @@ $NetBSD: patch-dj,v 1.4 2009/08/11 14:26:58 taca Exp $ rb_scan_args(argc, argv, "01", &arg); if(!NIL_P(arg)){ -@@ -310,7 +310,7 @@ static VALUE ++ OCSP_REQUEST *req = DATA_PTR(self), *x; + arg = ossl_to_der_if_possible(arg); + StringValue(arg); + p = (unsigned char*)RSTRING_PTR(arg); +- if(!d2i_OCSP_REQUEST((OCSP_REQUEST**)&DATA_PTR(self), &p, +- RSTRING_LEN(arg))){ ++ x = d2i_OCSP_REQUEST(&req, &p, RSTRING_LEN(arg)); ++ DATA_PTR(self) = req; ++ if(!x){ + ossl_raise(eOCSPError, "cannot load DER encoded request"); + } + } +@@ -134,7 +136,7 @@ ossl_ocspreq_add_nonce(int argc, VALUE * + else{ + StringValue(val); + GetOCSPReq(self, req); +- ret = OCSP_request_add1_nonce(req, RSTRING_PTR(val), RSTRING_LEN(val)); ++ ret = OCSP_request_add1_nonce(req, (unsigned char *)RSTRING_PTR(val), RSTRING_LEN(val)); + } + if(!ret) ossl_raise(eOCSPError, NULL); + +@@ -265,7 +267,7 @@ ossl_ocspreq_to_der(VALUE self) + if((len = i2d_OCSP_REQUEST(req, NULL)) <= 0) + ossl_raise(eOCSPError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_OCSP_REQUEST(req, &p) <= 0) + ossl_raise(eOCSPError, NULL); + ossl_str_adjust(str, p); +@@ -310,15 +312,17 @@ static VALUE ossl_ocspres_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg; @@ -22,3 +54,34 @@ $NetBSD: patch-dj,v 1.4 2009/08/11 14:26:58 taca Exp $ rb_scan_args(argc, argv, "01", &arg); if(!NIL_P(arg)){ ++ OCSP_RESPONSE *res = DATA_PTR(self), *x; + arg = ossl_to_der_if_possible(arg); + StringValue(arg); +- p = RSTRING_PTR(arg); +- if(!d2i_OCSP_RESPONSE((OCSP_RESPONSE**)&DATA_PTR(self), &p, +- RSTRING_LEN(arg))){ ++ p = (unsigned char *)RSTRING_PTR(arg); ++ x = d2i_OCSP_RESPONSE(&res, &p, RSTRING_LEN(arg)); ++ DATA_PTR(self) = res; ++ if(!x){ + ossl_raise(eOCSPError, "cannot load DER encoded response"); + } + } +@@ -377,7 +381,7 @@ ossl_ocspres_to_der(VALUE self) + if((len = i2d_OCSP_RESPONSE(res, NULL)) <= 0) + ossl_raise(eOCSPError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_OCSP_RESPONSE(res, &p) <= 0) + ossl_raise(eOCSPError, NULL); + ossl_str_adjust(str, p); +@@ -436,7 +440,7 @@ ossl_ocspbres_add_nonce(int argc, VALUE + else{ + StringValue(val); + GetOCSPBasicRes(self, bs); +- ret = OCSP_basic_add1_nonce(bs, RSTRING_PTR(val), RSTRING_LEN(val)); ++ ret = OCSP_basic_add1_nonce(bs, (unsigned char *)RSTRING_PTR(val), RSTRING_LEN(val)); + } + if(!ret) ossl_raise(eOCSPError, NULL); + diff --git a/lang/ruby18-base/patches/patch-dk b/lang/ruby18-base/patches/patch-dk index 0b7d62c13bd..02fca349d94 100644 --- a/lang/ruby18-base/patches/patch-dk +++ b/lang/ruby18-base/patches/patch-dk @@ -1,67 +1,49 @@ -$NetBSD: patch-dk,v 1.1 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-dk,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Decrease warning from Ruby's repositry. +* r18172: suppress warnings. +* r18181: (d2i_of_void): define for older versions. [ruby-dev:35637] +* r26835: backport fixes in 1.9. ---- ext/openssl/openssl_missing.h.orig 2008-08-04 13:44:17.000000000 +0900 +--- ext/openssl/openssl_missing.h.orig 2010-05-24 23:58:49.000000000 +0000 +++ ext/openssl/openssl_missing.h -@@ -18,6 +18,9 @@ extern "C" { - #ifndef TYPEDEF_D2I_OF - typedef char *d2i_of_void(); - #endif -+#ifndef TYPEDEF_I2D_OF -+typedef int i2d_of_void(); -+#endif - - /* - * These functions are not included in headers of OPENSSL <= 0.9.6b -@@ -25,39 +28,39 @@ typedef char *d2i_of_void(); +@@ -28,7 +28,7 @@ typedef int i2d_of_void(); #if !defined(PEM_read_bio_DSAPublicKey) # define PEM_read_bio_DSAPublicKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ - (char *(*)())d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(char **)x,cb,u) -+ (d2i_of_void *)d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,x,cb,u) ++ (d2i_of_void *)d2i_DSAPublicKey,PEM_STRING_DSA_PUBLIC,bp,(void **)x,cb,u) #endif #if !defined(PEM_write_bio_DSAPublicKey) - # define PEM_write_bio_DSAPublicKey(bp,x) \ -- PEM_ASN1_write_bio((int (*)())i2d_DSAPublicKey,\ -+ PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPublicKey,\ - PEM_STRING_DSA_PUBLIC,\ - bp,(char *)x, NULL, NULL, 0, NULL, NULL) - #endif +@@ -40,27 +40,27 @@ typedef int i2d_of_void(); #if !defined(DSAPrivateKey_dup) --# define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPrivateKey, \ + # define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPrivateKey, \ - (char *(*)())d2i_DSAPrivateKey,(char *)dsa) -+# define DSAPrivateKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPrivateKey, \ + (d2i_of_void *)d2i_DSAPrivateKey,(char *)dsa) #endif #if !defined(DSAPublicKey_dup) --# define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((int (*)())i2d_DSAPublicKey, \ + # define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPublicKey, \ - (char *(*)())d2i_DSAPublicKey,(char *)dsa) -+# define DSAPublicKey_dup(dsa) (DSA *)ASN1_dup((i2d_of_void *)i2d_DSAPublicKey, \ + (d2i_of_void *)d2i_DSAPublicKey,(char *)dsa) #endif #if !defined(X509_REVOKED_dup) --# define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((int (*)())i2d_X509_REVOKED, \ + # define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((i2d_of_void *)i2d_X509_REVOKED, \ - (char *(*)())d2i_X509_REVOKED, (char *)rev) -+# define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((i2d_of_void *)i2d_X509_REVOKED, \ + (d2i_of_void *)d2i_X509_REVOKED, (char *)rev) #endif #if !defined(PKCS7_SIGNER_INFO_dup) --# define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((int (*)())i2d_PKCS7_SIGNER_INFO, \ + # define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_SIGNER_INFO, \ - (char *(*)())d2i_PKCS7_SIGNER_INFO, (char *)si) -+# define PKCS7_SIGNER_INFO_dup(si) (PKCS7_SIGNER_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_SIGNER_INFO, \ + (d2i_of_void *)d2i_PKCS7_SIGNER_INFO, (char *)si) #endif #if !defined(PKCS7_RECIP_INFO_dup) --# define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((int (*)())i2d_PKCS7_RECIP_INFO, \ + # define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_RECIP_INFO, \ - (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri) -+# define PKCS7_RECIP_INFO_dup(ri) (PKCS7_RECIP_INFO *)ASN1_dup((i2d_of_void *)i2d_PKCS7_RECIP_INFO, \ + (d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)ri) #endif diff --git a/lang/ruby18-base/patches/patch-dl b/lang/ruby18-base/patches/patch-dl index 2295751dbf3..a446ae7e648 100644 --- a/lang/ruby18-base/patches/patch-dl +++ b/lang/ruby18-base/patches/patch-dl @@ -1,28 +1,57 @@ -$NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ +$NetBSD: patch-dl,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. ---- ext/openssl/ossl_asn1.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_asn1.c.orig 2010-05-24 23:58:49.000000000 +0000 +++ ext/openssl/ossl_asn1.c -@@ -304,10 +304,10 @@ obj_to_asn1derstr(VALUE obj) - * DER to Ruby converters - */ - static VALUE --decode_bool(unsigned char* der, int length) -+decode_bool(const unsigned char* der, int length) +@@ -33,7 +33,7 @@ asn1time_to_time(ASN1_TIME *time) + + switch (time->type) { + case V_ASN1_UTCTIME: +- if (sscanf(time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, ++ if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, + &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { + ossl_raise(rb_eTypeError, "bad UTCTIME format"); + } +@@ -44,7 +44,7 @@ asn1time_to_time(ASN1_TIME *time) + } + break; + case V_ASN1_GENERALIZEDTIME: +- if (sscanf(time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, ++ if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, + &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { + ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" ); + } +@@ -80,7 +80,7 @@ time_to_time_t(VALUE time) + VALUE + asn1str_to_str(ASN1_STRING *str) { - int bool; +- return rb_str_new(str->data, str->length); ++ return rb_str_new((const char *)str->data, str->length); + } + + /* +@@ -214,7 +214,7 @@ obj_to_asn1bstr(VALUE obj, long unused_b + StringValue(obj); + if(!(bstr = ASN1_BIT_STRING_new())) + ossl_raise(eASN1Error, NULL); +- ASN1_BIT_STRING_set(bstr, RSTRING_PTR(obj), RSTRING_LEN(obj)); ++ ASN1_BIT_STRING_set(bstr, (unsigned char *)RSTRING_PTR(obj), RSTRING_LEN(obj)); + bstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */ + bstr->flags |= ASN1_STRING_FLAG_BITS_LEFT|(unused_bits&0x07); + +@@ -307,7 +307,7 @@ static VALUE + decode_bool(unsigned char* der, int length) + { + int val; - unsigned char *p; + const unsigned char *p; p = der; - if((bool = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0) -@@ -317,10 +317,10 @@ decode_bool(unsigned char* der, int leng - } - - static VALUE --decode_int(unsigned char* der, int length) -+decode_int(const unsigned char* der, int length) + if((val = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0) +@@ -320,7 +320,7 @@ static VALUE + decode_int(unsigned char* der, int length) { ASN1_INTEGER *ai; - unsigned char *p; @@ -30,26 +59,8 @@ $NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ VALUE ret; int status = 0; -@@ -336,10 +336,11 @@ decode_int(unsigned char* der, int lengt - } - - static VALUE --decode_bstr(unsigned char* der, int length, long *unused_bits) -+decode_bstr(const unsigned char* der, int length, long *unused_bits) - { - ASN1_BIT_STRING *bstr; -- unsigned char *p, *buf; -+ const unsigned char *p; -+ unsigned char *buf; - long len; - VALUE ret; - -@@ -362,10 +363,10 @@ decode_bstr(unsigned char* der, int leng - } - - static VALUE --decode_enum(unsigned char* der, int length) -+decode_enum(const unsigned char* der, int length) +@@ -360,7 +360,7 @@ static VALUE + decode_enum(unsigned char* der, int length) { ASN1_ENUMERATED *ai; - unsigned char *p; @@ -57,12 +68,8 @@ $NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ VALUE ret; int status = 0; -@@ -381,10 +382,10 @@ decode_enum(unsigned char* der, int leng - } - - static VALUE --decode_null(unsigned char* der, int length) -+decode_null(const unsigned char* der, int length) +@@ -379,7 +379,7 @@ static VALUE + decode_null(unsigned char* der, int length) { ASN1_NULL *null; - unsigned char *p; @@ -70,12 +77,8 @@ $NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ p = der; if(!(null = d2i_ASN1_NULL(NULL, &p, length))) -@@ -395,10 +396,10 @@ decode_null(unsigned char* der, int leng - } - - static VALUE --decode_obj(unsigned char* der, int length) -+decode_obj(const unsigned char* der, int length) +@@ -393,7 +393,7 @@ static VALUE + decode_obj(unsigned char* der, int length) { ASN1_OBJECT *obj; - unsigned char *p; @@ -83,12 +86,8 @@ $NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ VALUE ret; int nid; BIO *bio; -@@ -424,10 +425,10 @@ decode_obj(unsigned char* der, int lengt - } - - static VALUE --decode_time(unsigned char* der, int length) -+decode_time(const unsigned char* der, int length) +@@ -422,7 +422,7 @@ static VALUE + decode_time(unsigned char* der, int length) { ASN1_TIME *time; - unsigned char *p; @@ -96,44 +95,85 @@ $NetBSD: patch-dl,v 1.1 2009/08/11 14:26:58 taca Exp $ VALUE ret; int status = 0; -@@ -712,10 +713,10 @@ ossl_asn1data_to_der(VALUE self) - } - - static VALUE --ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth, -- int once, int yield) -+ossl_asn1_decode0(const unsigned char **pp, long length, long *offset, -+ long depth, int once, int yield) +@@ -697,7 +697,7 @@ ossl_asn1data_to_der(VALUE self) + if((length = ASN1_object_size(1, RSTRING_LEN(value), tag)) <= 0) + ossl_raise(eASN1Error, NULL); + der = rb_str_new(0, length); +- p = RSTRING_PTR(der); ++ p = (unsigned char *)RSTRING_PTR(der); + ASN1_put_object(&p, is_cons, RSTRING_LEN(value), tag, tag_class); + memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value)); + p += RSTRING_LEN(value); +@@ -711,6 +711,7 @@ ossl_asn1_decode0(unsigned char **pp, lo + int once, int yield) { -- unsigned char *start, *p; -+ const unsigned char *p, *start; + unsigned char *start, *p; ++ const unsigned char *p0; long len, off = *offset; int hlen, tag, tc, j; VALUE ary, asn1data, value, tag_class; -@@ -818,7 +819,7 @@ ossl_asn1_decode0(unsigned char **pp, lo - static VALUE - ossl_asn1_traverse(VALUE self, VALUE obj) - { -- unsigned char *p; -+ const unsigned char *p; - long offset = 0; - volatile VALUE tmp; - -@@ -834,7 +835,7 @@ static VALUE - ossl_asn1_decode(VALUE self, VALUE obj) - { - VALUE ret, ary; -- unsigned char *p; -+ const unsigned char *p; - long offset = 0; - volatile VALUE tmp; - -@@ -851,7 +852,7 @@ static VALUE - ossl_asn1_decode_all(VALUE self, VALUE obj) - { - VALUE ret; -- unsigned char *p; -+ const unsigned char *p; - long offset = 0; - volatile VALUE tmp; - +@@ -719,7 +720,9 @@ ossl_asn1_decode0(unsigned char **pp, lo + p = *pp; + while(length > 0){ + start = p; +- j = ASN1_get_object(&p, &len, &tag, &tc, length); ++ p0 = p; ++ j = ASN1_get_object(&p0, &len, &tag, &tc, length); ++ p = (unsigned char *)p0; + if(j & 0x80) ossl_raise(eASN1Error, NULL); + hlen = p - start; + if(yield){ +@@ -754,7 +757,7 @@ ossl_asn1_decode0(unsigned char **pp, lo + else value = ossl_asn1_decode0(&p, len, &off, depth+1, 0, yield); + } + else{ +- value = rb_str_new(p, len); ++ value = rb_str_new((const char *)p, len); + p += len; + off += len; + } +@@ -819,7 +822,7 @@ ossl_asn1_traverse(VALUE self, VALUE obj + + obj = ossl_to_der_if_possible(obj); + tmp = rb_str_new4(StringValue(obj)); +- p = RSTRING_PTR(tmp); ++ p = (unsigned char *)RSTRING_PTR(tmp); + ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 1); + + return Qnil; +@@ -835,7 +838,7 @@ ossl_asn1_decode(VALUE self, VALUE obj) + + obj = ossl_to_der_if_possible(obj); + tmp = rb_str_new4(StringValue(obj)); +- p = RSTRING_PTR(tmp); ++ p = (unsigned char *)RSTRING_PTR(tmp); + ary = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 1, 0); + ret = rb_ary_entry(ary, 0); + +@@ -852,7 +855,7 @@ ossl_asn1_decode_all(VALUE self, VALUE o + + obj = ossl_to_der_if_possible(obj); + tmp = rb_str_new4(StringValue(obj)); +- p = RSTRING_PTR(tmp); ++ p = (unsigned char *)RSTRING_PTR(tmp); + ret = ossl_asn1_decode0(&p, RSTRING_LEN(tmp), &offset, 0, 0, 0); + + return ret; +@@ -947,7 +950,7 @@ ossl_asn1prim_to_der(VALUE self) + ossl_ASN1_TYPE_free(asn1); + reallen = p - buf; + assert(reallen <= len); +- str = ossl_buf2str(buf, reallen); /* buf will be free in ossl_buf2str */ ++ str = ossl_buf2str((char *)buf, reallen); /* buf will be free in ossl_buf2str */ + + return str; + } +@@ -969,7 +972,7 @@ ossl_asn1cons_to_der(VALUE self) + seq_len = ASN1_object_size(1, RSTRING_LEN(value), tag); + length = ASN1_object_size(1, seq_len, tn); + str = rb_str_new(0, length); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(tc == V_ASN1_UNIVERSAL) + ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc); + else{ diff --git a/lang/ruby18-base/patches/patch-dm b/lang/ruby18-base/patches/patch-dm deleted file mode 100644 index 8345a53d253..00000000000 --- a/lang/ruby18-base/patches/patch-dm +++ /dev/null @@ -1,116 +0,0 @@ -$NetBSD: patch-dm,v 1.1 2009/08/11 14:26:58 taca Exp $ - -* Take care for API of OpenSSL 1.0.0 and later. -* Constify. - ---- ext/openssl/ossl_config.c.orig 2007-07-20 15:22:54.000000000 +0900 -+++ ext/openssl/ossl_config.c -@@ -294,8 +294,17 @@ ossl_config_get_section_old(VALUE self, - - #ifdef IMPLEMENT_LHASH_DOALL_ARG_FN - static void --get_conf_section(CONF_VALUE *cv, VALUE ary) -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+get_conf_section_doall_arg(void *arg1, void *arg2) -+#else -+get_conf_section(void *arg1, void *arg2) -+#endif - { -+ CONF_VALUE *cv; -+ VALUE ary; -+ -+ cv = arg1; -+ ary = (VALUE)arg2; - if(cv->name) return; - rb_ary_push(ary, rb_str_new2(cv->section)); - } -@@ -310,19 +319,31 @@ ossl_config_get_sections(VALUE self) - - GetConfig(self, conf); - ary = rb_ary_new(); -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+ LHM_lh_doall_arg(CONF_VALUE, conf->data, -+ LHASH_DOALL_ARG_FN(get_conf_section), void, (void*)ary); -+#else - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary); -+#endif - - return ary; - } - - static void --dump_conf_value(CONF_VALUE *cv, VALUE str) -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+dump_conf_value_doall_arg(void *arg1, void *arg2) -+#else -+dump_conf_value(void *arg1, void *arg2) -+#endif - { - STACK_OF(CONF_VALUE) *sk; -- CONF_VALUE *v; -+ CONF_VALUE *cv, *v; -+ VALUE str; - int i, num; - -+ cv = arg1; - if (cv->name) return; -+ str = (VALUE)arg2; - sk = (STACK_OF(CONF_VALUE)*)cv->value; - num = sk_CONF_VALUE_num(sk); - rb_str_cat2(str, "[ "); -@@ -346,7 +367,12 @@ dump_conf(CONF *conf) - VALUE str; - - str = rb_str_new(0, 0); -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+ LHM_lh_doall_arg(CONF_VALUE, conf->data, -+ LHASH_DOALL_ARG_FN(dump_conf_value), void, (void*)str); -+#else - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str); -+#endif - - return str; - } -@@ -362,13 +388,18 @@ ossl_config_to_s(VALUE self) - } - - static void --each_conf_value(CONF_VALUE *cv, void* dummy) -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+each_conf_value_doall_arg(void *arg1, void* dummy) -+#else -+each_conf_value(void *arg1, void* dummy) -+#endif - { - STACK_OF(CONF_VALUE) *sk; -- CONF_VALUE *v; -+ CONF_VALUE *cv, *v; - VALUE section, name, value, args; - int i, num; - -+ cv = arg1; - if (cv->name) return; - sk = (STACK_OF(CONF_VALUE)*)cv->value; - num = sk_CONF_VALUE_num(sk); -@@ -390,7 +421,12 @@ ossl_config_each(VALUE self) - CONF *conf; - - GetConfig(self, conf); -+#if OPENSSL_VERSION_NUMBER >= 0x10000000L -+ LHM_lh_doall_arg(CONF_VALUE, conf->data, -+ LHASH_DOALL_ARG_FN(each_conf_value), void, (void*)NULL); -+#else - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL); -+#endif - - return self; - } -@@ -421,7 +457,7 @@ static VALUE - ossl_config_inspect(VALUE self) - { - VALUE str, ary = ossl_config_get_sections(self); -- char *cname = rb_class2name(rb_obj_class(self)); -+ const char *cname = rb_class2name(rb_obj_class(self)); - - str = rb_str_new2("#<"); - rb_str_cat2(str, cname); diff --git a/lang/ruby18-base/patches/patch-dn b/lang/ruby18-base/patches/patch-dn index 2ac756a5bc4..cfcb737deae 100644 --- a/lang/ruby18-base/patches/patch-dn +++ b/lang/ruby18-base/patches/patch-dn @@ -1,10 +1,11 @@ -$NetBSD: patch-dn,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dn,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. ---- ext/openssl/ossl_engine.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_engine.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_engine.c -@@ -326,7 +326,7 @@ static VALUE +@@ -344,7 +344,7 @@ static VALUE ossl_engine_inspect(VALUE self) { VALUE str; diff --git a/lang/ruby18-base/patches/patch-do b/lang/ruby18-base/patches/patch-do index 3b5ecc7de08..5405961b6dc 100644 --- a/lang/ruby18-base/patches/patch-do +++ b/lang/ruby18-base/patches/patch-do @@ -1,10 +1,10 @@ -$NetBSD: patch-do,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-do,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. ---- ext/openssl/ossl_ns_spki.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_ns_spki.c.orig 2007-06-08 15:02:04.000000000 +0000 +++ ext/openssl/ossl_ns_spki.c -@@ -56,7 +56,7 @@ ossl_spki_initialize(int argc, VALUE *ar +@@ -56,14 +56,14 @@ ossl_spki_initialize(int argc, VALUE *ar { NETSCAPE_SPKI *spki; VALUE buffer; @@ -13,3 +13,29 @@ $NetBSD: patch-do,v 1.1 2009/08/11 14:26:59 taca Exp $ if (rb_scan_args(argc, argv, "01", &buffer) == 0) { return self; + } + StringValue(buffer); + if (!(spki = NETSCAPE_SPKI_b64_decode(RSTRING_PTR(buffer), -1))) { +- p = RSTRING_PTR(buffer); ++ p = (unsigned char *)RSTRING_PTR(buffer); + if (!(spki = d2i_NETSCAPE_SPKI(NULL, &p, RSTRING_LEN(buffer)))) { + ossl_raise(eSPKIError, NULL); + } +@@ -87,7 +87,7 @@ ossl_spki_to_der(VALUE self) + if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0) + ossl_raise(eX509CertError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if (i2d_NETSCAPE_SPKI(spki, &p) <= 0) + ossl_raise(eX509CertError, NULL); + ossl_str_adjust(str, p); +@@ -172,7 +172,7 @@ ossl_spki_get_challenge(VALUE self) + return rb_str_new(0, 0); + } + +- return rb_str_new(spki->spkac->challenge->data, ++ return rb_str_new((const char *)spki->spkac->challenge->data, + spki->spkac->challenge->length); + } + diff --git a/lang/ruby18-base/patches/patch-dp b/lang/ruby18-base/patches/patch-dp index 80ea3d0e07d..3fd8dde2233 100644 --- a/lang/ruby18-base/patches/patch-dp +++ b/lang/ruby18-base/patches/patch-dp @@ -1,100 +1,41 @@ -$NetBSD: patch-dp,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dp,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Instead of returning different type of value thorugh generic type, - use separate functions for each type. +* r18172: suppress warnings. +* r26838: backport the commit from trunk. ---- ext/openssl/ossl_pkcs7.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_pkcs7.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_pkcs7.c -@@ -570,12 +570,11 @@ ossl_pkcs7_add_certificate(VALUE self, V - return self; - } - --static STACK * --pkcs7_get_certs_or_crls(VALUE self, int want_certs) -+static STACK_OF(X509) * -+pkcs7_get_certs(VALUE self) - { - PKCS7 *pkcs7; - STACK_OF(X509) *certs; -- STACK_OF(X509_CRL) *crls; - int i; - - GetPKCS7(self, pkcs7); -@@ -583,17 +582,38 @@ pkcs7_get_certs_or_crls(VALUE self, int - switch(i){ - case NID_pkcs7_signed: - certs = pkcs7->d.sign->cert; -- crls = pkcs7->d.sign->crl; - break; - case NID_pkcs7_signedAndEnveloped: - certs = pkcs7->d.signed_and_enveloped->cert; -+ break; -+ default: -+ certs = NULL; -+ } -+ -+ return certs; -+} -+ -+static STACK_OF(X509_CRL) * -+pkcs7_get_crls(VALUE self) -+{ -+ PKCS7 *pkcs7; -+ STACK_OF(X509_CRL) *crls; -+ int i; -+ -+ GetPKCS7(self, pkcs7); -+ i = OBJ_obj2nid(pkcs7->type); -+ switch(i){ -+ case NID_pkcs7_signed: -+ crls = pkcs7->d.sign->crl; -+ break; -+ case NID_pkcs7_signedAndEnveloped: - crls = pkcs7->d.signed_and_enveloped->crl; - break; - default: -- certs = crls = NULL; -+ crls = NULL; - } - -- return want_certs ? certs : crls; -+ return crls; - } - - static VALUE -@@ -608,7 +628,7 @@ ossl_pkcs7_set_certificates(VALUE self, - STACK_OF(X509) *certs; - X509 *cert; - -- certs = pkcs7_get_certs_or_crls(self, 1); -+ certs = pkcs7_get_certs(self); - while((cert = sk_X509_pop(certs))) X509_free(cert); - rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self); - -@@ -618,7 +638,7 @@ ossl_pkcs7_set_certificates(VALUE self, +@@ -309,7 +309,7 @@ ossl_pkcs7_alloc(VALUE klass) static VALUE - ossl_pkcs7_get_certificates(VALUE self) + ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self) { -- return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1)); -+ return ossl_x509_sk2ary(pkcs7_get_certs(self)); - } - - static VALUE -@@ -648,7 +668,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ar - STACK_OF(X509_CRL) *crls; - X509_CRL *crl; - -- crls = pkcs7_get_certs_or_crls(self, 0); -+ crls = pkcs7_get_crls(self); - while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl); - rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self); - -@@ -658,7 +678,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ar - static VALUE - ossl_pkcs7_get_crls(VALUE self) - { -- return ossl_x509crl_sk2ary(pkcs7_get_certs_or_crls(self, 0)); -+ return ossl_x509crl_sk2ary(pkcs7_get_crls(self)); - } - - static VALUE +- PKCS7 *p7; ++ PKCS7 *p7, *pkcs = DATA_PTR(self); + BIO *in; + VALUE arg; + +@@ -317,10 +317,12 @@ ossl_pkcs7_initialize(int argc, VALUE *a + return self; + arg = ossl_to_der_if_possible(arg); + in = ossl_obj2bio(arg); +- p7 = PEM_read_bio_PKCS7(in, (PKCS7 **)&DATA_PTR(self), NULL, NULL); ++ p7 = PEM_read_bio_PKCS7(in, &pkcs, NULL, NULL); ++ DATA_PTR(self) = pkcs; + if (!p7) { +- BIO_reset(in); +- p7 = d2i_PKCS7_bio(in, (PKCS7 **)&DATA_PTR(self)); ++ (void)BIO_reset(in); ++ p7 = d2i_PKCS7_bio(in, &pkcs); ++ DATA_PTR(self) = pkcs; + } + BIO_free(in); + ossl_pkcs7_set_data(self, Qnil); +@@ -798,7 +800,7 @@ ossl_pkcs7_to_der(VALUE self) + if((len = i2d_PKCS7(pkcs7, NULL)) <= 0) + ossl_raise(ePKCS7Error, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_PKCS7(pkcs7, &p) <= 0) + ossl_raise(ePKCS7Error, NULL); + ossl_str_adjust(str, p); diff --git a/lang/ruby18-base/patches/patch-dq b/lang/ruby18-base/patches/patch-dq index 09179335e7a..fbea3cd5aae 100644 --- a/lang/ruby18-base/patches/patch-dq +++ b/lang/ruby18-base/patches/patch-dq @@ -1,9 +1,16 @@ -$NetBSD: patch-dq,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dq,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Use modern OpenSSL API to catch up OpenSSL 1.0.0 and later. +* r18172: suppress warnings. +* r20494: (ossl_ssl_read_nonblock): OpenSSL::SSL::SSLSocket should implement + read_nonblock. a patch from Aaron Patterson in [ruby-core:20277]. + fix: #814 [ruby-core:20241] +* r21772: Test for Server Name Indication support. +* r23008: revert incomplete read_nonblock implemenatation. +* r26835: backport fixes in 1.9. +* r26838: backport the commit from trunk. * Constify (some cases are depends on OpenSSL's version). ---- ext/openssl/ossl_ssl.c.orig 2008-06-06 17:05:24.000000000 +0900 +--- ext/openssl/ossl_ssl.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_ssl.c @@ -26,6 +26,12 @@ # define TO_SOCKET(s) s @@ -18,7 +25,31 @@ $NetBSD: patch-dq,v 1.1 2009/08/11 14:26:59 taca Exp $ VALUE mSSL; VALUE eSSLError; VALUE cSSLContext; -@@ -95,7 +101,7 @@ ID ID_callback_state; +@@ -69,6 +75,9 @@ static const char *ossl_sslctx_attrs[] = + "verify_callback", "options", "cert_store", "extra_chain_cert", + "client_cert_cb", "tmp_dh_callback", "session_id_context", + "session_get_cb", "session_new_cb", "session_remove_cb", ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++ "servername_cb", ++#endif + }; + + #define ossl_ssl_get_io(o) rb_iv_get((o),"@io") +@@ -86,7 +95,12 @@ static const char *ossl_sslctx_attrs[] = + #define ossl_ssl_set_tmp_dh(o,v) rb_iv_set((o),"@tmp_dh",(v)) + + static const char *ossl_ssl_attr_readers[] = { "io", "context", }; +-static const char *ossl_ssl_attrs[] = { "sync_close", }; ++static const char *ossl_ssl_attrs[] = { ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++ "hostname", ++#endif ++ "sync_close", ++}; + + ID ID_callback_state; + +@@ -95,7 +109,7 @@ ID ID_callback_state; */ struct { const char *name; @@ -27,7 +58,7 @@ $NetBSD: patch-dq,v 1.1 2009/08/11 14:26:59 taca Exp $ } ossl_ssl_method_tab[] = { #define OSSL_SSL_METHOD_ENTRY(name) { #name, name##_method } OSSL_SSL_METHOD_ENTRY(TLSv1), -@@ -144,7 +150,7 @@ ossl_sslctx_s_alloc(VALUE klass) +@@ -144,7 +158,7 @@ ossl_sslctx_s_alloc(VALUE klass) static VALUE ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method) { @@ -36,16 +67,162 @@ $NetBSD: patch-dq,v 1.1 2009/08/11 14:26:59 taca Exp $ const char *s; int i; -@@ -585,7 +591,7 @@ ossl_sslctx_setup(VALUE self) +@@ -297,7 +311,7 @@ ossl_ssl_verify_callback(int preverify_o + static VALUE + ossl_call_session_get_cb(VALUE ary) + { +- VALUE ssl_obj, sslctx_obj, cb, ret; ++ VALUE ssl_obj, sslctx_obj, cb; + + Check_Type(ary, T_ARRAY); + ssl_obj = rb_ary_entry(ary, 0); +@@ -325,7 +339,7 @@ ossl_sslctx_session_get_cb(SSL *ssl, uns + ssl_obj = (VALUE)ptr; + ary = rb_ary_new2(2); + rb_ary_push(ary, ssl_obj); +- rb_ary_push(ary, rb_str_new(buf, len)); ++ rb_ary_push(ary, rb_str_new((const char *)buf, len)); + + ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_session_get_cb, ary, &state); + if (state) { +@@ -344,7 +358,7 @@ ossl_sslctx_session_get_cb(SSL *ssl, uns + static VALUE + ossl_call_session_new_cb(VALUE ary) + { +- VALUE ssl_obj, sslctx_obj, cb, ret; ++ VALUE ssl_obj, sslctx_obj, cb; + + Check_Type(ary, T_ARRAY); + ssl_obj = rb_ary_entry(ary, 0); +@@ -387,10 +401,11 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL + return RTEST(ret_obj) ? 1 : 0; + } + ++#if 0 /* unused */ + static VALUE + ossl_call_session_remove_cb(VALUE ary) + { +- VALUE sslctx_obj, cb, ret; ++ VALUE sslctx_obj, cb; + + Check_Type(ary, T_ARRAY); + sslctx_obj = rb_ary_entry(ary, 0); +@@ -400,6 +415,7 @@ ossl_call_session_remove_cb(VALUE ary) + + return rb_funcall(cb, rb_intern("call"), 1, ary); + } ++#endif + + static void + ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess) +@@ -446,6 +462,66 @@ ossl_sslctx_add_extra_chain_cert_i(VALUE + return i; + } + ++static VALUE ossl_sslctx_setup(VALUE self); ++ ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++static VALUE ++ossl_call_servername_cb(VALUE ary) ++{ ++ VALUE ssl_obj, sslctx_obj, cb, ret_obj; ++ ++ Check_Type(ary, T_ARRAY); ++ ssl_obj = rb_ary_entry(ary, 0); ++ ++ sslctx_obj = rb_iv_get(ssl_obj, "@context"); ++ if (NIL_P(sslctx_obj)) return Qnil; ++ cb = rb_iv_get(sslctx_obj, "@servername_cb"); ++ if (NIL_P(cb)) return Qnil; ++ ++ ret_obj = rb_funcall(cb, rb_intern("call"), 1, ary); ++ if (rb_obj_is_kind_of(ret_obj, cSSLContext)) { ++ SSL *ssl; ++ SSL_CTX *ctx2; ++ ++ ossl_sslctx_setup(ret_obj); ++ Data_Get_Struct(ssl_obj, SSL, ssl); ++ Data_Get_Struct(ret_obj, SSL_CTX, ctx2); ++ SSL_set_SSL_CTX(ssl, ctx2); ++ } else if (!NIL_P(ret_obj)) { ++ rb_raise(rb_eArgError, "servername_cb must return an OpenSSL::SSL::SSLContext object or nil"); ++ } ++ ++ return ret_obj; ++} ++ ++static int ++ssl_servername_cb(SSL *ssl, int *ad, void *arg) ++{ ++ VALUE ary, ssl_obj, ret_obj; ++ void *ptr; ++ int state = 0; ++ const char *servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); ++ ++ if (!servername) ++ return SSL_TLSEXT_ERR_OK; ++ ++ if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL) ++ return SSL_TLSEXT_ERR_ALERT_FATAL; ++ ssl_obj = (VALUE)ptr; ++ ary = rb_ary_new2(2); ++ rb_ary_push(ary, ssl_obj); ++ rb_ary_push(ary, rb_str_new2(servername)); ++ ++ ret_obj = rb_protect((VALUE(*)_((VALUE)))ossl_call_servername_cb, ary, &state); ++ if (state) { ++ rb_ivar_set(ssl_obj, ID_callback_state, INT2NUM(state)); ++ return SSL_TLSEXT_ERR_ALERT_FATAL; ++ } ++ ++ return SSL_TLSEXT_ERR_OK; ++} ++#endif ++ + /* + * call-seq: + * ctx.setup => Qtrue # first time +@@ -563,7 +639,7 @@ ossl_sslctx_setup(VALUE self) + val = ossl_sslctx_get_sess_id_ctx(self); + if (!NIL_P(val)){ + StringValue(val); +- if (!SSL_CTX_set_session_id_context(ctx, RSTRING_PTR(val), ++ if (!SSL_CTX_set_session_id_context(ctx, (unsigned char *)RSTRING_PTR(val), + RSTRING_LEN(val))){ + ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:"); + } +@@ -581,11 +657,20 @@ ossl_sslctx_setup(VALUE self) + SSL_CTX_sess_set_remove_cb(ctx, ossl_sslctx_session_remove_cb); + OSSL_Debug("SSL SESSION remove callback added"); + } ++ ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++ val = rb_iv_get(self, "@servername_cb"); ++ if (!NIL_P(val)) { ++ SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb); ++ OSSL_Debug("SSL TLSEXT servername callback added"); ++ } ++#endif ++ + return Qtrue; } static VALUE -ossl_ssl_cipher_to_ary(SSL_CIPHER *cipher) -+ossl_ssl_cipher_to_ary(const SSL_CIPHER *cipher) ++ossl_ssl_cipher_to_ary(OSSL_CONST SSL_CIPHER *cipher) { VALUE ary; int bits, alg_bits; -@@ -623,10 +629,10 @@ ossl_sslctx_get_ciphers(VALUE self) +@@ -609,7 +694,7 @@ ossl_sslctx_get_ciphers(VALUE self) + { + SSL_CTX *ctx; + STACK_OF(SSL_CIPHER) *ciphers; +- SSL_CIPHER *cipher; ++ OSSL_CONST SSL_CIPHER *cipher; + VALUE ary; + int i, num; + +@@ -623,10 +708,10 @@ ossl_sslctx_get_ciphers(VALUE self) if (!ciphers) return rb_ary_new(); @@ -58,25 +235,208 @@ $NetBSD: patch-dq,v 1.1 2009/08/11 14:26:59 taca Exp $ rb_ary_push(ary, ossl_ssl_cipher_to_ary(cipher)); } return ary; -@@ -1196,10 +1202,10 @@ ossl_ssl_get_peer_cert_chain(VALUE self) - } - chain = SSL_get_peer_cert_chain(ssl); - if(!chain) return Qnil; -- num = sk_num(chain); -+ num = sk_X509_num(chain); - ary = rb_ary_new2(num); - for (i = 0; i < num; i++){ -- cert = (X509*)sk_value(chain, i); -+ cert = sk_X509_value(chain, i); - rb_ary_push(ary, ossl_x509_new(cert)); +@@ -815,7 +900,6 @@ ossl_sslctx_flush_sessions(int argc, VAL + VALUE arg1; + SSL_CTX *ctx; + time_t tm = 0; +- int cb_state; + + rb_scan_args(argc, argv, "01", &arg1); + +@@ -889,6 +973,8 @@ ossl_ssl_initialize(int argc, VALUE *arg + ossl_sslctx_setup(ctx); + rb_call_super(0, 0); + ++ rb_iv_set(self, "@hostname", Qnil); ++ + return self; + } + +@@ -902,6 +988,10 @@ ossl_ssl_setup(VALUE self) + + Data_Get_Struct(self, SSL, ssl); + if(!ssl){ ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++ VALUE hostname = rb_iv_get(self, "@hostname"); ++#endif ++ + v_ctx = ossl_ssl_get_ctx(self); + Data_Get_Struct(v_ctx, SSL_CTX, ctx); + +@@ -911,6 +1001,12 @@ ossl_ssl_setup(VALUE self) + } + DATA_PTR(self) = ssl; + ++#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME ++ if (!NIL_P(hostname)) { ++ if (SSL_set_tlsext_host_name(ssl, StringValuePtr(hostname)) != 1) ++ ossl_raise(eSSLError, "SSL_set_tlsext_host_name:"); ++ } ++#endif + io = ossl_ssl_get_io(self); + GetOpenFile(io, fptr); + rb_io_check_readable(fptr); +@@ -947,7 +1043,15 @@ ossl_start_ssl(VALUE self, int (*func)() + Data_Get_Struct(self, SSL, ssl); + GetOpenFile(ossl_ssl_get_io(self), fptr); + for(;;){ +- if((ret = func(ssl)) > 0) break; ++ ret = func(ssl); ++ ++ cb_state = rb_ivar_get(self, ID_callback_state); ++ if (!NIL_P(cb_state)) ++ rb_jump_tag(NUM2INT(cb_state)); ++ ++ if (ret > 0) ++ break; ++ + switch((ret2 = ssl_get_error(ssl, ret))){ + case SSL_ERROR_WANT_WRITE: + rb_io_wait_writable(FPTR_TO_FD(fptr)); +@@ -963,10 +1067,6 @@ ossl_start_ssl(VALUE self, int (*func)() + } } -@@ -1214,7 +1220,7 @@ static VALUE - ossl_ssl_get_cipher(VALUE self) +- cb_state = rb_ivar_get(self, ID_callback_state); +- if (!NIL_P(cb_state)) +- rb_jump_tag(NUM2INT(cb_state)); +- + return self; + } + +@@ -1004,6 +1104,72 @@ ossl_ssl_accept(VALUE self) + static VALUE + ossl_ssl_read(int argc, VALUE *argv, VALUE self) { ++ SSL *ssl; ++ int ilen, nread = 0; ++ VALUE len, str; ++ rb_io_t *fptr; ++ ++ rb_scan_args(argc, argv, "11", &len, &str); ++ ilen = NUM2INT(len); ++ if(NIL_P(str)) str = rb_str_new(0, ilen); ++ else{ ++ StringValue(str); ++ rb_str_modify(str); ++ rb_str_resize(str, ilen); ++ } ++ if(ilen == 0) return str; ++ ++ Data_Get_Struct(self, SSL, ssl); ++ GetOpenFile(ossl_ssl_get_io(self), fptr); ++ if (ssl) { ++ if(SSL_pending(ssl) <= 0) ++ rb_thread_wait_fd(FPTR_TO_FD(fptr)); ++ for (;;){ ++ nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str)); ++ switch(SSL_get_error(ssl, nread)){ ++ case SSL_ERROR_NONE: ++ goto end; ++ case SSL_ERROR_ZERO_RETURN: ++ rb_eof_error(); ++ case SSL_ERROR_WANT_WRITE: ++ rb_io_wait_writable(FPTR_TO_FD(fptr)); ++ continue; ++ case SSL_ERROR_WANT_READ: ++ rb_io_wait_readable(FPTR_TO_FD(fptr)); ++ continue; ++ case SSL_ERROR_SYSCALL: ++ if(ERR_peek_error() == 0 && nread == 0) rb_eof_error(); ++ rb_sys_fail(0); ++ default: ++ ossl_raise(eSSLError, "SSL_read:"); ++ } ++ } ++ } ++ else { ++ ID id_sysread = rb_intern("sysread"); ++ rb_warning("SSL session is not started yet."); ++ return rb_funcall(ossl_ssl_get_io(self), id_sysread, 2, len, str); ++ } ++ ++end: ++ rb_str_set_len(str, nread); ++ OBJ_TAINT(str); ++ ++ return str; ++} ++ ++/* ++ * call-seq: ++ * ssl.read_nonblock(length) => string ++ * ssl.read_nonblock(length, buffer) => buffer ++ * ++ * === Parameters ++ * * +length+ is a positive integer. ++ * * +buffer+ is a string used to store the result. ++ */ ++static VALUE ++ossl_ssl_read_nonblock(int argc, VALUE *argv, VALUE self) ++{ SSL *ssl; -- SSL_CIPHER *cipher; -+ const SSL_CIPHER *cipher; + int ilen, nread = 0; + VALUE len, str; +@@ -1021,12 +1187,11 @@ ossl_ssl_read(int argc, VALUE *argv, VAL Data_Get_Struct(self, SSL, ssl); - if (!ssl) { + GetOpenFile(ossl_ssl_get_io(self), fptr); ++ rb_io_set_nonblock(fptr); + if (ssl) { +- if(SSL_pending(ssl) <= 0) +- rb_thread_wait_fd(FPTR_TO_FD(fptr)); + for (;;){ + nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str)); +- switch(ssl_get_error(ssl, nread)){ ++ switch(SSL_get_error(ssl, nread)){ + case SSL_ERROR_NONE: + goto end; + case SSL_ERROR_ZERO_RETURN: +@@ -1035,7 +1200,7 @@ ossl_ssl_read(int argc, VALUE *argv, VAL + rb_io_wait_writable(FPTR_TO_FD(fptr)); + continue; + case SSL_ERROR_WANT_READ: +- rb_io_wait_readable(FPTR_TO_FD(fptr)); ++ rb_sys_fail(fptr->path); + continue; + case SSL_ERROR_SYSCALL: + if(ERR_peek_error() == 0 && nread == 0) rb_eof_error(); +@@ -1046,9 +1211,8 @@ ossl_ssl_read(int argc, VALUE *argv, VAL + } + } + else { +- ID id_sysread = rb_intern("sysread"); + rb_warning("SSL session is not started yet."); +- return rb_funcall(ossl_ssl_get_io(self), id_sysread, 2, len, str); ++ return rb_funcall(ossl_ssl_get_io(self), rb_intern("sysread"), 2, len, str); + } + + end: +@@ -1221,7 +1385,7 @@ ossl_ssl_get_cipher(VALUE self) + rb_warning("SSL session is not started yet."); + return Qnil; + } +- cipher = SSL_get_current_cipher(ssl); ++ cipher = (SSL_CIPHER *)SSL_get_current_cipher(ssl); + + return ossl_ssl_cipher_to_ary(cipher); + } +@@ -1344,13 +1508,13 @@ Init_ossl_ssl() + + ID_callback_state = rb_intern("@callback_state"); + +- ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index(0,"ossl_ssl_ex_vcb_idx",0,0,0); +- ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,"ossl_ssl_ex_store_p",0,0,0); +- ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,"ossl_ssl_ex_ptr_idx",0,0,0); ++ ossl_ssl_ex_vcb_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_vcb_idx",0,0,0); ++ ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_store_p",0,0,0); ++ ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_ptr_idx",0,0,0); + ossl_ssl_ex_client_cert_cb_idx = +- SSL_get_ex_new_index(0,"ossl_ssl_ex_client_cert_cb_idx",0,0,0); ++ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0); + ossl_ssl_ex_tmp_dh_callback_idx = +- SSL_get_ex_new_index(0,"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0); ++ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0); + + mSSL = rb_define_module_under(mOSSL, "SSL"); + eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError); diff --git a/lang/ruby18-base/patches/patch-dr b/lang/ruby18-base/patches/patch-dr index eecb5fb7ffd..ff57725f6f1 100644 --- a/lang/ruby18-base/patches/patch-dr +++ b/lang/ruby18-base/patches/patch-dr @@ -1,15 +1,58 @@ -$NetBSD: patch-dr,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dr,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. +* r18943: (ossl_ocspreq_initialize): fix for initialization of r18168. +* r26838: backport the commit from trunk. ---- ext/openssl/ossl_x509attr.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_x509attr.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_x509attr.c -@@ -93,7 +93,7 @@ ossl_x509attr_initialize(int argc, VALUE +@@ -92,16 +92,17 @@ static VALUE + ossl_x509attr_initialize(int argc, VALUE *argv, VALUE self) { VALUE oid, value; - X509_ATTRIBUTE *attr; +- X509_ATTRIBUTE *attr; - unsigned char *p; ++ X509_ATTRIBUTE *attr, *x; + const unsigned char *p; GetX509Attr(self, attr); if(rb_scan_args(argc, argv, "11", &oid, &value) == 1){ + oid = ossl_to_der_if_possible(oid); + StringValue(oid); +- p = RSTRING_PTR(oid); +- if(!d2i_X509_ATTRIBUTE((X509_ATTRIBUTE**)&DATA_PTR(self), +- &p, RSTRING_LEN(oid))){ ++ p = (unsigned char *)RSTRING_PTR(oid); ++ x = d2i_X509_ATTRIBUTE(&attr, &p, RSTRING_LEN(oid)); ++ DATA_PTR(self) = attr; ++ if(!x){ + ossl_raise(eX509AttrError, NULL); + } + return self; +@@ -212,7 +213,7 @@ ossl_x509attr_get_value(VALUE self) + if(OSSL_X509ATTR_IS_SINGLE(attr)){ + length = i2d_ASN1_TYPE(attr->value.single, NULL); + str = rb_str_new(0, length); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + i2d_ASN1_TYPE(attr->value.single, &p); + ossl_str_adjust(str, p); + } +@@ -221,7 +222,7 @@ ossl_x509attr_get_value(VALUE self) + (unsigned char **) NULL, i2d_ASN1_TYPE, + V_ASN1_SET, V_ASN1_UNIVERSAL, 0); + str = rb_str_new(0, length); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p, + i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0); + ossl_str_adjust(str, p); +@@ -247,7 +248,7 @@ ossl_x509attr_to_der(VALUE self) + if((len = i2d_X509_ATTRIBUTE(attr, NULL)) <= 0) + ossl_raise(eX509AttrError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_X509_ATTRIBUTE(attr, &p) <= 0) + ossl_raise(eX509AttrError, NULL); + rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str)); diff --git a/lang/ruby18-base/patches/patch-ds b/lang/ruby18-base/patches/patch-ds index 8fec5e34c58..851b2f7c4ff 100644 --- a/lang/ruby18-base/patches/patch-ds +++ b/lang/ruby18-base/patches/patch-ds @@ -1,10 +1,44 @@ -$NetBSD: patch-ds,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-ds,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Constify. +* r18172: suppress warnings. ---- ext/openssl/ossl_x509cert.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_x509cert.c.orig 2007-06-08 15:02:04.000000000 +0000 +++ ext/openssl/ossl_x509cert.c -@@ -690,7 +690,7 @@ static VALUE +@@ -134,7 +134,7 @@ static VALUE + ossl_x509_initialize(int argc, VALUE *argv, VALUE self) + { + BIO *in; +- X509 *x509; ++ X509 *x509, *x = DATA_PTR(self);; + VALUE arg; + + if (rb_scan_args(argc, argv, "01", &arg) == 0) { +@@ -143,10 +143,12 @@ ossl_x509_initialize(int argc, VALUE *ar + } + arg = ossl_to_der_if_possible(arg); + in = ossl_obj2bio(arg); +- x509 = PEM_read_bio_X509(in, (X509 **)&DATA_PTR(self), NULL, NULL); ++ x509 = PEM_read_bio_X509(in, &x, NULL, NULL); ++ DATA_PTR(self) = x; + if (!x509) { +- BIO_reset(in); +- x509 = d2i_X509_bio(in, (X509 **)&DATA_PTR(self)); ++ (void)BIO_reset(in); ++ x509 = d2i_X509_bio(in, &x); ++ DATA_PTR(self) = x; + } + BIO_free(in); + if (!x509) ossl_raise(eX509CertError, NULL); +@@ -190,7 +192,7 @@ ossl_x509_to_der(VALUE self) + if ((len = i2d_X509(x509, NULL)) <= 0) + ossl_raise(eX509CertError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if (i2d_X509(x509, &p) <= 0) + ossl_raise(eX509CertError, NULL); + ossl_str_adjust(str, p); +@@ -690,7 +692,7 @@ static VALUE ossl_x509_inspect(VALUE self) { VALUE str; diff --git a/lang/ruby18-base/patches/patch-dt b/lang/ruby18-base/patches/patch-dt index 0c34c1935c6..8c5d784342a 100644 --- a/lang/ruby18-base/patches/patch-dt +++ b/lang/ruby18-base/patches/patch-dt @@ -1,24 +1,32 @@ -$NetBSD: patch-dt,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dt,v 1.2 2010/09/10 03:29:00 taca Exp $ -* Use proper funcition assosiated type. +* r18172: suppress warnings. +* r26838: backport the commit from trunk. ---- ext/openssl/ossl_x509crl.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_x509crl.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_x509crl.c -@@ -262,7 +262,7 @@ ossl_x509crl_get_revoked(VALUE self) - VALUE ary, revoked; +@@ -91,7 +91,7 @@ static VALUE + ossl_x509crl_initialize(int argc, VALUE *argv, VALUE self) + { + BIO *in; +- X509_CRL *crl; ++ X509_CRL *crl, *x = DATA_PTR(self); + VALUE arg; - GetX509CRL(self, crl); -- num = sk_X509_CRL_num(X509_CRL_get_REVOKED(crl)); -+ num = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl)); - if (num < 0) { - OSSL_Debug("num < 0???"); - return rb_ary_new(); -@@ -270,7 +270,7 @@ ossl_x509crl_get_revoked(VALUE self) - ary = rb_ary_new2(num); - for(i=0; i<num; i++) { - /* NO DUP - don't free! */ -- rev = (X509_REVOKED *)sk_X509_CRL_value(X509_CRL_get_REVOKED(crl), i); -+ rev = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i); - revoked = ossl_x509revoked_new(rev); - rb_ary_push(ary, revoked); + if (rb_scan_args(argc, argv, "01", &arg) == 0) { +@@ -99,10 +99,12 @@ ossl_x509crl_initialize(int argc, VALUE } + arg = ossl_to_der_if_possible(arg); + in = ossl_obj2bio(arg); +- crl = PEM_read_bio_X509_CRL(in, (X509_CRL **)&DATA_PTR(self), NULL, NULL); ++ crl = PEM_read_bio_X509_CRL(in, &x, NULL, NULL); ++ DATA_PTR(self) = x; + if (!crl) { +- BIO_reset(in); +- crl = d2i_X509_CRL_bio(in, (X509_CRL **)&DATA_PTR(self)); ++ (void)BIO_reset(in); ++ crl = d2i_X509_CRL_bio(in, &x); ++ DATA_PTR(self) = x; + } + BIO_free(in); + if (!crl) ossl_raise(eX509CRLError, NULL); diff --git a/lang/ruby18-base/patches/patch-du b/lang/ruby18-base/patches/patch-du index 45ddbedf8d2..135c749548e 100644 --- a/lang/ruby18-base/patches/patch-du +++ b/lang/ruby18-base/patches/patch-du @@ -1,10 +1,10 @@ -$NetBSD: patch-du,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-du,v 1.2 2010/09/10 03:29:00 taca Exp $ Constify. ---- ext/openssl/ossl_x509ext.c.orig 2007-06-09 00:02:04.000000000 +0900 +--- ext/openssl/ossl_x509ext.c.orig 2010-05-24 23:58:49.000000000 +0000 +++ ext/openssl/ossl_x509ext.c -@@ -273,7 +273,7 @@ static VALUE +@@ -274,7 +274,7 @@ static VALUE ossl_x509ext_initialize(int argc, VALUE *argv, VALUE self) { VALUE oid, value, critical; diff --git a/lang/ruby18-base/patches/patch-dv b/lang/ruby18-base/patches/patch-dv index 3eee808a3e3..e8cd4f5597b 100644 --- a/lang/ruby18-base/patches/patch-dv +++ b/lang/ruby18-base/patches/patch-dv @@ -1,8 +1,12 @@ -$NetBSD: patch-dv,v 1.1 2009/08/11 14:26:59 taca Exp $ +$NetBSD: patch-dv,v 1.2 2010/09/10 03:29:00 taca Exp $ -Constify. +* r18172: suppress warnings. +* r18943: (ossl_ocspreq_initialize): fix for initialization of r18168. +* r26835: backport fixes in 1.9. +* r26840: added X509::Name#hash_old as a wrapper for X509_NAME_hash_old + in OpenSSL 1.0.0. ---- ext/openssl/ossl_x509name.c.orig 2007-07-15 22:24:51.000000000 +0900 +--- ext/openssl/ossl_x509name.c.orig 2010-06-21 09:18:59.000000000 +0000 +++ ext/openssl/ossl_x509name.c @@ -135,7 +135,7 @@ ossl_x509name_initialize(int argc, VALUE rb_block_call(tmp, rb_intern("each"), 0, 0, ossl_x509name_init_i, args); @@ -11,5 +15,32 @@ Constify. - unsigned char *p; + const unsigned char *p; VALUE str = ossl_to_der_if_possible(arg); + X509_NAME *x; StringValue(str); - p = RSTRING_PTR(str); +@@ -167,7 +167,7 @@ VALUE ossl_x509name_add_entry(int argc, + if(NIL_P(type)) type = rb_aref(OBJECT_TYPE_TEMPLATE, oid); + GetX509Name(self, name); + if (!X509_NAME_add_entry_by_txt(name, RSTRING_PTR(oid), NUM2INT(type), +- RSTRING_PTR(value), RSTRING_LEN(value), -1, 0)) { ++ (unsigned char *)RSTRING_PTR(value), RSTRING_LEN(value), -1, 0)) { + ossl_raise(eX509NameError, NULL); + } + +@@ -248,7 +248,7 @@ ossl_x509name_to_a(VALUE self) + } + short_name = OBJ_nid2sn(OBJ_ln2nid(long_name)); + ary = rb_ary_new3(3, rb_str_new2(short_name), +- rb_str_new(entry->value->data, entry->value->length), ++ rb_str_new((const char *)entry->value->data, entry->value->length), + INT2FIX(entry->value->type)); + rb_ary_push(ret, ary); + } +@@ -343,7 +364,7 @@ ossl_x509name_to_der(VALUE self) + if((len = i2d_X509_NAME(name, NULL)) <= 0) + ossl_raise(eX509NameError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_X509_NAME(name, &p) <= 0) + ossl_raise(eX509NameError, NULL); + ossl_str_adjust(str, p); diff --git a/lang/ruby18-base/patches/patch-dw b/lang/ruby18-base/patches/patch-dw index 014888aa75b..59529f2e9f2 100644 --- a/lang/ruby18-base/patches/patch-dw +++ b/lang/ruby18-base/patches/patch-dw @@ -1,34 +1,17 @@ -$NetBSD: patch-dw,v 1.2 2010/01/14 15:07:28 taca Exp $ +$NetBSD: patch-dw,v 1.3 2010/09/10 03:29:00 taca Exp $ -webrick security fix. +Additional fix after webrick security fix. http://www.ruby-lang.org/en/news/2010/01/10/webrick-escape-sequence-injection/ ---- lib/webrick/accesslog.rb.orig 2007-02-12 23:01:19.000000000 +0000 +--- lib/webrick/accesslog.rb.orig 2010-01-10 10:30:06.000000000 +0000 +++ lib/webrick/accesslog.rb -@@ -53,15 +53,23 @@ module WEBrick +@@ -53,7 +53,7 @@ module WEBrick when ?e, ?i, ?n, ?o raise AccessLogError, "parameter is required for \"#{spec}\"" unless param -- params[spec][param] || "-" +- param = params[spec][param] ? escape(param) : "-" + (param = params[spec][param]) ? escape(param) : "-" when ?t params[spec].strftime(param || CLF_TIME_FORMAT) when ?% - "%" - else -- params[spec] -+ escape(params[spec].to_s) - end - } - end -+ -+ def escape(data) -+ if data.tainted? -+ data.gsub(/[[:cntrl:]\\]+/) {$&.dump[1...-1]}.untaint -+ else -+ data -+ end -+ end - end - end diff --git a/lang/ruby18-base/patches/patch-dx b/lang/ruby18-base/patches/patch-dx deleted file mode 100644 index 4a1a217fa3a..00000000000 --- a/lang/ruby18-base/patches/patch-dx +++ /dev/null @@ -1,21 +0,0 @@ -$NetBSD: patch-dx,v 1.1 2010/01/10 15:33:28 taca Exp $ - -webrick security fix. - -http://www.ruby-lang.org/en/news/2010/01/10/webrick-escape-sequence-injection/ - ---- lib/webrick/httprequest.rb.orig 2009-02-14 19:17:52.000000000 +0000 -+++ lib/webrick/httprequest.rb -@@ -242,11 +242,7 @@ module WEBrick - @raw_header << line - end - end -- begin -- @header = HTTPUtils::parse_header(@raw_header) -- rescue => ex -- raise HTTPStatus::BadRequest, ex.message -- end -+ @header = HTTPUtils::parse_header(@raw_header.join) - end - - def parse_uri(str, scheme="http") diff --git a/lang/ruby18-base/patches/patch-dy b/lang/ruby18-base/patches/patch-dy index bdbc0f2b70c..cfc09c899a7 100644 --- a/lang/ruby18-base/patches/patch-dy +++ b/lang/ruby18-base/patches/patch-dy @@ -1,61 +1,15 @@ -$NetBSD: patch-dy,v 1.2 2010/01/14 15:07:28 taca Exp $ +$NetBSD: patch-dy,v 1.3 2010/09/10 03:29:00 taca Exp $ -webrick security fix. +Additional fix after webrick security fix. -http://www.ruby-lang.org/en/news/2010/01/10/webrick-escape-sequence-injection/ - ---- lib/webrick/httpstatus.rb.orig 2007-02-12 23:01:19.000000000 +0000 +--- lib/webrick/httpstatus.rb.orig 2010-06-10 05:23:49.000000000 +0000 +++ lib/webrick/httpstatus.rb -@@ -12,7 +12,18 @@ module WEBrick +@@ -12,7 +12,7 @@ module WEBrick module HTTPStatus -- class Status < StandardError; end +- class Status < StandardError + class Status < StandardError -+ def initialize(*args) -+ args[0] = AccessLog.escape(args[0]) unless args.empty? -+ super(*args) -+ end -+ class << self -+ attr_reader :code, :reason_phrase -+ end -+ def code() self::class::code end -+ def reason_phrase() self::class::reason_phrase end -+ alias to_i code -+ end - class Info < Status; end - class Success < Status; end - class Redirect < Status; end -@@ -68,6 +79,7 @@ module WEBrick - CodeToError = {} - - StatusMessage.each{|code, message| -+ message.freeze - var_name = message.gsub(/[ \-]/,'_').upcase - err_name = message.gsub(/[ \-]/,'') - -@@ -79,18 +91,12 @@ module WEBrick - when 500...600; parent = ServerError - end - -- eval %- -- RC_#{var_name} = #{code} -- class #{err_name} < #{parent} -- def self.code() RC_#{var_name} end -- def self.reason_phrase() StatusMessage[code] end -- def code() self::class::code end -- def reason_phrase() self::class::reason_phrase end -- alias to_i code -- end -- - -- -- CodeToError[code] = const_get(err_name) -+ const_set("RC_#{var_name}", code) -+ err_class = Class.new(parent) -+ err_class.instance_variable_set(:@code, code) -+ err_class.instance_variable_set(:@reason_phrase, message) -+ const_set(err_name, err_class) -+ CodeToError[code] = err_class - } - - def reason_phrase(code) + def initialize(*args) + args[0] = AccessLog.escape(args[0]) unless args.empty? + super(*args) diff --git a/lang/ruby18-base/patches/patch-dz b/lang/ruby18-base/patches/patch-dz deleted file mode 100644 index 2433b248b9c..00000000000 --- a/lang/ruby18-base/patches/patch-dz +++ /dev/null @@ -1,22 +0,0 @@ -$NetBSD: patch-dz,v 1.1 2010/01/10 15:33:28 taca Exp $ - -webrick security fix. - -http://www.ruby-lang.org/en/news/2010/01/10/webrick-escape-sequence-injection/ - ---- lib/webrick/httputils.rb.orig 2008-08-04 05:21:05.000000000 +0000 -+++ lib/webrick/httputils.rb -@@ -128,11 +128,11 @@ module WEBrick - when /^\s+(.*?)\s*\z/om - value = $1 - unless field -- raise "bad header '#{line.inspect}'." -+ raise HTTPStatus::BadRequest, "bad header '#{line}'." - end - header[field][-1] << " " << value - else -- raise "bad header '#{line.inspect}'." -+ raise HTTPStatus::BadRequest, "bad header '#{line}'." - end - } - header.each{|key, values| diff --git a/lang/ruby18-base/patches/patch-ea b/lang/ruby18-base/patches/patch-ea deleted file mode 100644 index 4258bf4997f..00000000000 --- a/lang/ruby18-base/patches/patch-ea +++ /dev/null @@ -1,16 +0,0 @@ -$NetBSD: patch-ea,v 1.1 2010/08/16 07:08:13 taca Exp $ - -* Fix for possible cross-site scripting (CVE-2010-0541) from r29002 in - Ruby's repository. - ---- lib/webrick/httpresponse.rb.orig 2008-06-06 08:05:24.000000000 +0000 -+++ lib/webrick/httpresponse.rb -@@ -209,7 +209,7 @@ module WEBrick - @keep_alive = false - self.status = HTTPStatus::RC_INTERNAL_SERVER_ERROR - end -- @header['content-type'] = "text/html" -+ @header['content-type'] = "text/html; charset=ISO-8859-1" - - if respond_to?(:create_error_page) - create_error_page() diff --git a/lang/ruby18-base/patches/patch-eb b/lang/ruby18-base/patches/patch-eb new file mode 100644 index 00000000000..b3d7f36077e --- /dev/null +++ b/lang/ruby18-base/patches/patch-eb @@ -0,0 +1,15 @@ +$NetBSD: patch-eb,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* Fix a warning. + +--- ext/digest/digest.c.orig 2009-12-14 03:19:26.000000000 +0000 ++++ ext/digest/digest.c +@@ -275,7 +275,7 @@ rb_digest_instance_inspect(VALUE self) + { + VALUE str; + size_t digest_len = 32; /* about this size at least */ +- char *cname; ++ const char *cname; + + cname = rb_obj_classname(self); + diff --git a/lang/ruby18-base/patches/patch-ec b/lang/ruby18-base/patches/patch-ec new file mode 100644 index 00000000000..1b971d236b9 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ec @@ -0,0 +1,29 @@ +$NetBSD: patch-ec,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. +* r26838: backport the commit from trunk. + +--- ext/openssl/ossl.h.orig 2010-06-21 09:18:59.000000000 +0000 ++++ ext/openssl/ossl.h +@@ -114,10 +114,19 @@ extern VALUE eOSSLError; + #define STACK _STACK + #endif + ++#if 0 ++/* ++ * Compatibility ++ */ ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++#define STACK _STACK ++#endif ++#endif ++ + /* + * String to HEXString conversion + */ +-int string2hex(char *, int, char **, int *); ++int string2hex(const unsigned char *, int, char **, int *); + + /* + * Data Conversion diff --git a/lang/ruby18-base/patches/patch-ed b/lang/ruby18-base/patches/patch-ed new file mode 100644 index 00000000000..1074198d08c --- /dev/null +++ b/lang/ruby18-base/patches/patch-ed @@ -0,0 +1,38 @@ +$NetBSD: patch-ed,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. + +--- ext/openssl/ossl_bn.c.orig 2010-05-24 23:58:49.000000000 +0000 ++++ ext/openssl/ossl_bn.c +@@ -131,12 +131,12 @@ ossl_bn_initialize(int argc, VALUE *argv + + switch (base) { + case 0: +- if (!BN_mpi2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) { ++ if (!BN_mpi2bn((unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str), bn)) { + ossl_raise(eBNError, NULL); + } + break; + case 2: +- if (!BN_bin2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) { ++ if (!BN_bin2bn((unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str), bn)) { + ossl_raise(eBNError, NULL); + } + break; +@@ -185,13 +185,13 @@ ossl_bn_to_s(int argc, VALUE *argv, VALU + case 0: + len = BN_bn2mpi(bn, NULL); + str = rb_str_new(0, len); +- if (BN_bn2mpi(bn, RSTRING_PTR(str)) != len) ++ if (BN_bn2mpi(bn, (unsigned char *)RSTRING_PTR(str)) != len) + ossl_raise(eBNError, NULL); + break; + case 2: + len = BN_num_bytes(bn); + str = rb_str_new(0, len); +- if (BN_bn2bin(bn, RSTRING_PTR(str)) != len) ++ if (BN_bn2bin(bn, (unsigned char *)RSTRING_PTR(str)) != len) + ossl_raise(eBNError, NULL); + break; + case 10: diff --git a/lang/ruby18-base/patches/patch-ee b/lang/ruby18-base/patches/patch-ee new file mode 100644 index 00000000000..544b7f9e8f7 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ee @@ -0,0 +1,42 @@ +$NetBSD: patch-ee,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r23015: (GetDigestPtr): use StringValueCStr instead of STR2CSTR. +* r23506: (Init_ossl_digest): avoid recursing require. + +--- ext/openssl/ossl_digest.c.orig 2008-02-25 08:48:57.000000000 +0000 ++++ ext/openssl/ossl_digest.c +@@ -38,7 +38,7 @@ GetDigestPtr(VALUE obj) + const EVP_MD *md; + + if (TYPE(obj) == T_STRING) { +- const char *name = STR2CSTR(obj); ++ const char *name = StringValueCStr(obj); + + md = EVP_get_digestbyname(name); + if (!md) +@@ -96,7 +96,6 @@ ossl_digest_initialize(int argc, VALUE * + { + EVP_MD_CTX *ctx; + const EVP_MD *md; +- char *name; + VALUE type, data; + + rb_scan_args(argc, argv, "11", &type, &data); +@@ -182,7 +181,7 @@ ossl_digest_finish(int argc, VALUE *argv + rb_str_resize(str, EVP_MD_CTX_size(ctx)); + } + +- EVP_DigestFinal_ex(ctx, RSTRING_PTR(str), NULL); ++ EVP_DigestFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), NULL); + + return str; + } +@@ -234,7 +233,6 @@ ossl_digest_block_length(VALUE self) + void + Init_ossl_digest() + { +- rb_require("openssl"); + rb_require("digest"); + + #if 0 /* let rdoc know about mOSSL */ diff --git a/lang/ruby18-base/patches/patch-ef b/lang/ruby18-base/patches/patch-ef new file mode 100644 index 00000000000..ee1beb7ff49 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ef @@ -0,0 +1,35 @@ +$NetBSD: patch-ef,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. + +--- ext/openssl/ossl_pkcs12.c.orig 2007-06-08 15:02:04.000000000 +0000 ++++ ext/openssl/ossl_pkcs12.c +@@ -137,15 +137,17 @@ ossl_pkcs12_initialize(int argc, VALUE * + X509 *x509; + STACK_OF(X509) *x509s = NULL; + int st = 0; ++ PKCS12 *pkcs = DATA_PTR(self); + + if(rb_scan_args(argc, argv, "02", &arg, &pass) == 0) return self; + passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass); + in = ossl_obj2bio(arg); +- d2i_PKCS12_bio(in, (PKCS12 **)&DATA_PTR(self)); ++ d2i_PKCS12_bio(in, &pkcs); ++ DATA_PTR(self) = pkcs; + BIO_free(in); + + pkey = cert = ca = Qnil; +- if(!PKCS12_parse((PKCS12*)DATA_PTR(self), passphrase, &key, &x509, &x509s)) ++ if(!PKCS12_parse(pkcs, passphrase, &key, &x509, &x509s)) + ossl_raise(ePKCS12Error, "PKCS12_parse"); + pkey = rb_protect((VALUE(*)_((VALUE)))ossl_pkey_new, (VALUE)key, + &st); /* NO DUP */ +@@ -181,7 +183,7 @@ ossl_pkcs12_to_der(VALUE self) + if((len = i2d_PKCS12(p12, NULL)) <= 0) + ossl_raise(ePKCS12Error, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_PKCS12(p12, &p) <= 0) + ossl_raise(ePKCS12Error, NULL); + ossl_str_adjust(str, p); diff --git a/lang/ruby18-base/patches/patch-eg b/lang/ruby18-base/patches/patch-eg new file mode 100644 index 00000000000..366bbec06e8 --- /dev/null +++ b/lang/ruby18-base/patches/patch-eg @@ -0,0 +1,34 @@ +$NetBSD: patch-eg,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. + +--- ext/openssl/ossl_pkey.c.orig 2010-05-24 23:58:49.000000000 +0000 ++++ ext/openssl/ossl_pkey.c +@@ -164,7 +164,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, + { + EVP_PKEY *pkey; + EVP_MD_CTX ctx; +- int buf_len; ++ unsigned int buf_len; + VALUE str; + + if (rb_funcall(self, id_private_q, 0, NULL) != Qtrue) { +@@ -175,7 +175,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, + StringValue(data); + EVP_SignUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data)); + str = rb_str_new(0, EVP_PKEY_size(pkey)+16); +- if (!EVP_SignFinal(&ctx, RSTRING_PTR(str), &buf_len, pkey)) ++ if (!EVP_SignFinal(&ctx, (unsigned char *)RSTRING_PTR(str), &buf_len, pkey)) + ossl_raise(ePKeyError, NULL); + assert((long)buf_len <= RSTRING_LEN(str)); + rb_str_set_len(str, buf_len); +@@ -194,7 +194,7 @@ ossl_pkey_verify(VALUE self, VALUE diges + StringValue(sig); + StringValue(data); + EVP_VerifyUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data)); +- switch (EVP_VerifyFinal(&ctx, RSTRING_PTR(sig), RSTRING_LEN(sig), pkey)) { ++ switch (EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LEN(sig), pkey)) { + case 0: + return Qfalse; + case 1: diff --git a/lang/ruby18-base/patches/patch-eh b/lang/ruby18-base/patches/patch-eh new file mode 100644 index 00000000000..04d61125382 --- /dev/null +++ b/lang/ruby18-base/patches/patch-eh @@ -0,0 +1,34 @@ +$NetBSD: patch-eh,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. + +--- ext/openssl/ossl_pkey_dh.c.orig 2010-05-24 23:58:49.000000000 +0000 ++++ ext/openssl/ossl_pkey_dh.c +@@ -169,7 +169,7 @@ ossl_dh_initialize(int argc, VALUE *argv + in = ossl_obj2bio(arg); + dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL); + if (!dh){ +- BIO_reset(in); ++ (void)BIO_reset(in); + dh = d2i_DHparams_bio(in, NULL); + } + BIO_free(in); +@@ -254,7 +254,7 @@ ossl_dh_to_der(VALUE self) + if((len = i2d_DHparams(pkey->pkey.dh, NULL)) <= 0) + ossl_raise(eDHError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_DHparams(pkey->pkey.dh, &p) < 0) + ossl_raise(eDHError, NULL); + ossl_str_adjust(str, p); +@@ -407,7 +407,7 @@ ossl_dh_compute_key(VALUE self, VALUE pu + pub_key = GetBNPtr(pub); + len = DH_size(dh); + str = rb_str_new(0, len); +- if ((len = DH_compute_key(RSTRING_PTR(str), pub_key, dh)) < 0) { ++ if ((len = DH_compute_key((unsigned char *)RSTRING_PTR(str), pub_key, dh)) < 0) { + ossl_raise(eDHError, NULL); + } + rb_str_set_len(str, len); diff --git a/lang/ruby18-base/patches/patch-ei b/lang/ruby18-base/patches/patch-ei new file mode 100644 index 00000000000..71e7526cd45 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ei @@ -0,0 +1,70 @@ +$NetBSD: patch-ei,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. + +--- ext/openssl/ossl_pkey_dsa.c.orig 2010-05-24 23:58:49.000000000 +0000 ++++ ext/openssl/ossl_pkey_dsa.c +@@ -161,19 +161,19 @@ ossl_dsa_initialize(int argc, VALUE *arg + in = ossl_obj2bio(arg); + dsa = PEM_read_bio_DSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd); + if (!dsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL); + } + if (!dsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + dsa = PEM_read_bio_DSA_PUBKEY(in, NULL, NULL, NULL); + } + if (!dsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + dsa = d2i_DSAPrivateKey_bio(in, NULL); + } + if (!dsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + dsa = d2i_DSA_PUBKEY_bio(in, NULL); + } + BIO_free(in); +@@ -289,7 +289,7 @@ ossl_dsa_to_der(VALUE self) + if((len = i2d_func(pkey->pkey.dsa, NULL)) <= 0) + ossl_raise(eDSAError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_func(pkey->pkey.dsa, &p) < 0) + ossl_raise(eDSAError, NULL); + ossl_str_adjust(str, p); +@@ -387,7 +387,7 @@ static VALUE + ossl_dsa_sign(VALUE self, VALUE data) + { + EVP_PKEY *pkey; +- int buf_len; ++ unsigned int buf_len; + VALUE str; + + GetPKeyDSA(self, pkey); +@@ -396,7 +396,8 @@ ossl_dsa_sign(VALUE self, VALUE data) + ossl_raise(eDSAError, "Private DSA key needed!"); + } + str = rb_str_new(0, ossl_dsa_buf_size(pkey)); +- if (!DSA_sign(0, RSTRING_PTR(data), RSTRING_LEN(data), RSTRING_PTR(str), ++ if (!DSA_sign(0, (unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data), ++ (unsigned char *)RSTRING_PTR(str), + &buf_len, pkey->pkey.dsa)) { /* type is ignored (0) */ + ossl_raise(eDSAError, NULL); + } +@@ -420,8 +421,8 @@ ossl_dsa_verify(VALUE self, VALUE digest + StringValue(digest); + StringValue(sig); + /* type is ignored (0) */ +- ret = DSA_verify(0, RSTRING_PTR(digest), RSTRING_LEN(digest), +- RSTRING_PTR(sig), RSTRING_LEN(sig), pkey->pkey.dsa); ++ ret = DSA_verify(0, (unsigned char *)RSTRING_PTR(digest), RSTRING_LEN(digest), ++ (unsigned char *)RSTRING_PTR(sig), RSTRING_LEN(sig), pkey->pkey.dsa); + if (ret < 0) { + ossl_raise(eDSAError, NULL); + } diff --git a/lang/ruby18-base/patches/patch-ej b/lang/ruby18-base/patches/patch-ej new file mode 100644 index 00000000000..67a9cb190f0 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ej @@ -0,0 +1,71 @@ +$NetBSD: patch-ej,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r23015: (GetDigestPtr): use StringValueCStr instead of STR2CSTR. +* r26835: backport fixes in 1.9. +* r26837: fix misc documentation along with test_dsa_sign_asn1_FIPS186_3 + +--- ext/openssl/ossl_pkey_ec.c.orig 2010-06-21 09:18:59.000000000 +0000 ++++ ext/openssl/ossl_pkey_ec.c +@@ -186,22 +186,22 @@ static VALUE ossl_ec_key_initialize(int + + ec = PEM_read_bio_ECPrivateKey(in, NULL, NULL, NULL); + if (!ec) { +- BIO_reset(in); ++ (void)BIO_reset(in); + ec = PEM_read_bio_EC_PUBKEY(in, NULL, NULL, NULL); + } + if (!ec) { +- BIO_reset(in); ++ (void)BIO_reset(in); + ec = d2i_ECPrivateKey_bio(in, NULL); + } + if (!ec) { +- BIO_reset(in); ++ (void)BIO_reset(in); + ec = d2i_EC_PUBKEY_bio(in, NULL); + } + + BIO_free(in); + + if (ec == NULL) { +- const char *name = STR2CSTR(arg); ++ const char *name = StringValueCStr(arg); + int nid = OBJ_sn2nid(name); + + if (nid == NID_undef) +@@ -778,14 +778,14 @@ static VALUE ossl_ec_group_initialize(in + + group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL); + if (!group) { +- BIO_reset(in); ++ (void)BIO_reset(in); + group = d2i_ECPKParameters_bio(in, NULL); + } + + BIO_free(in); + + if (!group) { +- const char *name = STR2CSTR(arg1); ++ const char *name = StringValueCStr(arg1); + int nid = OBJ_sn2nid(name); + + if (nid == NID_undef) +@@ -1092,7 +1092,7 @@ static VALUE ossl_ec_group_get_seed(VALU + if (seed_len == 0) + return Qnil; + +- return rb_str_new(EC_GROUP_get0_seed(group), seed_len); ++ return rb_str_new((const char *)EC_GROUP_get0_seed(group), seed_len); + } + + /* call-seq: +@@ -1107,7 +1107,7 @@ static VALUE ossl_ec_group_set_seed(VALU + Require_EC_GROUP(self, group); + StringValue(seed); + +- if (EC_GROUP_set_seed(group, RSTRING_PTR(seed), RSTRING_LEN(seed)) != RSTRING_LEN(seed)) ++ if (EC_GROUP_set_seed(group, (unsigned char *)RSTRING_PTR(seed), RSTRING_LEN(seed)) != RSTRING_LEN(seed)) + ossl_raise(eEC_GROUP, "EC_GROUP_set_seed"); + + return seed; diff --git a/lang/ruby18-base/patches/patch-ek b/lang/ruby18-base/patches/patch-ek new file mode 100644 index 00000000000..8103081f21a --- /dev/null +++ b/lang/ruby18-base/patches/patch-ek @@ -0,0 +1,89 @@ +$NetBSD: patch-ek,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. + +--- ext/openssl/ossl_pkey_rsa.c.orig 2010-05-24 23:58:49.000000000 +0000 ++++ ext/openssl/ossl_pkey_rsa.c +@@ -151,23 +151,23 @@ ossl_rsa_initialize(int argc, VALUE *arg + in = ossl_obj2bio(arg); + rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd); + if (!rsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL); + } + if (!rsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + rsa = PEM_read_bio_RSA_PUBKEY(in, NULL, NULL, NULL); + } + if (!rsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + rsa = d2i_RSAPrivateKey_bio(in, NULL); + } + if (!rsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + rsa = d2i_RSAPublicKey_bio(in, NULL); + } + if (!rsa) { +- BIO_reset(in); ++ (void)BIO_reset(in); + rsa = d2i_RSA_PUBKEY_bio(in, NULL); + } + BIO_free(in); +@@ -288,7 +288,7 @@ ossl_rsa_to_der(VALUE self) + if((len = i2d_func(pkey->pkey.rsa, NULL)) <= 0) + ossl_raise(eRSAError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if(i2d_func(pkey->pkey.rsa, &p) < 0) + ossl_raise(eRSAError, NULL); + ossl_str_adjust(str, p); +@@ -315,8 +315,8 @@ ossl_rsa_public_encrypt(int argc, VALUE + pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding); + StringValue(buffer); + str = rb_str_new(0, ossl_rsa_buf_size(pkey)); +- buf_len = RSA_public_encrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer), +- RSTRING_PTR(str), pkey->pkey.rsa, ++ buf_len = RSA_public_encrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer), ++ (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa, + pad); + if (buf_len < 0) ossl_raise(eRSAError, NULL); + rb_str_set_len(str, buf_len); +@@ -341,8 +341,8 @@ ossl_rsa_public_decrypt(int argc, VALUE + pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding); + StringValue(buffer); + str = rb_str_new(0, ossl_rsa_buf_size(pkey)); +- buf_len = RSA_public_decrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer), +- RSTRING_PTR(str), pkey->pkey.rsa, ++ buf_len = RSA_public_decrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer), ++ (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa, + pad); + if (buf_len < 0) ossl_raise(eRSAError, NULL); + rb_str_set_len(str, buf_len); +@@ -370,8 +370,8 @@ ossl_rsa_private_encrypt(int argc, VALUE + pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding); + StringValue(buffer); + str = rb_str_new(0, ossl_rsa_buf_size(pkey)); +- buf_len = RSA_private_encrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer), +- RSTRING_PTR(str), pkey->pkey.rsa, ++ buf_len = RSA_private_encrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer), ++ (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa, + pad); + if (buf_len < 0) ossl_raise(eRSAError, NULL); + rb_str_set_len(str, buf_len); +@@ -400,8 +400,8 @@ ossl_rsa_private_decrypt(int argc, VALUE + pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding); + StringValue(buffer); + str = rb_str_new(0, ossl_rsa_buf_size(pkey)); +- buf_len = RSA_private_decrypt(RSTRING_LEN(buffer), RSTRING_PTR(buffer), +- RSTRING_PTR(str), pkey->pkey.rsa, ++ buf_len = RSA_private_decrypt(RSTRING_LEN(buffer), (unsigned char *)RSTRING_PTR(buffer), ++ (unsigned char *)RSTRING_PTR(str), pkey->pkey.rsa, + pad); + if (buf_len < 0) ossl_raise(eRSAError, NULL); + rb_str_set_len(str, buf_len); diff --git a/lang/ruby18-base/patches/patch-el b/lang/ruby18-base/patches/patch-el new file mode 100644 index 00000000000..fd4a391771c --- /dev/null +++ b/lang/ruby18-base/patches/patch-el @@ -0,0 +1,24 @@ +$NetBSD: patch-el,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. + +--- ext/openssl/ossl_rand.c.orig 2008-05-29 18:15:50.000000000 +0000 ++++ ext/openssl/ossl_rand.c +@@ -99,7 +99,7 @@ ossl_rand_bytes(VALUE self, VALUE len) + int n = NUM2INT(len); + + str = rb_str_new(0, n); +- if (!RAND_bytes(RSTRING_PTR(str), n)) { ++ if (!RAND_bytes((unsigned char *)RSTRING_PTR(str), n)) { + ossl_raise(eRandomError, NULL); + } + +@@ -118,7 +118,7 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE + int n = NUM2INT(len); + + str = rb_str_new(0, n); +- if (!RAND_pseudo_bytes(RSTRING_PTR(str), n)) { ++ if (!RAND_pseudo_bytes((unsigned char *)RSTRING_PTR(str), n)) { + ossl_raise(eRandomError, NULL); + } + diff --git a/lang/ruby18-base/patches/patch-em b/lang/ruby18-base/patches/patch-em new file mode 100644 index 00000000000..756a7964a86 --- /dev/null +++ b/lang/ruby18-base/patches/patch-em @@ -0,0 +1,31 @@ +$NetBSD: patch-em,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. +* r26835: backport fixes in 1.9. +* r26850: (ossl_ssl_session_{get,set}_time{,out}): fixed a bug introduced by + backporting. (see [ruby-dev:40573]) use long in according to + OpenSSL API. (SSL_SESSION_{get,set}_time{,out}) +* r26861: (ossl_pkcs5_pbkdf2_hmac): follows function definition in + OpenSSL 1.0.0beta5. PKCS5_PBKDF2_HMAC is from 1.0.0 (0.9.8 only + has PKCS5_PBKDF2_HMAC_SHA1) + +--- ext/openssl/ossl_ssl_session.c.orig 2010-06-21 09:18:59.000000000 +0000 ++++ ext/openssl/ossl_ssl_session.c +@@ -36,8 +36,6 @@ static VALUE ossl_ssl_session_alloc(VALU + static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1) + { + SSL_SESSION *ctx = NULL; +- VALUE obj; +- unsigned char *p; + + if (RDATA(self)->data) + ossl_raise(eSSLSession, "SSL Session already initialized"); +@@ -55,7 +53,7 @@ static VALUE ossl_ssl_session_initialize + ctx = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL); + + if (!ctx) { +- BIO_reset(in); ++ (void)BIO_reset(in); + ctx = d2i_SSL_SESSION_bio(in, NULL); + } + diff --git a/lang/ruby18-base/patches/patch-en b/lang/ruby18-base/patches/patch-en new file mode 100644 index 00000000000..ae78b555619 --- /dev/null +++ b/lang/ruby18-base/patches/patch-en @@ -0,0 +1,40 @@ +$NetBSD: patch-en,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r18172: suppress warnings. + +--- ext/openssl/ossl_x509req.c.orig 2007-06-08 15:02:04.000000000 +0000 ++++ ext/openssl/ossl_x509req.c +@@ -99,7 +99,7 @@ static VALUE + ossl_x509req_initialize(int argc, VALUE *argv, VALUE self) + { + BIO *in; +- X509_REQ *req; ++ X509_REQ *req, *x = DATA_PTR(self); + VALUE arg; + + if (rb_scan_args(argc, argv, "01", &arg) == 0) { +@@ -107,10 +107,12 @@ ossl_x509req_initialize(int argc, VALUE + } + arg = ossl_to_der_if_possible(arg); + in = ossl_obj2bio(arg); +- req = PEM_read_bio_X509_REQ(in, (X509_REQ **)&DATA_PTR(self), NULL, NULL); ++ req = PEM_read_bio_X509_REQ(in, &x, NULL, NULL); ++ DATA_PTR(self) = x; + if (!req) { +- BIO_reset(in); +- req = d2i_X509_REQ_bio(in, (X509_REQ **)&DATA_PTR(self)); ++ (void)BIO_reset(in); ++ req = d2i_X509_REQ_bio(in, &x); ++ DATA_PTR(self) = x; + } + BIO_free(in); + if (!req) ossl_raise(eX509ReqError, NULL); +@@ -171,7 +173,7 @@ ossl_x509req_to_der(VALUE self) + if ((len = i2d_X509_REQ(req, NULL)) <= 0) + ossl_raise(eX509CertError, NULL); + str = rb_str_new(0, len); +- p = RSTRING_PTR(str); ++ p = (unsigned char *)RSTRING_PTR(str); + if (i2d_X509_REQ(req, &p) <= 0) + ossl_raise(eX509ReqError, NULL); + ossl_str_adjust(str, p); diff --git a/lang/ruby18-base/patches/patch-eo b/lang/ruby18-base/patches/patch-eo new file mode 100644 index 00000000000..83620474517 --- /dev/null +++ b/lang/ruby18-base/patches/patch-eo @@ -0,0 +1,96 @@ +$NetBSD: patch-eo,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26209: rename {addr,name}info functions to ensure those are used on darwin. + +--- ext/socket/addrinfo.h.orig 2008-06-06 12:19:21.000000000 +0000 ++++ ext/socket/addrinfo.h +@@ -29,7 +29,6 @@ + + #ifndef ADDR_INFO_H + #define ADDR_INFO_H +-#ifndef HAVE_GETADDRINFO + + /* special compatibility hack */ + #undef EAI_ADDRFAMILY +@@ -61,17 +60,6 @@ + #undef NI_NUMERICSERV + #undef NI_DGRAM + +-#undef addrinfo +-#define addrinfo addrinfo__compat +-#undef getaddrinfo +-#define getaddrinfo getaddrinfo__compat +-#undef getnameinfo +-#define getnameinfo getnameinfo__compat +-#undef freehostent +-#define freehostent freehostent__compat +-#undef freeaddrinfo +-#define freeaddrinfo freeaddrinfo__compat +- + #ifndef __P + # ifdef HAVE_PROTOTYPES + # define __P(args) args +@@ -134,6 +122,7 @@ + #define NI_NUMERICSERV 0x00000008 + #define NI_DGRAM 0x00000010 + ++#ifndef HAVE_TYPE_STRUCT_ADDRINFO + struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ +@@ -144,6 +133,24 @@ struct addrinfo { + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ + }; ++#endif ++ ++#ifndef HAVE_GETADDRINFO ++#undef getaddrinfo ++#define getaddrinfo getaddrinfo__compat ++#endif ++#ifndef HAVE_GETNAMEINFO ++#undef getnameinfo ++#define getnameinfo getnameinfo__compat ++#endif ++#ifndef HAVE_FREEHOSTENT ++#undef freehostent ++#define freehostent freehostent__compat ++#endif ++#ifndef HAVE_FREEADDRINFO ++#undef freeaddrinfo ++#define freeaddrinfo freeaddrinfo__compat ++#endif + + extern int getaddrinfo __P(( + const char *hostname, const char *servname, +@@ -152,19 +159,20 @@ extern int getaddrinfo __P(( + + extern int getnameinfo __P(( + const struct sockaddr *sa, +- size_t salen, ++ socklen_t salen, + char *host, +- size_t hostlen, ++ socklen_t hostlen, + char *serv, +- size_t servlen, ++ socklen_t servlen, + int flags)); + + extern void freehostent __P((struct hostent *)); + extern void freeaddrinfo __P((struct addrinfo *)); +-#if defined __UCLIBC__ ++extern ++#ifdef GAI_STRERROR_CONST + const + #endif +-extern char *gai_strerror __P((int)); ++char *gai_strerror __P((int)); + + /* In case there is no definition of offsetof() provided - though any proper + Standard C system should have one. */ +@@ -174,4 +182,3 @@ Standard C system should have one. */ + #endif + + #endif +-#endif diff --git a/lang/ruby18-base/patches/patch-ep b/lang/ruby18-base/patches/patch-ep new file mode 100644 index 00000000000..835799ec744 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ep @@ -0,0 +1,11 @@ +$NetBSD: patch-ep,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26209: rename {addr,name}info functions to ensure those are used on darwin. + +--- ext/socket/depend.orig 2007-02-12 23:01:19.000000000 +0000 ++++ ext/socket/depend +@@ -1,3 +1,3 @@ +-socket.o : socket.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h sockport.h ++socket.o : socket.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/rubyio.h $(hdrdir)/rubysig.h addrinfo.h sockport.h + getnameinfo.o: getnameinfo.c $(topdir)/config.h addrinfo.h sockport.h + getaddrinfo.o: getaddrinfo.c $(topdir)/config.h addrinfo.h sockport.h diff --git a/lang/ruby18-base/patches/patch-eq b/lang/ruby18-base/patches/patch-eq new file mode 100644 index 00000000000..590b88097dd --- /dev/null +++ b/lang/ruby18-base/patches/patch-eq @@ -0,0 +1,43 @@ +$NetBSD: patch-eq,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26209: rename {addr,name}info functions to ensure those are used on darwin. + +--- ext/socket/getaddrinfo.c.orig 2009-02-25 06:06:08.000000000 +0000 ++++ ext/socket/getaddrinfo.c +@@ -87,10 +87,6 @@ + #include "addrinfo.h" + #include "sockport.h" + +-#if defined(__KAME__) && defined(INET6) +-# define FAITH +-#endif +- + #define SUCCESS 0 + #define ANY 0 + #define YES 1 +@@ -493,11 +489,7 @@ getaddrinfo(hostname, servname, hints, r + break; + #ifdef INET6 + case AF_INET6: +-#ifdef HAVE_ADDR8 +- pfx = ((struct in6_addr *)pton)->s6_addr8[0]; +-#else + pfx = ((struct in6_addr *)pton)->s6_addr[0]; +-#endif + if (pfx == 0 || pfx == 0xfe || pfx == 0xff) + pai->ai_flags &= ~AI_CANONNAME; + break; +@@ -673,9 +665,10 @@ get_addr(hostname, af, res, pai, port0) + + GET_AI(cur->ai_next, &afdl[N_INET6], ap, port); + in6 = &((struct sockaddr_in6 *)cur->ai_next->ai_addr)->sin6_addr; +- memcpy(&in6->s6_addr32[0], &faith_prefix, +- sizeof(struct in6_addr) - sizeof(struct in_addr)); +- memcpy(&in6->s6_addr32[3], ap, sizeof(struct in_addr)); ++ memcpy(&in6->s6_addr, &faith_prefix, ++ sizeof(struct in6_addr) - sizeof(struct in_addr)); ++ memcpy(&in6->s6_addr + sizeof(struct in_addr), ap, ++ sizeof(struct in_addr)); + } else + #endif /* FAITH */ + GET_AI(cur->ai_next, afd, ap, port); diff --git a/lang/ruby18-base/patches/patch-er b/lang/ruby18-base/patches/patch-er new file mode 100644 index 00000000000..57e6fa55330 --- /dev/null +++ b/lang/ruby18-base/patches/patch-er @@ -0,0 +1,21 @@ +$NetBSD: patch-er,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26209: rename {addr,name}info functions to ensure those are used on darwin. + +--- ext/socket/getnameinfo.c.orig 2007-07-22 05:33:47.000000000 +0000 ++++ ext/socket/getnameinfo.c +@@ -135,11 +135,11 @@ inet_ntop(af, addr, numaddr, numaddr_len + int + getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + const struct sockaddr *sa; +- size_t salen; ++ socklen_t salen; + char *host; +- size_t hostlen; ++ socklen_t hostlen; + char *serv; +- size_t servlen; ++ socklen_t servlen; + int flags; + { + struct afd *afd; diff --git a/lang/ruby18-base/patches/patch-es b/lang/ruby18-base/patches/patch-es new file mode 100644 index 00000000000..f0cc1bc5c9e --- /dev/null +++ b/lang/ruby18-base/patches/patch-es @@ -0,0 +1,15 @@ +$NetBSD: patch-es,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26140: (strio_getline): fix for "" as separator. + +--- ext/stringio/stringio.c.orig 2009-12-24 08:54:26.000000000 +0000 ++++ ext/stringio/stringio.c +@@ -933,7 +933,7 @@ strio_getline(argc, argv, ptr) + s = p; + while ((p = memchr(p, '\n', e - p)) && (p != e)) { + if (*++p == '\n') { +- e = p; ++ e = p + 1; + break; + } + } diff --git a/lang/ruby18-base/patches/patch-et b/lang/ruby18-base/patches/patch-et new file mode 100644 index 00000000000..747125508f1 --- /dev/null +++ b/lang/ruby18-base/patches/patch-et @@ -0,0 +1,12 @@ +$NetBSD: patch-et,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26424: fix circular requrie in drb. + +--- lib/drb/eq.rb.orig 2007-02-12 23:01:19.000000000 +0000 ++++ lib/drb/eq.rb +@@ -1,5 +1,3 @@ +-require 'drb/drb' +- + module DRb + class DRbObject + def ==(other) diff --git a/lang/ruby18-base/patches/patch-eu b/lang/ruby18-base/patches/patch-eu new file mode 100644 index 00000000000..835f5b821c4 --- /dev/null +++ b/lang/ruby18-base/patches/patch-eu @@ -0,0 +1,70 @@ +$NetBSD: patch-eu,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26783: (Open3#popen3): use Thread.detach instead of double-fork, so that + the exit status can be obtained. +* r26784: (Open3#popen3): ignore trap and at_exit also when exec failed. + [ruby-dev:30181] + +--- lib/open3.rb.orig 2009-12-14 04:28:06.000000000 +0000 ++++ lib/open3.rb +@@ -56,39 +56,40 @@ module Open3 + + pid = fork{ + # child +- fork{ +- # grandchild +- pw[1].close +- STDIN.reopen(pw[0]) +- pw[0].close +- +- pr[0].close +- STDOUT.reopen(pr[1]) +- pr[1].close +- +- pe[0].close +- STDERR.reopen(pe[1]) +- pe[1].close +- +- exec(*cmd) +- } +- exit!(0) ++ pw[1].close ++ STDIN.reopen(pw[0]) ++ pw[0].close ++ ++ pr[0].close ++ STDOUT.reopen(pr[1]) ++ pr[1].close ++ ++ pe[0].close ++ STDERR.reopen(pe[1]) ++ pe[1].close ++ ++ trap("EXIT", "DEFAULT") ++ at_exit {exit!(false)} ++ at_exit {raise($!)} ++ exec(*cmd) + } + + pw[0].close + pr[1].close + pe[1].close +- Process.waitpid(pid) ++ waiter = Process.detach(pid) + pi = [pw[1], pr[0], pe[0]] ++ result = pi + [waiter] + pw[1].sync = true + if defined? yield + begin +- return yield(*pi) ++ return yield(*result) + ensure + pi.each{|p| p.close unless p.closed?} ++ waiter.join + end + end +- pi ++ result + end + module_function :popen3 + end diff --git a/lang/ruby18-base/patches/patch-ev b/lang/ruby18-base/patches/patch-ev new file mode 100644 index 00000000000..54394c45d47 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ev @@ -0,0 +1,14 @@ +$NetBSD: patch-ev,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26583: don't use NOFOLLOW because /dev/urandom is a symlink in OpenSolaris. + +--- lib/securerandom.rb.orig 2007-10-10 14:37:42.000000000 +0000 ++++ lib/securerandom.rb +@@ -57,7 +57,6 @@ module SecureRandom + flags = File::RDONLY + flags |= File::NONBLOCK if defined? File::NONBLOCK + flags |= File::NOCTTY if defined? File::NOCTTY +- flags |= File::NOFOLLOW if defined? File::NOFOLLOW + begin + File.open("/dev/urandom", flags) {|f| + unless f.stat.chardev? diff --git a/lang/ruby18-base/patches/patch-ew b/lang/ruby18-base/patches/patch-ew new file mode 100644 index 00000000000..fd42dde9f92 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ew @@ -0,0 +1,16 @@ +$NetBSD: patch-ew,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r26583: don't use O_NOFOLLOW because /dev/urandom is a symlink in OpenSolaris. + +--- random.c.orig 2009-01-17 03:18:21.000000000 +0000 ++++ random.c +@@ -280,9 +280,6 @@ random_seed() + #ifdef O_NOCTTY + |O_NOCTTY + #endif +-#ifdef O_NOFOLLOW +- |O_NOFOLLOW +-#endif + )) >= 0) { + if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) { + read(fd, seed, seed_len); diff --git a/lang/ruby18-base/patches/patch-ex b/lang/ruby18-base/patches/patch-ex new file mode 100644 index 00000000000..61a9a0dad6e --- /dev/null +++ b/lang/ruby18-base/patches/patch-ex @@ -0,0 +1,18 @@ +$NetBSD: patch-ex,v 1.1 2010/09/10 03:29:01 taca Exp $ + +* r17429: (Net::POP3#set_all_uids): speed up. + +--- lib/net/pop.rb.orig 2009-02-03 05:35:56.000000000 +0000 ++++ lib/net/pop.rb +@@ -683,9 +683,8 @@ module Net + end + + def set_all_uids #:nodoc: internal use only (called from POPMail#uidl) +- command().uidl.each do |num, uid| +- @mails.find {|m| m.number == num }.uid = uid +- end ++ uidl = command().uidl ++ @mails.each {|m| m.uid = uidl[m.number] } + end + + def logging(msg) diff --git a/lang/ruby18-base/patches/patch-ga b/lang/ruby18-base/patches/patch-ga new file mode 100644 index 00000000000..2bd2fe9fd44 --- /dev/null +++ b/lang/ruby18-base/patches/patch-ga @@ -0,0 +1,14 @@ +$NetBSD: patch-ga,v 1.1 2010/09/10 03:29:01 taca Exp $ + +--- ext/curses/extconf.rb.orig 2007-11-15 10:51:07.000000000 +0000 ++++ ext/curses/extconf.rb +@@ -11,9 +11,6 @@ if have_header(*curses=%w"ncurses.h") an + make=true + elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "initscr") + make=true +-elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr") +- curses.unshift("varargs.h") +- make=true + elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr") + make=true + end diff --git a/lang/ruby18-base/patches/patch-gb b/lang/ruby18-base/patches/patch-gb new file mode 100644 index 00000000000..46de435175f --- /dev/null +++ b/lang/ruby18-base/patches/patch-gb @@ -0,0 +1,17 @@ +$NetBSD: patch-gb,v 1.1 2010/09/10 03:29:01 taca Exp $ + +--- ext/tk/sample/tkbiff.rb.orig 2007-02-12 23:01:19.000000000 +0000 ++++ ext/tk/sample/tkbiff.rb +@@ -12,7 +12,11 @@ if ARGV.length == 0 + if ENV['MAIL'] + $spool = ENV['MAIL'] + else +- $spool = '/var/spool/mail/' + ENV['USER'] ++ dir = '/var/mail' ++ unless FileTest.directory?(dir) ++ dir = '/var/spool/mail' ++ end ++ $spool = dir + '/' + ENV['USER'] + end + else + $spool = ARGV[0] |