Revert syntactic/style changes

So actual changes aren't obfuscated
This commit is contained in:
Willem Toorop 2015-12-17 12:37:33 +01:00
parent 0d6d8116bc
commit a2e15a169d
3 changed files with 54 additions and 58 deletions

View File

@ -429,8 +429,6 @@ case "$enable_stub_only" in
;;
esac
# search to set include and library paths right
# find libidn
my_with_libidn=1

View File

@ -1793,7 +1793,7 @@ getdns_context_set_dnssec_allowed_skew(struct getdns_context *context,
*/
getdns_return_t
getdns_context_set_upstream_recursive_servers(struct getdns_context *context,
struct getdns_list *upstream_list)
struct getdns_list *upstream_list)
{
getdns_return_t r;
size_t count = 0;
@ -1810,16 +1810,16 @@ struct getdns_list *upstream_list)
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = 0; /* Datagram socket */
hints.ai_flags = AI_NUMERICHOST; /* No reverse name lookups */
hints.ai_protocol = 0; /* Any protocol */
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = 0; /* Datagram socket */
hints.ai_flags = AI_NUMERICHOST; /* No reverse name lookups */
hints.ai_protocol = 0; /* Any protocol */
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
upstreams = upstreams_create(
context, count * GETDNS_UPSTREAM_TRANSPORTS);
context, count * GETDNS_UPSTREAM_TRANSPORTS);
for (i = 0; i < count; i++) {
getdns_dict *dict;
getdns_bindata *address_type;
@ -1834,7 +1834,7 @@ struct getdns_list *upstream_list)
goto error;
if ((r = getdns_dict_get_bindata(
dict, "address_type", &address_type)))
dict, "address_type",&address_type)))
goto error;
if (address_type->size < 4)
goto invalid_parameter;
@ -1845,24 +1845,24 @@ struct getdns_list *upstream_list)
else goto invalid_parameter;
if ((r = getdns_dict_get_bindata(
dict, "address_data", &address_data)))
dict, "address_data", &address_data)))
goto error;
if ((addr.ss_family == AF_INET &&
address_data->size != 4) ||
(addr.ss_family == AF_INET6 &&
address_data->size != 16))
address_data->size != 4) ||
(addr.ss_family == AF_INET6 &&
address_data->size != 16))
goto invalid_parameter;
if (inet_ntop(addr.ss_family, address_data->data,
addrstr, 1024) == NULL)
addrstr, 1024) == NULL)
goto invalid_parameter;
if (getdns_dict_get_bindata(dict, "scope_id", &scope_id) ==
GETDNS_RETURN_GOOD) {
GETDNS_RETURN_GOOD) {
if (strlen(addrstr) + scope_id->size > 1022)
goto invalid_parameter;
eos = &addrstr[strlen(addrstr)];
*eos++ = '%';
(void)memcpy(eos, scope_id->data, scope_id->size);
(void) memcpy(eos, scope_id->data, scope_id->size);
eos[scope_id->size] = 0;
}
@ -1875,10 +1875,10 @@ struct getdns_list *upstream_list)
continue;
if (getdns_upstream_transports[j] != GETDNS_TRANSPORT_TLS)
(void)getdns_dict_get_int(dict, "port", &port);
(void) getdns_dict_get_int(dict, "port", &port);
else
(void)getdns_dict_get_int(dict, "tls_port", &port);
(void)snprintf(portstr, 1024, "%d", (int)port);
(void) getdns_dict_get_int(dict, "tls_port", &port);
(void) snprintf(portstr, 1024, "%d", (int)port);
if (getaddrinfo(addrstr, portstr, &hints, &ai))
goto invalid_parameter;
@ -1894,12 +1894,12 @@ struct getdns_list *upstream_list)
upstream_init(upstream, upstreams, ai);
upstream->transport = getdns_upstream_transports[j];
if (getdns_upstream_transports[j] == GETDNS_TRANSPORT_TLS ||
getdns_upstream_transports[j] == GETDNS_TRANSPORT_STARTTLS) {
getdns_upstream_transports[j] == GETDNS_TRANSPORT_STARTTLS) {
if ((r = getdns_dict_get_bindata(
dict, "tls_auth_name", &tls_auth_name)) == GETDNS_RETURN_GOOD) {
/*TODO: VALIDATE THIS STRING!*/
memcpy(upstream->tls_auth_name,
(char *)tls_auth_name->data,
(char *)tls_auth_name->data,
tls_auth_name->size);
upstream->tls_auth_name[tls_auth_name->size] = '\0';
}
@ -1920,7 +1920,8 @@ invalid_parameter:
error:
_getdns_upstreams_dereference(upstreams);
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
} /* getdns_context_set_upstream_recursive_servers */
static void
set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
@ -2355,7 +2356,7 @@ _getdns_context_prepare_for_resolution(struct getdns_context *context,
#ifdef HAVE_TLS_v1_2
/* Create client context, use TLS v1.2 only for now */
context->tls_ctx = SSL_CTX_new(TLSv1_2_client_method());
if (context->tls_ctx == NULL)
if(context->tls_ctx == NULL)
#ifndef USE_WINSOCK
return GETDNS_RETURN_BAD_CONTEXT;
#else
@ -2364,16 +2365,13 @@ _getdns_context_prepare_for_resolution(struct getdns_context *context,
/* Be strict and only use the cipher suites recommended in RFC7525
Unless we later fallback to opportunistic. */
const char* const PREFERRED_CIPHERS = "EECDH+aRSA+AESGCM:EECDH+aECDSA+AESGCM:EDH+aRSA+AESGCM";
if (!SSL_CTX_set_cipher_list(context->tls_ctx, PREFERRED_CIPHERS)) {
if (!SSL_CTX_set_cipher_list(context->tls_ctx, PREFERRED_CIPHERS))
return GETDNS_RETURN_BAD_CONTEXT;
}
if (!SSL_CTX_set_default_verify_paths(context->tls_ctx)) {
if (!SSL_CTX_set_default_verify_paths(context->tls_ctx))
return GETDNS_RETURN_BAD_CONTEXT;
}
#else
if (tls_only_is_in_transports_list(context) == 1) {
if (tls_only_is_in_transports_list(context) == 1)
return GETDNS_RETURN_BAD_CONTEXT;
}
/* A null tls_ctx will make TLS fail and fallback to the other
transports will kick-in.*/
#endif

View File

@ -641,18 +641,18 @@ stub_tcp_read(int fd, getdns_tcp_state *tcp, struct mem_funcs *mf, getdns_eventl
}
read = recv(fd, tcp->read_pos, tcp->to_read, 0);
if (read == -1) {
#ifdef USE_WINSOCK
printf("read (in tcp ) %s\n",
wsa_strerror(WSAGetLastError()));
if (WSAGetLastError() == WSAECONNRESET)
return STUB_TCP_AGAIN;
if (WSAGetLastError() == WSAEINPROGRESS)
return STUB_TCP_AGAIN;
if (WSAGetLastError() == WSAEWOULDBLOCK) {
winsock_tcp_wouldblock(event, EV_READ);
return STUB_TCP_AGAIN;
}
#ifdef USE_WINSOCK
printf("read (in tcp ) %s\n",
wsa_strerror(WSAGetLastError()));
if (WSAGetLastError() == WSAECONNRESET)
return STUB_TCP_AGAIN;
if (WSAGetLastError() == WSAEINPROGRESS)
return STUB_TCP_AGAIN;
if (WSAGetLastError() == WSAEWOULDBLOCK) {
winsock_tcp_wouldblock(event, EV_READ);
return STUB_TCP_AGAIN;
}
#else
if (errno == EAGAIN || errno == EWOULDBLOCK)
return STUB_TCP_AGAIN;
@ -762,19 +762,19 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
upstream). We must let the handshake complete since non-blocking. */
errno == EINPROGRESS)) ||
written < pkt_len + 2) {
#else
#ifdef USE_WINSOCK
written = sendto(fd, netreq->query - 2, pkt_len + 2,
0, (struct sockaddr *)&(netreq->upstream->addr),
netreq->upstream->addr_len);
#else
written = write(fd, netreq->query - 2, pkt_len + 2);
#endif
if ((written == -1 && (errno == EAGAIN ||
errno == EWOULDBLOCK)) ||
written < pkt_len + 2) {
#else
#ifdef USE_WINSOCK
written = sendto(fd, netreq->query - 2, pkt_len + 2,
0, (struct sockaddr *)&(netreq->upstream->addr),
netreq->upstream->addr_len);
#else
written = write(fd, netreq->query - 2, pkt_len + 2);
#endif
if ((written == -1 && (errno == EAGAIN ||
errno == EWOULDBLOCK)) ||
written < pkt_len + 2) {
#endif
/* We couldn't write the whole packet.
* We have to return with STUB_TCP_AGAIN.
@ -1374,7 +1374,7 @@ stub_tcp_read_cb(void *userarg)
int q;
switch ((q = stub_tcp_read(netreq->fd, &netreq->tcp,
&dnsreq->context->mf, &netreq->event))) {
&dnsreq->context->mf))) {
case STUB_TCP_AGAIN:
return;
@ -1452,7 +1452,7 @@ upstream_read_cb(void *userarg)
&upstream->upstreams->mf);
else
q = stub_tcp_read(upstream->fd, &upstream->tcp,
&upstream->upstreams->mf, &netreq->event);
&upstream->upstreams->mf);
switch (q) {
case STUB_TCP_AGAIN: