Skip to content

Commit

Permalink
- release 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepultz committed Aug 23, 2016
1 parent 0b93fa6 commit 81026ba
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 82 deletions.
38 changes: 2 additions & 36 deletions Net/DNS2.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,43 +866,9 @@ public static function isIPv6($_address)
*/
public static function expandIPv6($_address)
{
if (strpos($_address, '::') !== false) {

$part = explode('::', $_address);
$part[0] = explode(':', $part[0]);
$part[1] = explode(':', $part[1]);

$missing = array();

$x = (8 - (count($part[0]) + count($part[1])));
for ($i = 0; $i < $x; $i++) {

array_push($missing, '0000');
}

$missing = array_merge($part[0], $missing);
$part = array_merge($missing, $part[1]);

} else {

$part = explode(':', $_address);
}

foreach ($part as &$p) {
while (strlen($p) < 4) {
$p = '0' . $p;
}
}

unset($p);
$hex = unpack('H*hex', inet_pton($_address));

$result = implode(':', $part);

if (strlen($result) == 39) {
return $result;
} else {
return false;
}
return substr(preg_replace('/([A-f0-9]{4})/', "$1:", $hex['hex']), 0, -1);
}
/**
Expand Down
33 changes: 29 additions & 4 deletions Net/DNS2/Lookups.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ class Net_DNS2_Lookups

// 11-15 reserved

const RCODE_BADSIG = 16; // RFC 2845
const RCODE_BADSIG = 16; // RFC 2845
const RCODE_BADVERS = 16; // RFC 6891
const RCODE_BADKEY = 17; // RFC 2845
const RCODE_BADTIME = 18; // RFC 2845
const RCODE_BADMODE = 19; // RFC 2930
const RCODE_BADNAME = 20; // RFC 2930
const RCODE_BADALG = 21; // RFC 2930
const RCODE_BADTRUNC = 22; // RFC 4635
const RCODE_BADCOOKIE = 23; // RFC 7873

/*
* internal errors codes returned by the exceptions class
Expand All @@ -162,6 +164,7 @@ class Net_DNS2_Lookups
const E_DNS_BADNAME = self::RCODE_BADNAME;
const E_DNS_BADALG = self::RCODE_BADALG;
const E_DNS_BADTRUNC = self::RCODE_BADTRUNC;
const E_DNS_BADCOOKIE = self::RCODE_BADCOOKIE;

// other error conditions

Expand All @@ -185,6 +188,24 @@ class Net_DNS2_Lookups
const E_CACHE_SHM_FILE = 501;
const E_CACHE_SHM_UNAVAIL = 502;

/*
* EDNS0 Option Codes (OPT)
*/
// 0 - Reserved
const EDNS0_OPT_LLQ = 1;
const EDNS0_OPT_UL = 2;
const EDNS0_OPT_NSID = 3;
// 4 - Reserved
const EDNS0_OPT_DAU = 5;
const EDNS0_OPT_DHU = 6;
const EDNS0_OPT_N3U = 7;
const EDNS0_OPT_CLIENT_SUBNET = 8;
const EDNS0_OPT_EXPIRE = 9;
const EDNS0_OPT_COOKIE = 10;
const EDNS0_OPT_TCP_KEEPALIVE = 11;
const EDNS0_OPT_PADDING = 12;
const EDNS0_OPT_CHAIN = 13;

/*
* DNSSEC Algorithms
*/
Expand Down Expand Up @@ -273,16 +294,17 @@ class Net_DNS2_Lookups
'NSEC3' => 50, // RFC 5155
'NSEC3PARAM' => 51, // RFC 5155
'TLSA' => 52, // RFC 6698
'SMIMEA' => 53, // draft-ietf-dane-smime-10

// 53 - 54 unassigned
// 54 unassigned

'HIP' => 55, // RFC 5205
'NINFO' => 56, // Not implemented
'RKEY' => 57, // Not implemented
'TALINK' => 58, //
'CDS' => 59, // RFC 7344
'CDNSKEY' => 60, // RFC 7344
'OPENPGPKEY' => 61, // IETF (draft-ietf-dane-openpgpkey)
'OPENPGPKEY' => 61, // RFC 7929
'CSYNC' => 62, // RFC 7477

// 63 - 98 unassigned
Expand Down Expand Up @@ -310,8 +332,9 @@ class Net_DNS2_Lookups
'ANY' => 255, // RFC 1035 - we support both 'ANY' and '*'
'URI' => 256, // tools.ietf.org/html/draft-faltstrom-uri-06
'CAA' => 257, // tools.ietf.org/html/draft-ietf-pkix-caa-03
'AVC' => 258, // Application Visibility and Control

// 258 - 32767 unassigned
// 259 - 32767 unassigned

'TA' => 32768, // same as DS
'DLV' => 32769 // RFC 4431
Expand Down Expand Up @@ -384,6 +407,7 @@ class Net_DNS2_Lookups
50 => 'Net_DNS2_RR_NSEC3',
51 => 'Net_DNS2_RR_NSEC3PARAM',
52 => 'Net_DNS2_RR_TLSA',
53 => 'Net_DNS2_RR_SMIMEA',
55 => 'Net_DNS2_RR_HIP',
58 => 'Net_DNS2_RR_TALINK',
59 => 'Net_DNS2_RR_CDS',
Expand All @@ -407,6 +431,7 @@ class Net_DNS2_Lookups
255 => 'Net_DNS2_RR_ANY',
256 => 'Net_DNS2_RR_URI',
257 => 'Net_DNS2_RR_CAA',
258 => 'Net_DNS2_RR_AVC',
32768 => 'Net_DNS2_RR_TA',
32769 => 'Net_DNS2_RR_DLV'
);
Expand Down
15 changes: 0 additions & 15 deletions Net/DNS2/Packet.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,6 @@ public function reset()

return true;
}

/**
* formats an IPv6 IP address in the preferred format
*
* @param string $address The IPv6 IP address to format
*
* @return string The IPv6 IP address formatted in the new format
* @access public
* @deprecated function deprecated in 1.1.3
*
*/
public static function formatIPv6($address)
{
return Net_DNS2::expandIPv6($address);
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion Net/DNS2/RR/OPENPGPKEY.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function rrSet(Net_DNS2_Packet &$packet)
{
if ($this->rdlength > 0) {

$this->key = base64_encode($this->rdata);
$this->key = base64_encode(substr($this->rdata, 0, $this->rdlength));

return true;
}
Expand Down
14 changes: 10 additions & 4 deletions package.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

date_default_timezone_set('America/Toronto');

ini_set("include_path", ".:/usr/local/php/lib/php/:/usr/local/php/lib/php/PEAR/PackageFileManager");
ini_set("include_path", ".:/usr/local/php/lib/php/:/usr/share/pear/");
require_once 'PEAR/PackageFileManager/File.php';
require_once 'PEAR/PackageFileManager2.php';

Expand All @@ -11,7 +11,7 @@
$e = $pkg->setOptions(array(

'baseinstalldir' => '/',
'packagedirectory' => '/u/devel/www/Net_DNS2/',
'packagedirectory' => '/u/devel/www/net_dns/Net_DNS2/',
'ignore' => array(
'package.php',
'package.xml',
Expand Down Expand Up @@ -40,11 +40,17 @@
"- changed the role for the README.md file to doc\n" .
"- parse the resolv.conf options line; right now I just support the timeout and rotate options.\n" .
"- the options values only work if you set the new option use_resolv_options to true; this is to keep backwards compatibility.\n" .
"- Adds support for RFC 6594; support for SHA-256 and ECDSA in the SSHFP resource record.\n"
"- added support for RFC 6594; support for SHA-256 and ECDSA in the SSHFP resource record.\n" .
"- added the SMIMEA resource record; this just extends the TLSA record.\n" .
"- added the AVC resource records; this just extends the TXT record.\n" .
"- added error and EDNS0 defines for DNS Cookies (RFC7873)\n" .
"- added EDNS0 defines to the lookup class\n" .
"- dropped the Net_DNS2_Packet::formatIPv6() function; this was deprecated in v1.1.3\n" .
"- re-wrote the Net_DNS2::expandIPv6() function. Based on testing, the new version is about twice as fast.\n"
);
$pkg->setPackageType('php');
$pkg->addRelease();
$pkg->setPhpDep('5.1.2');
$pkg->setPhpDep('5.2.1');
$pkg->setPearinstallerDep('1.4.0a12');
$pkg->addMaintainer('lead', 'mikepultz', 'Mike Pultz', '[email protected]');
$pkg->setLicense('BSD License', 'http://www.opensource.org/licenses/bsd-license.php');
Expand Down
72 changes: 51 additions & 21 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
<package packagerversion="1.10.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
http://pear.php.net/dtd/tasks-1.0.xsd
http://pear.php.net/dtd/package-2.0
http://pear.php.net/dtd/package-2.0.xsd">
Expand All @@ -15,34 +15,38 @@ This release is (in most cases) 2x - 10x faster than Net_DNS, as well as include
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2015-04-13</date>
<time>18:31:57</time>
<date>2016-08-22</date>
<time>23:37:12</time>
<version>
<release>1.4.1</release>
<api>1.4.1</api>
<release>1.4.2</release>
<api>1.4.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
<notes>
- increased the default DNSSEC payload size value to 4000 bytes per RFC 4035 section 4.1; this is still configurable.
- fixed a bug where I was still using the DNS_MAX_UDP_SIZE default (512 bytes) for all requests, event DNSSEC, where I should have been using the dnssec_payload_size config value.
- removed the limitation that PTR records had to look like IP addresses; you can add other things to PTR records, like service discovery objects- RFC 6763.
- dropped support for using the Sockets library on Windows. There have been too many inconsistencies between versions of Windows; we&apos;ll just default to use the Streams library.
- fixed the Net_DNS2_RR_PTR class so we can pass ptrdname&apos;s with spaces in them so that we can support DNS-Based Service Discovery (RFC 6763).
- added support for the CSYNC resource record - see RFC 7477.
- changed the role for the README.md file to doc
- parse the resolv.conf options line; right now I just support the timeout and rotate options.
- the options values only work if you set the new option use_resolv_options to true; this is to keep backwards compatibility.
- added support for RFC 6594; support for SHA-256 and ECDSA in the SSHFP resource record.
- added the SMIMEA resource record; this just extends the TLSA record.
- added the AVC resource records; this just extends the TXT record.
- added error and EDNS0 defines for DNS Cookies (RFC7873)
- added EDNS0 defines to the lookup class
- dropped the Net_DNS2_Packet::formatIPv6() function; this was deprecated in v1.1.3
- re-wrote the Net_DNS2::expandIPv6() function. Based on testing, the new version is about twice as fast.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
<file baseinstalldir="/" md5sum="c01ec130223d7667a38e340825885028" name="Net/DNS2.php" role="php" />
<file baseinstalldir="/" md5sum="41bbd9d40c333761b4ac284d996eef7d" name="Net/DNS2.php" role="php" />
<file baseinstalldir="/" md5sum="a60f2fcb5ed6ec1d81c4a94a45b3adf7" name="Net/DNS2/BitMap.php" role="php" />
<file baseinstalldir="/" md5sum="0b5fad565a09a59e17495e7e4d76cac0" name="Net/DNS2/Cache.php" role="php" />
<file baseinstalldir="/" md5sum="68264e0b4d6c30829ad7d46b41d4dc5a" name="Net/DNS2/Exception.php" role="php" />
<file baseinstalldir="/" md5sum="dcb7f02189851fdc215dde140ce28383" name="Net/DNS2/Header.php" role="php" />
<file baseinstalldir="/" md5sum="30be5582bf7f37008d2708c9a2c76f07" name="Net/DNS2/Lookups.php" role="php" />
<file baseinstalldir="/" md5sum="cbf444dfecdc6fbf3287969029c48ca5" name="Net/DNS2/Packet.php" role="php" />
<file baseinstalldir="/" md5sum="7125216aad5f765eb5d01815b9023dd5" name="Net/DNS2/Lookups.php" role="php" />
<file baseinstalldir="/" md5sum="f7e40dbfd5905667e87e7dced94397f7" name="Net/DNS2/Packet.php" role="php" />
<file baseinstalldir="/" md5sum="26e2e2061ba08e1520876a515e9ad511" name="Net/DNS2/PrivateKey.php" role="php" />
<file baseinstalldir="/" md5sum="1fa5d7f3a68455ab7c023bf004e2751d" name="Net/DNS2/Question.php" role="php" />
<file baseinstalldir="/" md5sum="2e6ae3e974c3f9ed6384ed46a1f9dac5" name="Net/DNS2/Resolver.php" role="php" />
Expand All @@ -59,6 +63,7 @@ This release is (in most cases) 2x - 10x faster than Net_DNS, as well as include
<file baseinstalldir="/" md5sum="70d5ace71d06980515922de59266b7a5" name="Net/DNS2/RR/ANY.php" role="php" />
<file baseinstalldir="/" md5sum="5cf029a7233a9f4a81fe0717befdc3cc" name="Net/DNS2/RR/APL.php" role="php" />
<file baseinstalldir="/" md5sum="4f6fa9f6038cf2734c1de76d60f16750" name="Net/DNS2/RR/ATMA.php" role="php" />
<file baseinstalldir="/" md5sum="31839c759b721603877bc40756b82af2" name="Net/DNS2/RR/AVC.php" role="php" />
<file baseinstalldir="/" md5sum="d14c7f98525d0fb7c9e0eadbabe85f73" name="Net/DNS2/RR/CAA.php" role="php" />
<file baseinstalldir="/" md5sum="115adecfcc21bd17fa451d636c7f1133" name="Net/DNS2/RR/CDNSKEY.php" role="php" />
<file baseinstalldir="/" md5sum="00fb9449af0f84a8d6854c9524c2e928" name="Net/DNS2/RR/CDS.php" role="php" />
Expand Down Expand Up @@ -92,18 +97,19 @@ This release is (in most cases) 2x - 10x faster than Net_DNS, as well as include
<file baseinstalldir="/" md5sum="e3baf5bb9ca3259ab90371860944afd9" name="Net/DNS2/RR/NSEC.php" role="php" />
<file baseinstalldir="/" md5sum="9240baed43a0cb95b5f3e3851fd9b632" name="Net/DNS2/RR/NSEC3.php" role="php" />
<file baseinstalldir="/" md5sum="d04d56622dd6cfbf943d7dc8b5bb379e" name="Net/DNS2/RR/NSEC3PARAM.php" role="php" />
<file baseinstalldir="/" md5sum="29dbe4039917a36432f24570676f8c8a" name="Net/DNS2/RR/OPENPGPKEY.php" role="php" />
<file baseinstalldir="/" md5sum="29d2419f455d3cd7634fdf6599dd93ea" name="Net/DNS2/RR/OPENPGPKEY.php" role="php" />
<file baseinstalldir="/" md5sum="94ac2415d9b04354966c41529ee65165" name="Net/DNS2/RR/OPT.php" role="php" />
<file baseinstalldir="/" md5sum="2a10ec2ce75ecf0dde39c30a79257a52" name="Net/DNS2/RR/PTR.php" role="php" />
<file baseinstalldir="/" md5sum="df719282e9e7942ff95aba24df75787c" name="Net/DNS2/RR/PX.php" role="php" />
<file baseinstalldir="/" md5sum="3bc649235397d380c116034f0be90e6a" name="Net/DNS2/RR/RP.php" role="php" />
<file baseinstalldir="/" md5sum="4860d050ca71d81aa747d6a1eb381b3f" name="Net/DNS2/RR/RRSIG.php" role="php" />
<file baseinstalldir="/" md5sum="1854c3520f9a7fdab77d13578364194c" name="Net/DNS2/RR/RT.php" role="php" />
<file baseinstalldir="/" md5sum="550120e35eaf854d95f00da0c4b8cc34" name="Net/DNS2/RR/SIG.php" role="php" />
<file baseinstalldir="/" md5sum="1678cdf44dde2faaa3986db39a8c9108" name="Net/DNS2/RR/SMIMEA.php" role="php" />
<file baseinstalldir="/" md5sum="20573547ead5339cb197991d305fb13d" name="Net/DNS2/RR/SOA.php" role="php" />
<file baseinstalldir="/" md5sum="41025887dd82c14781de35b938503e7e" name="Net/DNS2/RR/SPF.php" role="php" />
<file baseinstalldir="/" md5sum="dda9d5030fdb1977de4cfba58a3cb3b0" name="Net/DNS2/RR/SRV.php" role="php" />
<file baseinstalldir="/" md5sum="f854ff60caf46861c3ad031183ae66c7" name="Net/DNS2/RR/SSHFP.php" role="php" />
<file baseinstalldir="/" md5sum="999a5d35f71a227d190b42e90a768c1f" name="Net/DNS2/RR/SSHFP.php" role="php" />
<file baseinstalldir="/" md5sum="641614de862c9b02e405894c96e8ddfd" name="Net/DNS2/RR/TA.php" role="php" />
<file baseinstalldir="/" md5sum="43c3d7b5d1dfd6536a0e95fdd7a63561" name="Net/DNS2/RR/TALINK.php" role="php" />
<file baseinstalldir="/" md5sum="632607c3307ad5e9c3fa91232dbf9a4b" name="Net/DNS2/RR/TKEY.php" role="php" />
Expand All @@ -116,17 +122,17 @@ This release is (in most cases) 2x - 10x faster than Net_DNS, as well as include
<file baseinstalldir="/" md5sum="6b88e0b40fe820dea5dc28149c98a792" name="Net/DNS2/Socket/Sockets.php" role="php" />
<file baseinstalldir="/" md5sum="6c80cb53453ad0837532004c91e14dd7" name="Net/DNS2/Socket/Streams.php" role="php" />
<file baseinstalldir="/" md5sum="3830c26904fd0ecdcd9b40af7aed3bb6" name="tests/AllTests.php" role="test" />
<file baseinstalldir="/" md5sum="edadf1d417c229b25166677ae608baa7" name="tests/Net_DNS2_DNSSECTest.php" role="test" />
<file baseinstalldir="/" md5sum="4ff30101e288ed6084db6795ceaffd49" name="tests/Net_DNS2_ParserTest.php" role="test" />
<file baseinstalldir="/" md5sum="cb25a9d8f3fc5073b2cbff941b2417f3" name="tests/Net_DNS2_DNSSECTest.php" role="test" />
<file baseinstalldir="/" md5sum="0c6ee7b01f564952c3a7f9b69ce8d85a" name="tests/Net_DNS2_ParserTest.php" role="test" />
<file baseinstalldir="/" md5sum="3667edbb50ebfa4089bb678168f1899f" name="tests/Net_DNS2_ResolverTest.php" role="test" />
<file baseinstalldir="/" md5sum="46ec3bdb18dbe41d1c9f345939ea76a6" name="LICENSE" role="doc" />
<file baseinstalldir="/" md5sum="029c7ee07807607df1dc22f06a55dbaa" name="README.md" role="doc" />
<file baseinstalldir="/" md5sum="9290a83f15bd81ff0af2e0149d17fd1d" name="LICENSE" role="doc" />
<file baseinstalldir="/" md5sum="ffcaea84e3ca0d168ed4861c19d19049" name="README.md" role="doc" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.1.2</min>
<min>5.2.1</min>
</php>
<pearinstaller>
<min>1.4.0a12</min>
Expand Down Expand Up @@ -466,5 +472,29 @@ Initial Beta release of Net_DNS2
- added support for the CSYNC resource record - see RFC 7477.
</notes>
</release>
<release>
<version>
<release>1.4.2</release>
<api>1.4.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2016-08-22</date>
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
<notes>
- changed the role for the README.md file to doc
- parse the resolv.conf options line; right now I just support the timeout and rotate options.
- the options values only work if you set the new option use_resolv_options to true; this is to keep backwards compatibility.
- added support for RFC 6594; support for SHA-256 and ECDSA in the SSHFP resource record.
- added the SMIMEA resource record; this just extends the TLSA record.
- added the AVC resource records; this just extends the TXT record.
- added error and EDNS0 defines for DNS Cookies (RFC7873)
- added EDNS0 defines to the lookup class
- dropped the Net_DNS2_Packet::formatIPv6() function; this was deprecated in v1.1.3
- re-wrote the Net_DNS2::expandIPv6() function. Based on testing, the new version is about twice as fast.
</notes>
</release>
</changelog>
</package>
2 changes: 1 addition & 1 deletion tests/Net_DNS2_DNSSECTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testDNSSEC()
$r->dnssec = true;

$result = $r->query('org', 'SOA', 'IN');

print_r($result);
$this->assertTrue(($result->header->ad == 1));
$this->assertTrue(($result->additional[0] instanceof Net_DNS2_RR_OPT));
$this->assertTrue(($result->additional[0]->do == 1));
Expand Down
Loading

0 comments on commit 81026ba

Please sign in to comment.