[git] GnuPG - branch, master, updated. gnupg-2.2.7-155-gbcdbf8b

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Jun 15 06:03:46 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  bcdbf8b8ebe9d61160e0b007dabe1b6462ffbc93 (commit)
       via  1c0b6681e4f322b88ac35d1f21c03d3cfc35fc23 (commit)
      from  3e6ad302eaf3a4a9f3e60379133b3dfdbe0e1b2d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bcdbf8b8ebe9d61160e0b007dabe1b6462ffbc93
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Jun 15 12:58:29 2018 +0900

    libdns: Fix connect and try next nameserver when ECONNREFUSED.
    
    * dirmngr/dns.c (dns_so_check): When EINVAL, release the association
    by connect with AF_UNSPEC and try again.  Also try again for
    ECONNREFUSED.
    (dns_res_exec): Try next nameserver when ECONNREFUSED.
    
    --
    
    GnuPG-bug-id: T3374
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index 178070a..d2445a0 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -7614,8 +7614,23 @@ retry:
 
 		so->state++;	/* FALL THROUGH */
 	case DNS_SO_UDP_CONN:
+	udp_connect_retry:
 		error = dns_connect(so->udp, (struct sockaddr *)&so->remote, dns_sa_len(&so->remote));
 		dns_trace_sys_connect(so->trace, so->udp, SOCK_DGRAM, (struct sockaddr *)&so->remote, error);
+
+		/* Linux returns EINVAL when address was bound to
+		   localhost and it's external IP address now.  */
+		if (error == EINVAL) {
+			struct sockaddr unspec_addr;
+			memset (&unspec_addr, 0, sizeof unspec_addr);
+			unspec_addr.sa_family = AF_UNSPEC;
+			connect(so->udp, &unspec_addr, sizeof unspec_addr);
+			goto udp_connect_retry;
+		} else if (error == ECONNREFUSED)
+			/* Error for previous socket operation may
+			   be reserverd asynchronously. */
+			goto udp_connect_retry;
+
 		if (error)
 			goto error;
 
@@ -8824,7 +8839,10 @@ exec:
 		if (dns_so_elapsed(&R->so) >= dns_resconf_timeout(R->resconf))
 			dgoto(R->sp, DNS_R_FOREACH_A);
 
-		if ((error = dns_so_check(&R->so)))
+		error = dns_so_check(&R->so);
+		if (error == ECONNREFUSED)
+			dgoto(R->sp, DNS_R_FOREACH_A);
+		else if (error)
 			goto error;
 
 		if (!dns_p_setptr(&F->answer, dns_so_fetch(&R->so, &error)))
@@ -8957,7 +8975,10 @@ exec:
 		if (dns_so_elapsed(&R->so) >= dns_resconf_timeout(R->resconf))
 			dgoto(R->sp, DNS_R_FOREACH_AAAA);
 
-		if ((error = dns_so_check(&R->so)))
+		error = dns_so_check(&R->so);
+		if (error == ECONNREFUSED)
+			dgoto(R->sp, DNS_R_FOREACH_AAAA);
+		else if (error)
 			goto error;
 
 		if (!dns_p_setptr(&F->answer, dns_so_fetch(&R->so, &error)))

commit 1c0b6681e4f322b88ac35d1f21c03d3cfc35fc23
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Jun 15 10:38:22 2018 +0900

    libdns: Clear struct sockaddr_storage by zero.
    
    * dirmngr/dns.c (dns_resconf_pton): Clear SS.
    (dns_resconf_setiface): Clear ->IFACE.
    (dns_hints_root, send_query): Clear SS.
    
    --
    
    POSIX requires clear the structure of struct sockaddr_in6.  On macOS,
    in some case like bind, it is better to clear even for struct
    sockaddr_in.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index 13ef4b8..178070a 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -5549,6 +5549,7 @@ int dns_resconf_pton(struct sockaddr_storage *ss, const char *src) {
 	unsigned short port = 0;
 	int ch, af = AF_INET, error;
 
+	memset(ss, 0, sizeof *ss);
 	while ((ch = *src++)) {
 		switch (ch) {
 		case ' ':
@@ -6311,6 +6312,7 @@ int dns_resconf_setiface(struct dns_resolv_conf *resconf, const char *addr, unsi
 	int af = (strchr(addr, ':'))? AF_INET6 : AF_INET;
 	int error;
 
+	memset(&resconf->iface, 0, sizeof (struct sockaddr_storage));
 	if ((error = dns_pton(af, addr, dns_sa_addr(af, &resconf->iface, NULL))))
 		return error;
 
@@ -6622,6 +6624,7 @@ struct dns_hints *dns_hints_root(struct dns_resolv_conf *resconf, int *error_) {
 	for (i = 0; i < lengthof(root_hints); i++) {
 		af	= root_hints[i].af;
 
+		memset(&ss, 0, sizeof ss);
 		if ((error = dns_pton(af, root_hints[i].addr, dns_sa_addr(af, &ss, NULL))))
 			goto error;
 
@@ -10866,6 +10869,7 @@ static int send_query(int argc, char *argv[]) {
 	struct dns_socket *so;
 	int error, type;
 
+	memset(&ss, 0, sizeof ss);
 	if (argc > 1) {
 		ss.ss_family	= (strchr(argv[1], ':'))? AF_INET6 : AF_INET;
 

-----------------------------------------------------------------------

Summary of changes:
 dirmngr/dns.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list