diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-07-30 10:29:58 +0200 |
---|---|---|
committer | Stef Walter <stefw@redhat.com> | 2014-09-25 09:45:32 +0200 |
commit | 448fb1d17de52a7c8f2d807daa76d8d0e2700665 (patch) | |
tree | dc208dca3233c471019756a432e512631fe7c125 | |
parent | a3208e5d8612c1fac70f4b72705ab4d155c69c3e (diff) | |
download | p11-kit-448fb1d17de52a7c8f2d807daa76d8d0e2700665.tar.gz |
remote: does accept socket file on cmd
-rw-r--r-- | p11-kit/p11-kit.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/p11-kit/p11-kit.c b/p11-kit/p11-kit.c index cb317da..effcebb 100644 --- a/p11-kit/p11-kit.c +++ b/p11-kit/p11-kit.c @@ -131,22 +131,25 @@ p11_kit_remote (int argc, char *argv[]) { CK_FUNCTION_LIST *module; + char *socket_file = NULL; int opt; int ret; enum { opt_verbose = 'v', opt_help = 'h', + opt_socket = 's', }; struct option options[] = { { "verbose", no_argument, NULL, opt_verbose }, { "help", no_argument, NULL, opt_help }, + { "socket", required_argument, NULL, opt_socket }, { 0 }, }; p11_tool_desc usages[] = { - { 0, "usage: p11-kit remote <module>" }, + { 0, "usage: p11-kit remote <module> -s <socket-file>" }, { 0 }, }; @@ -155,6 +158,9 @@ p11_kit_remote (int argc, case opt_verbose: p11_kit_be_loud (); break; + case opt_socket: + socket_file = strdup(optarg); + break; case opt_help: case '?': p11_tool_usage (usages, options); @@ -168,6 +174,11 @@ p11_kit_remote (int argc, argc -= optind; argv += optind; + if (socket_file == NULL) { + p11_tool_usage (usages, options); + return 2; + } + if (argc != 1) { p11_message ("specify the module to remote"); return 2; @@ -177,7 +188,7 @@ p11_kit_remote (int argc, if (module == NULL) return 1; - ret = p11_kit_remote_serve_module (module, getenv("P11_KIT_SOCKET")); + ret = p11_kit_remote_serve_module (module, socket_file); p11_kit_module_release (module); return ret; |