From 49d862e89dd0a0010ed23889ec6f7c00a68521ef Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 25 Dec 2013 14:05:11 +0100 Subject: changed digest option to -d to -D (-d is used by the original check_http plugin for "String to expect in the response headers"). Command line option moved to check_curl.ggo and regenerated cmdline.[ch] --- src/check_curl.ggo | 3 +++ src/cmdline.c | 41 +++++++++++++++++++++-------------------- src/cmdline.h | 4 ++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/check_curl.ggo b/src/check_curl.ggo index 7d387d4..532a5ff 100644 --- a/src/check_curl.ggo +++ b/src/check_curl.ggo @@ -115,6 +115,9 @@ option "key" - "Private key file name (SSL)" typestr="key" optional +option "digest" D "Use digest auth on http authentication" + optional + option "protocol" - "The protocol to use (http, ftp)" string typestr="protocol" diff --git a/src/cmdline.c b/src/cmdline.c index 6b7f0c8..e401729 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -54,8 +54,8 @@ const char *gengetopt_args_info_help[] = { " --cacert=file CA certificate to verify peer against (SSL)", " -E, --cert=file Client certificate file and password (SSL)", " --key=key Private key file name (SSL)", + " -D, --digest Use digest auth on http authentication", " --protocol=protocol The protocol to use (http, ftp) (possible\n values=\"http\", \"ftp\" default=`http')", - " -d, --digest Use digest auth on http authentication", 0 }; @@ -131,8 +131,8 @@ void clear_given (struct gengetopt_args_info *args_info) args_info->cacert_given = 0 ; args_info->cert_given = 0 ; args_info->key_given = 0 ; - args_info->protocol_given = 0 ; args_info->digest_given = 0 ; + args_info->protocol_given = 0 ; } static @@ -167,6 +167,7 @@ void clear_args (struct gengetopt_args_info *args_info) args_info->key_orig = NULL; args_info->protocol_arg = gengetopt_strdup ("http"); args_info->protocol_orig = NULL; + } static @@ -197,8 +198,8 @@ void init_args_info(struct gengetopt_args_info *args_info) args_info->cacert_help = gengetopt_args_info_help[18] ; args_info->cert_help = gengetopt_args_info_help[19] ; args_info->key_help = gengetopt_args_info_help[20] ; - args_info->protocol_help = gengetopt_args_info_help[21] ; - args_info->digest_help = gengetopt_args_info_help[22] ; + args_info->digest_help = gengetopt_args_info_help[21] ; + args_info->protocol_help = gengetopt_args_info_help[22] ; } @@ -438,10 +439,10 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) write_into_file(outfile, "cert", args_info->cert_orig, 0); if (args_info->key_given) write_into_file(outfile, "key", args_info->key_orig, 0); - if (args_info->protocol_given) - write_into_file(outfile, "protocol", args_info->protocol_orig, cmdline_parser_protocol_values); if (args_info->digest_given) write_into_file(outfile, "digest", 0, 0 ); + if (args_info->protocol_given) + write_into_file(outfile, "protocol", args_info->protocol_orig, cmdline_parser_protocol_values); i = EXIT_SUCCESS; @@ -1411,8 +1412,8 @@ cmdline_parser_internal ( { "cacert", 1, NULL, 0 }, { "cert", 1, NULL, 'E' }, { "key", 1, NULL, 0 }, + { "digest", 0, NULL, 'D' }, { "protocol", 1, NULL, 0 }, - { "digest", 0, NULL, 'd' }, { 0, 0, 0, 0 } }; @@ -1421,7 +1422,7 @@ cmdline_parser_internal ( custom_opterr = opterr; custom_optopt = optopt; - c = custom_getopt_long (argc, argv, "hVvt:c:w:H:I:p:u:f:a:s:SA:E:d", long_options, &option_index); + c = custom_getopt_long (argc, argv, "hVvt:c:w:H:I:p:u:f:a:s:SA:E:D", long_options, &option_index); optarg = custom_optarg; optind = custom_optind; @@ -1578,18 +1579,6 @@ cmdline_parser_internal ( additional_error)) goto failure; - break; - case 'd': /* Connect via SSL. Port defaults to 443. */ - - - if (update_arg( 0 , - 0 , &(args_info->digest_given), - &(local_args_info.digest_given), optarg, 0, 0, ARG_NO, - check_ambiguity, override, 0, 0, - "digest", 'd', - additional_error)) - goto failure; - break; case 'A': /* String to be sent in http header as \"User Agent\". */ @@ -1615,6 +1604,18 @@ cmdline_parser_internal ( goto failure; break; + case 'D': /* Use digest auth on http authentication. */ + + + if (update_arg( 0 , + 0 , &(args_info->digest_given), + &(local_args_info.digest_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "digest", 'D', + additional_error)) + goto failure; + + break; case 0: /* Long option with no short option */ /* The optional configuration file. */ diff --git a/src/cmdline.h b/src/cmdline.h index 811aec2..09b27b3 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -90,10 +90,10 @@ struct gengetopt_args_info char * key_arg; /**< @brief Private key file name (SSL). */ char * key_orig; /**< @brief Private key file name (SSL) original value given at command line. */ const char *key_help; /**< @brief Private key file name (SSL) help description. */ + const char *digest_help; /**< @brief Use digest auth on http authentication help description. */ char * protocol_arg; /**< @brief The protocol to use (http, ftp) (default='http'). */ char * protocol_orig; /**< @brief The protocol to use (http, ftp) original value given at command line. */ const char *protocol_help; /**< @brief The protocol to use (http, ftp) help description. */ - const char *digest_help; /**< @brief The protocol to use (http, ftp) help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ @@ -116,8 +116,8 @@ struct gengetopt_args_info unsigned int cacert_given ; /**< @brief Whether cacert was given. */ unsigned int cert_given ; /**< @brief Whether cert was given. */ unsigned int key_given ; /**< @brief Whether key was given. */ + unsigned int digest_given ; /**< @brief Whether digest was given. */ unsigned int protocol_given ; /**< @brief Whether protocol was given. */ - unsigned int digest_given ; /**< @brief Whether to use digest auth. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ -- cgit v1.2.3-54-g00ecf