]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
scripts: Initialize libstrongswan in id2sql to fix a crash
authorTobias Brunner <tobias@strongswan.org>
Mon, 4 May 2020 14:56:47 +0000 (16:56 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 4 May 2020 15:00:45 +0000 (17:00 +0200)
Since 770f4ccee12d ("identification: Optionally match RDNs in any order
and accept missing RDNs") the DN parser requires lib->settings.

scripts/id2sql.c

index a4035cf25c199d971ef634936b74169a81fbe1c9..fe55288b38d120efd9947399adc8f040e980434f 100644 (file)
@@ -14,6 +14,8 @@
  */
 
 #include <stdio.h>
+
+#include <library.h>
 #include <utils/identification.h>
 
 /**
@@ -25,6 +27,9 @@ int main(int argc, char *argv[])
        chunk_t enc;
        int i;
 
+       library_init(NULL, "id2sql");
+       atexit(library_deinit);
+
        if (argc < 2)
        {
                return -1;
@@ -45,6 +50,7 @@ int main(int argc, char *argv[])
                printf("%02x", (unsigned int)enc.ptr[i]);
        }
        printf("'\n");
+       id->destroy(id);
        return 0;
 }