From 8cd2c0dda2133d970618d62cf4ef47f688a68219 Mon Sep 17 00:00:00 2001 From: e9hack Date: Fri, 29 Nov 2024 16:56:32 +0100 Subject: [PATCH] Use the credential manager on windows - Added parsing of option -m --- cmdline.c | 17 ++++++++++++++--- cmdline.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cmdline.c b/cmdline.c index 36aafae..1d48731 100644 --- a/cmdline.c +++ b/cmdline.c @@ -98,6 +98,9 @@ void cmdline_parser_print_help (void) { #ifdef SETPROCTITLE " -x, --proctitle=STRING Use a different process title\n" #endif +#ifdef USE_WINCREDMAN +" -m Use the credential manager for passwords\n" +#endif "\n" "Miscellaneous options:\n" " -v, --verbose Turn on verbosity\n" @@ -164,7 +167,7 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar /* args_info->enforcetls1_given = 0; */ args_info->host_given = 0; args_info->cacert_given = 0; - + args_info->credman_flag = 0; /* No... we can't make this a function... -- Maniac */ #define clear_args() \ { \ @@ -202,6 +205,7 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar args_info->cacert_arg = NULL; \ args_info->enforceipv4_flag = 0; \ args_info->enforceipv6_flag = 0; \ + args_info->credman_flag = 0; \ } clear_args(); @@ -253,9 +257,9 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar { NULL, 0, NULL, 0 } }; - c = getopt_long (argc, argv, "hVia:u:s:t:F:p:P:r:R:d:H:x:c:k:vNeEXWBqLo:TzC:46", long_options, &option_index); + c = getopt_long (argc, argv, "hVia:u:s:t:F:p:P:r:R:d:H:x:c:k:mvNeEXWBqLo:TzC:46", long_options, &option_index); #else - c = getopt( argc, argv, "hVia:u:s:t:F:p:P:r:R:d:H:x:c:k:vNeEXWBqLo:TzC:46" ); + c = getopt( argc, argv, "hVia:u:s:t:F:p:P:r:R:d:H:x:c:k:mvNeEXWBqLo:TzC:46" ); #endif if (c == -1) @@ -349,6 +353,13 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar args_info->proctitle_arg = gengetopt_strdup (optarg); break; +#ifdef USE_WINCREDMAN + case 'm': + args_info->credman_flag = 1; + if( args_info->verbose_flag ) + message( "Use credential manager for passwords\n"); + break; +#endif case 'L': /* args_info->enforcetls1_given = 1; message("Enforcing TLSv1\n"); diff --git a/cmdline.h b/cmdline.h index 18b77e9..9639283 100644 --- a/cmdline.h +++ b/cmdline.h @@ -93,6 +93,7 @@ struct gengetopt_args_info { /* int enforcetls1_given; Wheter to enforce TLSv1 */ int host_given; /* Wheter we override the Host Header */ int cacert_given; /* Whether cacert was given */ + int credman_flag; /* Use credential manager to get passwords instead reading it from console. */ }; int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *args_info );