aboutsummaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/options.c b/src/options.c
index 10838ad..ee8e249 100644
--- a/src/options.c
+++ b/src/options.c
@@ -172,13 +172,6 @@ static const struct option_usage usage[] = {
"Tune the number of empty pings to send with each explicit acknowledgement.\n"
"Empty pings can compensate for ICMP sequence number inspection.\n"
},
- /** --force-md5 */
- {"force-md5", 0, OPT_BOOL, {.num = 0},
- "Force MD5 as challenge response checksum generator.\n"
-#ifndef ENABLE_SHA512
- "This is the default for this configuration.\n"
-#endif
- },
/** --force-sha512 */
{"force-sha512", 0, OPT_BOOL, {.num = 0},
"Force SHA512 as challenge response checksum generator.\n"
@@ -256,7 +249,6 @@ static struct option long_options[] = {
{"resend-interval", required_argument, 0, 't'},
{"payload-size", required_argument, 0, 'y'},
{"empty-pings", required_argument, 0, 'E'},
- {"force-md5", no_argument, &opts.force_md5, 1},
{"force-sha512", no_argument, &opts.force_sha512, 1},
{"daemon", optional_argument, 0, 'd'},
{"syslog", no_argument, 0, 'S'},
@@ -522,14 +514,14 @@ int parse_options(int argc, char **argv) {
pt_log(kLog_debug, "%s\n", "Password set - unauthenicated connections will be refused.");
/* Compute the md5 password digest */
md5_init(&state);
- md5_append(&state, (md5_byte_t*)optarg, strnlen(opts.password, BUFSIZ /* not optimal */));
+ md5_append(&state, (md5_byte_t *)optarg, strnlen(opts.password, BUFSIZ /* not optimal */));
md5_finish(&state, &opts.md5_password_digest[0]);
- // Hide the password in process listing
- memset(optarg, '*', strnlen(optarg, BUFSIZ /* not optimal */));
#ifdef ENABLE_SHA512
pt_log(kLog_debug, "%s\n", "Password set - sha512 authentication enabled.");
- SHA512(optarg, strnlen(opts.password, BUFSIZ /* not optimal */), &opts.sha512_password_digest[0]);
+ SHA512((const unsigned char *)optarg, strnlen(opts.password, BUFSIZ /* not optimal */), &opts.sha512_password_digest[0]);
#endif
+ // Hide the password in process listing
+ memset(optarg, '*', strnlen(optarg, BUFSIZ /* not optimal */));
break;
#ifndef WIN32
case 'd':
@@ -634,13 +626,10 @@ int parse_options(int argc, char **argv) {
exit(1);
}
-#if ENABLE_SHA512
- if (opts.force_md5) {
- pt_log(kLog_error, "%s\n", "You are forcing md5 but sha512 is available.");
- }
-#else
+#ifndef ENABLE_SHA512
if (opts.force_sha512) {
pt_log(kLog_error, "%s\n", "You are forcing sha512 but it isn't available.");
+ return 1;
}
#endif