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