INN commit: trunk (26 files)
INN Commit
rra at isc.org
Sun Nov 10 18:27:16 UTC 2013
Date: Sunday, November 10, 2013 @ 10:27:16
Author: iulius
Revision: 9564
sync a few m4, lib, and include files with latest rra-c-util
Changes to note:
* HAVE_KRB5 is now used instead of HAVE_KERBEROS in krb5.m4
* remove NETDB_SUCCESS (no longer used) from getaddrinfo.c
* define ARRAY_SIZE in getaddrinfo.c
* fix two warnings of unused variable and comparison of a floating
point number with 0 in snprintf.c
* define UNUSED in getnameinfo.c
* check the return status of snprintf instead of assuming that
it will always succeed in getnameinfo.c
* define SOCKLEN_T in socket.h instead of clibrary.h
* improve the definition of sockaddr_storage in socket.h
Modified:
trunk/include/clibrary.h
trunk/include/portable/getaddrinfo.h
trunk/include/portable/getnameinfo.h
trunk/include/portable/socket.h
trunk/lib/asprintf.c
trunk/lib/getaddrinfo.c
trunk/lib/getnameinfo.c
trunk/lib/inet_aton.c
trunk/lib/inet_ntoa.c
trunk/lib/inet_ntop.c
trunk/lib/mkstemp.c
trunk/lib/setenv.c
trunk/lib/seteuid.c
trunk/lib/snprintf.c
trunk/lib/strlcat.c
trunk/lib/strlcpy.c
trunk/m4/inet-ntoa.m4
trunk/m4/krb5-config.m4
trunk/m4/krb5.m4
trunk/m4/lib-depends.m4
trunk/m4/lib-helper.m4
trunk/m4/lib-pathname.m4
trunk/m4/pam-const.m4
trunk/m4/sasl.m4
trunk/m4/snprintf.m4
trunk/m4/vamacros.m4
--------------------------------+
include/clibrary.h | 4
include/portable/getaddrinfo.h | 49 ++++--
include/portable/getnameinfo.h | 55 ++++---
include/portable/socket.h | 291 +++++++++++++++++++++++++--------------
lib/asprintf.c | 2
lib/getaddrinfo.c | 206 +++++++++++++++------------
lib/getnameinfo.c | 94 +++++++-----
lib/inet_aton.c | 2
lib/inet_ntoa.c | 2
lib/inet_ntop.c | 2
lib/mkstemp.c | 2
lib/setenv.c | 2
lib/seteuid.c | 2
lib/snprintf.c | 48 +++---
lib/strlcat.c | 2
lib/strlcpy.c | 2
m4/inet-ntoa.m4 | 2
m4/krb5-config.m4 | 2
m4/krb5.m4 | 50 +++---
m4/lib-depends.m4 | 2
m4/lib-helper.m4 | 6
m4/lib-pathname.m4 | 2
m4/pam-const.m4 | 2
m4/sasl.m4 | 2
m4/snprintf.m4 | 2
m4/vamacros.m4 | 2
26 files changed, 503 insertions(+), 334 deletions(-)
Modified: include/clibrary.h
===================================================================
--- include/clibrary.h 2013-11-10 13:13:34 UTC (rev 9563)
+++ include/clibrary.h 2013-11-10 18:27:16 UTC (rev 9564)
@@ -137,10 +137,6 @@
#if !HAVE_SIG_ATOMIC_T
typedef int sig_atomic_t;
#endif
-/* In case <sys/socket.h> does not define socklen_t. */
-#if !HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
END_DECLS
Modified: include/portable/getaddrinfo.h
===================================================================
--- include/portable/getaddrinfo.h 2013-11-10 13:13:34 UTC (rev 9563)
+++ include/portable/getaddrinfo.h 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,18 +1,28 @@
-/* $Id$
-**
-** Replacement implementation of getaddrinfo.
-**
-** Written by Russ Allbery <rra at stanford.edu>
-** This work is hereby placed in the public domain by its author.
-**
-** This is an implementation of the getaddrinfo family of functions for
-** systems that lack it, so that code can use getaddrinfo always. It
-** provides IPv4 support only; for IPv6 support, a native getaddrinfo
-** implemenation is required.
-**
-** This file should generally be included by way of portable/socket.h rather
-** than directly.
-*/
+/* $Id$
+ *
+ * Replacement implementation of getaddrinfo.
+ *
+ * This is an implementation of the getaddrinfo family of functions for
+ * systems that lack it, so that code can use getaddrinfo always. It provides
+ * IPv4 support only; for IPv6 support, a native getaddrinfo implemenation is
+ * required.
+ *
+ * This file should generally be included by way of portable/socket.h rather
+ * than directly.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ *
+ * The authors hereby relinquish any claim to any copyright that they may have
+ * in this work, whether granted under contract or by operation of law or
+ * international treaty, and hereby commit to the public, at large, that they
+ * shall not, at any time in the future, seek to enforce any copyright in this
+ * work against any person or entity, or prevent any person or entity from
+ * copying, publishing, distributing or creating derivative works of this
+ * work.
+ */
#ifndef PORTABLE_GETADDRINFO_H
#define PORTABLE_GETADDRINFO_H 1
@@ -20,8 +30,9 @@
#include "config.h"
/* Skip this entire file if a system getaddrinfo was detected. */
-#if !HAVE_GETADDRINFO
+#ifndef HAVE_GETADDRINFO
+/* OpenBSD likes to have sys/types.h included before sys/socket.h. */
#include <sys/types.h>
#include <sys/socket.h>
@@ -60,12 +71,18 @@
BEGIN_DECLS
+/* Default to a hidden visibility for all portability functions. */
+#pragma GCC visibility push(hidden)
+
/* Function prototypes. */
int getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
void freeaddrinfo(struct addrinfo *ai);
const char *gai_strerror(int ecode);
+/* Undo default visibility change. */
+#pragma GCC visibility pop
+
END_DECLS
#endif /* !HAVE_GETADDRINFO */
Modified: include/portable/getnameinfo.h
===================================================================
--- include/portable/getnameinfo.h 2013-11-10 13:13:34 UTC (rev 9563)
+++ include/portable/getnameinfo.h 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,18 +1,27 @@
-/* $Id$
-**
-** Replacement implementation of getnameinfo.
-**
-** Written by Russ Allbery <rra at stanford.edu>
-** This work is hereby placed in the public domain by its author.
-**
-** This is an implementation of the getnameinfo function for systems that
-** lack it, so that code can use getnameinfo always. It provides IPv4
-** support only; for IPv6 support, a native getnameinfo implemenation is
-** required.
-**
-** This file should generally be included by way of portable/socket.h rather
-** than directly.
-*/
+/* $Id$
+ *
+ * Replacement implementation of getnameinfo.
+ *
+ * This is an implementation of the getnameinfo function for systems that lack
+ * it, so that code can use getnameinfo always. It provides IPv4 support
+ * only; for IPv6 support, a native getnameinfo implemenation is required.
+ *
+ * This file should generally be included by way of portable/socket.h rather
+ * than directly.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ *
+ * The authors hereby relinquish any claim to any copyright that they may have
+ * in this work, whether granted under contract or by operation of law or
+ * international treaty, and hereby commit to the public, at large, that they
+ * shall not, at any time in the future, seek to enforce any copyright in this
+ * work against any person or entity, or prevent any person or entity from
+ * copying, publishing, distributing or creating derivative works of this
+ * work.
+ */
#ifndef PORTABLE_GETNAMEINFO_H
#define PORTABLE_GETNAMEINFO_H 1
@@ -22,6 +31,7 @@
/* Skip this entire file if a system getaddrinfo was detected. */
#if !HAVE_GETNAMEINFO
+/* OpenBSD likes to have sys/types.h included before sys/socket.h. */
#include <sys/types.h>
#include <sys/socket.h>
@@ -32,9 +42,11 @@
#define NI_NUMERICSERV 0x0008
#define NI_DGRAM 0x0010
-/* Maximum length of hostnames and service names. Our implementation doesn't
- use these values, so they're taken from Linux. They're provided just for
- code that uses them to size buffers. */
+/*
+ * Maximum length of hostnames and service names. Our implementation doesn't
+ * use these values, so they're taken from Linux. They're provided just for
+ * code that uses them to size buffers.
+ */
#ifndef NI_MAXHOST
# define NI_MAXHOST 1025
#endif
@@ -44,10 +56,17 @@
BEGIN_DECLS
+/* Default to a hidden visibility for all portability functions. */
+#pragma GCC visibility push(hidden)
+
+/* Function prototypes. */
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *node, socklen_t nodelen,
char *service, socklen_t servicelen, int flags);
+/* Undo default visibility change. */
+#pragma GCC visibility pop
+
END_DECLS
#endif /* !HAVE_GETNAMEINFO */
Modified: include/portable/socket.h
===================================================================
--- include/portable/socket.h 2013-11-10 13:13:34 UTC (rev 9563)
+++ include/portable/socket.h 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,120 +1,118 @@
-/* $Id$
-**
-** Portability wrapper around <sys/socket.h> and friends.
-**
-** This header file is the equivalent of:
-**
-** #include <arpa/inet.h>
-** #include <netinet/in.h>
-** #include <netdb.h>
-** #include <sys/socket.h>
-**
-** but also cleans up various messes, mostly related to IPv6 support. It
-** ensures that inet_aton, inet_ntoa, and inet_ntop are available and
-** properly prototyped.
-*/
+/* $Id$
+ *
+ * Portability wrapper around <sys/socket.h> and friends.
+ *
+ * This header file is the equivalent of:
+ *
+ * #include <arpa/inet.h>
+ * #include <netinet/in.h>
+ * #include <netdb.h>
+ * #include <sys/socket.h>
+ *
+ * but also cleans up various messes, mostly related to IPv6 support, and
+ * provides a set of portability interfaces that work on both UNIX and
+ * Windows. It ensures that inet_aton, inet_ntoa, and inet_ntop are available
+ * and properly prototyped.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Copyright 2008, 2009, 2011, 2013
+ * The Board of Trustees of the Leland Stanford Junior University
+ * Copyright (c) 2004, 2005, 2006, 2007
+ * by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ * 2002, 2003 by The Internet Software Consortium and Rich Salz
+ *
+ * This code is derived from software contributed to the Internet Software
+ * Consortium by Rich Salz.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
#ifndef PORTABLE_SOCKET_H
#define PORTABLE_SOCKET_H 1
#include "config.h"
+
#include <errno.h>
#include <sys/types.h>
/* BSDI needs <netinet/in.h> before <arpa/inet.h>. */
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/socket.h>
+#ifdef _WIN32
+# include <winsock2.h>
+# include <ws2tcpip.h>
+#else
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <netdb.h>
+# include <sys/socket.h>
+#endif
-/* Pick up definitions of getaddrinfo and getnameinfo if not otherwise
- available. */
-#include "portable/getaddrinfo.h"
-#include "portable/getnameinfo.h"
+/*
+ * Pick up definitions of getaddrinfo and getnameinfo if not otherwise
+ * available.
+ */
+#include <portable/getaddrinfo.h>
+#include <portable/getnameinfo.h>
-BEGIN_DECLS
-
-/* Provide prototypes for inet_aton and inet_ntoa if not prototyped in the
- system header files since they're occasionally available without proper
- prototypes. */
-#if !HAVE_DECL_INET_ATON
-extern int inet_aton(const char *, struct in_addr *);
+/* Define socklen_t if it's not available in sys/socket.h. */
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
#endif
-#if !HAVE_DECL_INET_NTOA
-extern const char * inet_ntoa(const struct in_addr);
-#endif
-#if !HAVE_INET_NTOP
-extern const char * inet_ntop(int, const void *, char *, socklen_t);
-#endif
/*
- * Used for portability to Windows, which requires different functions be
- * called to close sockets, send data to or read from sockets, and get socket
- * errors than the regular functions and variables. Windows also uses SOCKET
- * to store socket descriptors instead of an int.
- *
- * socket_init must be called before socket functions are used and
- * socket_shutdown at the end of the program. socket_init may return failure,
- * but this interface doesn't have a way to retrieve the exact error.
- *
- * socket_close, socket_read, and socket_write must be used instead of the
- * standard functions. On Windows, closesocket must be called instead of
- * close for sockets and recv and send must always be used instead of read and
- * write.
- *
- * When reporting errors from socket functions, use socket_errno and
- * socket_strerror instead of errno and strerror. When setting errno to
- * something for socket errors (to preserve errors through close, for
- * example), use socket_set_errno instead of just assigning to errno.
- *
- * Socket file descriptors must be passed and stored in variables of type
- * socket_type rather than an int. Use INVALID_SOCKET for invalid socket file
- * descriptors rather than -1, and compare to INVALID_SOCKET when testing
- * whether operations succeed.
+ * Defined by RFC 3493, used to store a generic address. All of the extra
+ * goop here is to ensure that the structs are appropriately aligned on
+ * platforms that may require 64-bit alignment for the embedded addresses.
*/
-#ifdef _WIN32
-int socket_init(void);
-# define socket_shutdown() WSACleanup()
-# define socket_close(fd) closesocket(fd)
-# define socket_read(fd, b, s) recv((fd), (b), (s), 0)
-# define socket_write(fd, b, s) send((fd), (b), (s), 0)
-# define socket_errno WSAGetLastError()
-# define socket_set_errno(e) WSASetLastError(e)
-const char *socket_strerror(int);
-typedef SOCKET socket_type;
-#else
-# define socket_init() 1
-# define socket_shutdown() /* empty */
-# define socket_close(fd) close(fd)
-# define socket_read(fd, b, s) read((fd), (b), (s))
-# define socket_write(fd, b, s) write((fd), (b), (s))
-# define socket_errno errno
-# define socket_set_errno(e) errno = (e)
-# define socket_strerror(e) strerror(e)
-# define INVALID_SOCKET -1
-typedef int socket_type;
-#endif
-
-/* Defined by RFC 3493, used to store a generic address. Note that this
- doesn't do the alignment mangling that RFC 3493 does; it's not clear if
- that should be added.... */
#if !HAVE_STRUCT_SOCKADDR_STORAGE
+# define SS_MAXSIZE_ 128
+# ifdef HAVE_LONG_LONG_INT
+# define SS_ALIGNSIZE_ sizeof(long long)
+# define SS_ALIGNTYPE_ long long
+# else
+# define SS_ALIGNSIZE_ sizeof(long)
+# define SS_ALIGNTYPE_ long
+# endif
# if HAVE_STRUCT_SOCKADDR_SA_LEN
+# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - 2 * sizeof(unsigned char))
+# define SS_PAD2SIZE_ \
+ (SS_MAXSIZE_ - (2 * sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
struct sockaddr_storage {
unsigned char ss_len;
unsigned char ss_family;
- unsigned char __padding[128 - 2];
+ char __ss_pad1[SS_PAD1SIZE_];
+ SS_ALIGNTYPE_ __ss_align;
+ char __ss_pad2[SS_PAD2SIZE_];
};
# else
+# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - sizeof(unsigned char))
+# define SS_PAD2SIZE_ \
+ (SS_MAXSIZE_ - (sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
struct sockaddr_storage {
unsigned short ss_family;
- unsigned char __padding[128 - 2];
+ char __ss_pad1[SS_PAD1SIZE_];
+ SS_ALIGNTYPE_ __ss_align;
+ char __ss_pad2[SS_PAD2SIZE_];
};
# endif
#endif
-/* Use convenient, non-uglified names for the fields since we use them quite a
- bit in code. */
+/*
+ * RFC 2553 used underscores, so some old implementations may have that
+ * instead of the non-uglified names from RFC 3493.
+ */
#if HAVE_STRUCT_SOCKADDR_STORAGE && !HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
# define ss_family __ss_family
# define ss_len __ss_len
@@ -149,16 +147,21 @@
# endif /* HAVE_SOCKADDR_LEN */
#endif /* !HAVE_SA_LEN_MACRO */
-/* AI_ADDRCONFIG results in an error from getaddrinfo on BSD/OS and
- possibly other platforms. If configure determined it didn't work,
- pretend it doesn't exist. */
+/*
+ * AI_ADDRCONFIG results in an error from getaddrinfo on BSD/OS and possibly
+ * other platforms. If configure determined it didn't work, pretend it
+ * doesn't exist.
+ */
#if !defined(HAVE_GETADDRINFO_ADDRCONFIG) && defined(AI_ADDRCONFIG)
# undef AI_ADDRCONFIG
#endif
-/* POSIX requires AI_ADDRCONFIG and AI_NUMERICSERV, but some implementations
- don't have them yet. It's only used in a bitwise OR of flags, so defining
- them to 0 makes them harmlessly go away. */
+/*
+ * POSIX requires AI_ADDRCONFIG and AI_NUMERICSERV, but some implementations
+ * don't have them yet. We also may have hidden AI_ADDRCONFIG if it doesn't
+ * work. It's only used in a bitwise OR of flags, so defining them to 0 makes
+ * them harmlessly go away.
+ */
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
#endif
@@ -166,8 +169,10 @@
# define AI_NUMERICSERV 0
#endif
-/* Constants required by the IPv6 API. The buffer size required to hold any
- nul-terminated text representation of the given address type. */
+/*
+ * Constants required by the IPv6 API. The buffer size required to hold any
+ * nul-terminated text representation of the given address type.
+ */
#ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
#endif
@@ -175,18 +180,100 @@
# define INET6_ADDRSTRLEN 46
#endif
-/* This is one of the defined error codes from inet_ntop, but it may not be
- available on systems too old to have that function. */
+/*
+ * This is one of the defined error codes from inet_ntop, but it may not be
+ * available on systems too old to have that function.
+ */
#ifndef EAFNOSUPPORT
# define EAFNOSUPPORT EDOM
#endif
-/* EAI_ADDRFAMILY was made obsolete by RFC 3493, but it may still be
- * used by obsolete IPv6 stacks. */
+/*
+ * EAI_ADDRFAMILY was made obsolete by RFC 3493, but it may still be used by
+ * obsolete IPv6 stacks and may be distinct from EAI_FAMILY. Define it so
+ * that code that needs to handle this case can compare against it
+ * unconditionally.
+ */
#ifndef EAI_ADDRFAMILY
# define EAI_ADDRFAMILY EAI_FAMILY
#endif
+BEGIN_DECLS
+
+/*
+ * Provide prototypes for inet_aton and inet_ntoa if not prototyped in the
+ * system header files since they're occasionally available without proper
+ * prototypes.
+ */
+#if !HAVE_DECL_INET_ATON
+extern int inet_aton(const char *, struct in_addr *);
+#endif
+#if !HAVE_DECL_INET_NTOA
+extern const char *inet_ntoa(const struct in_addr);
+#endif
+
+/* Default to a hidden visibility for all portability functions. */
+#pragma GCC visibility push(hidden)
+
+#if !HAVE_INET_NTOP
+# ifdef _WIN32
+extern const char *inet_ntop(int, const void *, char *, int);
+# else
+extern const char *inet_ntop(int, const void *, char *, socklen_t);
+# endif
+#endif
+
+/*
+ * Used for portability to Windows, which requires different functions be
+ * called to close sockets, send data to or read from sockets, and get socket
+ * errors than the regular functions and variables. Windows also uses SOCKET
+ * to store socket descriptors instead of an int.
+ *
+ * socket_init must be called before socket functions are used and
+ * socket_shutdown at the end of the program. socket_init may return failure,
+ * but this interface doesn't have a way to retrieve the exact error.
+ *
+ * socket_close, socket_read, and socket_write must be used instead of the
+ * standard functions. On Windows, closesocket must be called instead of
+ * close for sockets and recv and send must always be used instead of read and
+ * write.
+ *
+ * When reporting errors from socket functions, use socket_errno and
+ * socket_strerror instead of errno and strerror. When setting errno to
+ * something for socket errors (to preserve errors through close, for
+ * example), use socket_set_errno instead of just assigning to errno.
+ *
+ * Socket file descriptors must be passed and stored in variables of type
+ * socket_type rather than an int. Use INVALID_SOCKET for invalid socket file
+ * descriptors rather than -1, and compare to INVALID_SOCKET when testing
+ * whether operations succeed.
+ */
+#ifdef _WIN32
+int socket_init(void);
+# define socket_shutdown() WSACleanup()
+# define socket_close(fd) closesocket(fd)
+# define socket_read(fd, b, s) recv((fd), (b), (s), 0)
+# define socket_write(fd, b, s) send((fd), (b), (s), 0)
+# define socket_errno WSAGetLastError()
+# define socket_set_errno(e) WSASetLastError(e)
+const char *socket_strerror(int);
+typedef SOCKET socket_type;
+#else
+# define socket_init() 1
+# define socket_shutdown() /* empty */
+# define socket_close(fd) close(fd)
+# define socket_read(fd, b, s) read((fd), (b), (s))
+# define socket_write(fd, b, s) write((fd), (b), (s))
+# define socket_errno errno
+# define socket_set_errno(e) errno = (e)
+# define socket_strerror(e) strerror(e)
+# define INVALID_SOCKET -1
+typedef int socket_type;
+#endif
+
+/* Undo default visibility change. */
+#pragma GCC visibility pop
+
END_DECLS
-#endif /* PORTABLE_SOCKET_H */
+#endif /* !PORTABLE_SOCKET_H */
Modified: lib/asprintf.c
===================================================================
--- lib/asprintf.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/asprintf.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -8,7 +8,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/getaddrinfo.c
===================================================================
--- lib/getaddrinfo.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/getaddrinfo.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,43 +1,52 @@
-/* $Id$
-**
-** Replacement for a missing getaddrinfo.
-**
-** Written by Russ Allbery <rra at stanford.edu>
-** This work is hereby placed in the public domain by its author.
-**
-** This is an implementation of getaddrinfo for systems that don't have one
-** so that networking code can use a consistant interface without #ifdef. It
-** is a fairly minimal implementation, with the following limitations:
-**
-** - IPv4 support only. IPv6 is not supported.
-** - AI_ADDRCONFIG is ignored.
-** - Not thread-safe due to gethostbyname and getservbyname.
-** - SOCK_DGRAM and SOCK_STREAM only.
-** - Multiple possible socket types only generate one addrinfo struct.
-** - Protocol hints aren't used correctly.
-**
-** The last four issues could probably be easily remedied, but weren't
-** needed for INN's purposes. Adding IPv6 support isn't worth it; systems
-** with IPv6 support should already support getaddrinfo natively.
-*/
+/* $Id$
+ *
+ * Replacement for a missing getaddrinfo.
+ *
+ * This is an implementation of getaddrinfo for systems that don't have one so
+ * that networking code can use a consistant interface without #ifdef. It is
+ * a fairly minimal implementation, with the following limitations:
+ *
+ * - IPv4 support only. IPv6 is not supported.
+ * - AI_ADDRCONFIG is ignored.
+ * - Not thread-safe due to gethostbyname and getservbyname.
+ * - SOCK_DGRAM and SOCK_STREAM only.
+ * - Multiple possible socket types only generate one addrinfo struct.
+ * - Protocol hints aren't used correctly.
+ *
+ * The last four issues could probably be easily remedied, but haven't been
+ * needed to date. Adding IPv6 support isn't worth it; systems with IPv6
+ * support should already support getaddrinfo natively.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ *
+ * The authors hereby relinquish any claim to any copyright that they may have
+ * in this work, whether granted under contract or by operation of law or
+ * international treaty, and hereby commit to the public, at large, that they
+ * shall not, at any time in the future, seek to enforce any copyright in this
+ * work against any person or entity, or prevent any person or entity from
+ * copying, publishing, distributing or creating derivative works of this
+ * work.
+ */
#include "config.h"
#include "clibrary.h"
#include "portable/socket.h"
+
#include <errno.h>
-/* Make sure we have access to h_errno and hstrerror to print out name
- resolution error messages. */
+/* We need access to h_errno to map errors from gethostbyname. */
#if !HAVE_DECL_H_ERRNO
extern int h_errno;
#endif
-/* The netdb constants, which aren't always defined (particularly if h_errno
- isn't declared. We also make sure that a few of the less-used ones are
- defined so that we can deal with them in case statements. */
-#ifndef NETDB_SUCCESS
-# define NETDB_SUCCESS 0
-#endif
+/*
+ * The netdb constants, which aren't always defined (particularly if h_errno
+ * isn't declared). We also make sure that a few of the less-used ones are
+ * defined so that we can deal with them in case statements.
+ */
#ifndef HOST_NOT_FOUND
# define HOST_NOT_FOUND 1
# define TRY_AGAIN 2
@@ -48,9 +57,11 @@
# define NETDB_INTERNAL -1
#endif
-/* If we're running the test suite, rename the functions to avoid conflicts
- with the system version. Note that we don't rename the structures and
- constants, but that should be okay (except possibly for gai_strerror. */
+/*
+ * If we're running the test suite, rename the functions to avoid conflicts
+ * with the system version. Note that we don't rename the structures and
+ * constants, but that should be okay (except possibly for gai_strerror).
+ */
#if TESTING
# define gai_strerror test_gai_strerror
# define freeaddrinfo test_freeaddrinfo
@@ -59,9 +70,13 @@
void test_freeaddrinfo(struct addrinfo *);
int test_getaddrinfo(const char *, const char *, const struct addrinfo *,
struct addrinfo **);
+#endif
-/* If the native platform doesn't support AI_NUMERICSERV or AI_NUMERICHOST,
- pick some other values for them. */
+/*
+ * If the native platform doesn't support AI_NUMERICSERV or AI_NUMERICHOST,
+ * pick some other values for them.
+ */
+#if TESTING
# if AI_NUMERICSERV == 0
# undef AI_NUMERICSERV
# define AI_NUMERICSERV 0x0080
@@ -72,6 +87,19 @@
# endif
#endif
+/*
+ * Value representing all of the hint flags set. Linux uses flags up to
+ * 0x0400, so be sure not to break when testing on that platform.
+ */
+#if TESTING
+# ifdef HAVE_GETADDRINFO
+# define AI_INTERNAL_ALL 0x04ff
+# else
+# define AI_INTERNAL_ALL 0x01ff
+# endif
+#else
+# define AI_INTERNAL_ALL 0x007f
+#endif
/* Table of strings corresponding to the EAI_* error codes. */
static const char * const gai_errors[] = {
@@ -87,30 +115,24 @@
"Supplied buffer too small", /* 10 EAI_OVERFLOW */
};
-/* Value representing all of the hint flags set. Linux uses flags up to
- 0x0400, so be sure not to break when testing on that platform. */
-#if TESTING
-# ifdef HAVE_GETADDRINFO
-# define AI_INTERNAL_ALL 0x04ff
-# else
-# define AI_INTERNAL_ALL 0x01ff
-# endif
-#else
-# define AI_INTERNAL_ALL 0x007f
-#endif
-
/* Macro to set the len attribute of sockaddr_in. */
#if HAVE_STRUCT_SOCKADDR_SA_LEN
-# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
+# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
#else
-# define sin_set_length(s) /* empty */
+# define sin_set_length(s) /* empty */
#endif
+/*
+ * Used for iterating through arrays. ARRAY_SIZE returns the number of
+ * elements in the array (useful for a < upper bound in a for loop).
+ */
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
/*
-** Return a constant string for a given EAI_* error code or a string
-** indicating an unknown error.
-*/
+ * Return a constant string for a given EAI_* error code or a string
+ * indicating an unknown error.
+ */
const char *
gai_strerror(int ecode)
{
@@ -122,8 +144,8 @@
/*
-** Free a linked list of addrinfo structs.
-*/
+ * Free a linked list of addrinfo structs.
+ */
void
freeaddrinfo(struct addrinfo *ai)
{
@@ -142,13 +164,13 @@
/*
-** Convert a numeric service string to a number with error checking,
-** returning true if the number was parsed correctly and false otherwise.
-** Stores the converted number in the second argument. Equivalent to calling
-** strtol, but with the base always fixed at 10, with checking of errno,
-** ensuring that all of the string is consumed, and checking that the
-** resulting number is positive.
-*/
+ * Convert a numeric service string to a number with error checking, returning
+ * true if the number was parsed correctly and false otherwise. Stores the
+ * converted number in the second argument. Equivalent to calling strtol, but
+ * with the base always fixed at 10, with checking of errno, ensuring that all
+ * of the string is consumed, and checking that the resulting number is
+ * positive.
+ */
static bool
convert_service(const char *string, long *result)
{
@@ -165,12 +187,12 @@
/*
-** Allocate a new addrinfo struct, setting some defaults given that this
-** implementation is IPv4 only. Also allocates an attached sockaddr_in and
-** zeroes it, per the requirement for getaddrinfo. Takes the socktype,
-** canonical name (which is copied if not NULL), address, and port. Returns
-** NULL on a memory allocation failure.
-*/
+ * Allocate a new addrinfo struct, setting some defaults given that this
+ * implementation is IPv4 only. Also allocates an attached sockaddr_in and
+ * zeroes it, per the requirement for getaddrinfo. Takes the socktype,
+ * canonical name (which is copied if not NULL), address, and port. Returns
+ * NULL on a memory allocation failure.
+ */
static struct addrinfo *
gai_addrinfo_new(int socktype, const char *canonical, struct in_addr addr,
unsigned short port)
@@ -211,13 +233,13 @@
/*
-** Look up a service. Takes the service name (which may be numeric), the
-** hint flags, a pointer to the socket type (used to determine whether TCP or
-** UDP services are of interest and, if 0, is filled in with the result of
-** getservbyname if the service was not numeric), and a pointer to the
-** addrinfo struct to fill in. Returns 0 on success or an EAI_* error on
-** failure.
-*/
+ * Look up a service. Takes the service name (which may be numeric), the hint
+ * flags, a pointer to the socket type (used to determine whether TCP or UDP
+ * services are of interest and, if 0, is filled in with the result of
+ * getservbyname if the service was not numeric), and a pointer to the
+ * addrinfo struct to fill in. Returns 0 on success or an EAI_* error on
+ * failure.
+ */
static int
gai_service(const char *servname, int flags, int *type, unsigned short *port)
{
@@ -237,9 +259,11 @@
else
protocol = NULL;
- /* We really technically should be generating an addrinfo struct for
- each possible protocol unless type is set, but this works well
- enough for what I need this for. */
+ /*
+ * We really technically should be generating an addrinfo struct for
+ * each possible protocol unless type is set, but this works well
+ * enough for what I need this for.
+ */
servent = getservbyname(servname, protocol);
if (servent == NULL)
return EAI_NONAME;
@@ -256,13 +280,13 @@
/*
-** Look up a host and fill in a linked list of addrinfo structs with the
-** results, one per IP address of the returned host. Takes the name or IP
-** address of the host as a string, the lookup flags, the type of socket (to
-** fill into the addrinfo structs), the port (likewise), and a pointer to
-** where the head of the linked list should be put. Returns 0 on success or
-** the appropriate EAI_* error.
-*/
+ * Look up a host and fill in a linked list of addrinfo structs with the
+ * results, one per IP address of the returned host. Takes the name or IP
+ * address of the host as a string, the lookup flags, the type of socket (to
+ * fill into the addrinfo structs), the port (likewise), and a pointer to
+ * where the head of the linked list should be put. Returns 0 on success or
+ * the appropriate EAI_* error.
+ */
static int
gai_lookup(const char *nodename, int flags, int socktype, unsigned short port,
struct addrinfo **res)
@@ -330,8 +354,8 @@
/*
-** The actual getaddrinfo implementation.
-*/
+ * The actual getaddrinfo implementation.
+ */
int
getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
@@ -363,10 +387,12 @@
socktype = 0;
}
- /* See what we're doing. If nodename is null, either AI_PASSIVE is set or
- we're getting information for connecting to a service on the loopback
- address. Otherwise, we're getting information for connecting to a
- remote system. */
+ /*
+ * See what we're doing. If nodename is null, either AI_PASSIVE is set or
+ * we're getting information for connecting to a service on the loopback
+ * address. Otherwise, we're getting information for connecting to a
+ * remote system.
+ */
if (servname == NULL)
port = 0;
else {
Modified: lib/getnameinfo.c
===================================================================
--- lib/getnameinfo.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/getnameinfo.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,31 +1,44 @@
-/* $Id$
-**
-** Replacement for a missing getnameinfo.
-**
-** Written by Russ Allbery <rra at stanford.edu>
-** This work is hereby placed in the public domain by its author.
-**
-** This is an implementation of getaddrinfo for systems that don't have one
-** so that networking code can use a consistant interface without #ifdef. It
-** is a fairly minimal implementation, with the following limitations:
-**
-** - IPv4 support only. IPv6 is not supported.
-** - NI_NOFQDN is ignored.
-** - Not thread-safe due to gethostbyaddr, getservbyport, and inet_ntoa.
-**
-** The last two issues could probably be easily remedied, but weren't needed
-** for INN's purposes. Adding IPv6 support isn't worth it; systems with IPv6
-** support should already support getnameinfo natively.
-*/
+/* $Id$
+ *
+ * Replacement for a missing getnameinfo.
+ *
+ * This is an implementation of getnameinfo for systems that don't have one so
+ * that networking code can use a consistant interface without #ifdef. It is
+ * a fairly minimal implementation, with the following limitations:
+ *
+ * - IPv4 support only. IPv6 is not supported.
+ * - NI_NOFQDN is ignored.
+ * - Not thread-safe due to gethostbyaddr, getservbyport, and inet_ntoa.
+ *
+ * The last two issues could probably be easily remedied, but haven't been
+ * needed so far. Adding IPv6 support isn't worth it; systems with IPv6
+ * support should already support getnameinfo natively.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ *
+ * The authors hereby relinquish any claim to any copyright that they may have
+ * in this work, whether granted under contract or by operation of law or
+ * international treaty, and hereby commit to the public, at large, that they
+ * shall not, at any time in the future, seek to enforce any copyright in this
+ * work against any person or entity, or prevent any person or entity from
+ * copying, publishing, distributing or creating derivative works of this
+ * work.
+ */
#include "config.h"
#include "clibrary.h"
#include "portable/socket.h"
+
#include <errno.h>
-/* If we're running the test suite, rename inet_ntoa to avoid conflicts with
- the system version. Note that we don't rename the structures and
- constants, but that should be okay (except possibly for gai_strerror. */
+/*
+ * If we're running the test suite, rename inet_ntoa to avoid conflicts with
+ * the system version. Note that we don't rename the structures and
+ * constants, but that should be okay (except possibly for gai_strerror).
+ */
#if TESTING
# define getnameinfo test_getnameinfo
int test_getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t,
@@ -37,12 +50,15 @@
# endif
#endif
+/* Used for unused parameters to silence gcc warnings. */
+#define UNUSED __attribute__((__unused__))
+
/*
-** Check to see if a name is fully qualified by seeing if it contains a
-** period. If it does, try to copy it into the provided node buffer and set
-** status accordingly, returning true. If not, return false.
-*/
+ * Check to see if a name is fully qualified by seeing if it contains a
+ * period. If it does, try to copy it into the provided node buffer and set
+ * status accordingly, returning true. If not, return false.
+ */
static bool
try_name(const char *name, char *node, socklen_t nodelen, int *status)
{
@@ -59,9 +75,9 @@
/*
-** Look up an address (or convert it to ASCII form) and put it in the
-** provided buffer, depending on what is requested by flags.
-*/
+ * Look up an address (or convert it to ASCII form) and put it in the provided
+ * buffer, depending on what is requested by flags.
+ */
static int
lookup_name(const struct in_addr *addr, char *node, socklen_t nodelen,
int flags)
@@ -86,8 +102,10 @@
return status;
}
- /* We found some results, but none of them were fully-qualified, so
- act as if we found nothing and either fail or fall through. */
+ /*
+ * We found some results, but none of them were fully-qualified, so
+ * act as if we found nothing and either fail or fall through.
+ */
if (flags & NI_NAMEREQD)
return EAI_NONAME;
}
@@ -102,15 +120,16 @@
/*
-** Look up a service (or convert it to ASCII form) and put it in the provided
-** buffer, depending on what is requested by flags.
-*/
+ * Look up a service (or convert it to ASCII form) and put it in the provided
+ * buffer, depending on what is requested by flags.
+ */
static int
lookup_service(unsigned short port, char *service, socklen_t servicelen,
int flags)
{
struct servent *srv;
const char *protocol;
+ int status;
/* Do the name lookup first unless told not to. */
if (!(flags & NI_NUMERICSERV)) {
@@ -125,15 +144,16 @@
}
/* Just convert the port number to ASCII. */
- if ((socklen_t) snprintf(service, servicelen, "%hu", port) > servicelen)
+ status = snprintf(service, servicelen, "%hu", port);
+ if (status < 0 || (socklen_t) status > servicelen)
return EAI_OVERFLOW;
return 0;
}
/*
-** The getnameinfo implementation.
-*/
+ * The getnameinfo implementation.
+ */
int
getnameinfo(const struct sockaddr *sa, socklen_t salen UNUSED, char *node,
socklen_t nodelen, char *service, socklen_t servicelen, int flags)
Modified: lib/inet_aton.c
===================================================================
--- lib/inet_aton.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/inet_aton.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -9,7 +9,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/inet_ntoa.c
===================================================================
--- lib/inet_ntoa.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/inet_ntoa.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -10,7 +10,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/inet_ntop.c
===================================================================
--- lib/inet_ntop.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/inet_ntop.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -11,7 +11,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/mkstemp.c
===================================================================
--- lib/mkstemp.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/mkstemp.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -8,7 +8,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/setenv.c
===================================================================
--- lib/setenv.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/setenv.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -8,7 +8,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/seteuid.c
===================================================================
--- lib/seteuid.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/seteuid.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -16,7 +16,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/snprintf.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -1,18 +1,24 @@
-/* $Id$
-**
-** Replacement for a missing snprintf or vsnprintf.
-**
-** The following implementation of snprintf was taken mostly verbatim from
-** <http://www.fiction.net/~blong/programs/>; it is the version of snprintf
-** used in Mutt.
-**
-** Please do not reformat or otherwise change this file more than
-** necessary so that later merges with the original source are easy.
-** Bug fixes and improvements should be sent back to the original author.
-*/
+/* $Id$
+ *
+ * Replacement for a missing snprintf or vsnprintf.
+ *
+ * The following implementation of snprintf was taken mostly verbatim from
+ * <http://www.fiction.net/blong/programs/>; it is the version of snprintf
+ * used in Mutt. A possibly newer version is used in wget, found at
+ * <https://github.com/wertarbyte/wget/blob/master/src/snprintf.c>.
+ *
+ * Please do not reformat or otherwise change this file more than necessary so
+ * that later merges with the original source are easy. Bug fixes and
+ * improvements should be sent back to the original author.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+ */
-/* If we're running the test suite, rename snprintf and vsnprintf to avoid
- conflicts with the system version. */
+/*
+ * If we're running the test suite, rename snprintf and vsnprintf to avoid
+ * conflicts with the system version.
+ */
#if TESTING
# define snprintf test_snprintf
# define vsnprintf test_vsnprintf
@@ -69,7 +75,7 @@
* fixed handling of %.0f
* added test for HAVE_LONG_DOUBLE
*
- * Russ Allbery <rra at stanford.edu> 2000-08-26
+ * Russ Allbery <eagle at eyrie.org> 2000-08-26
* fixed return value to comply with C99
* fixed handling of snprintf(NULL, ...)
*
@@ -90,6 +96,7 @@
**************************************************************/
#include "config.h"
+
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
@@ -116,8 +123,7 @@
# define LLONG long
#endif
-int snprintf (char *str, size_t count, const char *fmt, ...)
- __attribute__((__format__(printf, 3, 4)));
+int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
static int dopr (char *buffer, size_t maxlen, const char *format,
@@ -428,7 +434,7 @@
break;
case 'w':
/* not supported yet, treat as next char */
- ch = *format++;
+ format++;
break;
default:
/* Unknown, skip */
@@ -650,7 +656,7 @@
size_t omitcount = 0;
/*
- * AIX man page says the default is 0, but Solaris says the default
+ * AIX manpage says the default is 0, but Solaris says the default
* is 6, and sprintf on AIX defaults to 6
*/
if (max < 0)
@@ -691,7 +697,7 @@
/* For each leading 0 in fractional part, print one more
fractional digit. */
LDOUBLE temp;
- if (ufvalue != 0)
+ if (ufvalue > 0)
for (temp = ufvalue; temp < 0.1; temp *= 10)
++max;
}
@@ -842,7 +848,7 @@
/* VARARGS3 */
#ifdef HAVE_STDARGS
-int snprintf (char *str, size_t count, const char *fmt, ...)
+int snprintf (char *str,size_t count,const char *fmt,...)
#else
int snprintf (va_alist) va_dcl
#endif
Modified: lib/strlcat.c
===================================================================
--- lib/strlcat.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/strlcat.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -13,7 +13,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: lib/strlcpy.c
===================================================================
--- lib/strlcpy.c 2013-11-10 13:13:34 UTC (rev 9563)
+++ lib/strlcpy.c 2013-11-10 18:27:16 UTC (rev 9564)
@@ -12,7 +12,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Written by Russ Allbery <rra at stanford.edu>
+ * Written by Russ Allbery <eagle at eyrie.org>
*
* The authors hereby relinquish any claim to any copyright that they may have
* in this work, whether granted under contract or by operation of law or
Modified: m4/inet-ntoa.m4
===================================================================
--- m4/inet-ntoa.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/inet-ntoa.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -10,7 +10,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Copyright 1999, 2000, 2001, 2003 Russ Allbery <rra at stanford.edu>
+dnl Copyright 1999, 2000, 2001, 2003 Russ Allbery <eagle at eyrie.org>
dnl Copyright 2008, 2009
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
Modified: m4/krb5-config.m4
===================================================================
--- m4/krb5-config.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/krb5-config.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -11,7 +11,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2011, 2012
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
Modified: m4/krb5.m4
===================================================================
--- m4/krb5.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/krb5.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -12,21 +12,20 @@
dnl INN_LIB_KRB5_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
dnl Kerberos libraries, saving the current values first, and
dnl INN_LIB_KRB5_RESTORE to restore those settings to before the last
-dnl INN_LIB_KRB5_SWITCH. HAVE_KERBEROS will always be defined if INN_LIB_KRB5
-dnl is used.
+dnl INN_LIB_KRB5_SWITCH. HAVE_KRB5 will always be defined if INN_LIB_KRB5 is
+dnl used.
dnl
dnl If KRB5_CPPFLAGS, KRB5_LDFLAGS, or KRB5_LIBS are set before calling these
dnl macros, their values will be added to whatever the macros discover.
dnl
dnl Provides the INN_LIB_KRB5_OPTIONAL macro, which should be used if Kerberos
dnl support is optional. In this case, Kerberos libraries are mandatory if
-dnl --with-krb5 or related flags are given, and will not be probed for if
-dnl --without-krb5 is given. Otherwise, they'll be probed for, and
-dnl inn_use_kerberos will be set to true if they're found and not set
-dnl otherwise. The substitution variables will always be set, but they will
-dnl be empty unless Kerberos libraries are found and the user did not disable
-dnl Kerberos support. Similarly, HAVE_KERBEROS will be defined if Kerberos
-dnl libraries are found and the user didn't disable Kerberos support.
+dnl --with-krb5 is given, and will not be probed for if --without-krb5 is
+dnl given. Otherwise, they'll be probed for but will not be required.
+dnl Defines HAVE_KRB5 and sets inn_use_KRB5 to true if the libraries are
+dnl found. The substitution variables will always be set, but they will be
+dnl empty unless Kerberos libraries are found and the user did not disable
+dnl Kerberos support.
dnl
dnl Sets the Automake conditional KRB5_USES_COM_ERR saying whether we use
dnl com_err, since if we're also linking with AFS libraries, we may have to
@@ -45,7 +44,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
@@ -53,6 +52,9 @@
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
+dnl Ignore Automake conditionals if not using Automake.
+m4_define_default([AM_CONDITIONAL], [:])
+
dnl Headers to include when probing for Kerberos library properties.
AC_DEFUN([INN_INCLUDES_KRB5], [[
#if HAVE_KRB5_H
@@ -249,16 +251,15 @@
_INN_LIB_KRB5_MANUAL([$1])])])
inn_krb5_uses_com_err=false
AS_CASE([$LIBS], [*-lcom_err*], [inn_krb5_uses_com_err=true])
- m4_ifdef([AM_CONDITIONAL],
- [AM_CONDITIONAL([KRB5_USES_COM_ERR],
- [test x"$inn_krb5_uses_com_err" = xtrue])])])
+ AM_CONDITIONAL([KRB5_USES_COM_ERR],
+ [test x"$inn_krb5_uses_com_err" = xtrue])])
dnl The main macro for packages with mandatory Kerberos support.
AC_DEFUN([INN_LIB_KRB5],
[inn_krb5_root=
inn_krb5_libdir=
inn_krb5_includedir=
- inn_use_kerberos=true
+ inn_use_KRB5=true
AC_SUBST([KRB5_CPPFLAGS])
AC_SUBST([KRB5_LDFLAGS])
AC_SUBST([KRB5_LIBS])
@@ -279,14 +280,14 @@
[AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
[inn_krb5_libdir="$withval"])])
_INN_LIB_KRB5_INTERNAL([true])
- AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])
+ AC_DEFINE([HAVE_KRB5], 1, [Define to enable Kerberos features.])])
dnl The main macro for packages with optional Kerberos support.
AC_DEFUN([INN_LIB_KRB5_OPTIONAL],
[inn_krb5_root=
inn_krb5_libdir=
inn_krb5_includedir=
- inn_use_kerberos=
+ inn_use_KRB5=
AC_SUBST([KRB5_CPPFLAGS])
AC_SUBST([KRB5_LDFLAGS])
AC_SUBST([KRB5_LIBS])
@@ -295,9 +296,9 @@
[AS_HELP_STRING([--with-krb5@<:@=DIR@:>@],
[Location of Kerberos headers and libraries])],
[AS_IF([test x"$withval" = xno],
- [inn_use_kerberos=false],
+ [inn_use_KRB5=false],
[AS_IF([test x"$withval" != xyes], [inn_krb5_root="$withval"])
- inn_use_kerberos=true])])
+ inn_use_KRB5=true])])
AC_ARG_WITH([krb5-include],
[AS_HELP_STRING([--with-krb5-include=DIR],
[Location of Kerberos headers])],
@@ -309,17 +310,14 @@
[AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
[inn_krb5_libdir="$withval"])])
- AS_IF([test x"$inn_use_kerberos" != xfalse],
- [AS_IF([test x"$inn_use_kerberos" = xtrue],
+ AS_IF([test x"$inn_use_KRB5" != xfalse],
+ [AS_IF([test x"$inn_use_KRB5" = xtrue],
[_INN_LIB_KRB5_INTERNAL([true])],
[_INN_LIB_KRB5_INTERNAL([false])])],
- [m4_ifdef([AM_CONDITIONAL],
- [AM_CONDITIONAL([KRB5_USES_COM_ERR], [false])],
- [:])])
-
+ [AM_CONDITIONAL([KRB5_USES_COM_ERR], [false])])
AS_IF([test x"$KRB5_LIBS" != x],
- [inn_use_kerberos=true
- AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])])
+ [inn_use_KRB5=true
+ AC_DEFINE([HAVE_KRB5], 1, [Define to enable Kerberos features.])])])
dnl Source used by INN_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS.
AC_DEFUN([_INN_FUNC_KRB5_OPT_FREE_ARGS_SOURCE], [INN_INCLUDES_KRB5] [[
Modified: m4/lib-depends.m4
===================================================================
--- m4/lib-depends.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/lib-depends.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -13,7 +13,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2005, 2006, 2007
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
Modified: m4/lib-helper.m4
===================================================================
--- m4/lib-helper.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/lib-helper.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -7,13 +7,13 @@
dnl take as one of the arguments the prefix string to use for variables, which
dnl is usually something like "KRB5" or "GSSAPI".
dnl
-dnl Depends on INN_ENABLE_REDUCED_DEPENDS and INN_SET_LDFLAGS.
+dnl Depends on INN_SET_LDFLAGS.
dnl
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
-dnl Copyright 2011
+dnl Written by Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2011, 2013
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl This file is free software; the authors give unlimited permission to copy
Modified: m4/lib-pathname.m4
===================================================================
--- m4/lib-pathname.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/lib-pathname.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -16,7 +16,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2008, 2009
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
Modified: m4/pam-const.m4
===================================================================
--- m4/pam-const.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/pam-const.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -14,7 +14,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Copyright 2007 Russ Allbery <rra at stanford.edu>
+dnl Copyright 2007 Russ Allbery <eagle at eyrie.org>
dnl Copyright 2007, 2008 Markus Moeller
dnl
dnl This file is free software; the authors give unlimited permission to copy
Modified: m4/sasl.m4
===================================================================
--- m4/sasl.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/sasl.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -4,7 +4,7 @@
dnl This file provides INN_LIB_SASL, which defines the --with-sasl
dnl command-line option and probes for the location of Cyrus SASL v2 if that
dnl option is used without an optional path. It looks by default in $prefix,
-dnl /usr/local, and /usr. It then makes sure that Cyrus SASL is verison two
+dnl /usr/local, and /usr. It then makes sure that Cyrus SASL is version two
dnl and will link, and exports SASL_LDFLAGS, SASL_CPPFLAGS, and SASL_LIBS.
AC_DEFUN([INN_LIB_SASL],
Modified: m4/snprintf.m4
===================================================================
--- m4/snprintf.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/snprintf.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -13,7 +13,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2006, 2008, 2009
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
Modified: m4/vamacros.m4
===================================================================
--- m4/vamacros.m4 2013-11-10 13:13:34 UTC (rev 9563)
+++ m4/vamacros.m4 2013-11-10 18:27:16 UTC (rev 9564)
@@ -17,7 +17,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Written by Russ Allbery <rra at stanford.edu>
+dnl Written by Russ Allbery <eagle at eyrie.org>
dnl Copyright 2006, 2008, 2009
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
More information about the inn-committers
mailing list