More useful OID display for the case when the exact OID is not known

git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@239 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-06-10 00:01:53 +00:00
parent 9a1a0ccdce
commit 56e9027ec8
2 changed files with 16 additions and 1 deletions

View File

@ -172,7 +172,18 @@ def decode_oid(value):
if len(oidCache) == 0:
loadOids()
return " %s (%s)" % (str_rep, oidCache.get(str_rep, ("No description available",))[0])
description = oidCache.get(str_rep, None)
if description is None:
steps = [oid[:e] for e in range(len(oid)-1, 0, -1)]
for step in steps:
new_str_rep = ".".join([str(a) for a in step])
if oidCache.has_key(new_str_rep):
description = ("%s %s" % (oidCache[new_str_rep][0], ".".join([str(a) for a in oid[len(step):]])),)
break
if description is None:
description = ("No description available",)
return " %s (%s)" % (str_rep, description[0])
_gtimere = re.compile(r'(\d{4})(\d\d)(\d\d)(\d\d)(?:(\d\d)(\d\d(?:[.,]\d+)?)?)?(|Z|(?:[+-]\d\d(?:\d\d)?))$')
def decode_generalized_time(value):
@ -511,3 +522,4 @@ if __name__ == "__main__":
print utils.hexdump(c)
loadOids()

View File

@ -21,3 +21,6 @@
# I made this one up --Henryk
2.23.136.1.1.1 icao-sodData The data contained in the EF.SOD
# From tr-03110-eac-1.0.pdf
0.4.0.127.0.7 bsi-de Base OID for BSI, Germany