From c68b307eeb037fdf81256262fea4134bce80a484 Mon Sep 17 00:00:00 2001 From: "quovadis (service account)" <quovadis@ucc.gu.uwa.edu.au> Date: Mon, 10 Jan 2022 22:30:39 +0800 Subject: [PATCH] Fix query of TXT records for RFC2136 functions --- quovadis/quovadis.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quovadis/quovadis.php b/quovadis/quovadis.php index b92edfe..dab64a8 100644 --- a/quovadis/quovadis.php +++ b/quovadis/quovadis.php @@ -54,7 +54,7 @@ function get_rfc2136_txt($config, $name) { } catch(Net_DNS2_Exception $e) { - echo "::query() failed: ", $e->getMessage(), "\n"; + #echo "::query() failed: ", $e->getMessage(), "\n"; return ""; } @@ -63,7 +63,9 @@ function get_rfc2136_txt($config, $name) { // foreach($result->answer as $txtrr) { - return $txtrr; + $answer = $txtrr->asArray(); + $txt = trim(end($answer),'"'); + return $txt; } // @@ -232,7 +234,7 @@ function delete_rfc2136_txt($config, $name) { } catch(Net_DNS2_Exception $e) { - echo "::update() for deleteAny failed: ", $e->getMessage(), "\n"; + #echo "::update() for deleteAny failed: ", $e->getMessage(), "\n"; } return ""; @@ -252,6 +254,8 @@ function update_rfc2136_txt($config, $name, $txt) { // $txtrr = Net_DNS2_RR::fromString($name . "." . $config['QV_DOMAIN'] . ' TXT "'. $txt . '"'); + $txtrr->ttl=60; + // // add the record // @@ -270,7 +274,7 @@ function update_rfc2136_txt($config, $name, $txt) { } catch(Net_DNS2_Exception $e) { - echo "::update() failed: ", $e->getMessage(), "\n"; + #echo "::update() failed: ", $e->getMessage(), "\n"; } return ""; -- GitLab