[PATCH libksba 4/7] Adapt mkoidtbl script to newer dumpasn1 database format

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Sat Jul 12 13:11:16 CEST 2014


* tests/mkoidtbl.awk: optionally parse oid at OID line.

--

Debian jessie currently has dumpasn1 version 20130608-1. It uses
dumpasn1.cfg with slightly different format:

OID = 0 2 262 1 10
Comment = Deutsche Telekom
Description = Telesec

Adapted mkoidtbl to work on both types of files.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
---
 tests/mkoidtbl.awk | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/mkoidtbl.awk b/tests/mkoidtbl.awk
index 70aae33..f6f827f 100644
--- a/tests/mkoidtbl.awk
+++ b/tests/mkoidtbl.awk
@@ -28,11 +28,15 @@ BEGIN {
 }
 
 /^[ \t]*#/ { next }
-/^OID/     { flush() }
+/^OID/     { flush()
+             oid = substr($0, index($0, "=") + 2)
+             gsub (/[ \t]+/, ".", oid)
+}
 /^Comment/ { comment = substr($0, index($0, "=") + 2 )
              gsub(/\r/, "", comment)
              gsub (/\\/, "\\\\", comment)
              gsub (/"/, "\\\"", comment)
+             gsub (/\(\?\?\?\)/, "(?)", comment)
 }
 /^Description/ {
   desc = substr($0, index($0, "=") + 2)
@@ -40,11 +44,11 @@ BEGIN {
   if (match (desc, /\([0-9 \t]+\)/) > 2) {
     oid = substr(desc, RSTART+1, RLENGTH-2 )
     desc = substr(desc, 1, RSTART-1);
-    gsub (/[ \t]+/, ".", oid)
-    gsub (/\\/, "\\\\", desc)
-    gsub (/"/, "\\\"", desc)
-    sub (/[ \t]*$/, "", desc)
   }
+  gsub (/[ \t]+/, ".", oid)
+  gsub (/\\/, "\\\\", desc)
+  gsub (/"/, "\\\"", desc)
+  sub (/[ \t]*$/, "", desc)
 }
 
 END { flush();  print "  { NULL, NULL, NULL }\n};"  }
-- 
2.0.0




More information about the Gnupg-devel mailing list