Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/blacklist linux works...
details: https://anonhg.NetBSD.org/src/rev/a39f3055a6b9
branches: trunk
changeset: 335719:a39f3055a6b9
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 22 03:48:07 2015 +0000
description:
linux works...
diffstat:
external/bsd/blacklist/bin/blacklistctl.c | 5 +-
external/bsd/blacklist/bin/blacklistd.c | 7 +-
external/bsd/blacklist/bin/internal.h | 8 +-
external/bsd/blacklist/include/bl.h | 4 +-
external/bsd/blacklist/lib/bl.c | 6 +-
external/bsd/blacklist/port/Makefile.am | 10 +-
external/bsd/blacklist/port/configure.ac | 4 +-
external/bsd/blacklist/port/fgetln.c | 106 ++++++++++
external/bsd/blacklist/port/fparseln.c | 236 ++++++++++++++++++++++++
external/bsd/blacklist/port/getprogname.c | 4 +
external/bsd/blacklist/port/port.h | 21 ++
external/bsd/blacklist/port/sockaddr_snprintf.c | 9 +-
external/bsd/blacklist/port/strlcat.c | 13 +-
external/bsd/blacklist/port/strlcpy.c | 11 +-
external/bsd/blacklist/test/cltest.c | 52 ++++-
external/bsd/blacklist/test/srvtest.c | 63 +++++-
16 files changed, 514 insertions(+), 45 deletions(-)
diffs (truncated from 917 to 300 lines):
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/bin/blacklistctl.c
--- a/external/bsd/blacklist/bin/blacklistctl.c Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/bin/blacklistctl.c Thu Jan 22 03:48:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistctl.c,v 1.7 2015/01/22 03:10:49 christos Exp $ */
+/* $NetBSD: blacklistctl.c,v 1.8 2015/01/22 03:48:07 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistctl.c,v 1.7 2015/01/22 03:10:49 christos Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.8 2015/01/22 03:48:07 christos Exp $");
#include <stdio.h>
#include <time.h>
@@ -41,7 +41,6 @@
#include <util.h>
#endif
#include <fcntl.h>
-#include <db.h>
#include <err.h>
#include <stdlib.h>
#include <unistd.h>
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/bin/blacklistd.c
--- a/external/bsd/blacklist/bin/blacklistd.c Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/bin/blacklistd.c Thu Jan 22 03:48:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistd.c,v 1.14 2015/01/22 03:10:49 christos Exp $ */
+/* $NetBSD: blacklistd.c,v 1.15 2015/01/22 03:48:07 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include "config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: blacklistd.c,v 1.14 2015/01/22 03:10:49 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.15 2015/01/22 03:48:07 christos Exp $");
#include <sys/types.h>
#include <sys/socket.h>
@@ -284,7 +284,8 @@
if (tout == 0)
tout = 5000;
} else {
- daemon(0, 0);
+ if (daemon(0, 0) == -1)
+ err(EXIT_FAILURE, "daemon failed");
if (tout == 0)
tout = 15000;
}
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/bin/internal.h
--- a/external/bsd/blacklist/bin/internal.h Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/bin/internal.h Thu Jan 22 03:48:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: internal.h,v 1.6 2015/01/21 23:26:26 christos Exp $ */
+/* $NetBSD: internal.h,v 1.7 2015/01/22 03:48:07 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -31,9 +31,15 @@
#ifndef _INTERNAL_H
#define _INTERNAL_H
+#ifndef _PATH_BLCONF
#define _PATH_BLCONF "/etc/blacklistd/conf"
+#endif
+#ifndef _PATH_BLCONTROL
#define _PATH_BLCONTROL "/etc/blacklistd/control"
+#endif
+#ifndef _PATH_BLSTATE
#define _PATH_BLSTATE "/var/db/blacklistd.db"
+#endif
extern struct conf *conf;
extern size_t nconf;
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/include/bl.h
--- a/external/bsd/blacklist/include/bl.h Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/include/bl.h Thu Jan 22 03:48:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bl.h,v 1.8 2015/01/22 01:39:18 christos Exp $ */
+/* $NetBSD: bl.h,v 1.9 2015/01/22 03:48:07 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -51,7 +51,9 @@
#define bi_cred bi_u._bi_cred
+#ifndef _PATH_BLSOCK
#define _PATH_BLSOCK "/var/run/blsock"
+#endif
__BEGIN_DECLS
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/lib/bl.c
--- a/external/bsd/blacklist/lib/bl.c Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/lib/bl.c Thu Jan 22 03:48:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bl.c,v 1.12 2015/01/22 03:10:49 christos Exp $ */
+/* $NetBSD: bl.c,v 1.13 2015/01/22 03:48:07 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: bl.c,v 1.12 2015/01/22 03:10:49 christos Exp $");
+__RCSID("$NetBSD: bl.c,v 1.13 2015/01/22 03:48:07 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -167,12 +167,14 @@
}
#endif
+#ifdef notdef
if (srv)
if (listen(b->b_fd, 5) == -1) {
(*b->b_fun)(LOG_ERR, "%s: listen failed (%m)",
__func__);
goto out;
}
+#endif
return 0;
out:
bl_reset(b);
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/port/Makefile.am
--- a/external/bsd/blacklist/port/Makefile.am Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/port/Makefile.am Thu Jan 22 03:48:07 2015 +0000
@@ -1,13 +1,13 @@
#
-ACLOCAL_AMFLAGS = -Im4
+ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libblacklist.la
include_HEADERS = blacklist.h
-bin_PROGRAMS = blacklistd blacklistctl
+bin_PROGRAMS = blacklistd blacklistctl srvtest cltest
VPATH = ../bin:../lib:../test
-AM_CPPFLAGS = -I../include
+AM_CPPFLAGS = -I../include -DDOT="."
AM_CFLAGS = @WARNINGS@
libblacklist_la_SOURCES = bl.c blacklist.c
@@ -19,3 +19,7 @@
blacklistd_LDADD = libblacklist.la
blacklistctl_SOURCES = blacklistctl.c ${SRCS}
blacklistctl_LDADD = libblacklist.la
+srvtest_SOURCES = srvtest.c ${SRCS}
+srvtest_LDADD = libblacklist.la
+cltest_SOURCES = cltest.c ${SRCS}
+cltest_LDADD = libblacklist.la
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/port/configure.ac
--- a/external/bsd/blacklist/port/configure.ac Thu Jan 22 03:43:24 2015 +0000
+++ b/external/bsd/blacklist/port/configure.ac Thu Jan 22 03:48:07 2015 +0000
@@ -26,6 +26,8 @@
AC_CHECK_HEADERS(arpa/inet.h getopt.h err.h)
AC_CHECK_HEADERS(sys/types.h util.h sys/time.h time.h)
AC_CHECK_HEADERS(netatalk/at.h net/if_dl.h db.h db_185.h)
+AC_CHECK_LIB(rt, clock_gettime)
+AC_CHECK_LIB(db, __db185_open)
AH_BOTTOM([
#ifndef __NetBSD__
@@ -78,7 +80,7 @@
AC_CHECK_FUNCS(strerror)
dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(strtoi sockaddr_snprintf popenve clock_gettime strlcpy strlcat getprogname)
+AC_REPLACE_FUNCS(strtoi sockaddr_snprintf popenve clock_gettime strlcpy strlcat getprogname fparseln fgetln)
dnl See if we are cross-compiling
AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/port/fgetln.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/blacklist/port/fgetln.c Thu Jan 22 03:48:07 2015 +0000
@@ -0,0 +1,106 @@
+/* $NetBSD: fgetln.c,v 1.1 2015/01/22 03:48:07 christos Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if !HAVE_FGETLN
+#include <stdlib.h>
+#ifndef HAVE_NBTOOL_CONFIG_H
+/* These headers are required, but included from nbtool_config.h */
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#endif
+
+char *
+fgetln(FILE *fp, size_t *len)
+{
+ static char *buf = NULL;
+ static size_t bufsiz = 0;
+ char *ptr;
+
+
+ if (buf == NULL) {
+ bufsiz = BUFSIZ;
+ if ((buf = malloc(bufsiz)) == NULL)
+ return NULL;
+ }
+
+ if (fgets(buf, bufsiz, fp) == NULL)
+ return NULL;
+
+ *len = 0;
+ while ((ptr = strchr(&buf[*len], '\n')) == NULL) {
+ size_t nbufsiz = bufsiz + BUFSIZ;
+ char *nbuf = realloc(buf, nbufsiz);
+
+ if (nbuf == NULL) {
+ int oerrno = errno;
+ free(buf);
+ errno = oerrno;
+ buf = NULL;
+ return NULL;
+ } else
+ buf = nbuf;
+
+ if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL) {
+ buf[bufsiz] = '\0';
+ *len = strlen(buf);
+ return buf;
+ }
+
+ *len = bufsiz;
+ bufsiz = nbufsiz;
+ }
+
+ *len = (ptr - buf) + 1;
+ return buf;
+}
+
+#endif
+
+#ifdef TEST
+int
+main(int argc, char *argv[])
+{
+ char *p;
+ size_t len;
+
+ while ((p = fgetln(stdin, &len)) != NULL) {
+ (void)printf("%zu %s", len, p);
+ free(p);
+ }
+ return 0;
+}
+#endif
diff -r 3dd232c5da15 -r a39f3055a6b9 external/bsd/blacklist/port/fparseln.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/blacklist/port/fparseln.c Thu Jan 22 03:48:07 2015 +0000
@@ -0,0 +1,236 @@
+/* $NetBSD: fparseln.c,v 1.1 2015/01/22 03:48:07 christos Exp $ */
+
+/*
+ * Copyright (c) 1997 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
Home |
Main Index |
Thread Index |
Old Index