From 7bb84e4d9eeaccf292aebe4d349755b87f87a143 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 15 Sep 2009 23:24:17 +0200 Subject: BUGFIX: Sometimes get_console_input() would "skip" a prompt if data was still in the stream This happens when more data is entered than what fits into the buffer. Then the remaining input, including the new-line will be accepted automatically on the next get_console_input(). It's important to remember that the length argument of get_console_input() do not restrict how much data the user can type in. It only tells how big the receiving buffer is, thus leaving the remaining data in the file stream. The fix for eurephia_init was to make sure a bigger part of the buffer is used when calling get_console_input(), to be sure that new-line will be accepted into this buffer. --- utils/eurephia_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/utils/eurephia_init.c b/utils/eurephia_init.c index b492bce..011581d 100644 --- a/utils/eurephia_init.c +++ b/utils/eurephia_init.c @@ -330,7 +330,7 @@ int setup_password_params(eurephiaCTX *ctx, const int hash_thr_min, const int h printf(" eurephia :: PASSWORD PARAMETERS\n"); printf("------------------------------------------------------------------------------\n\n"); - get_console_input(buffer, 3, "Salt length for password hashes [32] ", 0); + get_console_input(buffer, 10, "Salt length for password hashes [32] ", 0); memset(&value, 0, 22); snprintf(value, 20, "%i", (atoi_nullsafe(buffer) > 0 ? atoi_nullsafe(buffer) : 32)); if( !config_set(ctx, "passwordhash_salt_length", value) ) { @@ -390,7 +390,7 @@ int setup_attempt_limits(eurephiaCTX *ctx) { "IP addresses. Remember that the user might connect via a proxy or a firewall\n" "with NAT enabled.\n\n"); - get_console_input(buffer, 4, "How many failed attempts will you allow per user name? [3]", 0); + get_console_input(buffer, 10, "How many failed attempts will you allow per user name? [3]", 0); memset(&value, 0, 22); snprintf(value, 20, "%i", (atoi_nullsafe(buffer) > 0 ? atoi_nullsafe(buffer) : 3)); if( !config_set(ctx, "allow_username_attempts", value) ) { @@ -398,7 +398,7 @@ int setup_attempt_limits(eurephiaCTX *ctx) { return 0; } - get_console_input(buffer, 4, "How many failed attempts will you allow per certificate? [5]", 0); + get_console_input(buffer, 10, "How many failed attempts will you allow per certificate? [5]", 0); memset(&value, 0, 22); snprintf(value, 20, "%i", (atoi_nullsafe(buffer) > 0 ? atoi_nullsafe(buffer) : 5)); if( !config_set(ctx, "allow_cert_attempts", value) ) { @@ -406,7 +406,7 @@ int setup_attempt_limits(eurephiaCTX *ctx) { return 0; } - get_console_input(buffer, 4, "How many failed attempts will you allow per IP address? [10]", 0); + get_console_input(buffer, 10, "How many failed attempts will you allow per IP address? [10]", 0); memset(&value, 0, 22); snprintf(value, 20, "%i", (atoi_nullsafe(buffer) > 0 ? atoi_nullsafe(buffer) : 10)); if( !config_set(ctx, "allow_ipaddr_attempts", value) ) { @@ -433,7 +433,7 @@ int setup_session_params(eurephiaCTX *ctx) { printf(" eurephia :: SESSION PARAMETERS\n"); printf("------------------------------------------------------------------------------\n\n"); - get_console_input(buffer, 5, + get_console_input(buffer, 10, "eurephiadmin: How many minutes before a session is auto logged out: [10]", 0); memset(&value, 0, 22); snprintf(value, 20, "%i", (atoi_nullsafe(buffer) > 0 ? atoi_nullsafe(buffer) : 10)); -- cgit