From 1fba61d926b808f2157805f069195ebfc5038e7f Mon Sep 17 00:00:00 2001 From: anolis-bot Date: Thu, 10 Nov 2022 14:58:15 +0800 Subject: [PATCH 1/3] update to dhcp-4.3.6-48.el8 Signed-off-by: anolis-bot --- 0001-dhcp-anolis-rebrand.patch | 25 ---- dhcp-omshell-hmac-sha512-support.patch | 155 +++++++++++++++++++++++++ dhcp.spec | 21 ++-- dist | 1 + 4 files changed, 164 insertions(+), 38 deletions(-) delete mode 100644 0001-dhcp-anolis-rebrand.patch create mode 100644 dhcp-omshell-hmac-sha512-support.patch create mode 100644 dist diff --git a/0001-dhcp-anolis-rebrand.patch b/0001-dhcp-anolis-rebrand.patch deleted file mode 100644 index 2a14960..0000000 --- a/0001-dhcp-anolis-rebrand.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d319974cc9cf532adccfea235d2a1c3e80d47fe9 Mon Sep 17 00:00:00 2001 -From: yangxiaoxuan -Date: Mon, 25 Jan 2021 22:10:36 +0800 -Subject: [PATCH] dhcp anolis rebrand - ---- - omapip/errwarn.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/omapip/errwarn.c b/omapip/errwarn.c -index f1f6fcd..be425e5 100644 ---- a/omapip/errwarn.c -+++ b/omapip/errwarn.c -@@ -57,7 +57,7 @@ char * bug_report_url(void) { - size_t url_len = 256; - - url = (char *) malloc(url_len * sizeof(char)); -- strcpy(url, "https://bugzilla.redhat.com/"); -+ strcpy(url, "https://bugzilla.openanolis.cn/"); - - if (!file) - return url; --- -2.18.2 - diff --git a/dhcp-omshell-hmac-sha512-support.patch b/dhcp-omshell-hmac-sha512-support.patch new file mode 100644 index 0000000..3c07ea8 --- /dev/null +++ b/dhcp-omshell-hmac-sha512-support.patch @@ -0,0 +1,155 @@ +diff --git a/omapip/connection.c b/omapip/connection.c +index a74becc..56826a5 100644 +--- a/omapip/connection.c ++++ b/omapip/connection.c +@@ -46,6 +46,9 @@ extern omapi_array_t *trace_listeners; + #endif + static isc_result_t omapi_connection_connect_internal (omapi_object_t *); + ++static isc_result_t ctring_from_attribute(omapi_object_t *obj, char *attr_name, ++ char **cstr); ++ + OMAPI_OBJECT_ALLOC (omapi_connection, + omapi_connection_object_t, omapi_type_connection) + +@@ -765,64 +768,41 @@ isc_result_t omapi_connection_reaper (omapi_object_t *h) + } + + static isc_result_t make_dst_key (dst_key_t **dst_key, omapi_object_t *a) { +- omapi_value_t *name = (omapi_value_t *)0; +- omapi_value_t *algorithm = (omapi_value_t *)0; +- omapi_value_t *key = (omapi_value_t *)0; +- char *name_str = NULL; ++ omapi_value_t *key = 0; ++ char *name_str = 0; ++ char *algorithm_str = 0; + isc_result_t status = ISC_R_SUCCESS; + +- if (status == ISC_R_SUCCESS) +- status = omapi_get_value_str +- (a, (omapi_object_t *)0, "name", &name); +- +- if (status == ISC_R_SUCCESS) +- status = omapi_get_value_str +- (a, (omapi_object_t *)0, "algorithm", &algorithm); +- +- if (status == ISC_R_SUCCESS) +- status = omapi_get_value_str +- (a, (omapi_object_t *)0, "key", &key); +- ++ /* Get the key name as a C string. */ ++ status = ctring_from_attribute(a, "name", &name_str); + if (status == ISC_R_SUCCESS) { +- if ((algorithm->value->type != omapi_datatype_data && +- algorithm->value->type != omapi_datatype_string) || +- strncasecmp((char *)algorithm->value->u.buffer.value, +- NS_TSIG_ALG_HMAC_MD5 ".", +- algorithm->value->u.buffer.len) != 0) { +- status = DHCP_R_INVALIDARG; ++ /* Get the algorithm name as a C string. */ ++ status = ctring_from_attribute(a, "algorithm", &algorithm_str); ++ if (status == ISC_R_SUCCESS) { ++ /* Get the key secret value */ ++ status = omapi_get_value_str(a, 0, "key", &key); ++ if (status == ISC_R_SUCCESS) { ++ /* Now let's try and create the key */ ++ status = isclib_make_dst_key( ++ name_str, ++ algorithm_str, ++ key->value->u.buffer.value, ++ key->value->u.buffer.len, ++ dst_key); ++ ++ if (*dst_key == NULL) { ++ status = ISC_R_NOMEMORY; ++ } ++ } + } + } + +- if (status == ISC_R_SUCCESS) { +- name_str = dmalloc (name -> value -> u.buffer.len + 1, MDL); +- if (!name_str) +- status = ISC_R_NOMEMORY; +- } +- +- if (status == ISC_R_SUCCESS) { +- memcpy (name_str, +- name -> value -> u.buffer.value, +- name -> value -> u.buffer.len); +- name_str [name -> value -> u.buffer.len] = 0; +- +- status = isclib_make_dst_key(name_str, +- DHCP_HMAC_MD5_NAME, +- key->value->u.buffer.value, +- key->value->u.buffer.len, +- dst_key); +- +- if (*dst_key == NULL) +- status = ISC_R_NOMEMORY; +- } +- + if (name_str) + dfree (name_str, MDL); ++ if (algorithm_str) ++ dfree (algorithm_str, MDL); + if (key) + omapi_value_dereference (&key, MDL); +- if (algorithm) +- omapi_value_dereference (&algorithm, MDL); +- if (name) +- omapi_value_dereference (&name, MDL); + + return status; + } +@@ -1105,3 +1085,50 @@ isc_result_t omapi_connection_stuff_values (omapi_object_t *c, + m -> inner); + return ISC_R_SUCCESS; + } ++ ++/* @brief Fetches the value of an attribute in an object as an allocated ++ * C string ++ * ++ * @param obj ompapi object containing the desire attribute ++ * @param attr_name name of the desired attribute ++ * @param[out] cstr pointer in which to place the allocated C string's address ++ * ++ * Caller is responsible for freeing (via dfree) the allocated string. ++ * ++ * @return ISC_R_SUCCESS if successful, otherwise indicates the type of failure ++*/ ++static isc_result_t ctring_from_attribute(omapi_object_t *obj, char *attr_name, ++ char **cstr) { ++ isc_result_t status = ISC_R_SUCCESS; ++ omapi_value_t *attr = 0; ++ ++ /* Find the attribute in the object. */ ++ status = omapi_get_value_str(obj, (omapi_object_t *)0, attr_name, ++ &attr); ++ if (status != ISC_R_SUCCESS) { ++ return (status); ++ } ++ ++ /* Got it, let's make sure it's either data or string type. */ ++ if (attr->value->type != omapi_datatype_data && ++ attr->value->type != omapi_datatype_string) { ++ return (DHCP_R_INVALIDARG); ++ } ++ ++ /* Make a C string from the attribute value. */ ++ *cstr = dmalloc (attr->value->u.buffer.len + 1, MDL); ++ if (!(*cstr)) { ++ status = ISC_R_NOMEMORY; ++ } else { ++ memcpy (*cstr, attr->value->u.buffer.value, ++ attr->value->u.buffer.len); ++ (*cstr)[attr->value->u.buffer.len] = 0; ++ } ++ ++ /* Get rid of the attribute reference */ ++ if (attr) { ++ omapi_value_dereference (&attr, MDL); ++ } ++ ++ return (status); ++} diff --git a/dhcp.spec b/dhcp.spec index fef0ba6..710225b 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -1,7 +1,6 @@ # SystemTap support is disabled by default %{!?sdt:%global sdt 0} -%define anolis_release .0.1 #http://lists.fedoraproject.org/pipermail/devel/2011-August/155358.html %global _hardened_build 1 @@ -17,7 +16,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.6 -Release: 47%{anolis_release}%{?dist} +Release: 48%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -85,11 +84,7 @@ Patch48: dhcp-bind-9.11.patch Patch49: dhcp-detect-system-time-jumps.patch Patch50: dhcp-key_algorithm.patch Patch51: dhcp-statement_parser.patch - -#Add by anolis -Patch1001: 0001-dhcp-anolis-rebrand.patch - -#end +Patch52: dhcp-omshell-hmac-sha512-support.patch BuildRequires: autoconf BuildRequires: automake @@ -371,6 +366,9 @@ rm bind/bind.tar.gz # https://bugzilla.redhat.com/show_bug.cgi?id=1963807 %patch51 -p1 +# https://bugzilla.redhat.com/show_bug.cgi?id=2016248 +%patch52 -p1 + # Update paths in all man pages for page in client/dhclient.conf.5 client/dhclient.leases.5 \ client/dhclient-script.8 client/dhclient.8 ; do @@ -387,15 +385,13 @@ for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8 ; do -e 's|ETCDIR|%{dhcpconfdir}|g' $page done -%patch1001 -p1 - sed -i -e 's|/var/db/|%{_localstatedir}/lib/dhcpd/|g' contrib/dhcp-lease-list.pl %build #libtoolize --copy --force autoreconf --verbose --force --install -CFLAGS="%{optflags} -fno-strict-aliasing -fcommon" \ +CFLAGS="%{optflags} -fno-strict-aliasing" \ %configure \ --with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \ --with-srv6-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd6.leases \ @@ -706,9 +702,8 @@ done %endif %changelog -* Fri Jan 14 2022 yangxiaoxuan - 12:4.3.6-47.0.1 -- Rebrand for Anolis OS -- Fix gcc10 -fno-common compile issue for compatible with gcc10 build +* Tue May 10 2022 Martin Osvald - 12:4.3.6-48 +- omshell: add support for hmac-sha512 algorithm (#2016248) * Tue Dec 21 2021 Petr Menšík - 12:4.3.6-47 - Rebuilt on a new side-tag (#2022715) diff --git a/dist b/dist new file mode 100644 index 0000000..9c0e36e --- /dev/null +++ b/dist @@ -0,0 +1 @@ +an8 -- Gitee From ac18bd072933e92626382ef0b29bedcbf91f3772 Mon Sep 17 00:00:00 2001 From: yangxiaoxuan Date: Mon, 25 Jan 2021 23:09:37 +0800 Subject: [PATCH 2/3] rebrand: rebrand for anolis Signed-off-by: yangxiaoxuan Change-Id: Ibdb49ddee2e62f880cc2b33c237cd76ec4757ec6 --- 0001-dhcp-anolis-rebrand.patch | 25 +++++++++++++++++++++++++ dhcp.spec | 13 ++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0001-dhcp-anolis-rebrand.patch diff --git a/0001-dhcp-anolis-rebrand.patch b/0001-dhcp-anolis-rebrand.patch new file mode 100644 index 0000000..2a14960 --- /dev/null +++ b/0001-dhcp-anolis-rebrand.patch @@ -0,0 +1,25 @@ +From d319974cc9cf532adccfea235d2a1c3e80d47fe9 Mon Sep 17 00:00:00 2001 +From: yangxiaoxuan +Date: Mon, 25 Jan 2021 22:10:36 +0800 +Subject: [PATCH] dhcp anolis rebrand + +--- + omapip/errwarn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/omapip/errwarn.c b/omapip/errwarn.c +index f1f6fcd..be425e5 100644 +--- a/omapip/errwarn.c ++++ b/omapip/errwarn.c +@@ -57,7 +57,7 @@ char * bug_report_url(void) { + size_t url_len = 256; + + url = (char *) malloc(url_len * sizeof(char)); +- strcpy(url, "https://bugzilla.redhat.com/"); ++ strcpy(url, "https://bugzilla.openanolis.cn/"); + + if (!file) + return url; +-- +2.18.2 + diff --git a/dhcp.spec b/dhcp.spec index 710225b..5721c79 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -1,6 +1,7 @@ # SystemTap support is disabled by default %{!?sdt:%global sdt 0} +%define anolis_release .0.1 #http://lists.fedoraproject.org/pipermail/devel/2011-August/155358.html %global _hardened_build 1 @@ -16,7 +17,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.6 -Release: 48%{?dist} +Release: 48%{anolis_release}%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -86,6 +87,11 @@ Patch50: dhcp-key_algorithm.patch Patch51: dhcp-statement_parser.patch Patch52: dhcp-omshell-hmac-sha512-support.patch +#Add by anolis +Patch1001: 0001-dhcp-anolis-rebrand.patch + +#end + BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool @@ -385,6 +391,8 @@ for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8 ; do -e 's|ETCDIR|%{dhcpconfdir}|g' $page done +%patch1001 -p1 + sed -i -e 's|/var/db/|%{_localstatedir}/lib/dhcpd/|g' contrib/dhcp-lease-list.pl %build @@ -702,6 +710,9 @@ done %endif %changelog +* Tue Jan 03 2023 yangxiaoxuan - 12:4.3.6-48.0.1 +- Rebrand for Anolis OS + * Tue May 10 2022 Martin Osvald - 12:4.3.6-48 - omshell: add support for hmac-sha512 algorithm (#2016248) -- Gitee From 7612593ce425bfed694ee88e7aa29d01aa98308a Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Fri, 25 Sep 2020 15:00:40 +0800 Subject: [PATCH 3/3] spec: [gcc10] Fix gcc10 -fno-common compile issue until upstream fixes this change has given better compatible with gcc10 toolchain, should be maintained util upstream fixes 'multiple definition ...' warnings Fix gcc10 -fno-common compile issue for compatible with gcc10 build Signed-off-by: weitao zhou --- dhcp.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dhcp.spec b/dhcp.spec index 5721c79..6cdf28e 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -399,7 +399,7 @@ sed -i -e 's|/var/db/|%{_localstatedir}/lib/dhcpd/|g' contrib/dhcp-lease-list.pl #libtoolize --copy --force autoreconf --verbose --force --install -CFLAGS="%{optflags} -fno-strict-aliasing" \ +CFLAGS="%{optflags} -fno-strict-aliasing -fcommon" \ %configure \ --with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \ --with-srv6-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd6.leases \ @@ -712,6 +712,7 @@ done %changelog * Tue Jan 03 2023 yangxiaoxuan - 12:4.3.6-48.0.1 - Rebrand for Anolis OS +- Fix gcc10 -fno-common compile issue for compatible with gcc10 build * Tue May 10 2022 Martin Osvald - 12:4.3.6-48 - omshell: add support for hmac-sha512 algorithm (#2016248) -- Gitee