]> granicus.if.org Git - p11-kit/commitdiff
trust: Fix the 'p11-kit extract' command
authorStef Walter <stef@thewalter.net>
Tue, 9 Jul 2013 10:24:40 +0000 (12:24 +0200)
committerStef Walter <stef@thewalter.net>
Tue, 9 Jul 2013 10:24:40 +0000 (12:24 +0200)
This is supposed to call over to 'trust extract' and wasn't
working correctly.

p11-kit/Makefile.am
p11-kit/p11-kit.c
trust/extract.c

index 72dc2ff049a2359e03cb685b5923fe60af4a3914..9802b2333325c39ab4a269f2155f3bffb0b21859 100644 (file)
@@ -9,6 +9,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir) \
        -I$(COMMON) \
        -DSRCDIR=\"$(srcdir)\" \
+       -DBINDIR=\"$(bindir)\" \
        -DPRIVATEDIR=\"$(privatedir)\" \
        -DP11_KIT_FUTURE_UNSTABLE_API \
        $(NULL)
index ecee1ff8c996830c85f5e265fe6b6f377318f405..28c6f4a8104f7c949a48fa7810461680f861bae3 100644 (file)
@@ -80,7 +80,7 @@ p11_kit_external (int argc,
        return_val_if_fail (path != NULL, 1);
 
        argv[argc] = NULL;
-       execvp (path, argv);
+       execv (path, argv);
 
        /* At this point we have no command */
        p11_message ("'%s' is not a valid command. See 'p11-kit --help'", argv[0]);
@@ -91,7 +91,25 @@ int
 p11_kit_extract (int argc,
                  char *argv[])
 {
-       return p11_kit_external (argc, argv);
+       char *path;
+       char **args;
+
+       args = calloc (argc + 2, sizeof (char *));
+       return_val_if_fail (args != NULL, 1);
+
+       args[0] = "trust";
+       memcpy (args + 1, argv, sizeof (char *) * argc);
+       args[argc + 1] = NULL;
+
+       /* Add our libexec directory to the path */
+       path = p11_path_build (BINDIR, args[0], NULL);
+       return_val_if_fail (path != NULL, 1);
+
+       execv (path, args);
+
+       /* At this point we have no command */
+       p11_message ("'%s' is not a valid command. See 'p11-kit --help'", argv[0]);
+       return 2;
 }
 
 int
index 39d30e038a0407c2a9b17e7d2b20af98c07b478d..b80fd8098b98ef5ee1c23a53b1e4f05aca45c4f6 100644 (file)
@@ -297,7 +297,7 @@ p11_trust_extract (int argc,
        };
 
        p11_tool_desc usages[] = {
-               { 0, "usage: p11-kit extract --format=<output> <destination>" },
+               { 0, "usage: trust extract --format=<output> <destination>" },
                { opt_filter,
                  "filter of what to export\n"
                  "  ca-anchors        certificate anchors (default)\n"