Hello community, here is the log from the commit of package ell for openSUSE:Factory checked in at 2020-01-06 16:02:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ell (Old) and /work/SRC/openSUSE:Factory/.ell.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ell" Mon Jan 6 16:02:03 2020 rev:12 rq:760500 version:0.27 Changes: -------- --- /work/SRC/openSUSE:Factory/ell/ell.changes 2019-11-06 13:48:31.099662898 +0100 +++ /work/SRC/openSUSE:Factory/.ell.new.6675/ell.changes 2020-01-06 16:02:05.769722938 +0100 @@ -1,0 +2,7 @@ +Thu Jan 2 11:25:54 UTC 2020 - Harry ten Berge <[email protected]> + +- ver 0.27: + * Fix issue with data overflow and multiple PEMs. + * Fix issue with handling DHCP lease expiration. + +------------------------------------------------------------------- Old: ---- ell-0.26.tar.sign ell-0.26.tar.xz New: ---- ell-0.27.tar.sign ell-0.27.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ell.spec ++++++ --- /var/tmp/diff_new_pack.dKFafw/_old 2020-01-06 16:02:06.321723225 +0100 +++ /var/tmp/diff_new_pack.dKFafw/_new 2020-01-06 16:02:06.325723226 +0100 @@ -1,7 +1,7 @@ # # spec file for package ell # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: ell %define lname libell0 -Version: 0.26 +Version: 0.27 Release: 0 Summary: Wireless setup and cryptography library License: LGPL-2.1-or-later ++++++ ell-0.26.tar.xz -> ell-0.27.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ChangeLog new/ell-0.27/ChangeLog --- old/ell-0.26/ChangeLog 2019-10-30 11:41:14.000000000 +0100 +++ new/ell-0.27/ChangeLog 2019-12-13 10:09:05.000000000 +0100 @@ -1,3 +1,7 @@ +ver 0.27: + Fix issue with data overflow and multiple PEMs. + Fix issue with handling DHCP lease expiration. + ver 0.26: Fix issue with memory leak and TLS certificates. Fix issue with buffer size and TLS PRF handling. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/Makefile.am new/ell-0.27/Makefile.am --- old/ell-0.26/Makefile.am 2019-10-11 01:59:42.000000000 +0200 +++ new/ell-0.27/Makefile.am 2019-12-13 10:09:05.000000000 +0100 @@ -178,7 +178,8 @@ unit/test-ecc \ unit/test-ecdh \ unit/test-time \ - unit/test-path + unit/test-path \ + unit/test-net dbus_tests = unit/test-hwdb \ unit/test-dbus \ @@ -304,6 +305,8 @@ unit_test_path_LDADD = ell/libell-private.la +unit_test_net_LDADD = ell/libell-private.la + if MAINTAINER_MODE noinst_LTLIBRARIES += unit/example-plugin.la endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/Makefile.in new/ell-0.27/Makefile.in --- old/ell-0.26/Makefile.in 2019-10-30 11:42:52.000000000 +0100 +++ new/ell-0.27/Makefile.in 2019-12-13 10:10:43.000000000 +0100 @@ -132,7 +132,8 @@ unit/test-uuid$(EXEEXT) unit/test-pbkdf2$(EXEEXT) \ unit/test-dhcp$(EXEEXT) unit/test-dir-watch$(EXEEXT) \ unit/test-ecc$(EXEEXT) unit/test-ecdh$(EXEEXT) \ - unit/test-time$(EXEEXT) unit/test-path$(EXEEXT) + unit/test-time$(EXEEXT) unit/test-path$(EXEEXT) \ + unit/test-net$(EXEEXT) am__EXEEXT_2 = unit/test-hwdb$(EXEEXT) unit/test-dbus$(EXEEXT) \ unit/test-dbus-util$(EXEEXT) unit/test-dbus-message$(EXEEXT) \ unit/test-dbus-message-fds$(EXEEXT) \ @@ -348,6 +349,9 @@ unit_test_main_SOURCES = unit/test-main.c unit_test_main_OBJECTS = unit/test-main.$(OBJEXT) unit_test_main_DEPENDENCIES = ell/libell-private.la +unit_test_net_SOURCES = unit/test-net.c +unit_test_net_OBJECTS = unit/test-net.$(OBJEXT) +unit_test_net_DEPENDENCIES = ell/libell-private.la unit_test_netlink_SOURCES = unit/test-netlink.c unit_test_netlink_OBJECTS = unit/test-netlink.$(OBJEXT) unit_test_netlink_DEPENDENCIES = ell/libell-private.la @@ -472,16 +476,16 @@ unit/$(DEPDIR)/test-gvariant-util.Po \ unit/$(DEPDIR)/test-hashmap.Po unit/$(DEPDIR)/test-hwdb.Po \ unit/$(DEPDIR)/test-io.Po unit/$(DEPDIR)/test-key.Po \ - unit/$(DEPDIR)/test-main.Po unit/$(DEPDIR)/test-netlink.Po \ - unit/$(DEPDIR)/test-path.Po unit/$(DEPDIR)/test-pbkdf2.Po \ - unit/$(DEPDIR)/test-pem.Po unit/$(DEPDIR)/test-plugin.Po \ - unit/$(DEPDIR)/test-queue.Po unit/$(DEPDIR)/test-random.Po \ - unit/$(DEPDIR)/test-ringbuf.Po unit/$(DEPDIR)/test-settings.Po \ - unit/$(DEPDIR)/test-siphash.Po unit/$(DEPDIR)/test-string.Po \ - unit/$(DEPDIR)/test-time.Po unit/$(DEPDIR)/test-tls.Po \ - unit/$(DEPDIR)/test-uintset.Po unit/$(DEPDIR)/test-unit.Po \ - unit/$(DEPDIR)/test-utf8.Po unit/$(DEPDIR)/test-util.Po \ - unit/$(DEPDIR)/test-uuid.Po + unit/$(DEPDIR)/test-main.Po unit/$(DEPDIR)/test-net.Po \ + unit/$(DEPDIR)/test-netlink.Po unit/$(DEPDIR)/test-path.Po \ + unit/$(DEPDIR)/test-pbkdf2.Po unit/$(DEPDIR)/test-pem.Po \ + unit/$(DEPDIR)/test-plugin.Po unit/$(DEPDIR)/test-queue.Po \ + unit/$(DEPDIR)/test-random.Po unit/$(DEPDIR)/test-ringbuf.Po \ + unit/$(DEPDIR)/test-settings.Po unit/$(DEPDIR)/test-siphash.Po \ + unit/$(DEPDIR)/test-string.Po unit/$(DEPDIR)/test-time.Po \ + unit/$(DEPDIR)/test-tls.Po unit/$(DEPDIR)/test-uintset.Po \ + unit/$(DEPDIR)/test-unit.Po unit/$(DEPDIR)/test-utf8.Po \ + unit/$(DEPDIR)/test-util.Po unit/$(DEPDIR)/test-uuid.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -517,12 +521,13 @@ unit/test-genl-msg.c unit/test-gvariant-message.c \ unit/test-gvariant-util.c unit/test-hashmap.c unit/test-hwdb.c \ unit/test-io.c unit/test-key.c unit/test-main.c \ - unit/test-netlink.c unit/test-path.c unit/test-pbkdf2.c \ - unit/test-pem.c unit/test-plugin.c unit/test-queue.c \ - unit/test-random.c unit/test-ringbuf.c unit/test-settings.c \ - unit/test-siphash.c unit/test-string.c unit/test-time.c \ - unit/test-tls.c unit/test-uintset.c unit/test-unit.c \ - unit/test-utf8.c unit/test-util.c unit/test-uuid.c + unit/test-net.c unit/test-netlink.c unit/test-path.c \ + unit/test-pbkdf2.c unit/test-pem.c unit/test-plugin.c \ + unit/test-queue.c unit/test-random.c unit/test-ringbuf.c \ + unit/test-settings.c unit/test-siphash.c unit/test-string.c \ + unit/test-time.c unit/test-tls.c unit/test-uintset.c \ + unit/test-unit.c unit/test-utf8.c unit/test-util.c \ + unit/test-uuid.c DIST_SOURCES = $(ell_libell_private_la_SOURCES) \ $(ell_libell_la_SOURCES) unit/example-plugin.c \ examples/dbus-client.c examples/dbus-service.c \ @@ -540,12 +545,13 @@ unit/test-genl-msg.c unit/test-gvariant-message.c \ unit/test-gvariant-util.c unit/test-hashmap.c unit/test-hwdb.c \ unit/test-io.c unit/test-key.c unit/test-main.c \ - unit/test-netlink.c unit/test-path.c unit/test-pbkdf2.c \ - unit/test-pem.c unit/test-plugin.c unit/test-queue.c \ - unit/test-random.c unit/test-ringbuf.c unit/test-settings.c \ - unit/test-siphash.c unit/test-string.c unit/test-time.c \ - unit/test-tls.c unit/test-uintset.c unit/test-unit.c \ - unit/test-utf8.c unit/test-util.c unit/test-uuid.c + unit/test-net.c unit/test-netlink.c unit/test-path.c \ + unit/test-pbkdf2.c unit/test-pem.c unit/test-plugin.c \ + unit/test-queue.c unit/test-random.c unit/test-ringbuf.c \ + unit/test-settings.c unit/test-siphash.c unit/test-string.c \ + unit/test-time.c unit/test-tls.c unit/test-uintset.c \ + unit/test-unit.c unit/test-utf8.c unit/test-util.c \ + unit/test-uuid.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -1074,7 +1080,8 @@ unit/test-ecc \ unit/test-ecdh \ unit/test-time \ - unit/test-path + unit/test-path \ + unit/test-net dbus_tests = unit/test-hwdb \ unit/test-dbus \ @@ -1155,6 +1162,7 @@ unit_test_ecdh_LDFLAGS = -Wl,-wrap,l_getrandom unit_test_time_LDADD = ell/libell-private.la unit_test_path_LDADD = ell/libell-private.la +unit_test_net_LDADD = ell/libell-private.la unit_example_plugin_la_LDFLAGS = -no-undefined -module -avoid-version \ -rpath /dummy @@ -1594,6 +1602,12 @@ unit/test-main$(EXEEXT): $(unit_test_main_OBJECTS) $(unit_test_main_DEPENDENCIES) $(EXTRA_unit_test_main_DEPENDENCIES) unit/$(am__dirstamp) @rm -f unit/test-main$(EXEEXT) $(AM_V_CCLD)$(LINK) $(unit_test_main_OBJECTS) $(unit_test_main_LDADD) $(LIBS) +unit/test-net.$(OBJEXT): unit/$(am__dirstamp) \ + unit/$(DEPDIR)/$(am__dirstamp) + +unit/test-net$(EXEEXT): $(unit_test_net_OBJECTS) $(unit_test_net_DEPENDENCIES) $(EXTRA_unit_test_net_DEPENDENCIES) unit/$(am__dirstamp) + @rm -f unit/test-net$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(unit_test_net_OBJECTS) $(unit_test_net_LDADD) $(LIBS) unit/test-netlink.$(OBJEXT): unit/$(am__dirstamp) \ unit/$(DEPDIR)/$(am__dirstamp) @@ -1804,6 +1818,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-io.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-key.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-net.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-netlink.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-path.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@unit/$(DEPDIR)/test-pbkdf2.Po@am__quote@ # am--include-marker @@ -2318,6 +2333,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +unit/test-net.log: unit/test-net$(EXEEXT) + @p='unit/test-net$(EXEEXT)'; \ + b='unit/test-net'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) unit/test-hwdb.log: unit/test-hwdb$(EXEEXT) @p='unit/test-hwdb$(EXEEXT)'; \ b='unit/test-hwdb'; \ @@ -2741,6 +2763,7 @@ -rm -f unit/$(DEPDIR)/test-io.Po -rm -f unit/$(DEPDIR)/test-key.Po -rm -f unit/$(DEPDIR)/test-main.Po + -rm -f unit/$(DEPDIR)/test-net.Po -rm -f unit/$(DEPDIR)/test-netlink.Po -rm -f unit/$(DEPDIR)/test-path.Po -rm -f unit/$(DEPDIR)/test-pbkdf2.Po @@ -2895,6 +2918,7 @@ -rm -f unit/$(DEPDIR)/test-io.Po -rm -f unit/$(DEPDIR)/test-key.Po -rm -f unit/$(DEPDIR)/test-main.Po + -rm -f unit/$(DEPDIR)/test-net.Po -rm -f unit/$(DEPDIR)/test-netlink.Po -rm -f unit/$(DEPDIR)/test-path.Po -rm -f unit/$(DEPDIR)/test-pbkdf2.Po diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/configure new/ell-0.27/configure --- old/ell-0.26/configure 2019-10-30 11:42:47.000000000 +0100 +++ new/ell-0.27/configure 2019-12-13 10:10:37.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ell 0.26. +# Generated by GNU Autoconf 2.69 for ell 0.27. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='ell' PACKAGE_TARNAME='ell' -PACKAGE_VERSION='0.26' -PACKAGE_STRING='ell 0.26' +PACKAGE_VERSION='0.27' +PACKAGE_STRING='ell 0.27' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1350,7 +1350,7 @@ # 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 ell 0.26 to adapt to many kinds of systems. +\`configure' configures ell 0.27 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1421,7 +1421,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ell 0.26:";; + short | recursive ) echo "Configuration of ell 0.27:";; esac cat <<\_ACEOF @@ -1548,7 +1548,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ell configure 0.26 +ell configure 0.27 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1913,7 +1913,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ell $as_me 0.26, which was +It was created by ell $as_me 0.27, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2781,7 +2781,7 @@ # Define the identity of the package. PACKAGE='ell' - VERSION='0.26' + VERSION='0.27' cat >>confdefs.h <<_ACEOF @@ -13683,7 +13683,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ell $as_me 0.26, which was +This file was extended by ell $as_me 0.27, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13749,7 +13749,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ell config.status 0.26 +ell config.status 0.27 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/configure.ac new/ell-0.27/configure.ac --- old/ell-0.26/configure.ac 2019-10-30 11:41:14.000000000 +0100 +++ new/ell-0.27/configure.ac 2019-12-13 10:09:05.000000000 +0100 @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT(ell, 0.26) +AC_INIT(ell, 0.27) AC_CONFIG_HEADERS(config.h) AC_CONFIG_AUX_DIR(build-aux) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/dbus-filter.c new/ell-0.27/ell/dbus-filter.c --- old/ell-0.26/ell/dbus-filter.c 2017-06-10 15:42:47.000000000 +0200 +++ new/ell-0.27/ell/dbus-filter.c 2019-12-13 10:09:05.000000000 +0100 @@ -240,11 +240,12 @@ void *user_data) { struct filter_node **node_ptr = &filter->root; - struct filter_node *node; + struct filter_node *uninitialized_var(node); struct filter_node *parent = filter->root; bool remote_rule = false; struct _dbus_filter_condition sorted[rule_len]; - struct _dbus_filter_condition *unused, *condition; + struct _dbus_filter_condition *unused; + struct _dbus_filter_condition *uninitialized_var(condition); struct _dbus_filter_condition *end = sorted + rule_len; memcpy(sorted, rule, sizeof(sorted)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/dhcp-lease.c new/ell-0.27/ell/dhcp-lease.c --- old/ell-0.26/ell/dhcp-lease.c 2019-05-11 21:15:54.000000000 +0200 +++ new/ell-0.27/ell/dhcp-lease.c 2019-12-13 10:09:05.000000000 +0100 @@ -31,6 +31,8 @@ #include "private.h" #include "dhcp.h" #include "dhcp-private.h" +#include "utf8.h" +#include "net.h" struct l_dhcp_lease *_dhcp_lease_new(void) { @@ -45,6 +47,8 @@ return; l_free(lease->dns); + l_free(lease->domain_name); + l_free(lease); } @@ -99,6 +103,28 @@ } } break; + case L_DHCP_OPTION_DOMAIN_NAME: + if (l < 1 || l > 253) + goto error; + + /* Disallow embedded NUL bytes. */ + if (memchr(v, 0, l - 1)) + goto error; + + if (!l_utf8_validate(v, l, NULL)) + goto error; + + lease->domain_name = l_new(char, l + 1); + + memcpy(lease->domain_name, v, l); + + if (l_net_hostname_is_root(lease->domain_name)) + goto error; + + if (l_net_hostname_is_localhost(lease->domain_name)) + goto error; + + break; default: break; } @@ -110,6 +136,17 @@ if (lease->lifetime < 10) goto error; + /* + * RFC2131, Section 3.3: + * "Throughout the protocol, times are to be represented in units of + * seconds. The time value of 0xffffffff is reserved to represent + * "infinity"." + * + * Don't bother checking t1/t2 for infinite leases + */ + if (lease->lifetime == 0xffffffffu) + return lease; + if (!lease->t1) lease->t1 = lease->lifetime / 2; @@ -124,7 +161,7 @@ return lease; error: - l_free(lease); + _dhcp_lease_free(lease); return NULL; } @@ -201,6 +238,14 @@ return dns_list; } +LIB_EXPORT char *l_dhcp_lease_get_domain_name(const struct l_dhcp_lease *lease) +{ + if (unlikely(!lease)) + return NULL; + + return l_strdup(lease->domain_name); +} + LIB_EXPORT uint32_t l_dhcp_lease_get_t1(const struct l_dhcp_lease *lease) { if (unlikely(!lease)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/dhcp-private.h new/ell-0.27/ell/dhcp-private.h --- old/ell-0.26/ell/dhcp-private.h 2019-05-11 21:15:54.000000000 +0200 +++ new/ell-0.27/ell/dhcp-private.h 2019-12-13 10:09:05.000000000 +0100 @@ -120,6 +120,7 @@ uint32_t t2; uint32_t router; uint32_t *dns; + char *domain_name; }; struct l_dhcp_lease *_dhcp_lease_new(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/dhcp.c new/ell-0.27/ell/dhcp.c --- old/ell-0.26/ell/dhcp.c 2019-10-24 08:57:04.000000000 +0200 +++ new/ell-0.27/ell/dhcp.c 2019-12-13 10:09:05.000000000 +0100 @@ -779,9 +779,21 @@ l_dhcp_client_stop(client); } +static void dhcp_client_lease_expired(struct l_timeout *timeout, + void *user_data) +{ + struct l_dhcp_client *client = user_data; + + CLIENT_DEBUG(""); + + l_dhcp_client_stop(client); + dhcp_client_event_notify(client, L_DHCP_CLIENT_EVENT_NO_LEASE); +} + static void dhcp_client_t2_expired(struct l_timeout *timeout, void *user_data) { struct l_dhcp_client *client = user_data; + uint32_t next_timeout = client->lease->lifetime - client->lease->t2; CLIENT_DEBUG(""); @@ -792,7 +804,10 @@ */ CLIENT_ENTER_STATE(DHCP_STATE_REBINDING); - /* TODO: Start timer for the expiration time */ + l_timeout_modify_ms(client->timeout_lease, + dhcp_fuzz_secs(next_timeout)); + l_timeout_set_callback(client->timeout_lease, + dhcp_client_lease_expired, client, NULL); } static void dhcp_client_t1_expired(struct l_timeout *timeout, void *user_data) @@ -843,8 +858,11 @@ return -EINVAL; lease = _dhcp_lease_parse_options(&iter); - if (!lease) + if (!lease) { + CLIENT_DEBUG("Failed to parse DHCP options."); + return -ENOMSG; + } lease->address = ack->yiaddr; @@ -987,11 +1005,17 @@ * reacquisition." */ l_timeout_remove(client->timeout_lease); - client->timeout_lease = - l_timeout_create_ms(dhcp_fuzz_secs(client->lease->t1), - dhcp_client_t1_expired, - client, NULL); + /* Infinite lease, no need to start t1 */ + if (client->lease->lifetime != 0xffffffffu) { + uint32_t next_timeout = + dhcp_fuzz_secs(client->lease->t1); + + client->timeout_lease = + l_timeout_create_ms(next_timeout, + dhcp_client_t1_expired, + client, NULL); + } break; case DHCP_STATE_INIT_REBOOT: case DHCP_STATE_REBOOTING: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/dhcp.h new/ell-0.27/ell/dhcp.h --- old/ell-0.26/ell/dhcp.h 2019-05-11 21:15:54.000000000 +0200 +++ new/ell-0.27/ell/dhcp.h 2019-12-13 10:09:05.000000000 +0100 @@ -95,6 +95,7 @@ char *l_dhcp_lease_get_broadcast(const struct l_dhcp_lease *lease); char *l_dhcp_lease_get_server_id(const struct l_dhcp_lease *lease); char **l_dhcp_lease_get_dns(const struct l_dhcp_lease *lease); +char *l_dhcp_lease_get_domain_name(const struct l_dhcp_lease *lease); uint32_t l_dhcp_lease_get_t1(const struct l_dhcp_lease *lease); uint32_t l_dhcp_lease_get_t2(const struct l_dhcp_lease *lease); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/ell.sym new/ell-0.27/ell/ell.sym --- old/ell-0.26/ell/ell.sym 2019-10-24 08:57:04.000000000 +0200 +++ new/ell-0.27/ell/ell.sym 2019-12-13 10:09:05.000000000 +0100 @@ -225,6 +225,7 @@ l_dhcp_lease_get_broadcast; l_dhcp_lease_get_server_id; l_dhcp_lease_get_dns; + l_dhcp_lease_get_domain_name; l_dhcp_lease_get_t1; l_dhcp_lease_get_t2; l_dhcp_lease_get_lifetime; @@ -346,6 +347,8 @@ /* net */ l_net_get_mac_address; l_net_get_name; + l_net_hostname_is_root; + l_net_hostname_is_localhost; /* netlink */ l_netlink_new; l_netlink_destroy; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/genl.h new/ell-0.27/ell/genl.h --- old/ell-0.26/ell/genl.h 2019-08-04 20:51:36.000000000 +0200 +++ new/ell-0.27/ell/genl.h 2019-12-13 10:09:05.000000000 +0100 @@ -31,6 +31,8 @@ extern "C" { #endif +struct iovec; + struct l_genl; struct l_genl_family_info; struct l_genl_family; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/net.c new/ell-0.27/ell/net.c --- old/ell-0.26/ell/net.c 2018-05-05 20:26:33.000000000 +0200 +++ new/ell-0.27/ell/net.c 2019-12-13 10:09:05.000000000 +0100 @@ -110,3 +110,71 @@ return l_strdup(ifr.ifr_name); } + +/** + * l_net_hostname_is_root: + * @hostname: Hostname to validate + * + * Identifies if the hostname given by @hostname is root domain name or + * not. + * + * Returns: #true if the given hostname is root and #false otherwise. + **/ +LIB_EXPORT bool l_net_hostname_is_root(const char *hostname) +{ + if (unlikely(!hostname)) + return false; + + if (!strcmp(hostname, "")) + return true; + + if (!strcmp(hostname, ".")) + return true; + + return false; +} + +static bool str_has_suffix(const char *str, const char *suffix) +{ + size_t str_len; + size_t suffix_len; + size_t len_diff; + + str_len = strlen(str); + suffix_len = strlen(suffix); + + if (str_len < suffix_len) + return false; + + len_diff = str_len - suffix_len; + + return !strcasecmp(&str[len_diff], suffix); +} + +/** + * l_net_hostname_is_localhost: + * @hostname: Hostname to validate + * + * Identifies if the hostname given by @hostname is localhost or not. + * + * Returns: #true if the given hostname is localhost and #false otherwise. + **/ +LIB_EXPORT bool l_net_hostname_is_localhost(const char *hostname) +{ + if (unlikely(!hostname)) + return false; + + if (!strcasecmp(hostname, "localhost") || + !strcasecmp(hostname, "localhost.") || + !strcasecmp(hostname, "localhost.localdomain") || + !strcasecmp(hostname, "localhost.localdomain.")) + return true; + + if (str_has_suffix(hostname, ".localhost") || + str_has_suffix(hostname, ".localhost.") || + str_has_suffix(hostname, ".localhost.localdomain") || + str_has_suffix(hostname, ".localhost.localdomain.")) + return true; + + return false; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/net.h new/ell-0.27/ell/net.h --- old/ell-0.26/ell/net.h 2018-05-05 20:26:33.000000000 +0200 +++ new/ell-0.27/ell/net.h 2019-12-13 10:09:05.000000000 +0100 @@ -32,6 +32,8 @@ bool l_net_get_mac_address(uint32_t ifindex, uint8_t *out_addr); char *l_net_get_name(uint32_t ifindex); +bool l_net_hostname_is_root(const char *hostname); +bool l_net_hostname_is_localhost(const char *hostname); #ifdef __cplusplus } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/ell/pem.c new/ell-0.27/ell/pem.c --- old/ell-0.26/ell/pem.c 2019-10-24 08:57:04.000000000 +0200 +++ new/ell-0.27/ell/pem.c 2019-12-13 10:09:05.000000000 +0100 @@ -333,7 +333,8 @@ const char *base64; size_t base64_len; - base64 = pem_next(ptr, len, &label, &base64_len, &ptr, false); + base64 = pem_next(ptr, end - ptr, &label, + &base64_len, &ptr, false); if (!base64) { if (!ptr) break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ell-0.26/unit/test-net.c new/ell-0.27/unit/test-net.c --- old/ell-0.26/unit/test-net.c 1970-01-01 01:00:00.000000000 +0100 +++ new/ell-0.27/unit/test-net.c 2019-12-13 10:09:05.000000000 +0100 @@ -0,0 +1,66 @@ +/* + * + * Embedded Linux library + * + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <assert.h> + +#include <ell/ell.h> + +static void test_net_hostname_is_localhost(const void *data) +{ + assert(l_net_hostname_is_localhost("localhost")); + assert(l_net_hostname_is_localhost("localhost.")); + assert(l_net_hostname_is_localhost("localhost.localdomain")); + assert(l_net_hostname_is_localhost("localhost.localdomain.")); + assert(l_net_hostname_is_localhost("other.localhost")); + assert(l_net_hostname_is_localhost("other.localhost.")); + assert(l_net_hostname_is_localhost("other.localhost.localdomain")); + assert(l_net_hostname_is_localhost("other.localhost.localdomain.")); + + assert(l_net_hostname_is_localhost("LOCALHOST")); + + assert(!l_net_hostname_is_localhost("notsolocalhost")); + assert(!l_net_hostname_is_localhost("localhost.com")); + assert(!l_net_hostname_is_localhost("")); +} + +static void test_net_hostname_is_root(const void *data) +{ + assert(l_net_hostname_is_root("")); + assert(l_net_hostname_is_root(".")); + assert(!l_net_hostname_is_root("notsoroot")); +} + +int main(int argc, char *argv[]) +{ + l_test_init(&argc, &argv); + + l_test_add("net/hostname_is_localhost", test_net_hostname_is_localhost, + NULL); + l_test_add("net/hostname_is_root", test_net_hostname_is_root, + NULL); + + return l_test_run(); +}
