Fossil SCM

Replaced the call to the undocumented ns_name_uncompress() function with dn_expand(), which is documented, at least on OpenBSD, and it's shorter. Then made ns_name_uncompress() and __ns_name_uncompress() fallbacks for this, with suitable autosetup tests for all of it.

wyoung 2018-09-22 16:38 libbind-ns-alternative
Commit d0fb5ac7cae085d60804115d7abfbfbbd9596a98da620e2e530b151c21b3aa46
2 files changed +5 -3 +7 -5
+5 -3
--- auto.def
+++ auto.def
@@ -520,15 +520,17 @@
520520
# record lookups and such.
521521
cc-check-includes arpa/nameser.h
522522
cc-include-needs bind/resolv.h netinet/in.h
523523
cc-check-includes bind/resolv.h
524524
cc-check-includes resolv.h
525
-if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] &&
526
- ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} {
525
+if { (![cc-check-function-in-lib dn_expand resolv] ||
526
+ ![cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
527
+ ![cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
528
+ (![cc-check-function-in-lib res_query {bind resolv}] ||
529
+ ![cc-check-function-in-lib __res_query {bind resolv}])} {
527530
msg-result "WARNING: SMTP feature will not be able to look up local MX."
528531
}
529
-cc-check-function-in-lib res_query resolv
530532
cc-check-function-in-lib res_9_ns_initparse resolv
531533
532534
# Other nonstandard function checks
533535
cc-check-functions utime
534536
cc-check-functions usleep
535537
--- auto.def
+++ auto.def
@@ -520,15 +520,17 @@
520 # record lookups and such.
521 cc-check-includes arpa/nameser.h
522 cc-include-needs bind/resolv.h netinet/in.h
523 cc-check-includes bind/resolv.h
524 cc-check-includes resolv.h
525 if { ![cc-check-function-in-lib ns_name_uncompress {resolv bind}] &&
526 ![cc-check-function-in-lib __ns_name_uncompress {resolv bind}]} {
 
 
 
527 msg-result "WARNING: SMTP feature will not be able to look up local MX."
528 }
529 cc-check-function-in-lib res_query resolv
530 cc-check-function-in-lib res_9_ns_initparse resolv
531
532 # Other nonstandard function checks
533 cc-check-functions utime
534 cc-check-functions usleep
535
--- auto.def
+++ auto.def
@@ -520,15 +520,17 @@
520 # record lookups and such.
521 cc-check-includes arpa/nameser.h
522 cc-include-needs bind/resolv.h netinet/in.h
523 cc-check-includes bind/resolv.h
524 cc-check-includes resolv.h
525 if { (![cc-check-function-in-lib dn_expand resolv] ||
526 ![cc-check-function-in-lib ns_name_uncompress {bind resolv}] ||
527 ![cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
528 (![cc-check-function-in-lib res_query {bind resolv}] ||
529 ![cc-check-function-in-lib __res_query {bind resolv}])} {
530 msg-result "WARNING: SMTP feature will not be able to look up local MX."
531 }
 
532 cc-check-function-in-lib res_9_ns_initparse resolv
533
534 # Other nonstandard function checks
535 cc-check-functions utime
536 cc-check-functions usleep
537
+7 -5
--- src/smtp.c
+++ src/smtp.c
@@ -19,11 +19,11 @@
1919
** to RFC 5321.
2020
*/
2121
#include "config.h"
2222
#include "smtp.h"
2323
#include <assert.h>
24
-#if HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \
24
+#if HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \
2525
(defined(__linux__) && !defined(FOSSIL_OMIT_DNS))
2626
# include <sys/types.h>
2727
# include <netinet/in.h>
2828
# if defined(HAVE_BIND_RESOLV_H)
2929
# include <bind/resolv.h>
@@ -30,12 +30,15 @@
3030
# include <bind/arpa/nameser_compat.h>
3131
# else
3232
# include <arpa/nameser.h>
3333
# include <resolv.h>
3434
# endif
35
-# if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(ns_name_uncompress)
36
-# define ns_name_uncompress __ns_name_uncompress
35
+# if defined(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand)
36
+# define dn_expand ns_name_uncompress
37
+# endif
38
+# if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand)
39
+# define dn_expand __ns_name_uncompress
3740
# endif
3841
# define FOSSIL_UNIX_STYLE_DNS 1
3942
#endif
4043
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
4144
# include <windows.h>
@@ -86,12 +89,11 @@
8689
iBestPriority = priority;
8790
}
8891
}
8992
}
9093
if( pBest ){
91
- ns_name_uncompress(aDns, aDns+nDns, pBest+2,
92
- zHostname, sizeof(zHostname));
94
+ dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname));
9395
return fossil_strdup(zHostname);
9496
}
9597
return 0;
9698
#elif defined(FOSSIL_WINDOWS_STYLE_DNS)
9799
DNS_STATUS status; /* Return status */
98100
--- src/smtp.c
+++ src/smtp.c
@@ -19,11 +19,11 @@
19 ** to RFC 5321.
20 */
21 #include "config.h"
22 #include "smtp.h"
23 #include <assert.h>
24 #if HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \
25 (defined(__linux__) && !defined(FOSSIL_OMIT_DNS))
26 # include <sys/types.h>
27 # include <netinet/in.h>
28 # if defined(HAVE_BIND_RESOLV_H)
29 # include <bind/resolv.h>
@@ -30,12 +30,15 @@
30 # include <bind/arpa/nameser_compat.h>
31 # else
32 # include <arpa/nameser.h>
33 # include <resolv.h>
34 # endif
35 # if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(ns_name_uncompress)
36 # define ns_name_uncompress __ns_name_uncompress
 
 
 
37 # endif
38 # define FOSSIL_UNIX_STYLE_DNS 1
39 #endif
40 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
41 # include <windows.h>
@@ -86,12 +89,11 @@
86 iBestPriority = priority;
87 }
88 }
89 }
90 if( pBest ){
91 ns_name_uncompress(aDns, aDns+nDns, pBest+2,
92 zHostname, sizeof(zHostname));
93 return fossil_strdup(zHostname);
94 }
95 return 0;
96 #elif defined(FOSSIL_WINDOWS_STYLE_DNS)
97 DNS_STATUS status; /* Return status */
98
--- src/smtp.c
+++ src/smtp.c
@@ -19,11 +19,11 @@
19 ** to RFC 5321.
20 */
21 #include "config.h"
22 #include "smtp.h"
23 #include <assert.h>
24 #if HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRES || \
25 (defined(__linux__) && !defined(FOSSIL_OMIT_DNS))
26 # include <sys/types.h>
27 # include <netinet/in.h>
28 # if defined(HAVE_BIND_RESOLV_H)
29 # include <bind/resolv.h>
@@ -30,12 +30,15 @@
30 # include <bind/arpa/nameser_compat.h>
31 # else
32 # include <arpa/nameser.h>
33 # include <resolv.h>
34 # endif
35 # if defined(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand)
36 # define dn_expand ns_name_uncompress
37 # endif
38 # if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand)
39 # define dn_expand __ns_name_uncompress
40 # endif
41 # define FOSSIL_UNIX_STYLE_DNS 1
42 #endif
43 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
44 # include <windows.h>
@@ -86,12 +89,11 @@
89 iBestPriority = priority;
90 }
91 }
92 }
93 if( pBest ){
94 dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname));
 
95 return fossil_strdup(zHostname);
96 }
97 return 0;
98 #elif defined(FOSSIL_WINDOWS_STYLE_DNS)
99 DNS_STATUS status; /* Return status */
100

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button