diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-15 23:24:17 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-15 23:24:17 +0200 |
commit | 7bb84e4d9eeaccf292aebe4d349755b87f87a143 (patch) | |
tree | 6776927244f488d27827041937ea7d0fa5c533c8 | |
parent | 87f88f42f2dc991a29b40adcfd4443e04ee6d126 (diff) | |
download | eurephia-7bb84e4d9eeaccf292aebe4d349755b87f87a143.tar.gz eurephia-7bb84e4d9eeaccf292aebe4d349755b87f87a143.tar.xz eurephia-7bb84e4d9eeaccf292aebe4d349755b87f87a143.zip |
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.
-rw-r--r-- | utils/eurephia_init.c | 10 |
1 files changed, 5 insertions, 5 deletions
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)); |