aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-03-10 17:10:01 +0000
committerlloyd <[email protected]>2007-03-10 17:10:01 +0000
commit3dce98940d95ab72e9fab7be9f6a11c9fe86d265 (patch)
tree92d771ac5e341a922804ed275f356f1c9108e15e
parente07cb7a4bd86420aef4d0d7e41ba033a08f71c73 (diff)
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.
-rw-r--r--src/oids.cpp12
1 files 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);
+ }
}
/*************************************************