X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_key.c;h=049fc1e8073c093a602275f9235a97fbfb4cd15c;hp=cb652c1e197c49e5bb45a8f25ca4b9324b9ece2b;hb=e3220cacb5bc79fc56167e61b7a342f88a33a479;hpb=83263b74460656ba557fd9bb84dc27258549e9cd diff --git a/src/protocol_key.c b/src/protocol_key.c index cb652c1e..049fc1e8 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -17,11 +17,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol_key.c,v 1.1.4.22 2003/07/24 12:08:16 guus Exp $ + $Id: protocol_key.c,v 1.1.4.24 2003/11/17 15:30:18 guus Exp $ */ #include "system.h" +#include +#include + #include "avl_tree.h" #include "connection.h" #include "logger.h" @@ -77,7 +80,8 @@ bool key_changed_h(connection_t *c) /* Tell the others */ - forward_request(c); + if(!tunnelserver) + forward_request(c); return true; } @@ -127,6 +131,9 @@ bool req_key_h(connection_t *c) memset(from->late, 0, sizeof(from->late)); send_ans_key(c, myself, from); } else { + if(tunnelserver) + return false; + send_req_key(to->nexthop->connection, from, to); } @@ -186,6 +193,9 @@ bool ans_key_h(connection_t *c) /* Forward it if necessary */ if(to != myself) { + if(tunnelserver) + return false; + return send_request(to->nexthop->connection, "%s", c->buffer); } @@ -251,7 +261,12 @@ bool ans_key_h(connection_t *c) from->compression = compression; if(from->cipher) - EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len); + if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len)) { + logger(LOG_ERR, _("Error during initialisation of key from %s (%s): %s"), + from->name, from->hostname, ERR_error_string(ERR_get_error(), NULL)); + return false; + } + flush_queue(from);