dnsapi/dns_autodns: escape XML special characters in credentials (#5317)
This commit is contained in:
+10
-1
@@ -139,12 +139,21 @@ _get_autodns_zone() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Escape the XML special characters (& < > ' ") so that credentials
|
||||||
|
# containing them do not break the request document (issue 5317).
|
||||||
|
_autodns_xml_encode() {
|
||||||
|
sed "s/&/\&/g;s/</\</g;s/>/\>/g;s/'/\'/g;s/\"/\"/g"
|
||||||
|
}
|
||||||
|
|
||||||
_build_request_auth_xml() {
|
_build_request_auth_xml() {
|
||||||
|
_autodns_user_xml="$(printf "%s" "$AUTODNS_USER" | _autodns_xml_encode)"
|
||||||
|
_autodns_password_xml="$(printf "%s" "$AUTODNS_PASSWORD" | _autodns_xml_encode)"
|
||||||
|
_autodns_context_xml="$(printf "%s" "$AUTODNS_CONTEXT" | _autodns_xml_encode)"
|
||||||
printf "<auth>
|
printf "<auth>
|
||||||
<user>%s</user>
|
<user>%s</user>
|
||||||
<password>%s</password>
|
<password>%s</password>
|
||||||
<context>%s</context>
|
<context>%s</context>
|
||||||
</auth>" "$AUTODNS_USER" "$AUTODNS_PASSWORD" "$AUTODNS_CONTEXT"
|
</auth>" "$_autodns_user_xml" "$_autodns_password_xml" "$_autodns_context_xml"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
|||||||
Reference in New Issue
Block a user