ruby-changes:19203
From: naruse <ko1@a...>
Date: Wed, 6 Apr 2011 11:44:54 +0900 (JST)
Subject: [ruby-changes:19203] Ruby:r31242 (trunk): * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize):
naruse 2011-04-06 11:44:46 +0900 (Wed, 06 Apr 2011) New Revision: 31242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31242 Log: * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize): pop pushed error after each try of reading. fixes #4550 Modified files: trunk/ChangeLog trunk/ext/openssl/ossl_pkey_rsa.c Index: ChangeLog =================================================================== --- ChangeLog (revision 31241) +++ ChangeLog (revision 31242) @@ -1,3 +1,8 @@ +Wed Apr 6 11:36:44 2011 NARUSE, Yui <naruse@r...> + + * ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize): + pop pushed error after each try of reading. fixes #4550 + Tue Apr 5 20:33:43 2011 Tanaka Akira <akr@f...> * include/ruby/encoding.h: parenthesize macro arguments. Index: ext/openssl/ossl_pkey_rsa.c =================================================================== --- ext/openssl/ossl_pkey_rsa.c (revision 31241) +++ ext/openssl/ossl_pkey_rsa.c (revision 31242) @@ -158,26 +158,34 @@ rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd); if (!rsa) { (void)BIO_reset(in); + (void)ERR_get_error(); rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL); } if (!rsa) { (void)BIO_reset(in); + (void)ERR_get_error(); rsa = PEM_read_bio_RSA_PUBKEY(in, NULL, NULL, NULL); } if (!rsa) { (void)BIO_reset(in); + (void)ERR_get_error(); rsa = d2i_RSAPrivateKey_bio(in, NULL); } if (!rsa) { (void)BIO_reset(in); + (void)ERR_get_error(); rsa = d2i_RSAPublicKey_bio(in, NULL); } if (!rsa) { (void)BIO_reset(in); + (void)ERR_get_error(); rsa = d2i_RSA_PUBKEY_bio(in, NULL); } BIO_free(in); - if (!rsa) ossl_raise(eRSAError, "Neither PUB key nor PRIV key:"); + if (!rsa) { + (void)ERR_get_error(); + ossl_raise(eRSAError, "Neither PUB key nor PRIV key:"); + } } if (!EVP_PKEY_assign_RSA(pkey, rsa)) { RSA_free(rsa); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/