From 7bab20a22b69de3239de475cbc72a5c39864f43c Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 11 Nov 2013 19:00:01 -0700 Subject: applying patch ruby-1.9.1.patch diff --git a/configure.in b/configure.in index c98a024..113d4e5 100644 --- a/configure.in +++ b/configure.in @@ -1462,11 +1462,11 @@ if test "$with_dln_a_out" != yes; then haiku*) case "$target_cpu" in powerpc*) : ${LDSHARED="ld -xms"} - DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o' + DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lroot glue-noinit.a init_term_dyn.o start_dyn.o' ;; i586*) : ${LDSHARED="ld -shared"} - DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lbe -lroot" + DLDFLAGS="$DLDFLAGS -L/boot/system/develop/lib -lroot -L/boot/home/config/develop/lib" ;; esac : ${LIBPATHENV=LIBRARY_PATH} diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h index 0998837..814ceef 100644 --- a/ext/nkf/nkf-utf8/nkf.h +++ b/ext/nkf/nkf-utf8/nkf.h @@ -164,6 +164,11 @@ void setbinmode(FILE *fp) # ifndef HAVE_LOCALE_H # define HAVE_LOCALE_H # endif +#elif defined(__HAIKU__) +# undef HAVE_LANGINFO_H +# ifndef HAVE_LOCALE_H +# define HAVE_LOCALE_H +# endif #else # ifndef HAVE_LANGINFO_H # define HAVE_LANGINFO_H diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index a3b612b..d900ef3 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary) #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= 0x10000000L +#define STACK _STACK +#endif + +/* * String to HEXString conversion */ int string2hex(const unsigned char *, int, char **, int *); diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index bc5067f..5ec5b06 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -1,5 +1,5 @@ /* - * $Id: ossl_config.c 18971 2008-08-31 03:36:09Z nobu $ + * $Id: ossl_config.c 27460 2010-04-23 14:28:56Z akr $ * 'OpenSSL for Ruby' project * Copyright (C) 2001-2002 Michal Rokos * All rights reserved. @@ -33,8 +33,8 @@ VALUE cConfig; VALUE eConfigError; -/* - * Public +/* + * Public */ static CONF *parse_config(VALUE, CONF*); @@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *argv, VALUE self) _CONF_new_data(conf); } #endif - + return self; } @@ -187,11 +187,30 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value) OPENSSL_free(cv); ossl_raise(eConfigError, "_CONF_add_string failure"); } - + return value; #endif } +static void +rb_ossl_config_modify_check(VALUE config) +{ + if (OBJ_FROZEN(config)) rb_error_frozen("OpenSSL::Config"); + if (!OBJ_UNTRUSTED(config) && rb_safe_level() >= 4) + rb_raise(rb_eSecurityError, "Insecure: can't modify OpenSSL config"); +} + +#if !defined(OSSL_NO_CONF_API) +static VALUE +ossl_config_add_value_m(VALUE self, VALUE section, VALUE name, VALUE value) +{ + rb_ossl_config_modify_check(self); + return ossl_config_add_value(self, section, name, value); +} +#else +#define ossl_config_add_value_m rb_f_notimplement +#endif + static VALUE ossl_config_get_value(VALUE self, VALUE section, VALUE name) { @@ -214,7 +233,7 @@ static VALUE ossl_config_get_value_old(int argc, VALUE *argv, VALUE self) { VALUE section, name; - + rb_scan_args(argc, argv, "11", §ion, &name); /* support conf.value(nil, "HOME") -> conf.get_value("", "HOME") */ @@ -247,6 +266,7 @@ ossl_config_set_section(VALUE self, VALUE section, VALUE hash) { VALUE arg[2]; + rb_ossl_config_modify_check(self); arg[0] = self; arg[1] = section; rb_block_call(hash, rb_intern("each"), 0, 0, set_conf_section_i, (VALUE)arg); @@ -278,7 +298,7 @@ ossl_config_get_section(VALUE self, VALUE section) return hash; } for (i=0; iname), rb_str_new2(entry->value)); } @@ -292,15 +312,16 @@ ossl_config_get_section_old(VALUE self, VALUE section) return ossl_config_get_section(self, section); } -#ifdef IMPLEMENT_LHASH_DOALL_ARG_FN +#if defined(IMPLEMENT_LHASH_DOALL_ARG_FN) && defined(LHASH_OF) static void -get_conf_section(CONF_VALUE *cv, VALUE ary) +get_conf_section_doall_arg(CONF_VALUE *cv, void *tmp) { + VALUE ary = (VALUE)tmp; if(cv->name) return; rb_ary_push(ary, rb_str_new2(cv->section)); } -static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE); +static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE, void) static VALUE ossl_config_get_sections(VALUE self) @@ -310,14 +331,16 @@ ossl_config_get_sections(VALUE self) GetConfig(self, conf); ary = rb_ary_new(); - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary); + lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(get_conf_section), + (void*)ary); return ary; } static void -dump_conf_value(CONF_VALUE *cv, VALUE str) +dump_conf_value_doall_arg(CONF_VALUE *cv, void *tmp) { + VALUE str = (VALUE)tmp; STACK_OF(CONF_VALUE) *sk; CONF_VALUE *v; int i, num; @@ -338,7 +361,7 @@ dump_conf_value(CONF_VALUE *cv, VALUE str) rb_str_cat2(str, "\n"); } -static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE*, VALUE); +static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE, void) static VALUE dump_conf(CONF *conf) @@ -346,7 +369,8 @@ dump_conf(CONF *conf) VALUE str; str = rb_str_new(0, 0); - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str); + lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), + (void*)str); return str; } @@ -362,7 +386,7 @@ ossl_config_to_s(VALUE self) } static void -each_conf_value(CONF_VALUE *cv, void* dummy) +each_conf_value_doall_arg(CONF_VALUE *cv, void *dummy) { STACK_OF(CONF_VALUE) *sk; CONF_VALUE *v; @@ -382,7 +406,7 @@ each_conf_value(CONF_VALUE *cv, void* dummy) } } -static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*); +static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE, void *) static VALUE ossl_config_each(VALUE self) @@ -392,7 +416,8 @@ ossl_config_each(VALUE self) RETURN_ENUMERATOR(self, 0, 0); GetConfig(self, conf); - lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL); + lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(each_conf_value), + (void*)NULL); return self; } @@ -456,7 +481,7 @@ Init_ossl_config() rb_define_method(cConfig, "initialize", ossl_config_initialize, -1); rb_define_method(cConfig, "get_value", ossl_config_get_value, 2); rb_define_method(cConfig, "value", ossl_config_get_value_old, -1); - rb_define_method(cConfig, "add_value", ossl_config_add_value, 3); + rb_define_method(cConfig, "add_value", ossl_config_add_value_m, 3); rb_define_method(cConfig, "[]", ossl_config_get_section, 1); rb_define_method(cConfig, "section", ossl_config_get_section_old, 1); rb_define_method(cConfig, "[]=", ossl_config_set_section, 2); diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index f7cd156..644e91a 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -572,12 +572,11 @@ ossl_pkcs7_add_certificate(VALUE self, VALUE cert) 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); @@ -585,17 +584,38 @@ pkcs7_get_certs_or_crls(VALUE self, int want_certs) 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 @@ -610,7 +630,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary) 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); @@ -620,7 +640,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary) static VALUE ossl_pkcs7_get_certificates(VALUE self) { - return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1)); + return ossl_x509_sk2ary(pkcs7_get_certs(self)); } static VALUE @@ -650,7 +670,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary) 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); @@ -660,7 +680,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary) 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 diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index c278edc..1167627 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1195,10 +1195,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)); } diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c index b236e4d..4d0848f 100644 --- a/ext/openssl/ossl_ssl_session.c +++ b/ext/openssl/ossl_ssl_session.c @@ -72,6 +72,16 @@ static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1) return self; } +#if HAVE_SSL_SESSION_CMP == 0 +int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b) +{ + if (a->ssl_version != b->ssl_version || + a->session_id_length != b->session_id_length) + return 1; + return memcmp(a->session_id,b-> session_id, a->session_id_length); +} +#endif + /* * call-seq: * session1 == session2 -> boolean diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c index 248e02a..2634cd9 100644 --- a/ext/openssl/ossl_x509attr.c +++ b/ext/openssl/ossl_x509attr.c @@ -218,8 +218,9 @@ ossl_x509attr_get_value(VALUE self) ossl_str_adjust(str, p); } else{ - length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL, - i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0); + length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, + (unsigned char **) NULL, i2d_ASN1_TYPE, + V_ASN1_SET, V_ASN1_UNIVERSAL, 0); str = rb_str_new(0, length); p = (unsigned char *)RSTRING_PTR(str); i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p, diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index 3896b6e..c5123ae 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -264,7 +264,7 @@ ossl_x509crl_get_revoked(VALUE self) VALUE ary, revoked; 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(); @@ -272,7 +272,7 @@ ossl_x509crl_get_revoked(VALUE self) ary = rb_ary_new2(num); for(i=0; i Date: Mon, 11 Nov 2013 20:00:13 -0700 Subject: Use gcc for linking modules diff --git a/configure.in b/configure.in index 113d4e5..9bfbfb3 100644 --- a/configure.in +++ b/configure.in @@ -1465,7 +1465,10 @@ if test "$with_dln_a_out" != yes; then DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lroot glue-noinit.a init_term_dyn.o start_dyn.o' ;; i586*) - : ${LDSHARED="ld -shared"} + : ${LDSHARED="${CC} -shared"} + if test "$rb_cv_binary_elf" = yes; then + LDFLAGS="$LDFLAGS -Wl,-export-dynamic" + fi DLDFLAGS="$DLDFLAGS -L/boot/system/develop/lib -lroot -L/boot/home/config/develop/lib" ;; esac -- 1.8.3.4 From c43e8e49d47f7778314d9a723f9430fa4686f7ba Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 11 Nov 2013 23:13:59 -0700 Subject: Add soname flags for libruby.so diff --git a/configure.in b/configure.in index 9bfbfb3..611b586 100644 --- a/configure.in +++ b/configure.in @@ -1777,6 +1777,10 @@ if test "$enable_shared" = 'yes'; then ;; esac ;; + haiku*) + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)' + LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' + ;; darwin*) LIBRUBY_SO='lib$(RUBY_SO_NAME).$(MAJOR).$(MINOR).$(TEENY).dylib' LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace' -- 1.8.3.4 From c6983e184282d3ffbb88c095ff13d1913c18a3f8 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 18 Dec 2013 21:52:24 -0500 Subject: Add case for x86_64. diff --git a/configure.in b/configure.in index 611b586..01f0bb0 100644 --- a/configure.in +++ b/configure.in @@ -1464,7 +1464,7 @@ if test "$with_dln_a_out" != yes; then : ${LDSHARED="ld -xms"} DLDFLAGS="$DLDFLAGS "'-export Init_$(TARGET) -lroot glue-noinit.a init_term_dyn.o start_dyn.o' ;; - i586*) + i586*|x86_64*) : ${LDSHARED="${CC} -shared"} if test "$rb_cv_binary_elf" = yes; then LDFLAGS="$LDFLAGS -Wl,-export-dynamic" -- 1.8.3.4