diff --git a/Knot.files b/Knot.files index a49f32f4ed6c6ece2df80852c77176a1b4351f3f..66add8be628a7640bdd9c7d478730d3ce640506b 100644 --- a/Knot.files +++ b/Knot.files @@ -31,6 +31,10 @@ libtap/tap/float.h libtap/tap/macros.h samples/Makefile.am src/Makefile.am +src/contrib/openbsd/strlcat.c +src/contrib/openbsd/strlcat.h +src/contrib/openbsd/strlcpy.c +src/contrib/openbsd/strlcpy.h src/contrib/ucw/array-sort.h src/contrib/ucw/binsearch.h src/contrib/ucw/heap.c @@ -375,10 +379,6 @@ src/libknot/internal/print.c src/libknot/internal/print.h src/libknot/internal/sockaddr.c src/libknot/internal/sockaddr.h -src/libknot/internal/strlcat.c -src/libknot/internal/strlcat.h -src/libknot/internal/strlcpy.c -src/libknot/internal/strlcpy.h src/libknot/internal/tolower.c src/libknot/internal/tolower.h src/libknot/internal/trie/hat-trie.c diff --git a/src/Makefile.am b/src/Makefile.am index 094e60107e367af22abad4c83a9a151d86abc9b8..fa3bfa8305ab8c428c24d59376438ab55ad2dad8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,6 +24,8 @@ AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) libcontrib_ladir = $(includedir) nobase_libcontrib_la_HEADERS = \ + contrib/openbsd/strlcat.h \ + contrib/openbsd/strlcpy.h \ contrib/ucw/array-sort.h \ contrib/ucw/binsearch.h \ contrib/ucw/heap.h \ @@ -84,8 +86,6 @@ nobase_libknot_internal_la_HEADERS = \ libknot/internal/net.h \ libknot/internal/print.h \ libknot/internal/sockaddr.h \ - libknot/internal/strlcat.h \ - libknot/internal/strlcpy.h \ libknot/internal/tolower.h \ libknot/internal/trie/hat-trie.h \ libknot/internal/trie/murmurhash3.h \ @@ -101,6 +101,8 @@ nobase_libknot_yparser_la_HEADERS = \ # dynamic: libknot sources libcontrib_la_SOURCES = \ + contrib/openbsd/strlcat.c \ + contrib/openbsd/strlcpy.c \ contrib/ucw/heap.c \ contrib/ucw/mempool.c \ $(nobase_libcontrib_la_HEADERS) @@ -153,8 +155,6 @@ libknot_internal_la_SOURCES = \ libknot/internal/net.c \ libknot/internal/print.c \ libknot/internal/sockaddr.c \ - libknot/internal/strlcat.c \ - libknot/internal/strlcpy.c \ libknot/internal/tolower.c \ libknot/internal/trie/hat-trie.c \ libknot/internal/trie/murmurhash3.c \ diff --git a/src/libknot/internal/strlcat.c b/src/contrib/openbsd/strlcat.c similarity index 94% rename from src/libknot/internal/strlcat.c rename to src/contrib/openbsd/strlcat.c index 1485dbfc8e9543993ff44cf5babee3c62a2cfa3e..1409062537a2a3c16c011ca66908bd102f016196 100644 --- a/src/libknot/internal/strlcat.c +++ b/src/contrib/openbsd/strlcat.c @@ -17,8 +17,7 @@ #include <sys/types.h> #include <string.h> -#include "libknot/internal/macros.h" -#include "libknot/internal/strlcat.h" +#include "contrib/openbsd/strlcat.h" size_t knot_strlcat(char *dst, const char *src, size_t siz) diff --git a/src/libknot/internal/strlcat.h b/src/contrib/openbsd/strlcat.h similarity index 100% rename from src/libknot/internal/strlcat.h rename to src/contrib/openbsd/strlcat.h diff --git a/src/libknot/internal/strlcpy.c b/src/contrib/openbsd/strlcpy.c similarity index 94% rename from src/libknot/internal/strlcpy.c rename to src/contrib/openbsd/strlcpy.c index 2e276e5569ae432364c9d08e6a4cec0d60c31add..eafc0e4b8915d440c09227cd8ac503e64955c1f2 100644 --- a/src/libknot/internal/strlcpy.c +++ b/src/contrib/openbsd/strlcpy.c @@ -17,8 +17,7 @@ #include <sys/types.h> #include <string.h> -#include "libknot/internal/macros.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" size_t knot_strlcpy(char *dst, const char *src, size_t siz) diff --git a/src/libknot/internal/strlcpy.h b/src/contrib/openbsd/strlcpy.h similarity index 96% rename from src/libknot/internal/strlcpy.h rename to src/contrib/openbsd/strlcpy.h index 73343e4ab11b83a22c9a1be996149f16f75f248c..6421068eb8f7c7170bdb7a2c4de8bf797dda9607 100644 --- a/src/libknot/internal/strlcpy.h +++ b/src/contrib/openbsd/strlcpy.h @@ -20,8 +20,6 @@ #define strlcpy(dst, src, size) knot_strlcpy(dst, src, size) #endif -#include "libknot/internal/macros.h" - /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). diff --git a/src/knot/common/log.c b/src/knot/common/log.c index 5d5d58cfd8457a44d42f0a87033ed94fc0ac685a..25820c4bea534a1f61bd4b1e0f28bccbb75bf3a5 100644 --- a/src/knot/common/log.c +++ b/src/knot/common/log.c @@ -33,7 +33,7 @@ #include "libknot/libknot.h" #include "libknot/internal/lists.h" #include "libknot/internal/macros.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" /* Single log message buffer length (one line). */ #define LOG_BUFLEN 512 diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c index e6c1e3946cd53778ad04a10880ef7a43076265f6..3341764dbc70db9cf58047db97dd0c4fdc556770 100644 --- a/src/knot/conf/conf.c +++ b/src/knot/conf/conf.c @@ -26,8 +26,8 @@ #include "libknot/internal/macros.h" #include "libknot/internal/mem.h" #include "libknot/internal/sockaddr.h" -#include "libknot/internal/strlcat.h" #include "libknot/yparser/yptrafo.h" +#include "contrib/openbsd/strlcat.h" /*! Configuration specific logging. */ #define CONF_LOG(severity, msg, ...) do { \ diff --git a/src/knot/conf/confdb.c b/src/knot/conf/confdb.c index 2f9c7902775f96f69bfa0bc2c0fd909f1e333bb4..05c610823c865b5ab120793ef657d88afa78b6f9 100644 --- a/src/knot/conf/confdb.c +++ b/src/knot/conf/confdb.c @@ -28,6 +28,7 @@ #include "knot/conf/confdb.h" #include "libknot/errcode.h" #include "libknot/yparser/yptrafo.h" +#include "contrib/openbsd/strlcpy.h" /* * A simple configuration: diff --git a/src/knot/conf/confio.c b/src/knot/conf/confio.c index 8d570b40b3fe496ca645c20534fca96294395419..4d8633566da8ac8d84c63130a25a77fc09ec9671 100644 --- a/src/knot/conf/confio.c +++ b/src/knot/conf/confio.c @@ -22,7 +22,7 @@ #include "knot/conf/tools.h" #include "libknot/yparser/yptrafo.h" #include "libknot/internal/mem.h" -#include "libknot/internal/strlcat.h" +#include "contrib/openbsd/strlcat.h" #define FCN(io) (io->fcn != NULL) ? io->fcn(io) : KNOT_EOK diff --git a/src/knot/ctl/remote.c b/src/knot/ctl/remote.c index 912089782ebab23857f68007a8cfb1fb4f98b36c..378540472fa5d6241d112ecc9e8e336c307ad032 100644 --- a/src/knot/ctl/remote.c +++ b/src/knot/ctl/remote.c @@ -33,8 +33,8 @@ #include "libknot/internal/macros.h" #include "libknot/internal/mem.h" #include "libknot/internal/net.h" -#include "libknot/internal/strlcpy.h" #include "libknot/yparser/yptrafo.h" +#include "contrib/openbsd/strlcpy.h" #define KNOT_CTL_REALM "knot." #define KNOT_CTL_REALM_EXT ("." KNOT_CTL_REALM) diff --git a/src/knot/nameserver/query_module.c b/src/knot/nameserver/query_module.c index 0b6da98e727ab096b77a49e91c1fcfb778afb9dd..856df413c27dc27bb198f52dd675103a64dfff85 100644 --- a/src/knot/nameserver/query_module.c +++ b/src/knot/nameserver/query_module.c @@ -1,6 +1,22 @@ +/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #include "knot/nameserver/query_module.h" #include "libknot/libknot.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" /* Compiled-in module headers. */ #include "knot/modules/synth_record.h" diff --git a/src/libknot/internal/sockaddr.c b/src/libknot/internal/sockaddr.c index 0212ab4ccb05322d3d2ff4833ce6a8eea7f0fbf6..4554a41dd50f87aef4c1dc5d82a0ca13e3416ead 100644 --- a/src/libknot/internal/sockaddr.c +++ b/src/libknot/internal/sockaddr.c @@ -22,8 +22,8 @@ #include "libknot/internal/utils.h" #include "libknot/internal/sockaddr.h" #include "libknot/internal/errcode.h" -#include "libknot/internal/strlcpy.h" #include "libknot/internal/consts.h" +#include "contrib/openbsd/strlcpy.h" int sockaddr_len(const struct sockaddr *ss) { diff --git a/src/utils/common/exec.c b/src/utils/common/exec.c index 263e980f2c1a13d3f86381a074e93b4abef3a9ef..9a94ad12fa83e799c67d119ea57ecd5427442e92 100644 --- a/src/utils/common/exec.c +++ b/src/utils/common/exec.c @@ -27,8 +27,8 @@ #include "libknot/internal/lists.h" #include "libknot/internal/print.h" #include "libknot/internal/sockaddr.h" -#include "libknot/internal/strlcat.h" #include "libknot/internal/wire_ctx.h" +#include "contrib/openbsd/strlcat.h" static lookup_table_t rtypes[] = { { KNOT_RRTYPE_A, "has IPv4 address" }, diff --git a/src/utils/common/params.c b/src/utils/common/params.c index 5b9ab8caae42d3430a33a7fdfbb0014270077358..bf6e6890947054ca81bd6c4935544d671eed9cc8 100644 --- a/src/utils/common/params.c +++ b/src/utils/common/params.c @@ -30,7 +30,7 @@ #include "utils/common/token.h" #include "libknot/libknot.h" #include "libknot/internal/mempattern.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" #define IPV4_REVERSE_DOMAIN "in-addr.arpa." #define IPV6_REVERSE_DOMAIN "ip6.arpa." diff --git a/src/utils/knot1to2/cf-lex.c b/src/utils/knot1to2/cf-lex.c index 7408cd6db3c0d5c95c73dc25d1e95b1cff29cb43..05b723e982aa9438b1d4163063d236b640e17212 100644 --- a/src/utils/knot1to2/cf-lex.c +++ b/src/utils/knot1to2/cf-lex.c @@ -860,7 +860,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[92] = #include "utils/knot1to2/includes.h" #include "utils/knot1to2/extra.h" #include "utils/knot1to2/cf-parse.tab.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" /* Imported symbols. */ #define lval (yylval->tok) diff --git a/src/utils/knot1to2/cf-lex.l b/src/utils/knot1to2/cf-lex.l index 0b8737a603c93ea21037498a9e947704c0e34d7b..4385ba5f3f5ee1260810dce4ddf739592ef012ab 100644 --- a/src/utils/knot1to2/cf-lex.l +++ b/src/utils/knot1to2/cf-lex.l @@ -28,7 +28,7 @@ #include "utils/knot1to2/includes.h" #include "utils/knot1to2/extra.h" #include "utils/knot1to2/cf-parse.tab.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" /* Imported symbols. */ #define lval (yylval->tok) diff --git a/src/utils/knot1to2/cf-parse.tab.c b/src/utils/knot1to2/cf-parse.tab.c index d9929b4d1b03cbcb24f7d7750f67c273dbac5ae2..ed13f5e9042df93753cde05df0f83721a5c86958 100644 --- a/src/utils/knot1to2/cf-parse.tab.c +++ b/src/utils/knot1to2/cf-parse.tab.c @@ -80,8 +80,8 @@ #include "utils/knot1to2/scheme.h" #include "utils/knot1to2/extra.h" #include "utils/knot1to2/cf-parse.tab.h" -#include "libknot/internal/strlcat.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcat.h" +#include "contrib/openbsd/strlcpy.h" #define DEFAULT_PORT 53 #define DEFAULT_CTL_PORT 5533 diff --git a/src/utils/knot1to2/cf-parse.y b/src/utils/knot1to2/cf-parse.y index 89332cf765c81de23dc909fe690685d78f76e8dc..aad6effebf5969d73e7af51bd819234673401ee6 100644 --- a/src/utils/knot1to2/cf-parse.y +++ b/src/utils/knot1to2/cf-parse.y @@ -24,8 +24,8 @@ #include "utils/knot1to2/scheme.h" #include "utils/knot1to2/extra.h" #include "utils/knot1to2/cf-parse.tab.h" -#include "libknot/internal/strlcat.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcat.h" +#include "contrib/openbsd/strlcpy.h" #define DEFAULT_PORT 53 #define DEFAULT_CTL_PORT 5533 diff --git a/src/utils/knsupdate/knsupdate_exec.c b/src/utils/knsupdate/knsupdate_exec.c index df651929d6bd9c7480455a1138a040f2487eb9aa..76d45eca167898d34c082fac50406be27e8af0ef 100644 --- a/src/utils/knsupdate/knsupdate_exec.c +++ b/src/utils/knsupdate/knsupdate_exec.c @@ -34,7 +34,7 @@ #include "libknot/internal/getline.h" #include "libknot/internal/macros.h" #include "libknot/internal/mem.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" /* Declarations of cmd parse functions. */ typedef int (*cmd_handle_f)(const char *lp, knsupdate_params_t *params); diff --git a/tests/base32hex.c b/tests/base32hex.c index c9e9198b4ececeeda8e7807e6fbe05e8651d1852..442a82988f673ef51eb0b0a7e4d039cc1c611c60 100644 --- a/tests/base32hex.c +++ b/tests/base32hex.c @@ -21,7 +21,7 @@ #include "libknot/libknot.h" #include "libknot/internal/base32hex.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" #define BUF_LEN 256 #define MAX_BIN_DATA_LEN ((INT32_MAX / 8) * 5) diff --git a/tests/base64.c b/tests/base64.c index db45809990bf1006c661df94e773eaf73f8a1ae3..6b680e3615f085b9f6b9f43299d01911fb993d19 100644 --- a/tests/base64.c +++ b/tests/base64.c @@ -21,7 +21,7 @@ #include "libknot/libknot.h" #include "libknot/internal/base64.h" -#include "libknot/internal/strlcpy.h" +#include "contrib/openbsd/strlcpy.h" #define BUF_LEN 256 #define MAX_BIN_DATA_LEN ((INT32_MAX / 4) * 3) diff --git a/tests/confio.c b/tests/confio.c index 9e05e5a1d4792fc7bab4257e88422be84fe69949..b84ac928cb3ef164095464d5df362eeb6769196a 100644 --- a/tests/confio.c +++ b/tests/confio.c @@ -20,8 +20,8 @@ #include "knot/conf/confio.h" #include "knot/conf/tools.h" #include "knot/ctl/remote.h" -#include "libknot/internal/strlcat.h" #include "libknot/internal/mem.h" +#include "contrib/openbsd/strlcat.h" #define SKIP_OPENBSD skip("Nested transactions are not supported on OpenBSD"); #define OUT_LEN 1024 diff --git a/tests/namedb.c b/tests/namedb.c index 1dbb4ca894c2425f623c869e2ea0448370e8519f..074657db44b02ae98f19575325d346d497ec9541 100644 --- a/tests/namedb.c +++ b/tests/namedb.c @@ -26,8 +26,8 @@ #include "libknot/internal/mem.h" #include "libknot/internal/namedb/namedb_lmdb.h" #include "libknot/internal/namedb/namedb_trie.h" -#include "libknot/internal/strlcpy.h" #include "libknot/libknot.h" +#include "contrib/openbsd/strlcpy.h" #include "contrib/ucw/mempool.h" /* UCW array sorting defines. */ diff --git a/tests/zonedb.c b/tests/zonedb.c index f522ba478cb1acc40a2f859513a7c76d9aa8b824..39b583f51d57fc0369d2fda08bf3fb830fe4330c 100644 --- a/tests/zonedb.c +++ b/tests/zonedb.c @@ -16,10 +16,10 @@ #include <tap/basic.h> -#include "libknot/internal/strlcat.h" -#include "libknot/internal/strlcpy.h" #include "knot/zone/zone.h" #include "knot/zone/zonedb.h" +#include "contrib/openbsd/strlcat.h" +#include "contrib/openbsd/strlcpy.h" #define ZONE_COUNT 10 static const char *zone_list[ZONE_COUNT] = {