Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
e12c7c8d
Unverified
Commit
e12c7c8d
authored
Jan 03, 2019
by
neil
Committed by
GitHub
Jan 03, 2019
Browse files
Merge pull request #1890 from LLeny/master
Fixes Neilpang/acme.sh#1888
parents
83a04072
46b3a915
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_namecheap.sh
View file @
e12c7c8d
...
...
@@ -199,9 +199,12 @@ _namecheap_check_config() {
_set_namecheap_TXT
()
{
subdomain
=
$2
txt
=
$3
tld
=
$(
echo
"
$1
"
|
cut
-d
'.'
-f
2
)
sld
=
$(
echo
"
$1
"
|
cut
-d
'.'
-f
1
)
request
=
"namecheap.domains.dns.getHosts&SLD=
$sld
&TLD=
$tld
"
if
!
_namecheap_set_tld_sld
"
$1
"
;
then
return
1
fi
request
=
"namecheap.domains.dns.getHosts&SLD=
${
_sld
}
&TLD=
${
_tld
}
"
if
!
_namecheap_post
"
$request
"
;
then
_err
"
$error
"
...
...
@@ -231,7 +234,7 @@ EOT
_debug hostrequestfinal
"
$_hostrequest
"
request
=
"namecheap.domains.dns.setHosts&SLD=
${
sld
}
&TLD=
${
tld
}${
_hostrequest
}
"
request
=
"namecheap.domains.dns.setHosts&SLD=
${
_
sld
}
&TLD=
${
_
tld
}${
_hostrequest
}
"
if
!
_namecheap_post
"
$request
"
;
then
_err
"
$error
"
...
...
@@ -244,9 +247,12 @@ EOT
_del_namecheap_TXT
()
{
subdomain
=
$2
txt
=
$3
tld
=
$(
echo
"
$1
"
|
cut
-d
'.'
-f
2
)
sld
=
$(
echo
"
$1
"
|
cut
-d
'.'
-f
1
)
request
=
"namecheap.domains.dns.getHosts&SLD=
$sld
&TLD=
$tld
"
if
!
_namecheap_set_tld_sld
"
$1
"
;
then
return
1
fi
request
=
"namecheap.domains.dns.getHosts&SLD=
${
_sld
}
&TLD=
${
_tld
}
"
if
!
_namecheap_post
"
$request
"
;
then
_err
"
$error
"
...
...
@@ -286,7 +292,7 @@ EOT
_debug hostrequestfinal
"
$_hostrequest
"
request
=
"namecheap.domains.dns.setHosts&SLD=
${
sld
}
&TLD=
${
tld
}${
_hostrequest
}
"
request
=
"namecheap.domains.dns.setHosts&SLD=
${
_
sld
}
&TLD=
${
_
tld
}${
_hostrequest
}
"
if
!
_namecheap_post
"
$request
"
;
then
_err
"
$error
"
...
...
@@ -306,3 +312,45 @@ _namecheap_add_host() {
_hostindex
=
$(
_math
"
$_hostindex
"
+ 1
)
_hostrequest
=
$(
printf
'%s&HostName%d=%s&RecordType%d=%s&Address%d=%s&MXPref%d=%d&TTL%d=%d'
"
$_hostrequest
"
"
$_hostindex
"
"
$1
"
"
$_hostindex
"
"
$2
"
"
$_hostindex
"
"
$3
"
"
$_hostindex
"
"
$4
"
"
$_hostindex
"
"
$5
"
)
}
_namecheap_set_tld_sld
()
{
domain
=
$1
_tld
=
""
_sld
=
""
i
=
2
while
true
;
do
_tld
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
_debug tld
"
$_tld
"
if
[
-z
"
$_tld
"
]
;
then
_debug
"invalid tld"
return
1
fi
j
=
$(
_math
"
$i
"
- 1
)
_sld
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
"
$j
"
)
_debug sld
"
$_sld
"
if
[
-z
"
$_sld
"
]
;
then
_debug
"invalid sld"
return
1
fi
request
=
"namecheap.domains.dns.getHosts&SLD=
$_sld
&TLD=
$_tld
"
if
!
_namecheap_post
"
$request
"
;
then
_debug
"sld(
$_sld
)/tld(
$_tld
) not found"
else
_debug
"sld(
$_sld
)/tld(
$_tld
) found"
return
0
fi
i
=
$(
_math
"
$i
"
+ 1
)
done
}
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