Accepting request 679660 from home:pmonrealgonzalez:branches:Base:System
- Fix build with gcc9 [bsc#1121223] * Avoid using compound literals - Upstream bug: https://dev.gnupg.org/T4367 * Added upstream patches: - 0001-libdns-Avoid-using-compound-literals.patch - 0002-libdns-Avoid-using-compound-literals-2.patch - 0003-libdns-Avoid-using-compound-literals-3.patch - 0004-libdns-Avoid-using-compound-literals-4.patch - 0005-libdns-Avoid-using-compound-literals-5.patch - 0006-libdns-Avoid-using-compound-literals-6.patch - 0007-libdns-Avoid-using-compound-literals-7.patch - 0008-libdns-Avoid-using-compound-literals-8.patch OBS-URL: https://build.opensuse.org/request/show/679660 OBS-URL: https://build.opensuse.org/package/show/Base:System/gpg2?expand=0&rev=222
This commit is contained in:
parent
637188eb82
commit
6a078f40f8
94
0001-libdns-Avoid-using-compound-literals.patch
Normal file
94
0001-libdns-Avoid-using-compound-literals.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 1c405499388fd5bed0968ab5c6c5d1b3373537b9 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 09:42:54 +0900
|
||||
Subject: [PATCH 1/8] libdns: Avoid using compound literals.
|
||||
|
||||
* dirmngr/dns.c (dns_inet_pton, dns_so_tcp_keep): Use automatic
|
||||
variables.
|
||||
(dns_poll, dns_send_nopipe): Likewise, adding const qualifier.
|
||||
|
||||
--
|
||||
|
||||
Compound literals is a feature of C99. Because we only use C90 plus
|
||||
some limited features, in the project, it's better to avoid it.
|
||||
|
||||
Besides, we make sure when it's read-only.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.c | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 210e9f49a..0645d2f55 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -944,10 +944,11 @@ static int dns_sa_cmp(void *a, void *b) {
|
||||
#if _WIN32
|
||||
static int dns_inet_pton(int af, const void *src, void *dst) {
|
||||
union { struct sockaddr_in sin; struct sockaddr_in6 sin6; } u;
|
||||
+ int size_of_u = (int)sizeof u;
|
||||
|
||||
u.sin.sin_family = af;
|
||||
|
||||
- if (0 != WSAStringToAddressA((void *)src, af, (void *)0, (struct sockaddr *)&u, &(int){ sizeof u }))
|
||||
+ if (0 != WSAStringToAddressA((void *)src, af, (void *)0, (struct sockaddr *)&u, &size_of_u))
|
||||
return -1;
|
||||
|
||||
switch (af) {
|
||||
@@ -1125,6 +1126,7 @@ static inline _Bool dns_isgraph(unsigned char c) {
|
||||
|
||||
static int dns_poll(int fd, short events, int timeout) {
|
||||
fd_set rset, wset;
|
||||
+ struct timeval tv = { timeout, 0 };
|
||||
|
||||
if (!events)
|
||||
return 0;
|
||||
@@ -1141,7 +1143,7 @@ static int dns_poll(int fd, short events, int timeout) {
|
||||
if (events & DNS_POLLOUT)
|
||||
FD_SET(fd, &wset);
|
||||
|
||||
- select(fd + 1, &rset, &wset, 0, (timeout >= 0)? &(struct timeval){ timeout, 0 } : NULL);
|
||||
+ select(fd + 1, &rset, &wset, 0, (timeout >= 0)? &tv : NULL);
|
||||
|
||||
return 0;
|
||||
} /* dns_poll() */
|
||||
@@ -1215,9 +1217,10 @@ static size_t dns_send_nopipe(int fd, const void *src, size_t len, int flags, dn
|
||||
|
||||
if (!sigismember(&pending, SIGPIPE)) {
|
||||
int saved = error;
|
||||
+ const struct timespec ts = { 0, 0 };
|
||||
|
||||
if (!count && error == EPIPE) {
|
||||
- while (-1 == sigtimedwait(&piped, NULL, &(struct timespec){ 0, 0 }) && errno == EINTR)
|
||||
+ while (-1 == sigtimedwait(&piped, NULL, &ts) && errno == EINTR)
|
||||
;;
|
||||
}
|
||||
|
||||
@@ -7111,7 +7114,8 @@ static int dns_socket(struct sockaddr *local, int type, int *error_) {
|
||||
|
||||
#if defined SO_NOSIGPIPE
|
||||
if (type != SOCK_DGRAM) {
|
||||
- if (0 != setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){ 1 }, sizeof (int)))
|
||||
+ const int v = 1;
|
||||
+ if (0 != setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &v, sizeof (int)))
|
||||
goto soerr;
|
||||
}
|
||||
#endif
|
||||
@@ -7487,11 +7491,12 @@ error:
|
||||
|
||||
static _Bool dns_so_tcp_keep(struct dns_socket *so) {
|
||||
struct sockaddr_storage remote;
|
||||
+ socklen_t l = sizeof remote;
|
||||
|
||||
if (so->tcp == -1)
|
||||
return 0;
|
||||
|
||||
- if (0 != getpeername(so->tcp, (struct sockaddr *)&remote, &(socklen_t){ sizeof remote }))
|
||||
+ if (0 != getpeername(so->tcp, (struct sockaddr *)&remote, &l))
|
||||
return 0;
|
||||
|
||||
return 0 == dns_sa_cmp(&remote, &so->remote);
|
||||
--
|
||||
2.20.1
|
||||
|
95
0002-libdns-Avoid-using-compound-literals-2.patch
Normal file
95
0002-libdns-Avoid-using-compound-literals-2.patch
Normal file
@ -0,0 +1,95 @@
|
||||
From 455ef62d29a112de05897139716265d07e4c6ae3 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 10:04:09 +0900
|
||||
Subject: [PATCH 2/8] libdns: Avoid using compound literals (2).
|
||||
|
||||
* dirmngr/dns.h (dns_strsection1, dns_strsection3): Remove.
|
||||
(dns_strclass1, dns_strclass3): Remove.
|
||||
(dns_strtype1, dns_strtype3): Remove.
|
||||
(dns_strsection, dns_strclass, dns_strtype): Directly use the
|
||||
function.
|
||||
* dirmngr/dns.c (dns_strsection): Use automatic variable.
|
||||
(dns_strclass, dns_strtype): Likewise.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.c | 15 +++++++++------
|
||||
dirmngr/dns.h | 16 +++-------------
|
||||
2 files changed, 12 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 0645d2f55..92084d112 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -10086,8 +10086,9 @@ static const struct {
|
||||
{ "AR", DNS_S_ADDITIONAL },
|
||||
};
|
||||
|
||||
-const char *(dns_strsection)(enum dns_section section, void *_dst, size_t lim) {
|
||||
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
|
||||
+const char *(dns_strsection)(enum dns_section section) {
|
||||
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
|
||||
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < lengthof(dns_sections); i++) {
|
||||
@@ -10135,8 +10136,9 @@ static const struct {
|
||||
{ "IN", DNS_C_IN },
|
||||
};
|
||||
|
||||
-const char *(dns_strclass)(enum dns_class type, void *_dst, size_t lim) {
|
||||
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
|
||||
+const char *(dns_strclass)(enum dns_class type) {
|
||||
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
|
||||
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < lengthof(dns_classes); i++) {
|
||||
@@ -10171,8 +10173,9 @@ enum dns_class dns_iclass(const char *name) {
|
||||
} /* dns_iclass() */
|
||||
|
||||
|
||||
-const char *(dns_strtype)(enum dns_type type, void *_dst, size_t lim) {
|
||||
- struct dns_buf dst = DNS_B_INTO(_dst, lim);
|
||||
+const char *(dns_strtype)(enum dns_type type) {
|
||||
+ char _dst[DNS_STRMAXLEN + 1] = { 0 };
|
||||
+ struct dns_buf dst = DNS_B_INTO(_dst, sizeof _dst);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < lengthof(dns_rrtypes); i++) {
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index 30d0b45af..6dedfbc91 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -291,25 +291,15 @@ enum dns_rcode {
|
||||
*/
|
||||
#define DNS_STRMAXLEN 47 /* "QUESTION|ANSWER|AUTHORITY|ADDITIONAL" */
|
||||
|
||||
-DNS_PUBLIC const char *dns_strsection(enum dns_section, void *, size_t);
|
||||
-#define dns_strsection3(a, b, c) \
|
||||
- dns_strsection((a), (b), (c))
|
||||
-#define dns_strsection1(a) dns_strsection((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
|
||||
-#define dns_strsection(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strsection, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
|
||||
+DNS_PUBLIC const char *dns_strsection(enum dns_section);
|
||||
|
||||
DNS_PUBLIC enum dns_section dns_isection(const char *);
|
||||
|
||||
-DNS_PUBLIC const char *dns_strclass(enum dns_class, void *, size_t);
|
||||
-#define dns_strclass3(a, b, c) dns_strclass((a), (b), (c))
|
||||
-#define dns_strclass1(a) dns_strclass((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
|
||||
-#define dns_strclass(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strclass, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
|
||||
+DNS_PUBLIC const char *dns_strclass(enum dns_class);
|
||||
|
||||
DNS_PUBLIC enum dns_class dns_iclass(const char *);
|
||||
|
||||
-DNS_PUBLIC const char *dns_strtype(enum dns_type, void *, size_t);
|
||||
-#define dns_strtype3(a, b, c) dns_strtype((a), (b), (c))
|
||||
-#define dns_strtype1(a) dns_strtype((a), (char [DNS_STRMAXLEN + 1]){ 0 }, DNS_STRMAXLEN + 1)
|
||||
-#define dns_strtype(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_strtype, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
|
||||
+DNS_PUBLIC const char *dns_strtype(enum dns_type);
|
||||
|
||||
DNS_PUBLIC enum dns_type dns_itype(const char *);
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
135
0003-libdns-Avoid-using-compound-literals-3.patch
Normal file
135
0003-libdns-Avoid-using-compound-literals-3.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From 72efb7840258808cd892b90d871ea1cc1c31d7f5 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 10:34:03 +0900
|
||||
Subject: [PATCH 3/8] libdns: Avoid using compound literals (3).
|
||||
|
||||
* dirmngr/dns.h (dns_p_new): Remove.
|
||||
* dirmngr/dns.c (dns_hosts_query): Use dns_p_init with automatic
|
||||
variable.
|
||||
(dns_hints_query, dns_res_glue, parse_packet, query_hosts)
|
||||
(send_query, show_hints, echo_port): Likewise.
|
||||
|
||||
--
|
||||
|
||||
Implicit automatic allocation by compound literals is confusing
|
||||
for C90 code.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.c | 27 ++++++++++++++++++---------
|
||||
dirmngr/dns.h | 3 ---
|
||||
2 files changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 92084d112..6acb4faa2 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -5278,7 +5278,8 @@ error:
|
||||
|
||||
|
||||
struct dns_packet *dns_hosts_query(struct dns_hosts *hosts, struct dns_packet *Q, int *error_) {
|
||||
- struct dns_packet *P = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
+ struct dns_packet *P = dns_p_init(&_P.p, 512);
|
||||
struct dns_packet *A = 0;
|
||||
struct dns_rr rr;
|
||||
struct dns_hosts_entry *ent;
|
||||
@@ -6839,6 +6840,7 @@ unsigned dns_hints_grep(struct sockaddr **sa, socklen_t *sa_len, unsigned lim, s
|
||||
|
||||
|
||||
struct dns_packet *dns_hints_query(struct dns_hints *hints, struct dns_packet *Q, int *error_) {
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
struct dns_packet *A, *P;
|
||||
struct dns_rr rr;
|
||||
char zone[DNS_D_MAXNAME + 1];
|
||||
@@ -6856,7 +6858,7 @@ struct dns_packet *dns_hints_query(struct dns_hints *hints, struct dns_packet *Q
|
||||
else if (zlen >= sizeof zone)
|
||||
goto toolong;
|
||||
|
||||
- P = dns_p_new(512);
|
||||
+ P = dns_p_init(&_P.p, 512);
|
||||
dns_header(P)->qr = 1;
|
||||
|
||||
if ((error = dns_rr_copy(P, &rr, Q)))
|
||||
@@ -8461,7 +8463,8 @@ error:
|
||||
|
||||
|
||||
static struct dns_packet *dns_res_glue(struct dns_resolver *R, struct dns_packet *Q) {
|
||||
- struct dns_packet *P = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
+ struct dns_packet *P = dns_p_init(&_P.p, 512);
|
||||
char qname[DNS_D_MAXNAME + 1];
|
||||
size_t qlen;
|
||||
enum dns_type qtype;
|
||||
@@ -10586,8 +10589,10 @@ static void print_packet(struct dns_packet *P, FILE *fp) {
|
||||
|
||||
|
||||
static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
- struct dns_packet *P = dns_p_new(512);
|
||||
- struct dns_packet *Q = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _Q = { 0 };
|
||||
+ struct dns_packet *P = dns_p_init(&_P.p, 512);
|
||||
+ struct dns_packet *Q = dns_p_init(&_Q.p, 512);
|
||||
enum dns_section section;
|
||||
struct dns_rr rr;
|
||||
int error;
|
||||
@@ -10787,7 +10792,8 @@ static int show_hosts(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
|
||||
|
||||
static int query_hosts(int argc, char *argv[]) {
|
||||
- struct dns_packet *Q = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _Q = { 0 };
|
||||
+ struct dns_packet *Q = dns_p_init(&_Q.p, 512);
|
||||
struct dns_packet *A;
|
||||
char qname[DNS_D_MAXNAME + 1];
|
||||
size_t qlen;
|
||||
@@ -10905,7 +10911,8 @@ static int dump_random(int argc, char *argv[]) {
|
||||
|
||||
|
||||
static int send_query(int argc, char *argv[]) {
|
||||
- struct dns_packet *A, *Q = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _Q = { 0 };
|
||||
+ struct dns_packet *A, *Q = dns_p_init(&_Q.p, 512);
|
||||
char host[INET6_ADDRSTRLEN + 1];
|
||||
struct sockaddr_storage ss;
|
||||
struct dns_socket *so;
|
||||
@@ -10999,9 +11006,10 @@ static int show_hints(int argc, char *argv[]) {
|
||||
if (0 == strcmp(how, "plain")) {
|
||||
dns_hints_dump(hints, stdout);
|
||||
} else {
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
struct dns_packet *query, *answer;
|
||||
|
||||
- query = dns_p_new(512);
|
||||
+ query = dns_p_init(&_P.p, 512);
|
||||
|
||||
if ((error = dns_p_push(query, DNS_S_QUESTION, who, strlen(who), DNS_T_A, DNS_C_IN, 0, 0)))
|
||||
panic("%s: %s", who, dns_strerror(error));
|
||||
@@ -11160,7 +11168,8 @@ static int echo_port(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
panic("127.0.0.1:5353: %s", dns_strerror(errno));
|
||||
|
||||
for (;;) {
|
||||
- struct dns_packet *pkt = dns_p_new(512);
|
||||
+ union { unsigned char b[dns_p_calcsize((512))]; struct dns_packet p; } _P = { 0 };
|
||||
+ struct dns_packet *pkt = dns_p_init(&_P.p, 512);
|
||||
struct sockaddr_storage ss;
|
||||
socklen_t slen = sizeof ss;
|
||||
ssize_t count;
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index 6dedfbc91..4a9417120 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -412,9 +412,6 @@ struct dns_packet {
|
||||
|
||||
#define dns_p_sizeof(P) dns_p_calcsize((P)->end)
|
||||
|
||||
-/** takes size of maximum desired payload */
|
||||
-#define dns_p_new(n) (dns_p_init((struct dns_packet *)&(union { unsigned char b[dns_p_calcsize((n))]; struct dns_packet p; }){ { 0 } }, dns_p_calcsize((n))))
|
||||
-
|
||||
/** takes size of entire packet structure as allocated */
|
||||
DNS_PUBLIC struct dns_packet *dns_p_init(struct dns_packet *, size_t);
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
68
0004-libdns-Avoid-using-compound-literals-4.patch
Normal file
68
0004-libdns-Avoid-using-compound-literals-4.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From 7313a112f9c7ada61d24285313d2e2d069a672e8 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 10:58:16 +0900
|
||||
Subject: [PATCH 4/8] libdns: Avoid using compound literals (4).
|
||||
|
||||
* dirmngr/dns.h (dns_d_new*): Remove.
|
||||
* dirmngr/dns.c (parse_packet): Use dns_d_init with automatic
|
||||
variable.
|
||||
(parse_domain): Likewise.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.c | 8 ++++++--
|
||||
dirmngr/dns.h | 5 -----
|
||||
2 files changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 6acb4faa2..f6a158789 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -10632,8 +10632,11 @@ static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
#if 0
|
||||
dns_rr_foreach(&rr, Q, .name = "ns8.yahoo.com.") {
|
||||
#else
|
||||
+ char _p[DNS_D_MAXNAME + 1] = { 0 };
|
||||
+ const char *dn = "ns8.yahoo.com";
|
||||
+ char *_name = dns_d_init(_p, sizeof _p, dn, strlen (dn), DNS_D_ANCHOR);
|
||||
struct dns_rr rrset[32];
|
||||
- struct dns_rr_i *rri = dns_rr_i_new(Q, .name = dns_d_new("ns8.yahoo.com", DNS_D_ANCHOR), .sort = MAIN.sort);
|
||||
+ struct dns_rr_i *rri = dns_rr_i_new(Q, .name = _name, .sort = MAIN.sort);
|
||||
unsigned rrcount = dns_rr_grep(rrset, lengthof(rrset), rri, Q, &error);
|
||||
|
||||
for (unsigned i = 0; i < rrcount; i++) {
|
||||
@@ -10661,13 +10664,14 @@ static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
|
||||
|
||||
static int parse_domain(int argc, char *argv[]) {
|
||||
+ char _p[DNS_D_MAXNAME + 1] = { 0 };
|
||||
char *dn;
|
||||
|
||||
dn = (argc > 1)? argv[1] : "f.l.google.com";
|
||||
|
||||
printf("[%s]\n", dn);
|
||||
|
||||
- dn = dns_d_new(dn);
|
||||
+ dn = dns_d_init(_p, sizeof _p, dn, strlen (dn), DNS_D_ANCHOR);
|
||||
|
||||
do {
|
||||
puts(dn);
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index 4a9417120..0953228f8 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -451,11 +451,6 @@ DNS_PUBLIC int dns_p_study(struct dns_packet *);
|
||||
#define DNS_D_CLEAVE 2 /* cleave sub-domain */
|
||||
#define DNS_D_TRIM 4 /* remove superfluous dots */
|
||||
|
||||
-#define dns_d_new3(a, b, f) dns_d_init(&(char[DNS_D_MAXNAME + 1]){ 0 }, DNS_D_MAXNAME + 1, (a), (b), (f))
|
||||
-#define dns_d_new2(a, f) dns_d_new3((a), strlen((a)), (f))
|
||||
-#define dns_d_new1(a) dns_d_new3((a), strlen((a)), DNS_D_ANCHOR)
|
||||
-#define dns_d_new(...) DNS_PP_CALL(DNS_PP_XPASTE(dns_d_new, DNS_PP_NARG(__VA_ARGS__)), __VA_ARGS__)
|
||||
-
|
||||
DNS_PUBLIC char *dns_d_init(void *, size_t, const void *, size_t, int);
|
||||
|
||||
DNS_PUBLIC size_t dns_d_anchor(void *, size_t, const void *, size_t);
|
||||
--
|
||||
2.20.1
|
||||
|
52
0005-libdns-Avoid-using-compound-literals-5.patch
Normal file
52
0005-libdns-Avoid-using-compound-literals-5.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From a1ccfe2b37847cce0db2fb94a7365c9fa501eda4 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 11:43:10 +0900
|
||||
Subject: [PATCH 5/8] libdns: Avoid using compound literals (5).
|
||||
|
||||
* dirmngr/dns.h (dns_rr_foreach): Don't use dns_rr_i_new.
|
||||
Call dns_rr_grep with NULL.
|
||||
* dirmngr/dns.c (dns_rr_grep): Support NULL for error_.
|
||||
|
||||
--
|
||||
|
||||
Here we still use C99 feature of struct member initialization in
|
||||
dns_rr_foreach, for struct dns_rr_i. Note that in C99, it guarantees
|
||||
non-specified member fields are initialized by zero. So, there's no
|
||||
need to use dns_rr_i_new at all.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.c | 3 ++-
|
||||
dirmngr/dns.h | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index f6a158789..85fd37fb2 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -3266,7 +3266,8 @@ unsigned dns_rr_grep(struct dns_rr *rr, unsigned lim, struct dns_rr_i *i, struct
|
||||
|
||||
return count;
|
||||
error:
|
||||
- *error_ = error;
|
||||
+ if (error_)
|
||||
+ *error_ = error;
|
||||
|
||||
return count;
|
||||
} /* dns_rr_grep() */
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index 0953228f8..da450c611 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -542,7 +542,7 @@ DNS_PUBLIC struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *, struct dns_packet *
|
||||
DNS_PUBLIC unsigned dns_rr_grep(struct dns_rr *, unsigned, struct dns_rr_i *, struct dns_packet *, int *);
|
||||
|
||||
#define dns_rr_foreach_(rr, P, ...) \
|
||||
- for (struct dns_rr_i DNS_PP_XPASTE(i, __LINE__) = *dns_rr_i_new((P), __VA_ARGS__); dns_rr_grep((rr), 1, &DNS_PP_XPASTE(i, __LINE__), (P), &(int){ 0 }); )
|
||||
+ for (struct dns_rr_i DNS_PP_XPASTE(i, __LINE__) = { __VA_ARGS__ }; dns_rr_grep((rr), 1, &DNS_PP_XPASTE(i, __LINE__), (P), NULL); )
|
||||
|
||||
#define dns_rr_foreach(...) dns_rr_foreach_(__VA_ARGS__)
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
289
0006-libdns-Avoid-using-compound-literals-6.patch
Normal file
289
0006-libdns-Avoid-using-compound-literals-6.patch
Normal file
@ -0,0 +1,289 @@
|
||||
From 6501e59d3685bb58753c9caea729a4b0eca3942a Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 11:55:32 +0900
|
||||
Subject: [PATCH 6/8] libdns: Avoid using compound literals (6).
|
||||
|
||||
* dirmngr/dns.h (dns_rr_i_new): Remove.
|
||||
(dns_rr_i_init): Remove unused second argument.
|
||||
* dirmngr/dns.c (dns_p_dump, dns_hints_query, print_packet)
|
||||
(parse_packet): Use automatic variable for struct dns_rr_i.
|
||||
(dns_d_cname): No need to call dns_rr_i_init after memset 0.
|
||||
(dns_rr_i_init): Remove unused second argument. Return nothing.
|
||||
* dirmngr/dns-stuff.c (resolve_addr_libdns, get_dns_cert_libdns)
|
||||
(getsrv_libdns): Follow the change of dns_rr_i_init.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns-stuff.c | 6 ++--
|
||||
dirmngr/dns.c | 73 +++++++++++++++++++++++++++++----------------
|
||||
dirmngr/dns.h | 5 +---
|
||||
3 files changed, 51 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
|
||||
index 7aa07c716..a1aa3145e 100644
|
||||
--- a/dirmngr/dns-stuff.c
|
||||
+++ b/dirmngr/dns-stuff.c
|
||||
@@ -1168,7 +1168,7 @@ resolve_addr_libdns (ctrl_t ctrl,
|
||||
struct dns_rr_i rri;
|
||||
|
||||
memset (&rri, 0, sizeof rri);
|
||||
- dns_rr_i_init (&rri, ans);
|
||||
+ dns_rr_i_init (&rri);
|
||||
rri.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
rri.name = host;
|
||||
rri.type = DNS_T_PTR;
|
||||
@@ -1459,7 +1459,7 @@ get_dns_cert_libdns (ctrl_t ctrl, const char *name, int want_certtype,
|
||||
goto leave;
|
||||
|
||||
memset (&rri, 0, sizeof rri);
|
||||
- dns_rr_i_init (&rri, ans);
|
||||
+ dns_rr_i_init (&rri);
|
||||
rri.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
rri.name = host;
|
||||
rri.type = qtype;
|
||||
@@ -1889,7 +1889,7 @@ getsrv_libdns (ctrl_t ctrl,
|
||||
goto leave;
|
||||
|
||||
memset (&rri, 0, sizeof rri);
|
||||
- dns_rr_i_init (&rri, ans);
|
||||
+ dns_rr_i_init (&rri);
|
||||
rri.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
rri.name = host;
|
||||
rri.type = DNS_T_SRV;
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 85fd37fb2..9da44cd77 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -2217,7 +2217,8 @@ static void dns_p_dump3(struct dns_packet *P, struct dns_rr_i *I, FILE *fp) {
|
||||
|
||||
|
||||
void dns_p_dump(struct dns_packet *P, FILE *fp) {
|
||||
- dns_p_dump3(P, dns_rr_i_new(P, .section = 0), fp);
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
+ dns_p_dump3(P, &_I, fp);
|
||||
} /* dns_p_dump() */
|
||||
|
||||
|
||||
@@ -2796,8 +2797,7 @@ size_t dns_d_cname(void *dst, size_t lim, const void *dn, size_t len, struct dns
|
||||
{ error = ENAMETOOLONG; goto error; }
|
||||
|
||||
for (depth = 0; depth < 7; depth++) {
|
||||
- dns_rr_i_init(memset(&i, 0, sizeof i), P);
|
||||
-
|
||||
+ memset(&i, 0, sizeof i);
|
||||
i.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
i.name = host;
|
||||
i.type = DNS_T_CNAME;
|
||||
@@ -3222,15 +3222,11 @@ int dns_rr_i_shuffle(struct dns_rr *a, struct dns_rr *b, struct dns_rr_i *i, str
|
||||
} /* dns_rr_i_shuffle() */
|
||||
|
||||
|
||||
-struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *i, struct dns_packet *P) {
|
||||
+void dns_rr_i_init(struct dns_rr_i *i) {
|
||||
static const struct dns_rr_i i_initializer;
|
||||
|
||||
- (void)P;
|
||||
-
|
||||
i->state = i_initializer.state;
|
||||
i->saved = i->state;
|
||||
-
|
||||
- return i;
|
||||
} /* dns_rr_i_init() */
|
||||
|
||||
|
||||
@@ -6850,8 +6846,11 @@ struct dns_packet *dns_hints_query(struct dns_hints *hints, struct dns_packet *Q
|
||||
struct sockaddr *sa;
|
||||
socklen_t slen;
|
||||
int error;
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
|
||||
- if (!dns_rr_grep(&rr, 1, dns_rr_i_new(Q, .section = DNS_S_QUESTION), Q, &error))
|
||||
+ _I.section = DNS_S_QUESTION;
|
||||
+
|
||||
+ if (!dns_rr_grep(&rr, 1, &_I, Q, &error))
|
||||
goto error;
|
||||
|
||||
if (!(zlen = dns_d_expand(zone, sizeof zone, rr.dn.p, Q, &error)))
|
||||
@@ -8537,12 +8536,22 @@ static int dns_res_nameserv_cmp(struct dns_rr *a, struct dns_rr *b, struct dns_r
|
||||
struct dns_ns ns;
|
||||
int cmp, error;
|
||||
|
||||
- if (!(error = dns_ns_parse(&ns, a, P)))
|
||||
- glued[0] = !!dns_rr_grep(&x, 1, dns_rr_i_new(P, .section = (DNS_S_ALL & ~DNS_S_QD), .name = ns.host, .type = DNS_T_A), P, &error);
|
||||
+ if (!(error = dns_ns_parse(&ns, a, P))) {
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
|
||||
- if (!(error = dns_ns_parse(&ns, b, P)))
|
||||
- glued[1] = !!dns_rr_grep(&y, 1, dns_rr_i_new(P, .section = (DNS_S_ALL & ~DNS_S_QD), .name = ns.host, .type = DNS_T_A), P, &error);
|
||||
+ _I.section = (DNS_S_ALL & ~DNS_S_QD);
|
||||
+ _I.name = ns.host;
|
||||
+ _I.type = DNS_T_A;
|
||||
+ glued[0] = !!dns_rr_grep(&x, 1, &_I, P, &error);
|
||||
+ }
|
||||
+ if (!(error = dns_ns_parse(&ns, b, P))) {
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
|
||||
+ _I.section = (DNS_S_ALL & ~DNS_S_QD);
|
||||
+ _I.name = ns.host;
|
||||
+ _I.type = DNS_T_A;
|
||||
+ glued[1] = !!dns_rr_grep(&y, 1, &_I, P, &error);
|
||||
+ }
|
||||
if ((cmp = glued[1] - glued[0])) {
|
||||
return cmp;
|
||||
} else if ((cmp = (dns_rr_offset(&y) < i->args[0]) - (dns_rr_offset(&x) < i->args[0]))) {
|
||||
@@ -8743,7 +8752,7 @@ exec:
|
||||
|
||||
F->state++; /* FALL THROUGH */
|
||||
case DNS_R_ITERATE:
|
||||
- dns_rr_i_init(&F->hints_i, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_i);
|
||||
|
||||
F->hints_i.section = DNS_S_AUTHORITY;
|
||||
F->hints_i.type = DNS_T_NS;
|
||||
@@ -8762,7 +8771,7 @@ exec:
|
||||
dgoto(R->sp, DNS_R_SWITCH);
|
||||
}
|
||||
|
||||
- dns_rr_i_init(&F->hints_j, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_j);
|
||||
|
||||
/* Assume there are glue records */
|
||||
dgoto(R->sp, DNS_R_FOREACH_A);
|
||||
@@ -8815,14 +8824,14 @@ exec:
|
||||
if (!dns_rr_i_count(&F->hints_j)) {
|
||||
/* Check if we have in fact servers
|
||||
with an IPv6 address. */
|
||||
- dns_rr_i_init(&F->hints_j, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_j);
|
||||
F->hints_j.name = u.ns.host;
|
||||
F->hints_j.type = DNS_T_AAAA;
|
||||
F->hints_j.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
if (dns_rr_grep(&rr, 1, &F->hints_j, F->hints, &error)) {
|
||||
/* We do. Reinitialize
|
||||
iterator and handle it. */
|
||||
- dns_rr_i_init(&F->hints_j, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_j);
|
||||
dgoto(R->sp, DNS_R_FOREACH_AAAA);
|
||||
}
|
||||
|
||||
@@ -8951,14 +8960,14 @@ exec:
|
||||
if (!dns_rr_i_count(&F->hints_j)) {
|
||||
/* Check if we have in fact servers
|
||||
with an IPv4 address. */
|
||||
- dns_rr_i_init(&F->hints_j, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_j);
|
||||
F->hints_j.name = u.ns.host;
|
||||
F->hints_j.type = DNS_T_A;
|
||||
F->hints_j.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
if (dns_rr_grep(&rr, 1, &F->hints_j, F->hints, &error)) {
|
||||
/* We do. Reinitialize
|
||||
iterator and handle it. */
|
||||
- dns_rr_i_init(&F->hints_j, F->hints);
|
||||
+ dns_rr_i_init(&F->hints_j);
|
||||
dgoto(R->sp, DNS_R_FOREACH_A);
|
||||
}
|
||||
|
||||
@@ -9096,7 +9105,7 @@ exec:
|
||||
R->smart.section = DNS_S_AN;
|
||||
R->smart.type = R->qtype;
|
||||
|
||||
- dns_rr_i_init(&R->smart, F->answer);
|
||||
+ dns_rr_i_init(&R->smart);
|
||||
|
||||
F->state++; /* FALL THROUGH */
|
||||
case DNS_R_SMART0_A:
|
||||
@@ -9840,7 +9849,7 @@ exec:
|
||||
return error;
|
||||
|
||||
dns_strlcpy(ai->i_cname, ai->cname, sizeof ai->i_cname);
|
||||
- dns_rr_i_init(&ai->i, ai->answer);
|
||||
+ dns_rr_i_init(&ai->i);
|
||||
ai->i.section = DNS_S_AN;
|
||||
ai->i.name = ai->i_cname;
|
||||
ai->i.type = dns_ai_qtype(ai);
|
||||
@@ -9887,7 +9896,7 @@ exec:
|
||||
ai->state++; /* FALL THROUGH */
|
||||
case DNS_AI_S_ITERATE_G:
|
||||
dns_strlcpy(ai->g_cname, ai->cname, sizeof ai->g_cname);
|
||||
- dns_rr_i_init(&ai->g, ai->glue);
|
||||
+ dns_rr_i_init(&ai->g);
|
||||
ai->g.section = DNS_S_ALL & ~DNS_S_QD;
|
||||
ai->g.name = ai->g_cname;
|
||||
ai->g.type = ai->af.qtype;
|
||||
@@ -9906,8 +9915,14 @@ exec:
|
||||
|
||||
return dns_ai_setent(ent, &any, rr.type, ai);
|
||||
case DNS_AI_S_SUBMIT_G:
|
||||
+ {
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
+
|
||||
+ _I.section = DNS_S_QD;
|
||||
+ _I.name = ai->g.name;
|
||||
+ _I.type = ai->g.type;
|
||||
/* skip if already queried */
|
||||
- if (dns_rr_grep(&rr, 1, dns_rr_i_new(ai->glue, .section = DNS_S_QD, .name = ai->g.name, .type = ai->g.type), ai->glue, &error))
|
||||
+ if (dns_rr_grep(&rr, 1, &_I, ai->glue, &error))
|
||||
dns_ai_goto(DNS_AI_S_FOREACH_I);
|
||||
/* skip if we recursed (CNAME chains should have been handled in the resolver) */
|
||||
if (++ai->g_depth > 1)
|
||||
@@ -9916,7 +9931,8 @@ exec:
|
||||
if ((error = dns_res_submit(ai->res, ai->g.name, ai->g.type, DNS_C_IN)))
|
||||
return error;
|
||||
|
||||
- ai->state++; /* FALL THROUGH */
|
||||
+ ai->state++;
|
||||
+ } /* FALL THROUGH */
|
||||
case DNS_AI_S_CHECK_G:
|
||||
if ((error = dns_res_check(ai->res)))
|
||||
return error;
|
||||
@@ -10582,7 +10598,9 @@ static struct dns_trace *trace(const char *mode) {
|
||||
|
||||
|
||||
static void print_packet(struct dns_packet *P, FILE *fp) {
|
||||
- dns_p_dump3(P, dns_rr_i_new(P, .sort = MAIN.sort), fp);
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
+ I.sort = MAIN.sort;
|
||||
+ dns_p_dump3(P, &I, fp);
|
||||
|
||||
if (MAIN.verbose > 2)
|
||||
hexdump(P->data, P->end, fp);
|
||||
@@ -10637,9 +10655,12 @@ static int parse_packet(int argc DNS_NOTUSED, char *argv[] DNS_NOTUSED) {
|
||||
const char *dn = "ns8.yahoo.com";
|
||||
char *_name = dns_d_init(_p, sizeof _p, dn, strlen (dn), DNS_D_ANCHOR);
|
||||
struct dns_rr rrset[32];
|
||||
- struct dns_rr_i *rri = dns_rr_i_new(Q, .name = _name, .sort = MAIN.sort);
|
||||
+ struct dns_rr_i _I = { 0 };
|
||||
+ struct dns_rr_i *rri = &I;
|
||||
unsigned rrcount = dns_rr_grep(rrset, lengthof(rrset), rri, Q, &error);
|
||||
|
||||
+ I.name = _name;
|
||||
+ I.sort = MAIN.sort;
|
||||
for (unsigned i = 0; i < rrcount; i++) {
|
||||
rr = rrset[i];
|
||||
#endif
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index da450c611..49b1c78bb 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -503,9 +503,6 @@ DNS_PUBLIC int dns_rr_cmp(struct dns_rr *, struct dns_packet *, struct dns_rr *,
|
||||
DNS_PUBLIC size_t dns_rr_print(void *, size_t, struct dns_rr *, struct dns_packet *, int *);
|
||||
|
||||
|
||||
-#define dns_rr_i_new(P, ...) \
|
||||
- dns_rr_i_init(&dns_quietinit((struct dns_rr_i){ 0, __VA_ARGS__ }), (P))
|
||||
-
|
||||
struct dns_rr_i {
|
||||
enum dns_section section;
|
||||
const void *name;
|
||||
@@ -533,7 +530,7 @@ DNS_PUBLIC int dns_rr_i_order(struct dns_rr *, struct dns_rr *, struct dns_rr_i
|
||||
|
||||
DNS_PUBLIC int dns_rr_i_shuffle(struct dns_rr *, struct dns_rr *, struct dns_rr_i *, struct dns_packet *);
|
||||
|
||||
-DNS_PUBLIC struct dns_rr_i *dns_rr_i_init(struct dns_rr_i *, struct dns_packet *);
|
||||
+DNS_PUBLIC void dns_rr_i_init(struct dns_rr_i *);
|
||||
|
||||
#define dns_rr_i_save(i) ((i)->saved = (i)->state)
|
||||
#define dns_rr_i_rewind(i) ((i)->state = (i)->saved)
|
||||
--
|
||||
2.20.1
|
||||
|
130
0007-libdns-Avoid-using-compound-literals-7.patch
Normal file
130
0007-libdns-Avoid-using-compound-literals-7.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From d661acd483236d34720a4959fc816d05f89c2cb7 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 12:13:35 +0900
|
||||
Subject: [PATCH 7/8] libdns: Avoid using compound literals (7).
|
||||
|
||||
* dirmngr/dns.h (DNS_OPTS_INIT, dns_opts): Remove.
|
||||
* dirmngr/dns-stuff.c (libdns_res_open): Use zero-ed, and initialized
|
||||
automatic variable for opts.
|
||||
* dirmngr/dns.c (send_query, resolve_query, resolve_addrinfo):
|
||||
Likewise.
|
||||
|
||||
--
|
||||
|
||||
In fact, DNS_OPTS_INIT was only needed when args are none. With
|
||||
partially specified initialization, C99 guarantees zero-ed other
|
||||
members just like static object.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns-stuff.c | 10 ++++++----
|
||||
dirmngr/dns.c | 15 ++++++++++-----
|
||||
dirmngr/dns.h | 3 ---
|
||||
3 files changed, 16 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
|
||||
index a1aa3145e..e48aca730 100644
|
||||
--- a/dirmngr/dns-stuff.c
|
||||
+++ b/dirmngr/dns-stuff.c
|
||||
@@ -701,6 +701,11 @@ libdns_res_open (ctrl_t ctrl, struct dns_resolver **r_res)
|
||||
gpg_error_t err;
|
||||
struct dns_resolver *res;
|
||||
int derr;
|
||||
+ struct dns_options opts = { 0 };
|
||||
+
|
||||
+ opts.socks_host = &libdns.socks_host;
|
||||
+ opts.socks_user = tor_socks_user;
|
||||
+ opts.socks_password = tor_socks_password;
|
||||
|
||||
*r_res = NULL;
|
||||
|
||||
@@ -726,10 +731,7 @@ libdns_res_open (ctrl_t ctrl, struct dns_resolver **r_res)
|
||||
set_dns_timeout (0);
|
||||
|
||||
res = dns_res_open (libdns.resolv_conf, libdns.hosts, libdns.hints, NULL,
|
||||
- dns_opts (.socks_host = &libdns.socks_host,
|
||||
- .socks_user = tor_socks_user,
|
||||
- .socks_password = tor_socks_password ),
|
||||
- &derr);
|
||||
+ &opts, &derr);
|
||||
if (!res)
|
||||
return libdns_error_to_gpg_error (derr);
|
||||
|
||||
diff --git a/dirmngr/dns.c b/dirmngr/dns.c
|
||||
index 9da44cd77..fa5e5283d 100644
|
||||
--- a/dirmngr/dns.c
|
||||
+++ b/dirmngr/dns.c
|
||||
@@ -10943,6 +10943,7 @@ static int send_query(int argc, char *argv[]) {
|
||||
struct sockaddr_storage ss;
|
||||
struct dns_socket *so;
|
||||
int error, type;
|
||||
+ struct dns_options opts = { 0 };
|
||||
|
||||
memset(&ss, 0, sizeof ss);
|
||||
if (argc > 1) {
|
||||
@@ -10977,7 +10978,7 @@ static int send_query(int argc, char *argv[]) {
|
||||
|
||||
fprintf(stderr, "querying %s for %s IN %s\n", host, MAIN.qname, dns_strtype(MAIN.qtype));
|
||||
|
||||
- if (!(so = dns_so_open((struct sockaddr *)&resconf()->iface, type, dns_opts(), &error)))
|
||||
+ if (!(so = dns_so_open((struct sockaddr *)&resconf()->iface, type, &opts, &error)))
|
||||
panic("dns_so_open: %s", dns_strerror(error));
|
||||
|
||||
while (!(A = dns_so_query(so, Q, (struct sockaddr *)&ss, &error))) {
|
||||
@@ -11061,6 +11062,11 @@ static int resolve_query(int argc DNS_NOTUSED, char *argv[]) {
|
||||
struct dns_packet *ans;
|
||||
const struct dns_stat *st;
|
||||
int error;
|
||||
+ struct dns_options opts = { 0 };
|
||||
+
|
||||
+ opts.socks_host = &MAIN.socks_host;
|
||||
+ opts.socks_user = MAIN.socks_user;
|
||||
+ opts.socks_password = MAIN.socks_password;
|
||||
|
||||
if (!MAIN.qname)
|
||||
MAIN.qname = "www.google.com";
|
||||
@@ -11070,9 +11076,7 @@ static int resolve_query(int argc DNS_NOTUSED, char *argv[]) {
|
||||
resconf()->options.recurse = recurse;
|
||||
|
||||
if (!(R = dns_res_open(resconf(), hosts(), dns_hints_mortal(hints(resconf(), &error)), cache(),
|
||||
- dns_opts(.socks_host=&MAIN.socks_host,
|
||||
- .socks_user=MAIN.socks_user,
|
||||
- .socks_password=MAIN.socks_password), &error)))
|
||||
+ &opts, &error)))
|
||||
panic("%s: %s", MAIN.qname, dns_strerror(error));
|
||||
|
||||
dns_res_settrace(R, trace("w+b"));
|
||||
@@ -11116,6 +11120,7 @@ static int resolve_addrinfo(int argc DNS_NOTUSED, char *argv[]) {
|
||||
struct addrinfo *ent;
|
||||
char pretty[512];
|
||||
int error;
|
||||
+ struct dns_options opts = { 0 };
|
||||
|
||||
if (!MAIN.qname)
|
||||
MAIN.qname = "www.google.com";
|
||||
@@ -11123,7 +11128,7 @@ static int resolve_addrinfo(int argc DNS_NOTUSED, char *argv[]) {
|
||||
|
||||
resconf()->options.recurse = recurse;
|
||||
|
||||
- if (!(res = dns_res_open(resconf(), hosts(), dns_hints_mortal(hints(resconf(), &error)), cache(), dns_opts(), &error)))
|
||||
+ if (!(res = dns_res_open(resconf(), hosts(), dns_hints_mortal(hints(resconf(), &error)), cache(), &opts, &error)))
|
||||
panic("%s: %s", MAIN.qname, dns_strerror(error));
|
||||
|
||||
if (!(ai = dns_ai_open(MAIN.qname, "80", MAIN.qtype, &ai_hints, res, &error)))
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index 49b1c78bb..afc19a19a 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -1032,9 +1032,6 @@ DNS_PUBLIC void dns_cache_close(struct dns_cache *);
|
||||
|
||||
#define DNS_OPTS_INITIALIZER_ { 0, 0 }, 0, 0
|
||||
#define DNS_OPTS_INITIALIZER { DNS_OPTS_INITIALIZER_ }
|
||||
-#define DNS_OPTS_INIT(...) { DNS_OPTS_INITIALIZER_, __VA_ARGS__ }
|
||||
-
|
||||
-#define dns_opts(...) (&dns_quietinit((struct dns_options)DNS_OPTS_INIT(__VA_ARGS__)))
|
||||
|
||||
struct dns_options {
|
||||
/*
|
||||
--
|
||||
2.20.1
|
||||
|
76
0008-libdns-Avoid-using-compound-literals-8.patch
Normal file
76
0008-libdns-Avoid-using-compound-literals-8.patch
Normal file
@ -0,0 +1,76 @@
|
||||
From 371ae25f8f6f2d1ac030bf984bca479393a5ed43 Mon Sep 17 00:00:00 2001
|
||||
From: NIIBE Yutaka <gniibe@fsij.org>
|
||||
Date: Tue, 26 Feb 2019 12:26:02 +0900
|
||||
Subject: [PATCH 8/8] libdns: Avoid using compound literals (8).
|
||||
|
||||
* dirmngr/dns.h (dns_quietinit): Remove.
|
||||
(dns_hints_i_new): Remove.
|
||||
|
||||
--
|
||||
|
||||
Even before our change, dns_quietinit was questionable macro; There
|
||||
was no place in dns.c which requires overrides in initializer list.
|
||||
Only redundant zero were.
|
||||
|
||||
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
||||
---
|
||||
dirmngr/dns.h | 20 --------------------
|
||||
1 file changed, 20 deletions(-)
|
||||
|
||||
diff --git a/dirmngr/dns.h b/dirmngr/dns.h
|
||||
index afc19a19a..024d6dcc8 100644
|
||||
--- a/dirmngr/dns.h
|
||||
+++ b/dirmngr/dns.h
|
||||
@@ -132,19 +132,6 @@ DNS_PUBLIC int *dns_debug_p(void);
|
||||
/*
|
||||
* C O M P I L E R A N N O T A T I O N S
|
||||
*
|
||||
- * GCC with -Wextra, and clang by default, complain about overrides in
|
||||
- * initializer lists. Overriding previous member initializers is well
|
||||
- * defined behavior in C. dns.c relies on this behavior to define default,
|
||||
- * overrideable member values when instantiating configuration objects.
|
||||
- *
|
||||
- * dns_quietinit() guards a compound literal expression with pragmas to
|
||||
- * silence these shrill warnings. This alleviates the burden of requiring
|
||||
- * third-party projects to adjust their compiler flags.
|
||||
- *
|
||||
- * NOTE: If you take the address of the compound literal, take the address
|
||||
- * of the transformed expression, otherwise the compound literal lifetime is
|
||||
- * tied to the scope of the GCC statement expression.
|
||||
- *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if defined __clang__
|
||||
@@ -152,21 +139,15 @@ DNS_PUBLIC int *dns_debug_p(void);
|
||||
#define DNS_PRAGMA_QUIET _Pragma("clang diagnostic ignored \"-Winitializer-overrides\"")
|
||||
#define DNS_PRAGMA_POP _Pragma("clang diagnostic pop")
|
||||
|
||||
-#define dns_quietinit(...) \
|
||||
- DNS_PRAGMA_PUSH DNS_PRAGMA_QUIET __VA_ARGS__ DNS_PRAGMA_POP
|
||||
#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4
|
||||
#define DNS_PRAGMA_PUSH _Pragma("GCC diagnostic push")
|
||||
#define DNS_PRAGMA_QUIET _Pragma("GCC diagnostic ignored \"-Woverride-init\"")
|
||||
#define DNS_PRAGMA_POP _Pragma("GCC diagnostic pop")
|
||||
|
||||
-/* GCC parses the _Pragma operator less elegantly than clang. */
|
||||
-#define dns_quietinit(...) \
|
||||
- __extension__ ({ DNS_PRAGMA_PUSH DNS_PRAGMA_QUIET __VA_ARGS__; DNS_PRAGMA_POP })
|
||||
#else
|
||||
#define DNS_PRAGMA_PUSH
|
||||
#define DNS_PRAGMA_QUIET
|
||||
#define DNS_PRAGMA_POP
|
||||
-#define dns_quietinit(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
@@ -980,7 +961,6 @@ struct dns_hints_i {
|
||||
} state;
|
||||
}; /* struct dns_hints_i */
|
||||
|
||||
-#define dns_hints_i_new(...) (&(struct dns_hints_i){ __VA_ARGS__ })
|
||||
|
||||
DNS_PUBLIC unsigned dns_hints_grep(struct sockaddr **, socklen_t *, unsigned, struct dns_hints_i *, struct dns_hints *);
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
16
gpg2.changes
16
gpg2.changes
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 26 11:35:29 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
|
||||
|
||||
- Fix build with gcc9 [bsc#1121223]
|
||||
* Avoid using compound literals
|
||||
- Upstream bug: https://dev.gnupg.org/T4367
|
||||
* Added upstream patches:
|
||||
- 0001-libdns-Avoid-using-compound-literals.patch
|
||||
- 0002-libdns-Avoid-using-compound-literals-2.patch
|
||||
- 0003-libdns-Avoid-using-compound-literals-3.patch
|
||||
- 0004-libdns-Avoid-using-compound-literals-4.patch
|
||||
- 0005-libdns-Avoid-using-compound-literals-5.patch
|
||||
- 0006-libdns-Avoid-using-compound-literals-6.patch
|
||||
- 0007-libdns-Avoid-using-compound-literals-7.patch
|
||||
- 0008-libdns-Avoid-using-compound-literals-8.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 22 19:30:29 UTC 2019 - olaf@aepfle.de
|
||||
|
||||
|
26
gpg2.spec
26
gpg2.spec
@ -36,6 +36,14 @@ Patch6: gnupg-dont-fail-with-seahorse-agent.patch
|
||||
Patch8: gnupg-set_umask_before_open_outfile.patch
|
||||
Patch9: gnupg-detect_FIPS_mode.patch
|
||||
Patch11: gnupg-add_legacy_FIPS_mode_option.patch
|
||||
Patch12: 0001-libdns-Avoid-using-compound-literals.patch
|
||||
Patch13: 0002-libdns-Avoid-using-compound-literals-2.patch
|
||||
Patch14: 0003-libdns-Avoid-using-compound-literals-3.patch
|
||||
Patch15: 0004-libdns-Avoid-using-compound-literals-4.patch
|
||||
Patch16: 0005-libdns-Avoid-using-compound-literals-5.patch
|
||||
Patch17: 0006-libdns-Avoid-using-compound-literals-6.patch
|
||||
Patch18: 0007-libdns-Avoid-using-compound-literals-7.patch
|
||||
Patch19: 0008-libdns-Avoid-using-compound-literals-8.patch
|
||||
BuildRequires: expect
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: libassuan-devel >= 2.5.0
|
||||
@ -87,6 +95,14 @@ gpg2 provides GPGSM, gpg-agent, and a keybox library.
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
touch -d 2018-05-04 doc/gpg.texi # to compensate for patch11 in order to not have man pages and info files have the build date (boo#1047218)
|
||||
|
||||
%build
|
||||
@ -128,23 +144,23 @@ ln -sf gpg2.1 %{buildroot}%{_mandir}/man1/gpg.1
|
||||
ln -sf gpgv2.1 %{buildroot}%{_mandir}/man1/gpgv.1
|
||||
# fix rpmlint invalid-lc-messages-dir:
|
||||
rm -rf %{buildroot}/%{_datadir}/locale/en@{bold,}quot
|
||||
# install scdaemon to %{_bindir} (bnc#863645)
|
||||
# install scdaemon to %%{_bindir} (bnc#863645)
|
||||
mv %{buildroot}%{_libdir}/scdaemon %{buildroot}%{_bindir}
|
||||
mv %{buildroot}%{_libdir}/dirmngr_ldap %{buildroot}%{_bindir}
|
||||
# install udev rules for scdaemon
|
||||
install -Dm 0644 %{SOURCE4} %{buildroot}%{_udevrulesdir}/60-scdaemon.rules
|
||||
# install legacy tools
|
||||
install -m 755 tools/gpg-zip %{buildroot}/%{_bindir}
|
||||
# install -m 755 tools/gpgsplit %{buildroot}/%{_bindir}
|
||||
# install -m 755 tools/gpgsplit %%{buildroot}/%%{_bindir}
|
||||
|
||||
%find_lang gnupg2
|
||||
%fdupes -s %{buildroot}
|
||||
|
||||
%check
|
||||
# Run only localy, fails in OBS
|
||||
#%if ! 0%{?qemu_user_space_build}
|
||||
#make %{?_smp_mflags} check
|
||||
#%endif
|
||||
#%%if ! 0%%{?qemu_user_space_build}
|
||||
#make %%{?_smp_mflags} check
|
||||
#%%endif
|
||||
|
||||
%post
|
||||
%udev_rules_update
|
||||
|
Loading…
Reference in New Issue
Block a user