~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/openssl/ossl_x509store.c

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: ossl_x509store.c 19080 2008-09-03 08:00:05Z ko1 $
 
2
 * $Id: ossl_x509store.c 27437 2010-04-22 08:04:13Z nobu $
3
3
 * 'OpenSSL for Ruby' project
4
4
 * Copyright (C) 2001-2002  Michal Rokos <m.rokos@sh.cvut.cz>
5
5
 * All rights reserved.
54
54
/*
55
55
 * Public functions
56
56
 */
57
 
VALUE 
 
57
VALUE
58
58
ossl_x509store_new(X509_STORE *store)
59
59
{
60
60
    VALUE obj;
76
76
 
77
77
X509_STORE *
78
78
DupX509StorePtr(VALUE obj)
79
 
{   
 
79
{
80
80
    X509_STORE *store;
81
81
 
82
82
    SafeGetX509Store(obj, store);
83
83
    CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE);
84
 
    
 
84
 
85
85
    return store;
86
86
}
87
87
 
88
88
/*
89
89
 * Private functions
90
90
 */
91
 
static VALUE 
 
91
static VALUE
92
92
ossl_x509store_alloc(VALUE klass)
93
93
{
94
94
    X509_STORE *store;
130
130
 
131
131
/* BUG: This method takes any number of arguments but appears to ignore them. */
132
132
    GetX509Store(self, store);
 
133
    store->ex_data.sk = NULL;
133
134
    X509_STORE_set_verify_cb_func(store, ossl_verify_cb);
134
135
    ossl_x509store_set_vfy_cb(self, Qnil);
135
136
 
170
171
#if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
171
172
    X509_STORE *store;
172
173
    long p = NUM2LONG(purpose);
173
 
    
 
174
 
174
175
    GetX509Store(self, store);
175
176
    X509_STORE_set_purpose(store, p);
176
177
#else
196
197
    return trust;
197
198
}
198
199
 
199
 
static VALUE 
 
200
static VALUE
200
201
ossl_x509store_set_time(VALUE self, VALUE time)
201
202
{
202
203
    rb_iv_set(self, "@time", time);
203
204
    return time;
204
205
}
205
206
 
206
 
static VALUE 
 
207
static VALUE
207
208
ossl_x509store_add_file(VALUE self, VALUE file)
208
209
{
209
210
    X509_STORE *store;
211
212
    char *path = NULL;
212
213
 
213
214
    if(file != Qnil){
214
 
        Check_SafeStr(file);
 
215
        SafeStringValue(file);
215
216
        path = RSTRING_PTR(file);
216
217
    }
217
218
    GetX509Store(self, store);
224
225
    return self;
225
226
}
226
227
 
227
 
static VALUE 
 
228
static VALUE
228
229
ossl_x509store_add_path(VALUE self, VALUE dir)
229
230
{
230
231
    X509_STORE *store;
232
233
    char *path = NULL;
233
234
 
234
235
    if(dir != Qnil){
235
 
        Check_SafeStr(dir);
 
236
        SafeStringValue(dir);
236
237
        path = RSTRING_PTR(dir);
237
238
    }
238
239
    GetX509Store(self, store);
292
293
static VALUE ossl_x509stctx_get_err_string(VALUE);
293
294
static VALUE ossl_x509stctx_get_chain(VALUE);
294
295
 
295
 
static VALUE 
 
296
static VALUE
296
297
ossl_x509store_verify(int argc, VALUE *argv, VALUE self)
297
298
{
298
299
    VALUE cert, chain;
349
350
    X509_STORE_CTX_free(ctx);
350
351
}
351
352
 
352
 
static VALUE 
 
353
static VALUE
353
354
ossl_x509stctx_alloc(VALUE klass)
354
355
{
355
356
    X509_STORE_CTX *ctx;
441
442
    return ary;
442
443
}
443
444
 
444
 
static VALUE 
 
445
static VALUE
445
446
ossl_x509stctx_get_err(VALUE self)
446
447
{
447
448
    X509_STORE_CTX *ctx;
462
463
    return err;
463
464
}
464
465
 
465
 
static VALUE 
 
466
static VALUE
466
467
ossl_x509stctx_get_err_string(VALUE self)
467
468
{
468
469
    X509_STORE_CTX *ctx;
474
475
    return rb_str_new2(X509_verify_cert_error_string(err));
475
476
}
476
477
 
477
 
static VALUE 
 
478
static VALUE
478
479
ossl_x509stctx_get_err_depth(VALUE self)
479
480
{
480
481
    X509_STORE_CTX *ctx;
484
485
    return INT2FIX(X509_STORE_CTX_get_error_depth(ctx));
485
486
}
486
487
 
487
 
static VALUE 
 
488
static VALUE
488
489
ossl_x509stctx_get_curr_cert(VALUE self)
489
490
{
490
491
    X509_STORE_CTX *ctx;
576
577
/*
577
578
 * INIT
578
579
 */
579
 
void 
 
580
void
580
581
Init_ossl_x509store()
581
582
{
582
583
    VALUE x509stctx;