]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Support a nullptr 'name' in pdns_ffi_param_add_record()
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 27 May 2019 14:28:58 +0000 (16:28 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Jul 2019 13:59:07 +0000 (15:59 +0200)
pdns/lua-recursor4-ffi.hh
pdns/lua-recursor4.cc

index a6e82ccab471f31b95f08d561f7dc47336ddcaab..817fe1259f17505d3a09b6a96489a55d5aa59b03 100644 (file)
@@ -63,5 +63,8 @@ extern "C" {
   void pdns_ffi_param_set_log_query(pdns_ffi_param_t* ref, bool logQuery) __attribute__ ((visibility ("default")));
   void pdns_ffi_param_set_rcode(pdns_ffi_param_t* ref, int rcode) __attribute__ ((visibility ("default")));
   void pdns_ffi_param_set_follow_cname_records(pdns_ffi_param_t* ref, bool follow) __attribute__ ((visibility ("default")));
+
+  /* returns true if the record was correctly added, false if something went wrong.
+     Passing a NULL pointer to 'name' will result in the qname being used for the record owner name. */
   bool pdns_ffi_param_add_record(pdns_ffi_param_t *ref, const char* name, uint16_t type, uint32_t ttl, const char* content, size_t contentSize, pdns_record_place_t place) __attribute__ ((visibility ("default")));
 }
index ead175a3755ce077d4436687f23df71b721123fd..6178ee72d672c5f3892a686fe205a200c02c0f6d 100644 (file)
@@ -866,7 +866,7 @@ bool pdns_ffi_param_add_record(pdns_ffi_param_t *ref, const char* name, uint16_t
 {
   try {
     DNSRecord dr;
-    dr.d_name = DNSName(name);
+    dr.d_name = name != nullptr ? DNSName(name) : ref->qname;
     dr.d_ttl = ttl;
     dr.d_type = type;
     dr.d_class = QClass::IN;