diff --git a/SOURCES/dhcp-4.2.5-centos-branding.patch b/SOURCES/dhcp-4.2.5-centos-branding.patch deleted file mode 100644 index f3e7113..0000000 --- a/SOURCES/dhcp-4.2.5-centos-branding.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -uNrp dhcp-4.1.1-P1.orig/omapip/errwarn.c dhcp-4.1.1-P1/omapip/errwarn.c ---- dhcp-4.1.1-P1.orig/omapip/errwarn.c 2012-08-15 14:04:33.149141000 +0000 -+++ dhcp-4.1.1-P1/omapip/errwarn.c 2012-08-15 14:13:05.582416057 +0000 -@@ -81,8 +81,8 @@ void log_fatal (const char * fmt, ... ) - log_error ("have been made to the base software release in order to make"); - log_error ("it work better with this distribution."); - log_error ("%s", ""); -- log_error ("Please report for this software via the Red Hat Bugzilla site:"); -- log_error (" http://bugzilla.redhat.com"); -+ log_error ("Please report for this software via the CentOS Bugs Database:"); -+ log_error (" http://bugs.centos.org/"); - log_error ("%s", ""); - log_error ("exiting."); - #endif diff --git a/SOURCES/dhcp-close_file_in_noreplay.patch b/SOURCES/dhcp-close_file_in_noreplay.patch new file mode 100644 index 0000000..75eadac --- /dev/null +++ b/SOURCES/dhcp-close_file_in_noreplay.patch @@ -0,0 +1,20 @@ +diff --git a/server/confpars.c b/server/confpars.c +index a9b4b57..761b102 100644 +--- a/server/confpars.c ++++ b/server/confpars.c +@@ -168,7 +168,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group, + if (result != ulen) + log_fatal ("%s: short read of %d bytes instead of %d.", + filename, ulen, result); +- close (file); + memfile: + /* If we're recording, write out the filename and file contents. */ + if (trace_record ()) +@@ -179,6 +178,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group, + status = new_parse(&cfile, file, NULL, 0, filename, 0); + #endif + noreplay: ++ close (file); + if (status != ISC_R_SUCCESS || cfile == NULL) + return status; + diff --git a/SOURCES/dhcp-system_time_changed.patch b/SOURCES/dhcp-system_time_changed.patch new file mode 100644 index 0000000..6fe66e7 --- /dev/null +++ b/SOURCES/dhcp-system_time_changed.patch @@ -0,0 +1,73 @@ +diff --git a/client/dhclient.c b/client/dhclient.c +index 1992467..364fd08 100644 +--- a/client/dhclient.c ++++ b/client/dhclient.c +@@ -4463,6 +4463,10 @@ isc_result_t dhcp_set_control_state (control_object_state_t oldstate, + case server_awaken: + state_reboot (client); + break; ++ case server_time_changed: ++ if (client->active) ++ state_reboot (client); ++ break; + } + } + } +diff --git a/common/dispatch.c b/common/dispatch.c +index af8a5b5..c1d558f 100644 +--- a/common/dispatch.c ++++ b/common/dispatch.c +@@ -110,10 +110,20 @@ dispatch(void) + { + isc_result_t status; + +- status = isc_app_ctxrun(dhcp_gbl_ctx.actx); +- +- log_fatal ("Dispatch routine failed: %s -- exiting", +- isc_result_totext (status)); ++ do{ ++ status = isc_app_ctxrun(dhcp_gbl_ctx.actx); ++ ++ if (status == ISC_R_TIMESHIFTED){ ++ status = dhcp_set_control_state(server_time_changed, ++ server_time_changed); ++ status = ISC_R_RELOAD; ++ log_info ("System time has been changed. Unable to use existing leases. Restarting"); ++ // do nothing, restart context ++ }; ++ } while (status == ISC_R_RELOAD); ++ ++ log_fatal ("Dispatch routine failed: %s -- exiting", ++ isc_result_totext (status)); + } + + void +diff --git a/includes/dhcpd.h b/includes/dhcpd.h +index deea2a7..d60a03c 100644 +--- a/includes/dhcpd.h ++++ b/includes/dhcpd.h +@@ -479,7 +479,8 @@ typedef enum { + server_running = 1, + server_shutdown = 2, + server_hibernate = 3, +- server_awaken = 4 ++ server_awaken = 4, ++ server_time_changed = 5 + } control_object_state_t; + + typedef struct { +diff --git a/server/dhcpd.c b/server/dhcpd.c +index 9617d75..9add7e4 100644 +--- a/server/dhcpd.c ++++ b/server/dhcpd.c +@@ -1392,6 +1392,10 @@ static isc_result_t dhcp_io_shutdown_countdown (void *vlp) + isc_result_t dhcp_set_control_state (control_object_state_t oldstate, + control_object_state_t newstate) + { ++ if (newstate == server_time_changed){ ++ log_error ("System time has been changed. Leases information unreliable!"); ++ return ISC_R_SUCCESS; ++ } + if (newstate == server_shutdown) { + shutdown_time = cur_time; + shutdown_state = shutdown_listeners; diff --git a/SPECS/dhcp.spec b/SPECS/dhcp.spec index e6fba20..e77ee33 100644 --- a/SPECS/dhcp.spec +++ b/SPECS/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.2.5 -Release: 77%{?dist} +Release: 79%{?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. @@ -117,8 +117,8 @@ Patch75: dhcp-4.2.5-isc-util.patch Patch76: dhcp-isc_heap_delete.patch Patch77: dhcp-handle_ctx_signals.patch -Patch78: dhcp-4.2.5-centos-branding.patch - +Patch78: dhcp-system_time_changed.patch +Patch79: dhcp-close_file_in_noreplay.patch BuildRequires: autoconf BuildRequires: automake @@ -126,7 +126,7 @@ BuildRequires: libtool BuildRequires: openldap-devel BuildRequires: libcap-ng-devel # https://fedorahosted.org/fpc/ticket/502#comment:3 -BuildRequires: bind-export-devel +BuildRequires: bind-export-devel >= 9.11.4-11 BuildRequires: systemd systemd-devel %if %sdt BuildRequires: systemtap-sdt-devel @@ -461,7 +461,12 @@ rm -rf includes/isc-dhcp %patch76 -p1 -b .heap-delete %patch77 -p1 -b .sig-handlers -%patch78 -p1 + +# https://bugzilla.redhat.com/1093803 +%patch78 -p1 -b .monotonic + +%patch79 -p1 -b .close-noreplay + # Update paths in all man pages for page in client/dhclient.conf.5 client/dhclient.leases.5 \ @@ -743,8 +748,11 @@ done %changelog -* Tue Aug 06 2019 CentOS Sources - 4.2.5-77.el7.centos -- Roll in CentOS Branding +* Tue Oct 1 2019 Pavel Zhukov - 12:4.2.5-79 +- Resolves: #1756850 - Close FD in noreplay mode + +* Wed Aug 14 2019 Pavel Zhukov - 12:4.2.5-78 +- Detect time shifts to prevent ip address expiration (#1093803) * Tue May 21 2019 Pavel Zhukov - 12:4.2.5-77 - Resolves: #1712414 - Reset signal handlers set by isclib