summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-07-15 09:47:16 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-07-15 09:47:16 +0200
commit163bc6d7fc268bdb1c7cc03699f69d0c5cc0b4cd (patch)
treeeec08d80894534fefc488261dfcb9a5c246cb523
parent980784c1917f19bfd2e9b11faca76d14e8589daa (diff)
New upstream version 4.14upstream/4.14
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/changelog.rst17
-rw-r--r--include/libHX/libxml_helper.h2
-rw-r--r--src/format.c5
-rw-r--r--src/io.c3
-rw-r--r--src/map.c2
-rw-r--r--src/proc.c2
-rw-r--r--src/socket.c7
-rw-r--r--src/tc-socket.c31
-rw-r--r--src/tc-string.c4
11 files changed, 77 insertions, 18 deletions
diff --git a/configure b/configure
index aff932f..f0146dd 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for libHX 4.12.
+# Generated by GNU Autoconf 2.71 for libHX 4.14.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -618,8 +618,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libHX'
PACKAGE_TARNAME='libhx'
-PACKAGE_VERSION='4.12'
-PACKAGE_STRING='libHX 4.12'
+PACKAGE_VERSION='4.14'
+PACKAGE_STRING='libHX 4.14'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1375,7 +1375,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libHX 4.12 to adapt to many kinds of systems.
+\`configure' configures libHX 4.14 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1446,7 +1446,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libHX 4.12:";;
+ short | recursive ) echo "Configuration of libHX 4.14:";;
esac
cat <<\_ACEOF
@@ -1561,7 +1561,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libHX configure 4.12
+libHX configure 4.14
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2195,7 +2195,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libHX $as_me 4.12, which was
+It was created by libHX $as_me 4.14, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3684,7 +3684,7 @@ fi
# Define the identity of the package.
PACKAGE='libhx'
- VERSION='4.12'
+ VERSION='4.14'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -18771,7 +18771,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libHX $as_me 4.12, which was
+This file was extended by libHX $as_me 4.14, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18839,7 +18839,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-libHX config.status 4.12
+libHX config.status 4.14
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index f569ade..92c72c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([libHX], [4.12])
+AC_INIT([libHX], [4.14])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 30f2d28..26c4d06 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,3 +1,20 @@
+v4.14 (2023-07-14)
+==================
+
+Fixes:
+
+* socket: make HX_addrport_split work on portless bracketed hostspec
+
+
+v4.13 (2023-06-21)
+==================
+
+Fixes:
+
+* io: do not fail HX_mkdir when a component is a symlink to a directory
+* xml_helper: fix infinite recursion in xml_getnsprop
+
+
v4.12 (2023-02-27)
==================
diff --git a/include/libHX/libxml_helper.h b/include/libHX/libxml_helper.h
index 08a0a07..5a02bf0 100644
--- a/include/libHX/libxml_helper.h
+++ b/include/libHX/libxml_helper.h
@@ -118,7 +118,7 @@ static __inline__ const char *xml_getprop(const xmlNode *node, const char *attr)
static __inline__ char *xml_getnsprop(const xmlNode *node, const char *nsprefix,
const char *attr)
{
- return xml_getnsprop(const_cast<const xmlNode *>(node), nsprefix, attr);
+ return xml_getnsprop(const_cast<xmlNode *>(node), nsprefix, attr);
}
#endif
diff --git a/src/format.c b/src/format.c
index 25c09d6..e924c6a 100644
--- a/src/format.c
+++ b/src/format.c
@@ -7,6 +7,7 @@
* General Public License as published by the Free Software Foundation;
* either version 2.1 or (at your option) any later version.
*/
+#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
@@ -681,6 +682,7 @@ EXPORT_SYMBOL ssize_t HXformat3_aprintf(const struct HXformat_map *blk,
out:
ret = -errno;
HXmc_free(out);
+ *resultp = nullptr;
return ret;
}
@@ -716,7 +718,7 @@ EXPORT_SYMBOL int HXformat_sprintf(const struct HXformat_map *ftable,
EXPORT_SYMBOL ssize_t HXformat3_sprintf(const struct HXformat_map *ftable,
char *dest, size_t size, const char *fmt)
{
- hxmc_t *str;
+ hxmc_t *str = nullptr;
ssize_t ret;
if ((ret = HXformat_aprintf(ftable, &str, fmt)) < 0)
@@ -725,6 +727,7 @@ EXPORT_SYMBOL ssize_t HXformat3_sprintf(const struct HXformat_map *ftable,
*dest = '\0';
return 0;
}
+ assert(str != nullptr);
strncpy(dest, str, size);
size_t xl = strlen(dest);
HXmc_free(str);
diff --git a/src/io.c b/src/io.c
index a6c0a68..76c9444 100644
--- a/src/io.c
+++ b/src/io.c
@@ -66,7 +66,7 @@ static int mkdir_gen(const char *d, unsigned int mode)
return 1;
if (errno != EEXIST)
return -errno;
- if (lstat(d, &sb) == 0) {
+ if (stat(d, &sb) == 0) {
#if defined(_WIN32)
if (sb.st_mode & S_IFDIR)
#else
@@ -424,6 +424,7 @@ HX_realpath_symres(struct HX_realpath_state *state, const char *path)
return -ELOOP;
#endif
+ assert(state->link_target != nullptr);
if (*state->link_target == '/') {
*state->dest = '\0';
if (HXmc_setlen(&state->dest, 0) == NULL)
diff --git a/src/map.c b/src/map.c
index 40f376c..36e4633 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1145,7 +1145,7 @@ static const struct HXmap_node *HXumap_traverse(struct HXumap_trav *trav)
while (trav->head == &hmap->bk_array[trav->bk_current]) {
if (++trav->bk_current >= HXhash_primes[hmap->power])
- return false;
+ return NULL;
trav->head = hmap->bk_array[trav->bk_current].next;
}
diff --git a/src/proc.c b/src/proc.c
index 1151fff..801023b 100644
--- a/src/proc.c
+++ b/src/proc.c
@@ -69,7 +69,7 @@ static int HXproc_switch_group(const struct passwd *pw, const char *group)
return HXproc_switch_gid(pw, gr->gr_gid);
}
-EXPORT_SYMBOL int HXproc_switch_user(const char *user, const char *group)
+EXPORT_SYMBOL enum HXproc_su_status HXproc_switch_user(const char *user, const char *group)
{
const struct passwd *pw = NULL;
if (user != NULL && *user != '\0') {
diff --git a/src/socket.c b/src/socket.c
index 9b5d78a..0b6f674 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -86,8 +86,11 @@ int HX_addrport_split(const char *spec, char *host,
unsigned long hlen = end - spec;
if (hlen >= hbufsz)
return -E2BIG;
- if (*++end == '\0')
+ if (*++end == '\0') {
+ memmove(host, spec, hlen);
+ host[hlen] = '\0';
return 1;
+ }
if (*end++ != ':')
return -EINVAL;
char *nend = nullptr;
@@ -146,6 +149,8 @@ int HX_inet_connect(const char *host, uint16_t port, unsigned int oflags)
struct addrinfo *aires = nullptr;
int ret = HX_inet_lookup(host, port, AI_ADDRCONFIG, &aires);
int saved_errno = 0;
+ if (ret != 0)
+ ;
for (const struct addrinfo *r = aires; r != nullptr; r = r->ai_next) {
int fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
if (fd < 0) {
diff --git a/src/tc-socket.c b/src/tc-socket.c
index 9904ba8..3cdeb90 100644
--- a/src/tc-socket.c
+++ b/src/tc-socket.c
@@ -12,12 +12,30 @@
#ifndef AI_V4MAPPED
# define AI_V4MAPPED 0
#endif
+#include "internal.h"
-int main(void)
+static int t_parse(void)
+{
+ char host[32] = "bogus";
+ if (HX_addrport_split("[::1]", host, sizeof(host), nullptr) != 1 ||
+ strcmp(host, "::1") != 0)
+ return 1;
+ if (HX_addrport_split("[]", host, sizeof(host), nullptr) != 1 ||
+ strcmp(host, "") != 0)
+ return 1;
+ if (HX_addrport_split("", host, sizeof(host), nullptr) != 1 ||
+ strcmp(host, "") != 0)
+ return 1;
+ return 0;
+}
+
+static int t_local(void)
{
static const char *addrs[] = {
"::1", "::2", "::ffff:127.0.0.1", "::",
+ "[::1]", "[::2]", "[::ffff:127.0.0.1]", "[::]",
"127.0.0.1", "127.0.0.2", "1.1.1.1", "255.255.255.255",
+ "[127.0.0.1]", "[127.0.0.2]", "[1.1.1.1]", "[255.255.255.255]",
};
for (size_t i = 0; i < ARRAY_SIZE(addrs); ++i) {
char host[32] = {};
@@ -73,3 +91,14 @@ int main(void)
}
return EXIT_SUCCESS;
}
+
+int main(void)
+{
+ int ret = t_parse();
+ if (ret != 0)
+ return ret;
+ ret = t_local();
+ if (ret != EXIT_SUCCESS)
+ return ret;
+ return EXIT_SUCCESS;
+}
diff --git a/src/tc-string.c b/src/tc-string.c
index 77235c2..9bf668b 100644
--- a/src/tc-string.c
+++ b/src/tc-string.c
@@ -84,12 +84,16 @@ static void t_strncat(void)
{
char data[5] = "DATA";
+#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation"
+#endif
if (snprintf(data, sizeof(data), "12345678") >=
static_cast(ssize_t, sizeof(data)))
printf("Not enough space\n");
+#ifndef __clang__
#pragma GCC diagnostic pop
+#endif
printf("String: >%s<\n", data);
HX_strlcat(data, "pqrstuv__", 2);