|
114 | 114 | #ifndef DNS_T_A6
|
115 | 115 | #define DNS_T_A6 38
|
116 | 116 | #endif
|
| 117 | +#ifndef DNS_T_CAA |
| 118 | +#define DNS_T_CAA 257 |
| 119 | +#endif |
117 | 120 |
|
118 | 121 | #ifndef DNS_T_ANY
|
119 | 122 | #define DNS_T_ANY 255
|
@@ -286,22 +289,23 @@ static zend_string *php_gethostbyname(char *name)
|
286 | 289 | /* }}} */
|
287 | 290 |
|
288 | 291 | #if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32)
|
289 |
| -# define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ |
| 292 | +# define PHP_DNS_NUM_TYPES 13 /* Number of DNS Types Supported by PHP currently */ |
290 | 293 |
|
291 | 294 | # define PHP_DNS_A 0x00000001
|
292 | 295 | # define PHP_DNS_NS 0x00000002
|
293 | 296 | # define PHP_DNS_CNAME 0x00000010
|
294 | 297 | # define PHP_DNS_SOA 0x00000020
|
295 | 298 | # define PHP_DNS_PTR 0x00000800
|
296 | 299 | # define PHP_DNS_HINFO 0x00001000
|
| 300 | +# define PHP_DNS_CAA 0x00002000 |
297 | 301 | # define PHP_DNS_MX 0x00004000
|
298 | 302 | # define PHP_DNS_TXT 0x00008000
|
299 | 303 | # define PHP_DNS_A6 0x01000000
|
300 | 304 | # define PHP_DNS_SRV 0x02000000
|
301 | 305 | # define PHP_DNS_NAPTR 0x04000000
|
302 | 306 | # define PHP_DNS_AAAA 0x08000000
|
303 | 307 | # define PHP_DNS_ANY 0x10000000
|
304 |
| -# define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA) |
| 308 | +# define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_CAA|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA) |
305 | 309 | #endif /* HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) */
|
306 | 310 |
|
307 | 311 | /* Note: These functions are defined in ext/standard/dns_win32.c for Windows! */
|
@@ -384,6 +388,7 @@ PHP_FUNCTION(dns_check_record)
|
384 | 388 | else if (!strcasecmp("PTR", rectype)) type = DNS_T_PTR;
|
385 | 389 | else if (!strcasecmp("ANY", rectype)) type = DNS_T_ANY;
|
386 | 390 | else if (!strcasecmp("SOA", rectype)) type = DNS_T_SOA;
|
| 391 | + else if (!strcasecmp("CAA", rectype)) type = DNS_T_CAA; |
387 | 392 | else if (!strcasecmp("TXT", rectype)) type = DNS_T_TXT;
|
388 | 393 | else if (!strcasecmp("CNAME", rectype)) type = DNS_T_CNAME;
|
389 | 394 | else if (!strcasecmp("AAAA", rectype)) type = DNS_T_AAAA;
|
@@ -529,6 +534,23 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
|
529 | 534 | add_assoc_stringl(subarray, "os", (char*)cp, n);
|
530 | 535 | cp += n;
|
531 | 536 | break;
|
| 537 | + case DNS_T_CAA: |
| 538 | + /* See RFC 6844 for values https://tools.ietf.org/html/rfc6844 */ |
| 539 | + add_assoc_string(subarray, "type", "CAA"); |
| 540 | + // 1 flag byte |
| 541 | + CHECKCP(1); |
| 542 | + n = *cp & 0xFF; |
| 543 | + add_assoc_long(subarray, "flags", n); |
| 544 | + cp++; |
| 545 | + // Tag length (1 byte) |
| 546 | + CHECKCP(1); |
| 547 | + n = *cp & 0xFF; |
| 548 | + cp++; |
| 549 | + CHECKCP(n); |
| 550 | + add_assoc_stringl(subarray, "tag", (char*)cp, n); |
| 551 | + cp += n; |
| 552 | + add_assoc_string(subarray, "value", (char*)cp); |
| 553 | + break; |
532 | 554 | case DNS_T_TXT:
|
533 | 555 | {
|
534 | 556 | int l1 = 0, l2 = 0;
|
@@ -879,6 +901,9 @@ PHP_FUNCTION(dns_get_record)
|
879 | 901 | case 11:
|
880 | 902 | type_to_fetch = type_param&PHP_DNS_A6 ? DNS_T_A6 : 0;
|
881 | 903 | break;
|
| 904 | + case 12: |
| 905 | + type_to_fetch = type_param&PHP_DNS_CAA ? DNS_T_CAA : 0; |
| 906 | + break; |
882 | 907 | case PHP_DNS_NUM_TYPES:
|
883 | 908 | store_results = 0;
|
884 | 909 | continue;
|
@@ -1095,6 +1120,7 @@ PHP_MINIT_FUNCTION(dns) {
|
1095 | 1120 | REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT);
|
1096 | 1121 | REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT);
|
1097 | 1122 | REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT);
|
| 1123 | + REGISTER_LONG_CONSTANT("DNS_CAA", PHP_DNS_CAA, CONST_CS | CONST_PERSISTENT); |
1098 | 1124 | REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT);
|
1099 | 1125 | REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT);
|
1100 | 1126 | REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT);
|
|
0 commit comments