diff options
author | Stef Walter <stef@thewalter.net> | 2013-08-29 12:12:46 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-08-29 12:14:01 +0200 |
commit | c980eb29619edc28610a03ccb62514683604257c (patch) | |
tree | 806ab9d9f507a518622a7e0dffac146172a1f9e7 /trust/extract.c | |
parent | f2beacb7c59b9c4b41b00da993c747fd814882a8 (diff) |
Route 'p11-kit extract-trust' over to trust tool
The actual command is 'trust extract-compat'. Make installed placeholder
script reflect this. We still support the old placeholder script
if it is present.
Diffstat (limited to 'trust/extract.c')
-rw-r--r-- | trust/extract.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/trust/extract.c b/trust/extract.c index 0389d29..d12d18b 100644 --- a/trust/extract.c +++ b/trust/extract.c @@ -41,6 +41,7 @@ #include "iter.h" #include "message.h" #include "oid.h" +#include "path.h" #include "pkcs11.h" #include "pkcs11x.h" #include "save.h" @@ -48,6 +49,7 @@ #include <assert.h> #include <ctype.h> +#include <errno.h> #include <getopt.h> #include <stdint.h> #include <stdio.h> @@ -281,3 +283,39 @@ p11_trust_extract (int argc, p11_enumerate_cleanup (&ex); return ret; } + +int +p11_trust_extract_compat (int argc, + char *argv[]) +{ + char *path; + char *path2; + int error; + + argv[argc] = NULL; + + /* + * For compatibility with people who deployed p11-kit 0.18.x + * before trust stuff was put into its own branch. + */ + path2 = p11_path_build (PRIVATEDIR, "p11-kit-extract-trust", NULL); + return_val_if_fail (path2 != NULL, 1); + execv (path2, argv); + error = errno; + free (path2); + + if (error == ENOENT) { + path = p11_path_build (PRIVATEDIR, "trust-extract-compat", NULL); + return_val_if_fail (path != NULL, 1); + execv (path, argv); + error = errno; + free (path); + } + + /* At this point we have no command */ + p11_message_err (error, "could not run %s command", path); + + free (path); + free (path2); + return 2; +} |