diff options
author | Jakub Sławiński | 2006-02-05 15:14:03 +0100 |
---|---|---|
committer | Joshua Judson Rosen | 2014-07-17 21:15:02 +0200 |
commit | b457fec36399c1f7de093d5e92bb4fa453b79c86 (patch) | |
tree | 2084c9a78d40213015e6f10e3e9e01bc4c0c51f1 /src/server_check.c | |
parent | Update copyright statements. (diff) | |
download | apf-b457fec36399c1f7de093d5e92bb4fa453b79c86.tar.gz |
v0.8
- Fixed: infinite loop after buffering message
- Fixed: corrupt packets after closing connections in the stopped state
- Fixed: bug in mapping user numbers between afclient and afserver
- Fixed: premature close of the service connection
- Fixed: invalid buffering when the connection is closing
- Added: Multiple tunnels in one afclient<->afserver connection
Diffstat (limited to 'src/server_check.c')
-rw-r--r-- | src/server_check.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/server_check.c b/src/server_check.c index 7e2b015..9df5ac8 100644 --- a/src/server_check.c +++ b/src/server_check.c @@ -23,15 +23,28 @@ #include <stdio.h> #include <stdlib.h> #include <limits.h> +#include <assert.h> #include "server_check.h" #include "stats.h" #include "logging.h" +/* + * Function name: check_value + * Description: Checks if the string is a valid positive int number. + * Arguments: what - the string representing number + * info - the information string printed on failure + * Returns: The decoded int number. + */ + int check_value(char* what, char* info) { long tmp; + + assert(what != NULL); + assert(info != NULL); + tmp = check_value_liberal(what, info); if (tmp <= 0) { @@ -42,11 +55,22 @@ check_value(char* what, char* info) return tmp; } +/* + * Function name: check_value_liberal + * Description: Checks if the string is a valid int number. + * Arguments: what - the string representing number + * info - the information string printed on failure + * Returns: The decoded int number. + */ + int check_value_liberal(char* what, char* info) { char* znak; long tmp; + + assert(what != NULL); + assert(info != NULL); if ((tmp = strtol(what, &znak, 10)) >= INT_MAX) { aflog(LOG_T_INIT, LOG_I_CRIT, @@ -61,6 +85,16 @@ check_value_liberal(char* what, char* info) return tmp; } +/* + * Function name: check_long + * Description: Checks if the string is a valid long number. + * Arguments: text - the string representing number + * number - the pointer where decoded number will be stored + * Returns: 0 - success, + * 1 - value from outside the long number range, + * 2 - not the valid long number. + */ + int check_long(char* text, long* number) { |