projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Ian to the team
[privoxy.git]
/
gateway.c
diff --git
a/gateway.c
b/gateway.c
index
b65991a
..
2e43cb8
100644
(file)
--- a/
gateway.c
+++ b/
gateway.c
@@
-1,4
+1,4
@@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.8
1 2011/10/23 11:21:09
fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.8
3 2011/12/24 15:28:45
fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@
-808,6
+808,13
@@
static jb_socket socks4_connect(const struct forward_spec * fwd,
/* The error an its reason have already been logged by connect_to() */
return(JB_INVALID_SOCKET);
}
/* The error an its reason have already been logged by connect_to() */
return(JB_INVALID_SOCKET);
}
+ else if (write_socket(sfd, (char *)c, csiz))
+ {
+ errstr = "SOCKS4 negotiation write failed.";
+ log_error(LOG_LEVEL_CONNECT, "socks4_connect: %s", errstr);
+ err = 1;
+ close_socket(sfd);
+ }
else if (!data_is_available(sfd, csp->config->socket_timeout))
{
if (socket_is_still_alive(sfd))
else if (!data_is_available(sfd, csp->config->socket_timeout))
{
if (socket_is_still_alive(sfd))
@@
-822,13
+829,6
@@
static jb_socket socks4_connect(const struct forward_spec * fwd,
err = 1;
close_socket(sfd);
}
err = 1;
close_socket(sfd);
}
- else if (write_socket(sfd, (char *)c, csiz))
- {
- errstr = "SOCKS4 negotiation write failed.";
- log_error(LOG_LEVEL_CONNECT, "socks4_connect: %s", errstr);
- err = 1;
- close_socket(sfd);
- }
else if (read_socket(sfd, buf, sizeof(buf)) != sizeof(*s))
{
errstr = "SOCKS4 negotiation read failed.";
else if (read_socket(sfd, buf, sizeof(buf)) != sizeof(*s))
{
errstr = "SOCKS4 negotiation read failed.";
@@
-1116,6
+1116,15
@@
static jb_socket socks5_connect(const struct forward_spec *fwd,
assert(errstr != NULL);
csp->error_message = strdup(errstr);
assert(errstr != NULL);
csp->error_message = strdup(errstr);
+ if (server_size == -1)
+ {
+ /*
+ * We didn't read() anything from the server at all.
+ * Don't try to log a negative number of characters
+ * which could trigger an assert().
+ */
+ server_size = 0;
+ }
log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s: %N", errstr, server_size, sbuf);
close_socket(sfd);
errno = EINVAL;
log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s: %N", errstr, server_size, sbuf);
close_socket(sfd);
errno = EINVAL;