summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2013-12-25 14:05:11 +0100
committerAndreas Baumann <abaumann@yahoo.com>2013-12-25 14:05:11 +0100
commit49d862e89dd0a0010ed23889ec6f7c00a68521ef (patch)
tree5def2f00ae94ee515f347625446dc16cbcff884f
parent1071689c87f3b63ef1ac6c87c196a23b67f354a8 (diff)
downloadnagios-plugin-curl-49d862e89dd0a0010ed23889ec6f7c00a68521ef.tar.gz
nagios-plugin-curl-49d862e89dd0a0010ed23889ec6f7c00a68521ef.tar.bz2
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]
-rw-r--r--src/check_curl.ggo3
-rw-r--r--src/cmdline.c41
-rw-r--r--src/cmdline.h4
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;
@@ -1579,18 +1580,6 @@ cmdline_parser_internal (
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 */