X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fproxy.c;h=32cb7973ffcb51e9a928b7f20d62e5d9c44722cb;hp=2b8f87c13e36dcc5d32e47968ae8f33b2c14ae3c;hb=3c37fe38019ec9c08be6158a4f64128fc83ed605;hpb=30cc8541cca61368dc2c5de7452a8dd5456308d7 diff --git a/src/proxy.c b/src/proxy.c index 2b8f87c1..32cb7973 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -194,6 +194,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) { ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted"); c->allow_request = ID; + c->status.proxy_passed = true; + send_id(c); return 8; } else { logger(LOG_ERR, "Proxy request rejected"); @@ -249,6 +251,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) { } else { ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted"); c->allow_request = ID; + c->status.proxy_passed = true; + send_id(c); return replen; } @@ -257,8 +261,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) { if(!p || p - c->buffer >= c->buflen) return 0; - while(p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer))) { - if(p[-1] == '\n') + while((p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer)))) { + if(p > c->buffer + 3 && !memcmp(p - 3, "\r\n\r\n", 4)) break; } @@ -275,8 +279,12 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) { logger(LOG_DEBUG, "Proxy request granted"); replen = p + 1 - c->buffer; c->allow_request = ID; + c->status.proxy_passed = true; + send_id(c); return replen; } else { + p = memchr(c->buffer, '\n', c->buflen); + p[-1] = 0; logger(LOG_ERR, "Proxy request rejected: %s", c->buffer + 9); return false; }