From 3dce98940d95ab72e9fab7be9f6a11c9fe86d265 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 10 Mar 2007 17:10:01 +0000 Subject: Catch exceptions in OIDS::lookup and rethrow a Lookup_Error. Attempting to encode a public key that did not have an OID for its key format resulted in a very confusing exception (thrown from char2digit) that was completely meaningless to anyone. --- src/oids.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/oids.cpp b/src/oids.cpp index ee0cc6c0b..141b55707 100644 --- a/src/oids.cpp +++ b/src/oids.cpp @@ -40,9 +40,17 @@ std::string lookup(const OID& oid) OID lookup(const std::string& name) { std::string value = global_config().get("str2oid", name); - if(value == "") + if(value != "") + return OID(value); + + try + { return OID(name); - return OID(value); + } + catch(Exception) + { + throw Lookup_Error("No object identifier found for " + name); + } } /************************************************* -- cgit v1.2.3