From da61635b75f176c1e740c71809bc78a7c53b854a Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Fri, 7 Aug 2009 20:00:09 +0200 Subject: [PATCH] Quest Software, Inc. and its contributors waive all copyright claims on the attached getifaddrs test code and dedicate it to the public domain. Changed to looked to the other heimdal test apps by me --- lib/roken/Makefile.am | 1 + lib/roken/getifaddrs-test.c | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 lib/roken/getifaddrs-test.c diff --git a/lib/roken/Makefile.am b/lib/roken/Makefile.am index 352499178..cd64acad0 100644 --- a/lib/roken/Makefile.am +++ b/lib/roken/Makefile.am @@ -24,6 +24,7 @@ nodist_make_roken_SOURCES = make-roken.c check_PROGRAMS = \ base64-test \ getaddrinfo-test \ + getifaddrs-test \ hex-test \ test-readenv \ parse_bytes-test \ diff --git a/lib/roken/getifaddrs-test.c b/lib/roken/getifaddrs-test.c new file mode 100644 index 000000000..76ed061bc --- /dev/null +++ b/lib/roken/getifaddrs-test.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "roken.h" + +#include + +int +main(int argc, char **argv) +{ + struct ifaddrs *addrs = NULL; + int ret; + + ret = getifaddrs(&addrs); + if (ret != 0) + err(1, "getifaddrs"); + + /* Check that freeifaddrs doesn't crash */ + freeifaddrs(addrs); + + return 0; +}