Use the credential manager on windows

- Added parsing of option -m
This commit is contained in:
e9hack 2024-11-29 16:56:32 +01:00
parent 587798aca1
commit 8cd2c0dda2
2 changed files with 15 additions and 3 deletions

View file

@ -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");

View file

@ -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 );