diff options
author | Jakub Sławiński | 2005-11-16 20:53:54 +0100 |
---|---|---|
committer | Joshua Judson Rosen | 2014-07-17 21:15:00 +0200 |
commit | e1c93eb660b5e628c0d3c2bbdaf82dc24c07da84 (patch) | |
tree | 6e53f7909e980171ec1951c370929234eda07a9a /src | |
parent | v0.7.4 (diff) | |
download | apf-e1c93eb660b5e628c0d3c2bbdaf82dc24c07da84.tar.gz |
v0.7.5
- Fixed: manageport option in the afclient config file
- Fixed: severe bug in string_cp
- Fixed: wrong connection type used by afclient when afserver used --nossl
or --nozlib option
- Fixed: broken keep-alive option
Diffstat (limited to 'src')
-rw-r--r-- | src/activefor.h | 2 | ||||
-rw-r--r-- | src/afclient.c | 5 | ||||
-rw-r--r-- | src/afserver.c | 8 | ||||
-rw-r--r-- | src/file_client.c | 2 | ||||
-rw-r--r-- | src/server_check.c | 4 | ||||
-rw-r--r-- | src/server_set.c | 4 | ||||
-rw-r--r-- | src/string_functions.c | 4 |
7 files changed, 17 insertions, 12 deletions
diff --git a/src/activefor.h b/src/activefor.h index 4fcdbe0..31284b9 100644 --- a/src/activefor.h +++ b/src/activefor.h @@ -51,7 +51,7 @@ #define S_STATE_STOPPED 11 #define S_STATE_OPENING_CLOSED 17 -#define AF_VER(info) info" v0.7.4" +#define AF_VER(info) info" v0.7.5" #define TYPE_TCP 1 #define TYPE_UDP 3 diff --git a/src/afclient.c b/src/afclient.c index b450543..a208bf6 100644 --- a/src/afclient.c +++ b/src/afclient.c @@ -87,7 +87,6 @@ main(int argc, char **argv) struct sockaddr* clientAddress; fd_set rset, allset, wset, tmpset; struct timeval keepAlive; - int timeout = 0; char verbose = 0; HttpProxyOptions* hpo = HttpProxyOptions_new(); char hpoUsed = 0; @@ -792,9 +791,9 @@ main(int argc, char **argv) aflog(LOG_T_INIT, LOG_I_INFO, "Trying to reconnect..."); mysleep(ArOptions_get_arDelay(ClientRealm_get_arOptions(pointer))); + ClientRealm_set_realmType(pointer, realmType); } if (temp == 0) { - ClientRealm_set_realmType(pointer, realmType); break; } } while (i); @@ -847,7 +846,7 @@ main(int argc, char **argv) buff[0] = AF_S_KEEP_ALIVE; SslFd_send_message(ClientRealm_get_realmType(pointer), ClientRealm_get_masterSslFd(pointer), buff, 5); - keepAlive.tv_sec = timeout; + keepAlive.tv_sec = ClientRealm_get_keepAliveTimeout(pointer); keepAlive.tv_usec = 0; ClientRealm_set_keepAlive(pointer, keepAlive); } diff --git a/src/afserver.c b/src/afserver.c index 2d6e1eb..fe532ec 100644 --- a/src/afserver.c +++ b/src/afserver.c @@ -108,7 +108,7 @@ main(int argc, char **argv) char* certif = NULL; char* keys = NULL; char* dateformat = NULL; - char* stemp = NULL; + static char* stemp = NULL; SSL_METHOD* method; SSL_CTX* ctx; @@ -1367,14 +1367,12 @@ main(int argc, char **argv) get_realmname(config, j), get_clientname(pointer, k)); if (ConnectClient_get_state(srClientsTable[k]) == CONNECTCLIENT_STATE_AUTHORIZING) { n = SslFd_get_message(ServerRealm_get_realmType(pointer) | TYPE_SSL | TYPE_ZLIB, - ConnectClient_get_sslFd( - srClientsTable[k]), + ConnectClient_get_sslFd(srClientsTable[k]), buff, (-1) * HeaderBuffer_to_read(ConnectClient_get_header(srClientsTable[k]))); } else { n = SslFd_get_message(ServerRealm_get_realmType(pointer), - ConnectClient_get_sslFd( - srClientsTable[k]), + ConnectClient_get_sslFd(srClientsTable[k]), buff, (-1) * HeaderBuffer_to_read(ConnectClient_get_header(srClientsTable[k]))); } if (n == -1) { diff --git a/src/file_client.c b/src/file_client.c index 68ece7a..58ee489 100644 --- a/src/file_client.c +++ b/src/file_client.c @@ -196,7 +196,7 @@ cparsefile(char* name, int* status) ClientRealm_set_serverName(ClientConfiguration_get_realmsTable(cfg)[0], helpbuf2); } else if ((strcmp(helpbuf1, "m") == 0) || (strcmp(helpbuf1, "manageport") == 0)) { - ClientRealm_set_hostName(ClientConfiguration_get_realmsTable(cfg)[0], helpbuf2); + ClientRealm_set_managePort(ClientConfiguration_get_realmsTable(cfg)[0], helpbuf2); } else if ((strcmp(helpbuf1, "d") == 0) || (strcmp(helpbuf1, "hostname") == 0)) { ClientRealm_set_hostName(ClientConfiguration_get_realmsTable(cfg)[0], helpbuf2); diff --git a/src/server_check.c b/src/server_check.c index eb65d97..858d28e 100644 --- a/src/server_check.c +++ b/src/server_check.c @@ -31,7 +31,8 @@ int check_value(char* what, char* info) { - long tmp = check_value_liberal(what, info); + long tmp; + tmp = check_value_liberal(what, info); if (tmp <= 0) { aflog(LOG_T_INIT, LOG_I_CRIT, @@ -46,6 +47,7 @@ check_value_liberal(char* what, char* info) { char* znak; long tmp; + if ((tmp = strtol(what, &znak, 10)) >= INT_MAX) { aflog(LOG_T_INIT, LOG_I_CRIT, "%s: %s\n", info, what); diff --git a/src/server_set.c b/src/server_set.c index c3a0058..3537cc5 100644 --- a/src/server_set.c +++ b/src/server_set.c @@ -20,12 +20,14 @@ #include <stdlib.h> +#include "string_functions.h" + void set_value(char** dest, char* from, char* def) { if ((*dest) == NULL) { if (from != NULL) { - (*dest) = from; + string_cp(dest, from); } else { (*dest) = def; diff --git a/src/string_functions.c b/src/string_functions.c index 471d3eb..58ee17e 100644 --- a/src/string_functions.c +++ b/src/string_functions.c @@ -45,6 +45,10 @@ string_cp(char** dest, char* src) /* 1. releasing memory allocated by *dest */ if (dest != NULL) { if ((*dest) != NULL) { + /* if *dest points to the same memory as src - we shouldn't do anything */ + if ((*dest) == src) { + return (*dest); + } free((*dest)); (*dest) = NULL; } |