From b1d5cf7348105cb8205b0fe7c54494b1fefd80cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Fri, 8 Oct 2010 23:02:37 +0000 Subject: [PATCH] - Added numeric record type and raw data for unknown DNS record types. --- ext/standard/dns.c | 10 +++++++++- ext/standard/dns_win32.c | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 103d6904f8..22c44525e4 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -679,7 +679,15 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int add_assoc_string(*subarray, "replacement", name, 1); break; default: - cp += dlen; + { + char buf[10]; /* max length of short + sizeof(id #) */ + snprintf(buf, 10, "id #%hu", type); + buf[10-1] = '\0'; + add_assoc_string(*subarray, "type", buf, 1); + add_assoc_stringl(*subarray, "data", (char*) cp, (uint) dlen, 1); + cp += dlen; + break; + } } add_assoc_string(*subarray, "class", "IN", 1); diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index ac3aab00b1..a86cc06a1e 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -320,7 +320,14 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, zval **s break; default: - break; + { + char buf[10]; /* max length of short + sizeof(id #) */ + snprintf(buf, 10, "id #%hu", (unsigned short) type); + buf[10-1] = '\0'; + add_assoc_string(*subarray, "type", buf, 1); + add_assoc_stringl(*subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength, 1); + break; + } } add_assoc_string(*subarray, "class", "IN", 1); -- 2.40.0