summaryrefslogtreecommitdiff
path: root/lang/ruby18-base/patches/patch-dj
blob: 3b3cf7a1fc96c5059a34968582f92c694a84d5d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$NetBSD: patch-dj,v 1.2 2009/02/20 12:32:26 taca Exp $

Online Certificate Status Protocol's verify method fix from Ruby's
repository: revision 22440.

--- ext/openssl/ossl_ocsp.c.orig	2007-06-09 00:02:04.000000000 +0900
+++ ext/openssl/ossl_ocsp.c
@@ -589,22 +589,22 @@ ossl_ocspbres_sign(int argc, VALUE *argv
 static VALUE
 ossl_ocspbres_verify(int argc, VALUE *argv, VALUE self)
 {
-    VALUE certs, store, flags;
+    VALUE certs, store, flags, result;
     OCSP_BASICRESP *bs;
     STACK_OF(X509) *x509s;
     X509_STORE *x509st;
-    int flg, result;
+    int flg;
 
     rb_scan_args(argc, argv, "21", &certs, &store, &flags);
     x509st = GetX509StorePtr(store);
     flg = NIL_P(flags) ? 0 : INT2NUM(flags);
     x509s = ossl_x509_ary2sk(certs);
     GetOCSPBasicRes(self, bs);
-    result = OCSP_basic_verify(bs, x509s, x509st, flg);
+    result = OCSP_basic_verify(bs, x509s, x509st, flg) > 0 ? Qtrue : Qfalse;
     sk_X509_pop_free(x509s, X509_free);
     if(!result) rb_warn("%s", ERR_error_string(ERR_peek_error(), NULL));
 
-    return result ? Qtrue : Qfalse;
+    return result;
 }
 
 /*