From: Gustavo André dos Santos Lopes Date: Fri, 8 Oct 2010 23:02:37 +0000 (+0000) Subject: - Added numeric record type and raw data for unknown DNS X-Git-Tag: php-5.4.0alpha1~191^2~803 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1d5cf7348105cb8205b0fe7c54494b1fefd80cf;p=php - Added numeric record type and raw data for unknown DNS record types. --- 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);