summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_x509name.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 01:54:40 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 01:54:40 +0000
commitd89b8333c5bf7b319f0ab774951dfa53993ebdc1 (patch)
tree65e5b11627653d6cc3c5fe49f62b5b1c6899fdd5 /ext/openssl/ossl_x509name.c
parent9d24a847b8e6ecd92e735601a1102270b9507fbb (diff)
* ext/openssl/ossl_digest.c (ossl_digest_initialize): [ruby-dev:25198]
* lib/cgi/session.rb (CGI::Session::initialize): generate new session if given session_id does not exist. [ruby-list:40368] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_x509name.c')
-rw-r--r--ext/openssl/ossl_x509name.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index b198157..4a077af 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -119,19 +119,22 @@ ossl_x509name_initialize(int argc, VALUE *argv, VALUE self)
if (rb_scan_args(argc, argv, "02", &arg, &template) == 0) {
return self;
}
- else if (rb_obj_is_kind_of(arg, rb_cArray) == Qtrue){
- VALUE args;
- if(NIL_P(template)) template = OBJECT_TYPE_TEMPLATE;
- args = rb_ary_new3(2, self, template);
- rb_iterate(rb_each, arg, ossl_x509name_init_i, args);
- }
- else{
- unsigned char *p;
- VALUE str = ossl_to_der_if_possible(arg);
- StringValue(str);
- p = RSTRING(str)->ptr;
- if(!d2i_X509_NAME((X509_NAME**)&DATA_PTR(self), &p, RSTRING(str)->len)){
- ossl_raise(eX509NameError, NULL);
+ else {
+ VALUE tmp = rb_check_array_type(arg);
+ if (!NIL_P(tmp)) {
+ VALUE args;
+ if(NIL_P(template)) template = OBJECT_TYPE_TEMPLATE;
+ args = rb_ary_new3(2, self, template);
+ rb_iterate(rb_each, tmp, ossl_x509name_init_i, args);
+ }
+ else{
+ unsigned char *p;
+ VALUE str = ossl_to_der_if_possible(arg);
+ StringValue(str);
+ p = RSTRING(str)->ptr;
+ if(!d2i_X509_NAME((X509_NAME**)&DATA_PTR(self), &p, RSTRING(str)->len)){
+ ossl_raise(eX509NameError, NULL);
+ }
}
}
@@ -182,13 +185,13 @@ ossl_x509name_to_a(VALUE self)
const char *short_name;
VALUE ary, ret;
- GetX509Name(self, name);
entries = X509_NAME_entry_count(name);
if (entries < 0) {
OSSL_Debug("name entries < 0!");
return rb_ary_new();
}
ret = rb_ary_new2(entries);
+ GetX509Name(self, name);
for (i=0; i<entries; i++) {
if (!(entry = X509_NAME_get_entry(name, i))) {
ossl_raise(eX509NameError, NULL);