Commit 60cd5f6d authored by Russ Allbery's avatar Russ Allbery

Update to rra-c-util 4.1

* Build on systems where krb5/krb5.h exists but krb5.h does not.
* Kerberos probes no longer assume transitive library dependencies.
* Fix removal of /usr/include from Kerberos CPPFLAGS.
* Include strings.h where present for more POSIX string functions.
* Avoid passing a NULL context to krb5_get_error_message.
* Fix a data type issue in the messages utility library.
* Fix incorrect __attribute notations in the utility library.
* Add replacement for a missing strndup (such as on Mac OS X).
* Add notices to all files copied from rra-c-util.
parent 1d15aa81
# Automake makefile for krb5-sync.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2006, 2007, 2010 Board of Trustees, Leland Stanford Jr. University
# Copyright 2006, 2007, 2010, 2012
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
......@@ -66,11 +67,12 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 build-aux/compile \
#
# -Wconversion http://bugs.debian.org/488884 (htons warnings)
#
# Last checked against gcc 4.4 (2010-08-15).
WARNINGS = -g -O -Wall -Wextra -Wendif-labels -Wformat=2 -Winit-self \
-Wswitch-enum -Wdeclaration-after-statement -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wnested-externs -Werror
# Last checked against gcc 4.6.1 (2011-05-04).
WARNINGS = -g -O -Wall -Wextra -Wendif-labels -Wformat=2 -Winit-self \
-Wswitch-enum -Wdeclaration-after-statement -Wshadow \
-Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings \
-Wjump-misses-init -Wlogical-op -Wstrict-prototypes \
-Wmissing-prototypes -Wredundant-decls -Wnested-externs -Werror
warnings:
$(MAKE) V=0 CFLAGS='$(WARNINGS)'
......@@ -13,6 +13,18 @@ krb5-sync 2.2 (unreleased)
skip -randkey key changes in the plugin since we cannot currently do
anything sensible with them. Thanks, Dominic Hargreaves.
Update to rra-c-util 4.1:
* Build on systems where krb5/krb5.h exists but krb5.h does not.
* Kerberos probes no longer assume transitive library dependencies.
* Fix removal of /usr/include from Kerberos CPPFLAGS.
* Include strings.h where present for more POSIX string functions.
* Avoid passing a NULL context to krb5_get_error_message.
* Fix a data type issue in the messages utility library.
* Fix incorrect __attribute notations in the utility library.
* Add replacement for a missing strndup (such as on Mac OS X).
* Add notices to all files copied from rra-c-util.
krb5-sync 2.1 (2010-08-26)
Queue password changes on any failure to change the password in Active
......
dnl Autoconf configuration for krb5-sync.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
dnl Copyright 2006, 2007, 2010
dnl Board of Trustees, Leland Stanford Jr. University.
dnl Copyright 2006, 2007, 2010, 2012
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl See LICENSE for licensing terms.
......@@ -37,14 +37,16 @@ RRA_LIB_KRB5_RESTORE
AC_SEARCH_LIBS([ldap_initialize], [ldap])
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([sys/bittypes.h syslog.h])
AC_CHECK_HEADERS([strings.h sys/bittypes.h syslog.h])
AC_CHECK_DECLS([snprintf, vsnprintf])
RRA_C_C99_VAMACROS
RRA_C_GNU_VAMACROS
AC_TYPE_LONG_LONG_INT
AC_CHECK_TYPES([ssize_t], [], [],
[#include <sys/types.h>])
RRA_FUNC_SNPRINTF
AC_CHECK_FUNCS([setrlimit])
AC_REPLACE_FUNCS([asprintf strlcat strlcpy])
AC_REPLACE_FUNCS([asprintf strlcat strlcpy strndup])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADER([config.h])
......
This diff is collapsed.
......@@ -9,11 +9,16 @@ dnl
dnl This macro doesn't do much but is defined separately so that other macros
dnl can require it with AC_REQUIRE.
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@stanford.edu>
dnl Copyright 2005, 2006, 2007
dnl Board of Trustees, Leland Stanford Jr. University
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl See LICENSE for licensing terms.
dnl This file is free software; the authors give unlimited permission to copy
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS],
[rra_reduced_depends=false
......
......@@ -12,10 +12,16 @@ dnl
dnl This file also provides the Autoconf macro RRA_SET_LIBDIR, which sets the
dnl libdir variable to PREFIX/lib{,32,64} as appropriate.
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@stanford.edu>
dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
dnl Copyright 2008, 2009
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl See LICENSE for licensing terms.
dnl This file is free software; the authors give unlimited permission to copy
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
dnl Probe for the alternate library name that we should attempt on this
dnl architecture, given the size of an int, and set rra_lib_arch_name to that
......
......@@ -9,11 +9,16 @@ dnl
dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a
dnl fully working snprintf is found.
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@stanford.edu>
dnl Copyright 2006, 2008, 2009
dnl Board of Trustees, Leland Stanford Jr. University
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl See LICENSE for licensing terms.
dnl This file is free software; the authors give unlimited permission to copy
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
dnl Source used by RRA_FUNC_SNPRINTF.
AC_DEFUN([_RRA_FUNC_SNPRINTF_SOURCE], [[
......
......@@ -13,11 +13,16 @@ dnl #define macro(args...) fprintf(stderr, args)
dnl
dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate.
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@stanford.edu>
dnl Copyright 2006, 2008, 2009
dnl Board of Trustees, Leland Stanford Jr. University
dnl The Board of Trustees of the Leland Stanford Junior University
dnl
dnl See LICENSE for licensing terms.
dnl This file is free software; the authors give unlimited permission to copy
dnl and/or distribute it, with or without modifications, as long as this
dnl notice is preserved.
AC_DEFUN([_RRA_C_C99_VAMACROS_SOURCE], [[
#include <stdio.h>
......
......@@ -4,8 +4,18 @@
* Provides the same functionality as the standard GNU library routines
* asprintf and vasprintf for those platforms that don't have them.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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>
......
......@@ -5,8 +5,18 @@
* supply, Automake builds an empty library and then calls ar with nonsensical
* arguments. Ensure that libportable always contains at least one symbol.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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.
*/
/* Prototype to avoid gcc warnings. */
......
......@@ -6,8 +6,18 @@
* Everything in this file will be protected by #ifndef. If the native
* Kerberos libraries are fully capable, this file will be skipped.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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>
......
......@@ -16,8 +16,18 @@
* prefers the generic krb5_xfree(). In this case, this header provides
* krb5_free_unparsed_name() for both APIs since it's the most specific call.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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_KRB5_H
......@@ -32,7 +42,11 @@
#endif
#include <portable/macros.h>
#include <krb5.h>
#ifdef HAVE_KRB5_H
# include <krb5.h>
#else
# include <krb5/krb5.h>
#endif
#include <stdlib.h>
BEGIN_DECLS
......@@ -80,7 +94,7 @@ krb5_error_code krb5_get_init_creds_opt_alloc(krb5_context,
/* Heimdal-specific. */
#ifndef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS
#define krb5_get_init_creds_opt_set_default_flags(c, p, r, o) /* empty */
# define krb5_get_init_creds_opt_set_default_flags(c, p, r, o) /* empty */
#endif
/*
......
/*
* Portability macros used in include files.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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_MACROS_H
......
......@@ -8,6 +8,9 @@
* 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/>.
*/
/*
......
......@@ -5,13 +5,31 @@
* following the C99 specification, on hosts that don't have stdbool.h. This
* logic is based heavily on the example in the Autoconf manual.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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_STDBOOL_H
#define PORTABLE_STDBOOL_H 1
/*
* Allow inclusion of config.h to be skipped, since sometimes we have to use a
* stripped-down version of config.h with a different name.
*/
#ifndef CONFIG_H_INCLUDED
# include <config.h>
#endif
#if HAVE_STDBOOL_H
# include <stdbool.h>
#else
......
......@@ -9,8 +9,18 @@
* space available in the destination buffer, not just the amount of space
* remaining.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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>
......
......@@ -8,8 +8,18 @@
* total space required is returned. The destination string is not nul-filled
* like strncpy does, just nul-terminated.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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>
......
/*
* Replacement for a missing strndup.
*
* 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@stanford.edu>
*
* 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 <portable/system.h>
#include <errno.h>
/*
* If we're running the test suite, rename the functions to avoid conflicts
* with the system versions.
*/
#if TESTING
# undef strndup
# define strndup test_strndup
char *test_strndup(const char *, size_t);
#endif
char *
strndup(const char *s, size_t n)
{
size_t length;
char *copy;
if (s == NULL) {
errno = EINVAL;
return NULL;
}
length = strlen(s);
if (length > n)
length = n;
copy = malloc(length + 1);
if (copy == NULL)
return NULL;
memcpy(copy, s, length);
copy[length] = '\0';
return copy;
}
......@@ -13,13 +13,24 @@
* #include <stddef.h>
* #include <stdint.h>
* #include <string.h>
* #include <strings.h>
* #include <unistd.h>
*
* Missing functions are provided via #define or prototyped if available from
* the portable helper library. Also provides some standard #defines.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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_SYSTEM_H
......@@ -38,6 +49,9 @@
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
......@@ -56,6 +70,38 @@
/* Get the bool type. */
#include <portable/stdbool.h>
/* Windows provides snprintf under a different name. */
#ifdef _WIN32
# define snprintf _snprintf
#endif
/* Windows does not define ssize_t. */
#ifndef HAVE_SSIZE_T
typedef ptrdiff_t ssize_t;
#endif
/*
* POSIX requires that these be defined in <unistd.h>. If one of them has
* been defined, all the rest almost certainly have.
*/
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
# define STDOUT_FILENO 1
# define STDERR_FILENO 2
#endif
/*
* C99 requires va_copy. Older versions of GCC provide __va_copy. Per the
* Autoconf manual, memcpy is a generally portable fallback.
*/
#ifndef va_copy
# ifdef __va_copy
# define va_copy(d, s) __va_copy((d), (s))
# else
# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
# endif
#endif
BEGIN_DECLS
/* Default to a hidden visibility for all portability functions. */
......@@ -84,37 +130,13 @@ extern size_t strlcat(char *, const char *, size_t);
#if !HAVE_STRLCPY
extern size_t strlcpy(char *, const char *, size_t);
#endif
#if !HAVE_STRNDUP
extern char *strndup(const char *, size_t);
#endif
/* Undo default visibility change. */
#pragma GCC visibility pop
END_DECLS
/* Windows provides snprintf under a different name. */
#ifdef _WIN32
# define snprintf _snprintf
#endif
/*
* POSIX requires that these be defined in <unistd.h>. If one of them has
* been defined, all the rest almost certainly have.
*/
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
# define STDOUT_FILENO 1
# define STDERR_FILENO 2
#endif
/*
* C99 requires va_copy. Older versions of GCC provide __va_copy. Per the
* Autoconf manual, memcpy is a generally portable fallback.
*/
#ifndef va_copy
# ifdef __va_copy
# define va_copy(d, s) __va_copy((d), (s))
# else
# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
# endif
#endif
#endif /* !PORTABLE_SYSTEM_H */
/*
* Some standard helpful macros.
*
* 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@stanford.edu>
* This work is hereby placed in the public domain by its author.
*
* 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 UTIL_MACROS_H
......@@ -10,6 +20,15 @@
#include <portable/macros.h>
/*
* Used for iterating through arrays. ARRAY_SIZE returns the number of
* elements in the array (useful for a < upper bound in a for loop) and
* ARRAY_END returns a pointer to the element past the end (ISO C99 makes it
* legal to refer to such a pointer as long as it's never dereferenced).
*/
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define ARRAY_END(array) (&(array)[ARRAY_SIZE(array)])
/* Used for unused parameters to silence gcc warnings. */
#define UNUSED __attribute__((__unused__))
......
/*
* Error handling for Kerberos v5.
* Error handling for Kerberos.
*
* Provides versions of die and warn that take a Kerberos context and a
* Kerberos error code and append the Kerberos error message to the provided
* formatted message.
*
* 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@stanford.edu>
* Copyright 2006, 2007, 2008, 2009, 2010
* Board of Trustees, Leland Stanford Jr. University
* The Board of Trustees of the Leland Stanford Junior University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* See LICENSE for licensing terms.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
......@@ -32,12 +51,16 @@ die_krb5(krb5_context ctx, krb5_error_code code, const char *format, ...)
char *message;
va_list args;
k5_msg = krb5_get_error_message(ctx, code);
if (ctx != NULL)
k5_msg = krb5_get_error_message(ctx, code);
va_start(args, format);
if (xvasprintf(&message, format, args) < 0)
die("internal error: unable to format error message");
va_end(args);
die("%s: %s", message, k5_msg);
if (k5_msg == NULL)
die("%s", message);
else
die("%s: %s", message, k5_msg);
}
......@@ -51,12 +74,17 @@ warn_krb5(krb5_context ctx, krb5_error_code code, const char *format, ...)
char *message;
va_list args;
k5_msg = krb5_get_error_message(ctx, code);
if (ctx != NULL)
k5_msg = krb5_get_error_message(ctx, code);
va_start(args, format);
if (xvasprintf(&message, format, args) < 0)
die("internal error: unable to format error message");
va_end(args);
warn("%s: %s", message, k5_msg);
if (k5_msg == NULL)
warn("%s", message);
else
warn("%s: %s", message, k5_msg);
free(message);
krb5_free_error_message(ctx, k5_msg);
if (k5_msg != NULL)
krb5_free_error_message(ctx, k5_msg);
}
/*
* Prototypes for error handling for Kerberos.
*
* 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@stanford.edu>
* Copyright 2006, 2007, 2008, 2009, 2010
* Board of Trustees, Leland Stanford Jr. University
* The Board of Trustees of the Leland Stanford Junior University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* See LICENSE for licensing terms.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef UTIL_MESSAGES_KRB5_H
......
......@@ -50,13 +50,31 @@
* generates given the format and arguments), a format, an argument list as a
* va_list, and the applicable errno value (if any).
*
* Copyright 2008 Board of Trustees, Leland Stanford Jr. University
* 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@stanford.edu>
* Copyright 2008, 2009, 2010
* The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2004, 2005, 2006
* 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
*
* See LICENSE for licensing terms.
* 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.
*/
#include <config.h>
......@@ -189,8 +207,8 @@ message_log_syslog(int pri, size_t len, const char *fmt, va_list args, int err)
buffer = malloc(len + 1);
if (buffer == NULL) {
fprintf(stderr, "failed to malloc %u bytes at %s line %d: %s",
len + 1, __FILE__, __LINE__, strerror(errno));
fprintf(stderr, "failed to malloc %lu bytes at %s line %d: %s",
(unsigned long) len + 1, __FILE__, __LINE__, strerror(errno));
exit(message_fatal_cleanup ? (*message_fatal_cleanup)() : 1);
}
vsnprintf(buffer, len + 1, fmt, args);
......
/*
* Prototypes for message and error reporting (possibly fatal).
*
* Copyright 2008, 2010 Board of Trustees, Leland Stanford Jr. University
* 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, 2010
* The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2004, 2005, 2006
* 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
*
* See LICENSE for licensing terms.
* 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 UTIL_MESSAGES_H
......@@ -60,21 +77,21 @@ void message_handlers_die(unsigned int count, ...);
* argument list, and the errno setting if any.
*/
void message_log_stdout(size_t, const char *, va_list, int)
__attribute((__nonnull__));
__attribute__((__nonnull__));
void message_log_stderr(size_t, const char *, va_list, int)
__attribute((__nonnull__));
__attribute__((__nonnull__));
void message_log_syslog_debug(size_t, const char *, va_list, int)
__attribute((__nonnull__));
__attribute__((__nonnull__));
void message_log_syslog_info(size_t, const char *, va_list, int)