Fix more whitespaces

This commit is contained in:
Markus Moeller 2020-01-12 20:59:19 +00:00
parent 585882edd2
commit 917b68f28c
7 changed files with 127 additions and 122 deletions

View File

@ -26,3 +26,4 @@
void base64enc(char *dst, const void* src, size_t count); void base64enc(char *dst, const void* src, size_t count);
#endif #endif

View File

@ -1255,7 +1255,7 @@ static void relay_connection (struct conn_s *connptr)
if (ret != 0) { if (ret != 0) {
log_message(LOG_ERR, log_message(LOG_ERR,
"Failed to set client socket to blocking: %s", "Failed to set client socket to blocking: %s",
strerror (errno)); strerror(errno));
return; return;
} }
@ -1298,6 +1298,7 @@ connect_to_upstream_proxy(struct conn_s *connptr, struct request_s *request)
ulen = cur_upstream->ua.user ? strlen(cur_upstream->ua.user) : 0; ulen = cur_upstream->ua.user ? strlen(cur_upstream->ua.user) : 0;
passlen = cur_upstream->pass ? strlen(cur_upstream->pass) : 0; passlen = cur_upstream->pass ? strlen(cur_upstream->pass) : 0;
log_message(LOG_CONN, log_message(LOG_CONN,
"Established connection to %s proxy \"%s\" using file descriptor %d.", "Established connection to %s proxy \"%s\" using file descriptor %d.",
proxy_type_name (cur_upstream->type), cur_upstream->host, connptr->server_fd); proxy_type_name (cur_upstream->type), cur_upstream->host, connptr->server_fd);
@ -1307,16 +1308,19 @@ connect_to_upstream_proxy(struct conn_s *connptr, struct request_s *request)
buff[0] = 4; /* socks version */ buff[0] = 4; /* socks version */
buff[1] = 1; /* connect command */ buff[1] = 1; /* connect command */
port = htons(request->port); port = htons(request->port);
memcpy (&buff[2], &port, 2); /* dest port */ memcpy(&buff[2], &port, 2); /* dest port */
host = gethostbyname(request->host); host = gethostbyname(request->host);
memcpy (&buff[4], host->h_addr_list[0], 4); /* dest ip */ memcpy(&buff[4], host->h_addr_list[0], 4); /* dest ip */
buff[8] = 0; /* user */ buff[8] = 0; /* user */
if (9 != safe_write(connptr->server_fd, buff, 9)) if (9 != safe_write(connptr->server_fd, buff, 9))
return -1; return -1;
if (8 != safe_read(connptr->server_fd, buff, 8))
return -1;
if (buff[0]!=0 || buff[1]!=90) if (buff[0]!=0 || buff[1]!=90)
return -1; return -1;
} else if (cur_upstream->type == PT_SOCKS5) { } else if (cur_upstream->type == PT_SOCKS5) {
/* init */ /* init */
int n_methods = ulen ? 2 : 1; int n_methods = ulen ? 2 : 1;
buff[0] = 5; /* socks version */ buff[0] = 5; /* socks version */

View File

@ -145,7 +145,7 @@ static char *get_hostip (int *lookup_err, char *host, in_addr_t ip,
} }
const char * const char *
proxy_type_name (proxy_type type) proxy_type_name(proxy_type type)
{ {
switch (type) { switch (type) {
case PT_NONE: return "none"; case PT_NONE: return "none";
@ -246,7 +246,7 @@ static struct upstream *upstream_build (const struct upstream_proxy_list *plist,
up->ip = up->mask = 0; up->ip = up->mask = 0;
if (user) { if (user) {
if (type == PT_HTTP) { if (type == PT_HTTP) {
char b[BASE64ENC_BYTES((256+2) - 1) + 1]; char b[BASE64ENC_BYTES((256+2)-1) + 1];
ssize_t ret; ssize_t ret;
ret = basicauth_string(user, pass, b, sizeof b); ret = basicauth_string(user, pass, b, sizeof b);
if (ret == 0) { if (ret == 0) {