Skip to content

Commit 0da839c

Browse files
authored
Merge pull request #4720 from acmesh-official/dev
sync
2 parents b7caf7a + b6f62ac commit 0da839c

File tree

9 files changed

+540
-147
lines changed

9 files changed

+540
-147
lines changed

.github/workflows/DragonFlyBSD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
nat: |
6363
"8080": "80"
6464
prepare: |
65-
pkg install -y curl socat
65+
pkg install -y curl socat libnghttp2
6666
usesh: true
6767
run: |
6868
cd ../acmetest \

.github/workflows/OpenBSD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
6767
nat: |
6868
"8080": "80"
69-
prepare: pkg_add socat curl wget
69+
prepare: pkg_add socat curl wget libnghttp2
7070
usesh: true
7171
copyback: false
7272
run: |

acme.sh

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
VER=3.0.6
3+
VER=3.0.7
44

55
PROJECT_NAME="acme.sh"
66

@@ -923,8 +923,16 @@ _sed_i() {
923923
fi
924924
}
925925

926+
if [ "$(echo abc | egrep -o b 2>/dev/null)" = "b" ]; then
927+
__USE_EGREP=1
928+
else
929+
__USE_EGREP=""
930+
fi
931+
926932
_egrep_o() {
927-
if ! egrep -o "$1" 2>/dev/null; then
933+
if [ "$__USE_EGREP" ]; then
934+
egrep -o "$1"
935+
else
928936
sed -n 's/.*\('"$1"'\).*/\1/p'
929937
fi
930938
}
@@ -2101,9 +2109,20 @@ _head_n() {
21012109
}
21022110

21032111
_tail_n() {
2104-
if ! tail -n "$1" 2>/dev/null; then
2112+
if _is_solaris; then
21052113
#fix for solaris
21062114
tail -"$1"
2115+
else
2116+
tail -n "$1"
2117+
fi
2118+
}
2119+
2120+
_tail_c() {
2121+
if _is_solaris; then
2122+
#fix for solaris
2123+
tail -"$1"c
2124+
else
2125+
tail -c "$1"
21072126
fi
21082127
}
21092128

@@ -2116,6 +2135,7 @@ _send_signed_request() {
21162135
if [ -z "$keyfile" ]; then
21172136
keyfile="$ACCOUNT_KEY_PATH"
21182137
fi
2138+
_debug "=======Begin Send Signed Request======="
21192139
_debug url "$url"
21202140
_debug payload "$payload"
21212141

@@ -2277,7 +2297,7 @@ _setopt() {
22772297
if [ ! -f "$__conf" ]; then
22782298
touch "$__conf"
22792299
fi
2280-
if [ -n "$(tail -c 1 <"$__conf")" ]; then
2300+
if [ -n "$(_tail_c 1 <"$__conf")" ]; then
22812301
echo >>"$__conf"
22822302
fi
22832303

@@ -4602,9 +4622,10 @@ issue() {
46024622
_d="*.$_d"
46034623
fi
46044624
_debug2 _d "$_d"
4605-
_authorizations_map="$_d,$response
4625+
_authorizations_map="$_d,$response#$_authz_url
46064626
$_authorizations_map"
46074627
done
4628+
46084629
_debug2 _authorizations_map "$_authorizations_map"
46094630

46104631
_index=0
@@ -4656,7 +4677,8 @@ $_authorizations_map"
46564677
_on_issue_err "$_post_hook"
46574678
return 1
46584679
fi
4659-
4680+
_authz_url="$(echo "$_candidates" | sed "s/$_idn_d,//" | _egrep_o "#.*" | sed "s/^#//")"
4681+
_debug _authz_url "$_authz_url"
46604682
if [ -z "$thumbprint" ]; then
46614683
thumbprint="$(__calc_account_thumbprint)"
46624684
fi
@@ -4708,7 +4730,7 @@ $_authorizations_map"
47084730
_debug keyauthorization "$keyauthorization"
47094731
fi
47104732

4711-
dvlist="$d$sep$keyauthorization$sep$uri$sep$vtype$sep$_currentRoot"
4733+
dvlist="$d$sep$keyauthorization$sep$uri$sep$vtype$sep$_currentRoot$sep$_authz_url"
47124734
_debug dvlist "$dvlist"
47134735

47144736
vlist="$vlist$dvlist$dvsep"
@@ -4725,6 +4747,7 @@ $_authorizations_map"
47254747
keyauthorization=$(echo "$ventry" | cut -d "$sep" -f 2)
47264748
vtype=$(echo "$ventry" | cut -d "$sep" -f 4)
47274749
_currentRoot=$(echo "$ventry" | cut -d "$sep" -f 5)
4750+
_authz_url=$(echo "$ventry" | cut -d "$sep" -f 6)
47284751
_debug d "$d"
47294752
if [ "$keyauthorization" = "$STATE_VERIFIED" ]; then
47304753
_debug "$d is already verified, skip $vtype."
@@ -4850,7 +4873,7 @@ $_authorizations_map"
48504873
uri=$(echo "$ventry" | cut -d "$sep" -f 3)
48514874
vtype=$(echo "$ventry" | cut -d "$sep" -f 4)
48524875
_currentRoot=$(echo "$ventry" | cut -d "$sep" -f 5)
4853-
4876+
_authz_url=$(echo "$ventry" | cut -d "$sep" -f 6)
48544877
if [ "$keyauthorization" = "$STATE_VERIFIED" ]; then
48554878
_info "$d is already verified, skip $vtype."
48564879
continue
@@ -4860,6 +4883,7 @@ $_authorizations_map"
48604883
_debug "d" "$d"
48614884
_debug "keyauthorization" "$keyauthorization"
48624885
_debug "uri" "$uri"
4886+
_debug "_authz_url" "$_authz_url"
48634887
removelevel=""
48644888
token="$(printf "%s" "$keyauthorization" | cut -d '.' -f 1)"
48654889

@@ -4967,6 +4991,7 @@ $_authorizations_map"
49674991
MAX_RETRY_TIMES=30
49684992
fi
49694993

4994+
_debug "Lets check the status of the authz"
49704995
while true; do
49714996
waittimes=$(_math "$waittimes" + 1)
49724997
if [ "$waittimes" -ge "$MAX_RETRY_TIMES" ]; then
@@ -5014,9 +5039,9 @@ $_authorizations_map"
50145039
break
50155040
fi
50165041

5017-
if [ "$status" = "pending" ]; then
5042+
if _contains "$status" "pending"; then
50185043
_info "Pending, The CA is processing your order, please just wait. ($waittimes/$MAX_RETRY_TIMES)"
5019-
elif [ "$status" = "processing" ]; then
5044+
elif _contains "$status" "processing"; then
50205045
_info "Processing, The CA is processing your order, please just wait. ($waittimes/$MAX_RETRY_TIMES)"
50215046
else
50225047
_err "$d:Verify error:$response"
@@ -5029,7 +5054,7 @@ $_authorizations_map"
50295054
_sleep 2
50305055
_debug "checking"
50315056

5032-
_send_signed_request "$uri"
5057+
_send_signed_request "$_authz_url"
50335058

50345059
if [ "$?" != "0" ]; then
50355060
_err "$d:Verify error:$response"

0 commit comments

Comments
 (0)