projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Releasing 1.0.30.
[tinc]
/
src
/
proxy.c
diff --git
a/src/proxy.c
b/src/proxy.c
index
165d3f3
..
5268272
100644
(file)
--- a/
src/proxy.c
+++ b/
src/proxy.c
@@
-1,6
+1,6
@@
/*
proxy.c -- Proxy handling functions.
/*
proxy.c -- Proxy handling functions.
- Copyright (C) 2015 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2015
-2016
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-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;
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");
return 8;
} else {
logger(LOG_ERR, "Proxy request rejected");
@@
-203,7
+205,7
@@
int receive_proxy_meta(connection_t *c, int start, int lenin) {
case PROXY_SOCKS5:
if(c->buflen < 2)
return 0;
case PROXY_SOCKS5:
if(c->buflen < 2)
return 0;
- if(c->buffer[0] != 0x05 || c->buffer[1] == 0xff) {
+ if(c->buffer[0] != 0x05 || c->buffer[1] ==
(char)
0xff) {
logger(LOG_ERR, "Proxy authentication method rejected");
return -1;
}
logger(LOG_ERR, "Proxy authentication method rejected");
return -1;
}
@@
-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;
} else {
ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
c->allow_request = ID;
+ c->status.proxy_passed = true;
+ send_id(c);
return replen;
}
return replen;
}
@@
-256,7
+260,12
@@
int receive_proxy_meta(connection_t *c, int start, int lenin) {
char *p = memchr(c->buffer, '\n', c->buflen);
if(!p || p - c->buffer >= c->buflen)
return 0;
char *p = memchr(c->buffer, '\n', c->buflen);
if(!p || p - c->buffer >= c->buflen)
return 0;
- p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer));
+
+ 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;
+ }
+
if(!p)
return 0;
if(!p)
return 0;
@@
-270,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;
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 {
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;
}
logger(LOG_ERR, "Proxy request rejected: %s", c->buffer + 9);
return false;
}