Browse Source

enforce GNU source and enable POSIX entension

pull/465/head
Max Lv 9 years ago
parent
commit
551b152081
5 changed files with 1956 additions and 1995 deletions
  1. 32
      config.h.in
  2. 3893
      configure
  3. 1
      configure.ac
  4. 20
      libudns/udns_resolver.c
  5. 5
      src/utils.c

32
config.h.in

@ -319,6 +319,28 @@
/* Use PolarSSL library */
#undef USE_CRYPTO_POLARSSL
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
@ -334,6 +356,16 @@
# endif
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */

3893
configure
File diff suppressed because it is too large
View File

1
configure.ac

@ -7,6 +7,7 @@ AC_CONFIG_SRCDIR([src/encrypt.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR(auto)
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([subdir-objects foreign -Wall -Werror])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

20
libudns/udns_resolver.c

@ -126,12 +126,14 @@ qlist_insert_after(struct dns_qlist *list,
qlist_add_head(list, q);
}
union sockaddr_ns {
struct sockaddr sa;
struct sockaddr_in sin;
struct sockaddr_ns {
union {
struct sockaddr sa;
struct sockaddr_in sin;
#ifdef HAVE_IPv6
struct sockaddr_in6 sin6;
struct sockaddr_in6 sin6;
#endif
}
};
#define sin_eq(a,b) \
@ -150,7 +152,7 @@ struct dns_ctx { /* resolver context */
unsigned dnsc_port; /* default port (DNS_PORT) */
unsigned dnsc_udpbuf; /* size of UDP buffer */
/* array of nameserver addresses */
union sockaddr_ns dnsc_serv[DNS_MAXSERV];
struct sockaddr_ns dnsc_serv[DNS_MAXSERV];
unsigned dnsc_nserv; /* number of nameservers */
unsigned dnsc_salen; /* length of socket addresses */
dnsc_t dnsc_srchbuf[1024]; /* buffer for searchlist */
@ -230,7 +232,7 @@ enum {
};
int dns_add_serv(struct dns_ctx *ctx, const char *serv) {
union sockaddr_ns *sns;
struct sockaddr_ns *sns;
SETCTXFRESH(ctx);
if (!serv)
return (ctx->dnsc_nserv = 0);
@ -483,7 +485,7 @@ int dns_open(struct dns_ctx *ctx) {
int sock;
unsigned i;
int port;
union sockaddr_ns *sns;
struct sockaddr_ns *sns;
#ifdef HAVE_IPv6
unsigned have_inet6 = 0;
#endif
@ -814,7 +816,7 @@ dns_send_this(struct dns_ctx *ctx, struct dns_query *q,
return -1;
}
DNS_DBGQ(ctx, q, 1,
&ctx->dnsc_serv[servi].sa, sizeof(union sockaddr_ns),
&ctx->dnsc_serv[servi].sa, sizeof(struct sockaddr_ns),
ctx->dnsc_pbuf, qlen);
q->dnsq_servwait |= 1 << servi; /* expect reply from this ns */
@ -965,7 +967,7 @@ void dns_ioevent(struct dns_ctx *ctx, time_t now) {
dnsc_t *pbuf;
dnscc_t *pend, *pcur;
void *result;
union sockaddr_ns sns;
struct sockaddr_ns sns;
socklen_t slen;
SETCTX(ctx);

5
src/utils.c

@ -102,11 +102,8 @@ int run_as(const char *user)
/* Note that we use getpwnam_r() instead of getpwnam(),
which returns its result in a statically allocated buffer and
cannot be considered thread safe. */
#ifndef __sun
err = getpwnam_r(user, &pwdbuf, buf, buflen, &pwd);
#else
pwd = getpwnam_r(user, &pwdbuf, buf, buflen);
#endif
if (err == 0 && pwd) {
/* setgid first, because we may not be allowed to do it anymore after setuid */
if (setgid(pwd->pw_gid) != 0) {

Loading…
Cancel
Save