]> granicus.if.org Git - php/commitdiff
- Added numeric record type and raw data for unknown DNS
authorGustavo André dos Santos Lopes <cataphract@php.net>
Fri, 8 Oct 2010 23:02:37 +0000 (23:02 +0000)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Fri, 8 Oct 2010 23:02:37 +0000 (23:02 +0000)
  record types.

ext/standard/dns.c
ext/standard/dns_win32.c

index 103d6904f8ed072b0045e568cc1f01681d875ac1..22c44525e48d923854c57ca8ab700389e3feab05 100644 (file)
@@ -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);
index ac3aab00b17aa05bded1ab70e7798275a997dd80..a86cc06a1e49b96d1bf60e44cbd9bf795e61823f 100644 (file)
@@ -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);