#! /bin/sh

. /etc/control.d/functions-local-policy

CONFIG=/etc/sssd/sssd.conf

new_help disabled 'Disable automatically update DNS server with the IP address using SSSD'
new_help enabled 'Enable automatically update DNS server with the IP address using SSSD'
new_help default 'Disable automatically update DNS server with the IP address using SSSD by default'

new_subst default \
	'^\s*[#;]?[#; ]\s*dyndns_update\s*=\s*([Ff][Aa][Ll][Ss][Ee]|[Tt][Rr][Uu][Ee])\s*' \
	's/^\s*[#;]\?\s*\(dyndns_update\)\s*=.*/; \1 = false/'

new_subst enabled \
	'^\s*dyndns_update\s*=\s*[Tt][Rr][Uu][Ee]\s*' \
	's/^\s*[#;]\?\s*\(dyndns_update\)\s*\=.*/\1 = true/'

new_subst disabled \
	'^\s*dyndns_update\s*=\s*[Ff][Aa][Ll][Ss][Ee]\s*' \
	's/^\s*[#;]\?\s*\(dyndns_update\)\s*=.*/\1 = false/'

new_summary 'SSSD option specifies the automatically update DNS server (secured using GSS-TSIG) with the IP address of this client'

check_default_sssd_ad_ipa_option "$CONFIG" "$*" "dyndns_update" "disabled" "enabled disabled default" || exit $?
control_subst_with_file_check "$CONFIG" "$*" "disabled enabled default"
