Fossil

Changes On Branch libbind-ns-alternative
Login

Changes On Branch libbind-ns-alternative

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch libbind-ns-alternative Excluding Merge-Ins

This is equivalent to a diff from c285cd08 to b6c490ce

2018-10-01
06:21
Merged branch libbind-ns-alternative: I haven't found any platform where this won't build. It doesn't enable libbind or use libresolv better on every platform where it might possibly work, but at the very least it avoids build errors everywhere I've tried it. ... (check-in: 71c298f3 user: wyoung tags: trunk)
2018-09-22
17:40
Version 2.7 ... (check-in: 9aa9ba8b user: drh tags: trunk, release, version-2.7)
17:09
Typo fix ... (Closed-Leaf check-in: b6c490ce user: tangent tags: libbind-ns-alternative)
17:02
Added a check for ns_parserr(), which we currently don't know how to find on OpenBSD. This also fixes a logic error in auto.def which would cause the warning that this feature won't be compiled to not be given. ... (check-in: f99e7632 user: wyoung tags: libbind-ns-alternative)
05:47
Added autosetup checks for alternative libraries and names for the res_query() and ns_*() functions that module smtp.c previously depended on finding in libresolv/glibc. Checking it in on a branch because it needs multiplatform testing. This version solves the problem originally reported on the forum by Andy Goth, being that the current trunk doesn't build on CentOS 5. ... (check-in: ed3b1e4d user: wyoung tags: libbind-ns-alternative)
04:21
Add build directories to ignore-glob. ... (Closed-Leaf check-in: bddd4961 user: ashepilko tags: build-ignore-glob)
00:54
Second attempt at blockquote styling, this time restricting it to forum posts only. (Previous: [2190f86c324d0]) ... (check-in: c285cd08 user: wyoung tags: trunk)
00:22
Fix the indented paragraph on the homepage. ... (check-in: 0d7ac90d user: drh tags: trunk)

Changes to auto.def.

511
512
513
514
515
516
517
















518


519
520
521
522
523
524
525
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
    # Last resort, may be Windows
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}
















cc-check-function-in-lib ns_name_uncompress resolv


cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge
cc-check-functions backtrace

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
    # Last resort, may be Windows
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}

# The SMTP module requires special libraries and headers for MX DNS
# record lookups and such.
cc-check-includes arpa/nameser.h
cc-include-needs bind/resolv.h netinet/in.h
cc-check-includes bind/resolv.h
cc-check-includes resolv.h
if {    !(([cc-check-function-in-lib dn_expand resolv] ||
           [cc-check-function-in-lib   ns_name_uncompress {bind resolv}] ||
           [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) &&
          ([cc-check-function-in-lib   ns_parserr {bind resolv}] ||
           [cc-check-function-in-lib __ns_parserr {bind resolv}]) &&
          ([cc-check-function-in-lib   res_query {bind resolv}] ||
           [cc-check-function-in-lib __res_query {bind resolv}]))} {
    msg-result "WARNING: SMTP feature will not be able to look up local MX."
}
cc-check-function-in-lib res_9_ns_initparse resolv

# Other nonstandard function checks
cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge
cc-check-functions backtrace

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE

Changes to src/smtp.c.

17
18
19
20
21
22
23

24
25
26




27
28







29
30
31
32
33
34
35
**
** Implementation of SMTP (Simple Mail Transport Protocol) according
** to RFC 5321.
*/
#include "config.h"
#include "smtp.h"
#include <assert.h>

#if defined(__linux__) && !defined(FOSSIL_OMIT_DNS)
#  include <sys/types.h>
#  include <netinet/in.h>




#  include <arpa/nameser.h>
#  include <resolv.h>







#  define FOSSIL_UNIX_STYLE_DNS 1
#endif
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
#  include <windows.h>
#  include <windns.h>
#  define FOSSIL_WINDOWS_STYLE_DNS 1
#endif







>
|


>
>
>
>
|
|
>
>
>
>
>
>
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
**
** Implementation of SMTP (Simple Mail Transport Protocol) according
** to RFC 5321.
*/
#include "config.h"
#include "smtp.h"
#include <assert.h>
#if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \
    (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS)
#  include <sys/types.h>
#  include <netinet/in.h>
#  if defined(HAVE_BIND_RESOLV_H)
#    include <bind/resolv.h>
#    include <bind/arpa/nameser_compat.h>
#  else
#    include <arpa/nameser.h>
#    include <resolv.h>
#  endif
#  if defined(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand)
#    define dn_expand ns_name_uncompress
#  endif
#  if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand)
#    define dn_expand __ns_name_uncompress
#  endif
#  define FOSSIL_UNIX_STYLE_DNS 1
#endif
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
#  include <windows.h>
#  include <windns.h>
#  define FOSSIL_WINDOWS_STYLE_DNS 1
#endif
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
      if( priority<iBestPriority ){
        pBest = p;
        iBestPriority = priority;
      }
    }
  }
  if( pBest ){
    ns_name_uncompress(aDns, aDns+nDns, pBest+2,
                       zHostname, sizeof(zHostname));
    return fossil_strdup(zHostname);
  }
  return 0;
#elif defined(FOSSIL_WINDOWS_STYLE_DNS)
  DNS_STATUS status;           /* Return status */
  PDNS_RECORDA pDnsRecord, p;  /* Pointer to DNS_RECORD structure */
  int iBestPriority = 9999999; /* Best priority */







<
|







87
88
89
90
91
92
93

94
95
96
97
98
99
100
101
      if( priority<iBestPriority ){
        pBest = p;
        iBestPriority = priority;
      }
    }
  }
  if( pBest ){

    dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname));
    return fossil_strdup(zHostname);
  }
  return 0;
#elif defined(FOSSIL_WINDOWS_STYLE_DNS)
  DNS_STATUS status;           /* Return status */
  PDNS_RECORDA pDnsRecord, p;  /* Pointer to DNS_RECORD structure */
  int iBestPriority = 9999999; /* Best priority */