Fix bit shifting arithmetic so the code actually does what the last commit message...
[tinc] / src / protocol_auth.c
index 13dae1d..96e6b6e 100644 (file)
@@ -41,9 +41,8 @@
 #include "xalloc.h"
 
 bool send_id(connection_t *c) {
-       if(proxytype && c->outgoing)
-               if(!send_proxyrequest(c))
-                       return false;
+       if(proxytype && c->outgoing && !c->status.proxy_passed)
+               return send_proxyrequest(c);
 
        return send_request(c, "%d %s %d", ID, myself->connection->name,
                                                myself->connection->protocol_version);
@@ -196,6 +195,7 @@ bool send_metakey(connection_t *c) {
                        return false;
                }
 
+               c->outbudget = (uint64_t)1 << EVP_CIPHER_key_length(c->outcipher) * 4;
                c->status.encryptout = true;
        }
 
@@ -274,6 +274,7 @@ bool metakey_h(connection_t *c) {
                        return false;
                }
 
+               c->inbudget = (uint64_t)1 << EVP_CIPHER_key_length(c->incipher) * 4;
                c->status.decryptin = true;
        } else {
                c->incipher = NULL;