diff --git a/CHANGELOG b/CHANGELOG index b2c8c8009..9a8dfe06b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,9 @@ o [NSE][GH#2174] Script hostmap-crtsh got improved in several ways. The most identities that are syntactically incorrect to be hostnames are now ignored. [Michel Le Bihan, nnposter] +o [NSE][GH#2197] Client packets composed by the DHCP library will now contain + option 51 (IP address lease time) only when requested. [nnposter] + o [NSE][GH#2192] XML decoding in library citrixxml no longer crashes when encountering a character reference with codepoint greater than 255. (These references are now left unmodified.) [nnposter] diff --git a/nselib/dhcp.lua b/nselib/dhcp.lua index ac7949b0d..e1b21d1c3 100644 --- a/nselib/dhcp.lua +++ b/nselib/dhcp.lua @@ -396,7 +396,7 @@ end --@param overrides [optional] A table of overrides. If a field in the table matches a field in the DHCP -- packet (see rfc2131 section 2 for a list of possible fields), the value in the table -- will be sent instead of the default value. ---@param lease_time [optional] The lease time used when requestint an IP. Default: 1 second. +--@param lease_time [optional] The lease time used when requesting an IP. Default: none. --@param transaction_id The identity of the transaction. -- --@return status (true or false) @@ -444,7 +444,9 @@ function dhcp_build(request_type, ip_address, mac_address, options, request_opti end packet = packet .. string.pack(">Bs1", 0x37, request_options) -- Request options - packet = packet .. string.pack(">BBI4", 0x33, 4, lease_time or 1) -- Lease time + if lease_time then + packet = packet .. string.pack(">BBI4", 0x33, 4, lease_time) -- Lease time + end packet = packet .. "\xFF" -- Termination @@ -599,7 +601,7 @@ end --@param overrides [optional] A table of overrides. If a field in the table matches a field in the DHCP -- packet (see rfc2131 section 2 for a list of possible fields), the value in the table -- will be sent instead of the default value. ---@param lease_time [optional] The lease time used when requestint an IP. Default: 1 second. +--@param lease_time [optional] The lease time used when requesting an IP. Default: none. --@return status (true or false) --@return The parsed response, as a table. function make_request(target, request_type, ip_address, mac_address, options, request_options, overrides, lease_time)