Project

General

Profile

Feature #5787

OpenSSL::X509::Name#to_a Improvement (Patch Attached)

Added by reaperhulk (Paul Kehrer) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:<unknown>]

Description

In ruby 1.8/1.9/trunk the OpenSSL::X509::Name#to_a method attempts to map OIDs to short names. If an OID has no associated shortname this causes it to return the string "UNDEF". It would be much more useful if it returned the OID in this situation. I've written a patch and test for the patch and attached it to this bug in unified diff format.

You can also see the change at https://github.com/reaperhulk/ruby/commit/ff74d5c496fc6e71daa793c5baf7a24b0f2e7f98

name-fix.diff (2.7 KB) name-fix.diff reaperhulk (Paul Kehrer), 12/22/2011 03:30 AM
name-fix-v2.diff (2.6 KB) name-fix-v2.diff reaperhulk (Paul Kehrer), 12/22/2011 05:13 AM

Associated revisions

Revision 34481
Added by emboss almost 6 years ago

  • ext/openssl/ossl_x509name.c: Use the numerical representation of
    unrecognized OIDs instead of the sn "UNDEF".

  • test/openssl/test_x509name.rb: Add tests for the fixed behavior.

Patch provided by Paul Kehrer, thanḱ you!
[Feature #5787]

Revision 34481
Added by emboss almost 6 years ago

  • ext/openssl/ossl_x509name.c: Use the numerical representation of
    unrecognized OIDs instead of the sn "UNDEF".

  • test/openssl/test_x509name.rb: Add tests for the fixed behavior.

Patch provided by Paul Kehrer, thanḱ you!
[Feature #5787]

Revision 34481
Added by emboss almost 6 years ago

  • ext/openssl/ossl_x509name.c: Use the numerical representation of
    unrecognized OIDs instead of the sn "UNDEF".

  • test/openssl/test_x509name.rb: Add tests for the fixed behavior.

Patch provided by Paul Kehrer, thanḱ you!
[Feature #5787]

Revision 34481
Added by emboss almost 6 years ago

  • ext/openssl/ossl_x509name.c: Use the numerical representation of
    unrecognized OIDs instead of the sn "UNDEF".

  • test/openssl/test_x509name.rb: Add tests for the fixed behavior.

Patch provided by Paul Kehrer, thanḱ you!
[Feature #5787]

History

#1 Updated by reaperhulk (Paul Kehrer) almost 6 years ago

Updated patch to avoid a probable memory leak. I don't do much in C so if I still have a mistake please let me know! The github diff is at https://github.com/reaperhulk/ruby/compare/trunk

#2 [ruby-core:41769] Updated by MartinBosslet (Martin Bosslet) almost 6 years ago

  • Status changed from Open to Assigned
  • Assignee set to MartinBosslet (Martin Bosslet)
  • Target version set to 2.0.0

That's a good idea, Paul, thanks. It's also in line with RFC 4514 (the former 2253).
I'll have to check whether this causes problems when again parsing such a string
representation and probably fix that, too. But once that's done I'm going to apply
your patch.

#3 Updated by reaperhulk (Paul Kehrer) almost 6 years ago

Great news, let me know if there's anything I can do to help.

#4 Updated by Anonymous almost 6 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34481.
Paul, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/openssl/ossl_x509name.c: Use the numerical representation of
    unrecognized OIDs instead of the sn "UNDEF".

  • test/openssl/test_x509name.rb: Add tests for the fixed behavior.

Patch provided by Paul Kehrer, thanḱ you!
[Feature #5787]

Also available in: Atom PDF