diff --git a/src/pt-tls-client/pt-tls-client.c b/src/pt-tls-client/pt-tls-client.c index 09b42b6fe..a3328b576 100644 --- a/src/pt-tls-client/pt-tls-client.c +++ b/src/pt-tls-client/pt-tls-client.c @@ -20,15 +20,17 @@ #include #include #include +#include -#include -#include #include #include #include #include +#include +#include #include +#include /** * Print usage information @@ -38,6 +40,7 @@ static void usage(FILE *out, char *cmd) fprintf(out, "usage:\n"); fprintf(out, " %s --connect
[--port ] [--cert ]+\n", cmd); fprintf(out, " [--client ] [--secret ]\n"); + fprintf(out, " [--optionsfrom ]\n"); } /** @@ -120,7 +123,7 @@ static bool load_key(char *filename) /** * Debug level */ -static level_t pt_tls_level = 2; +static level_t pt_tls_level = 1; static void dbg_pt_tls(debug_t group, level_t level, char *fmt, ...) { @@ -135,6 +138,11 @@ static void dbg_pt_tls(debug_t group, level_t level, char *fmt, ...) } } +/** + * Handles --optionsfrom arguments + */ +options_t *options; + /** * Cleanup */ @@ -143,6 +151,7 @@ static void cleanup() lib->processor->cancel(lib->processor); lib->credmgr->remove_set(lib->credmgr, &creds->set); creds->destroy(creds); + options->destroy(options); libtnccs_deinit(); library_deinit(); } @@ -156,6 +165,7 @@ static void init() libtnccs_init(); dbg = dbg_pt_tls; + options = options_create(); if (!lib->plugins->load(lib->plugins, lib->settings->get_str(lib->settings, "pt-tls-client.load", PLUGINS))) @@ -187,6 +197,7 @@ int main(int argc, char *argv[]) {"cert", required_argument, NULL, 'x' }, {"key", required_argument, NULL, 'k' }, {"debug", required_argument, NULL, 'd' }, + {"optionsfrom", required_argument, NULL, '+' }, {0,0,0,0 } }; switch (getopt_long(argc, argv, "", long_opts, NULL)) @@ -228,6 +239,12 @@ int main(int argc, char *argv[]) case 'd': pt_tls_level = atoi(optarg); continue; + case '+': /* --optionsfrom */ + if (!options->from(options, optarg, &argc, &argv, optind)) + { + return 1; + } + continue; default: usage(stderr, argv[0]); return 1;