Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
399d6592
Commit
399d6592
authored
Mar 01, 2018
by
TigerP
Browse files
Fix some quotes and a check
parent
14c27554
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_da.sh
View file @
399d6592
...
@@ -76,7 +76,7 @@ _get_root() {
...
@@ -76,7 +76,7 @@ _get_root() {
p
=
1
p
=
1
# Get a list of all the domains
# Get a list of all the domains
# response will contain "list[]=example.com&list[]=example.org"
# response will contain "list[]=example.com&list[]=example.org"
_da_api CMD_API_SHOW_DOMAINS
""
${
domain
}
_da_api CMD_API_SHOW_DOMAINS
""
"
${
domain
}
"
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
_debug h
"
$h
"
_debug h
"
$h
"
...
@@ -125,13 +125,13 @@ _da_api() {
...
@@ -125,13 +125,13 @@ _da_api() {
error
=
"
$(
_getfield
"
$err_field
"
2
'='
)
"
error
=
"
$(
_getfield
"
$err_field
"
2
'='
)
"
text
=
"
$(
_getfield
"
$txt_field
"
2
'='
)
"
text
=
"
$(
_getfield
"
$txt_field
"
2
'='
)
"
details
=
"
$(
_getfield
"
$details_field
"
2
'='
)
"
details
=
"
$(
_getfield
"
$details_field
"
2
'='
)
"
_debug
"error:
${
error
}
, text:
${
text
}
, details:
${
details
}
"
if
[
"
$error
"
!=
"0"
]
;
then
if
[
"
$error
"
!=
"0"
]
;
then
_err
"error
$response
"
_err
"error
$response
"
return
1
return
1
fi
fi
;;
;;
CMD_API_SHOW_DOMAINS
)
CMD_API_SHOW_DOMAINS
)
;;
;;
esac
esac
return
0
return
0
}
}
...
@@ -155,7 +155,7 @@ _DA_getDomainInfo() {
...
@@ -155,7 +155,7 @@ _DA_getDomainInfo() {
_DA_addTxt
()
{
_DA_addTxt
()
{
curData
=
"domain=
${
_domain
}
&action=add&type=TXT&name=
${
_sub_domain
}
&value=
\"
${
txtvalue
}
\"
"
curData
=
"domain=
${
_domain
}
&action=add&type=TXT&name=
${
_sub_domain
}
&value=
\"
${
txtvalue
}
\"
"
_debug
"Calling _DA_addTxt: '
${
curData
}
' '
${
DA_Api
}
/CMD_API_DNS_CONTROL'"
_debug
"Calling _DA_addTxt: '
${
curData
}
' '
${
DA_Api
}
/CMD_API_DNS_CONTROL'"
_da_api CMD_API_DNS_CONTROL
${
curData
}
${
_domain
}
_da_api CMD_API_DNS_CONTROL
"
${
curData
}
"
"
${
_domain
}
"
_debug
"Result of _DA_addTxt: '
$response
'"
_debug
"Result of _DA_addTxt: '
$response
'"
if
_contains
"
${
response
}
"
'error=0'
;
then
if
_contains
"
${
response
}
"
'error=0'
;
then
_debug
"Add TXT succeeded"
_debug
"Add TXT succeeded"
...
@@ -170,7 +170,7 @@ _DA_addTxt() {
...
@@ -170,7 +170,7 @@ _DA_addTxt() {
_DA_rmTxt
()
{
_DA_rmTxt
()
{
curData
=
"domain=
${
_domain
}
&action=select&txtrecs0=name=
${
_sub_domain
}
&value=
\"
${
txtvalue
}
\"
"
curData
=
"domain=
${
_domain
}
&action=select&txtrecs0=name=
${
_sub_domain
}
&value=
\"
${
txtvalue
}
\"
"
_debug
"Calling _DA_rmTxt: '
${
curData
}
' '
${
DA_Api
}
/CMD_API_DNS_CONTROL'"
_debug
"Calling _DA_rmTxt: '
${
curData
}
' '
${
DA_Api
}
/CMD_API_DNS_CONTROL'"
if
[
"
$(
_da_api CMD_API_DNS_CONTROL
${
curData
}
${
_domain
}
)
"
==
"0"
]
;
then
if
_da_api CMD_API_DNS_CONTROL
"
${
curData
}
"
"
${
_domain
}
"
;
then
_debug
"Result of _DA_rmTxt: '
$response
'"
_debug
"Result of _DA_rmTxt: '
$response
'"
else
else
_err
"Result of _DA_rmTxt: '
$response
'"
_err
"Result of _DA_rmTxt: '
$response
'"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment