Skip to content

Commit b1d5cf7

Browse files
committed
- Added numeric record type and raw data for unknown DNS
record types.
1 parent dd5d1b2 commit b1d5cf7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ext/standard/dns.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,15 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
679679
add_assoc_string(*subarray, "replacement", name, 1);
680680
break;
681681
default:
682-
cp += dlen;
682+
{
683+
char buf[10]; /* max length of short + sizeof(id #) */
684+
snprintf(buf, 10, "id #%hu", type);
685+
buf[10-1] = '\0';
686+
add_assoc_string(*subarray, "type", buf, 1);
687+
add_assoc_stringl(*subarray, "data", (char*) cp, (uint) dlen, 1);
688+
cp += dlen;
689+
break;
690+
}
683691
}
684692

685693
add_assoc_string(*subarray, "class", "IN", 1);

ext/standard/dns_win32.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,14 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, zval **s
320320
break;
321321

322322
default:
323-
break;
323+
{
324+
char buf[10]; /* max length of short + sizeof(id #) */
325+
snprintf(buf, 10, "id #%hu", (unsigned short) type);
326+
buf[10-1] = '\0';
327+
add_assoc_string(*subarray, "type", buf, 1);
328+
add_assoc_stringl(*subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength, 1);
329+
break;
330+
}
324331
}
325332

326333
add_assoc_string(*subarray, "class", "IN", 1);

0 commit comments

Comments
 (0)