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

« back to all changes in this revision

Viewing changes to ext/openssl/ossl_x509crl.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_x509crl.c 18168 2008-07-22 15:34:23Z nobu $
 
2
 * $Id: ossl_x509crl.c 27440 2010-04-22 08:21:01Z 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.
66
66
    tmp = crl ? X509_CRL_dup(crl) : X509_CRL_new();
67
67
    if(!tmp) ossl_raise(eX509CRLError, NULL);
68
68
    WrapX509CRL(cX509CRL, obj, tmp);
69
 
        
 
69
 
70
70
    return obj;
71
71
}
72
72
 
73
73
/*
74
74
 * PRIVATE
75
75
 */
76
 
static VALUE 
 
76
static VALUE
77
77
ossl_x509crl_alloc(VALUE klass)
78
78
{
79
79
    X509_CRL *crl;
87
87
    return obj;
88
88
}
89
89
 
90
 
static VALUE 
 
90
static VALUE
91
91
ossl_x509crl_initialize(int argc, VALUE *argv, VALUE self)
92
92
{
93
93
    BIO *in;
116
116
ossl_x509crl_copy(VALUE self, VALUE other)
117
117
{
118
118
    X509_CRL *a, *b, *crl;
119
 
        
 
119
 
120
120
    rb_check_frozen(self);
121
121
    if (self == other) return self;
122
122
    GetX509CRL(self, a);
130
130
    return self;
131
131
}
132
132
 
133
 
static VALUE 
 
133
static VALUE
134
134
ossl_x509crl_get_version(VALUE self)
135
135
{
136
136
    X509_CRL *crl;
142
142
    return LONG2NUM(ver);
143
143
}
144
144
 
145
 
static VALUE 
 
145
static VALUE
146
146
ossl_x509crl_set_version(VALUE self, VALUE version)
147
147
{
148
148
    X509_CRL *crl;
159
159
    return version;
160
160
}
161
161
 
162
 
static VALUE 
 
162
static VALUE
163
163
ossl_x509crl_get_signature_algorithm(VALUE self)
164
164
{
165
165
    X509_CRL *crl;
181
181
    return str;
182
182
}
183
183
 
184
 
static VALUE 
 
184
static VALUE
185
185
ossl_x509crl_get_issuer(VALUE self)
186
186
{
187
187
    X509_CRL *crl;
191
191
    return ossl_x509name_new(X509_CRL_get_issuer(crl)); /* NO DUP - don't free */
192
192
}
193
193
 
194
 
static VALUE 
 
194
static VALUE
195
195
ossl_x509crl_set_issuer(VALUE self, VALUE issuer)
196
196
{
197
197
    X509_CRL *crl;
204
204
    return issuer;
205
205
}
206
206
 
207
 
static VALUE 
 
207
static VALUE
208
208
ossl_x509crl_get_last_update(VALUE self)
209
209
{
210
210
    X509_CRL *crl;
214
214
    return asn1time_to_time(X509_CRL_get_lastUpdate(crl));
215
215
}
216
216
 
217
 
static VALUE 
 
217
static VALUE
218
218
ossl_x509crl_set_last_update(VALUE self, VALUE time)
219
219
{
220
220
    X509_CRL *crl;
229
229
    return time;
230
230
}
231
231
 
232
 
static VALUE 
 
232
static VALUE
233
233
ossl_x509crl_get_next_update(VALUE self)
234
234
{
235
235
    X509_CRL *crl;
239
239
    return asn1time_to_time(X509_CRL_get_nextUpdate(crl));
240
240
}
241
241
 
242
 
static VALUE 
 
242
static VALUE
243
243
ossl_x509crl_set_next_update(VALUE self, VALUE time)
244
244
{
245
245
    X509_CRL *crl;
264
264
    VALUE ary, revoked;
265
265
 
266
266
    GetX509CRL(self, crl);
267
 
    num = sk_X509_CRL_num(X509_CRL_get_REVOKED(crl));
 
267
    num = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl));
268
268
    if (num < 0) {
269
269
        OSSL_Debug("num < 0???");
270
270
        return rb_ary_new();
272
272
    ary = rb_ary_new2(num);
273
273
    for(i=0; i<num; i++) {
274
274
        /* NO DUP - don't free! */
275
 
        rev = (X509_REVOKED *)sk_X509_CRL_value(X509_CRL_get_REVOKED(crl), i);
 
275
        rev = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i);
276
276
        revoked = ossl_x509revoked_new(rev);
277
277
        rb_ary_push(ary, revoked);
278
278
    }
280
280
    return ary;
281
281
}
282
282
 
283
 
static VALUE 
 
283
static VALUE
284
284
ossl_x509crl_set_revoked(VALUE self, VALUE ary)
285
285
{
286
286
    X509_CRL *crl;
306
306
    return ary;
307
307
}
308
308
 
309
 
static VALUE 
 
309
static VALUE
310
310
ossl_x509crl_add_revoked(VALUE self, VALUE revoked)
311
311
{
312
312
    X509_CRL *crl;
322
322
    return revoked;
323
323
}
324
324
 
325
 
static VALUE 
 
325
static VALUE
326
326
ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest)
327
327
{
328
328
    X509_CRL *crl;
339
339
    return self;
340
340
}
341
341
 
342
 
static VALUE 
 
342
static VALUE
343
343
ossl_x509crl_verify(VALUE self, VALUE key)
344
344
{
345
345
    X509_CRL *crl;
356
356
    return Qfalse;
357
357
}
358
358
 
359
 
static VALUE 
 
359
static VALUE
360
360
ossl_x509crl_to_der(VALUE self)
361
361
{
362
362
    X509_CRL *crl;
379
379
    return str;
380
380
}
381
381
 
382
 
static VALUE 
 
382
static VALUE
383
383
ossl_x509crl_to_pem(VALUE self)
384
384
{
385
385
    X509_CRL *crl;
402
402
    return str;
403
403
}
404
404
 
405
 
static VALUE 
 
405
static VALUE
406
406
ossl_x509crl_to_text(VALUE self)
407
407
{
408
408
    X509_CRL *crl;
421
421
    BIO_get_mem_ptr(out, &buf);
422
422
    str = rb_str_new(buf->data, buf->length);
423
423
    BIO_free(out);
424
 
        
 
424
 
425
425
    return str;
426
426
}
427
427
 
428
428
/*
429
429
 * Gets X509v3 extensions as array of X509Ext objects
430
430
 */
431
 
static VALUE 
 
431
static VALUE
432
432
ossl_x509crl_get_extensions(VALUE self)
433
433
{
434
434
    X509_CRL *crl;
454
454
/*
455
455
 * Sets X509_EXTENSIONs
456
456
 */
457
 
static VALUE 
 
457
static VALUE
458
458
ossl_x509crl_set_extensions(VALUE self, VALUE ary)
459
459
{
460
460
    X509_CRL *crl;
461
461
    X509_EXTENSION *ext;
462
462
    int i;
463
 
        
 
463
 
464
464
    Check_Type(ary, T_ARRAY);
465
465
    /* All ary members should be X509 Extensions */
466
466
    for (i=0; i<RARRAY_LEN(ary); i++) {
481
481
    return ary;
482
482
}
483
483
 
484
 
static VALUE 
 
484
static VALUE
485
485
ossl_x509crl_add_extension(VALUE self, VALUE extension)
486
486
{
487
487
    X509_CRL *crl;
501
501
/*
502
502
 * INIT
503
503
 */
504
 
void 
 
504
void
505
505
Init_ossl_x509crl()
506
506
{
507
507
    eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError);
508
508
 
509
509
    cX509CRL = rb_define_class_under(mX509, "CRL", rb_cObject);
510
 
        
 
510
 
511
511
    rb_define_alloc_func(cX509CRL, ossl_x509crl_alloc);
512
512
    rb_define_method(cX509CRL, "initialize", ossl_x509crl_initialize, -1);
513
513
    rb_define_copy_func(cX509CRL, ossl_x509crl_copy);
514
 
    
 
514
 
515
515
    rb_define_method(cX509CRL, "version", ossl_x509crl_get_version, 0);
516
516
    rb_define_method(cX509CRL, "version=", ossl_x509crl_set_version, 1);
517
517
    rb_define_method(cX509CRL, "signature_algorithm", ossl_x509crl_get_signature_algorithm, 0);