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.
Commit
d0fb5ac7cae085d60804115d7abfbfbbd9596a98da620e2e530b151c21b3aa46
Parent
c7640b38956595b…
2 files changed
+5
-3
+7
-5
M
auto.def
+5
-3
| --- auto.def | ||
| +++ auto.def | ||
| @@ -520,15 +520,17 @@ | ||
| 520 | 520 | # record lookups and such. |
| 521 | 521 | cc-check-includes arpa/nameser.h |
| 522 | 522 | cc-include-needs bind/resolv.h netinet/in.h |
| 523 | 523 | cc-check-includes bind/resolv.h |
| 524 | 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}]} { | |
| 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}])} { | |
| 527 | 530 | msg-result "WARNING: SMTP feature will not be able to look up local MX." |
| 528 | 531 | } |
| 529 | -cc-check-function-in-lib res_query resolv | |
| 530 | 532 | cc-check-function-in-lib res_9_ns_initparse resolv |
| 531 | 533 | |
| 532 | 534 | # Other nonstandard function checks |
| 533 | 535 | cc-check-functions utime |
| 534 | 536 | cc-check-functions usleep |
| 535 | 537 |
| --- 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 @@ | ||
| 19 | 19 | ** to RFC 5321. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "smtp.h" |
| 23 | 23 | #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 || \ | |
| 25 | 25 | (defined(__linux__) && !defined(FOSSIL_OMIT_DNS)) |
| 26 | 26 | # include <sys/types.h> |
| 27 | 27 | # include <netinet/in.h> |
| 28 | 28 | # if defined(HAVE_BIND_RESOLV_H) |
| 29 | 29 | # include <bind/resolv.h> |
| @@ -30,12 +30,15 @@ | ||
| 30 | 30 | # include <bind/arpa/nameser_compat.h> |
| 31 | 31 | # else |
| 32 | 32 | # include <arpa/nameser.h> |
| 33 | 33 | # include <resolv.h> |
| 34 | 34 | # 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 | |
| 37 | 40 | # endif |
| 38 | 41 | # define FOSSIL_UNIX_STYLE_DNS 1 |
| 39 | 42 | #endif |
| 40 | 43 | #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) |
| 41 | 44 | # include <windows.h> |
| @@ -86,12 +89,11 @@ | ||
| 86 | 89 | iBestPriority = priority; |
| 87 | 90 | } |
| 88 | 91 | } |
| 89 | 92 | } |
| 90 | 93 | 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)); | |
| 93 | 95 | return fossil_strdup(zHostname); |
| 94 | 96 | } |
| 95 | 97 | return 0; |
| 96 | 98 | #elif defined(FOSSIL_WINDOWS_STYLE_DNS) |
| 97 | 99 | DNS_STATUS status; /* Return status */ |
| 98 | 100 |
| --- 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 |