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
ec540743
Commit
ec540743
authored
Feb 25, 2019
by
Timothy Nelson
Committed by
neil
Feb 25, 2019
Browse files
Fix verification for namecheap domains not *owned* by the calling user (#2106)
parent
16a0f40a
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_namecheap.sh
View file @
ec540743
...
...
@@ -76,6 +76,22 @@ dns_namecheap_rm() {
# _sub_domain=_acme-challenge.www
# _domain=domain.com
_get_root
()
{
fulldomain
=
$1
if
!
_get_root_by_getList
"
$fulldomain
"
;
then
_debug
"Failed domain lookup via domains.getList api call. Trying domain lookup via domains.dns.getHosts api."
# The above "getList" api will only return hosts *owned* by the calling user. However, if the calling
# user is not the owner, but still has administrative rights, we must query the getHosts api directly.
# See this comment and the official namecheap response: http://disq.us/p/1q6v9x9
if
!
_get_root_by_getHosts
"
$fulldomain
"
;
then
return
1
fi
fi
return
0
}
_get_root_by_getList
()
{
domain
=
$1
if
!
_namecheap_post
"namecheap.domains.getList"
;
then
...
...
@@ -94,6 +110,10 @@ _get_root() {
#not valid
return
1
fi
if
!
_contains
"
$h
"
"
\\
."
;
then
#not valid
return
1
fi
if
!
_contains
"
$response
"
"
$h
"
;
then
_debug
"
$h
not found"
...
...
@@ -108,6 +128,31 @@ _get_root() {
return
1
}
_get_root_by_getHosts
()
{
i
=
100
p
=
99
while
[
$p
-ne
0
]
;
do
h
=
$(
printf
"%s"
"
$1
"
|
cut
-d
.
-f
$i
-100
)
if
[
-n
"
$h
"
]
;
then
if
_contains
"
$h
"
"
\\
."
;
then
_debug h
"
$h
"
if
_namecheap_set_tld_sld
"
$h
"
;
then
_sub_domain
=
$(
printf
"%s"
"
$1
"
|
cut
-d
.
-f
1-
$p
)
_domain
=
"
$h
"
return
0
else
_debug
"
$h
not found"
fi
fi
fi
i
=
"
$p
"
p
=
$(
_math
"
$p
"
- 1
)
done
return
1
}
_namecheap_set_publicip
()
{
if
[
-z
"
$NAMECHEAP_SOURCEIP
"
]
;
then
...
...
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