Browse Source

Merge pull request #4987 from acmesh-official/dev

sync
neil 1 year ago
parent
commit
de14d59bb3
2 changed files with 14 additions and 3 deletions
  1. 1 2
      .github/workflows/pr_dns.yml
  2. 13 1
      acme.sh

+ 1 - 2
.github/workflows/pr_dns.yml

@@ -4,8 +4,6 @@ on:
   pull_request_target:
   pull_request_target:
     types:
     types:
       - opened
       - opened
-    branches:
-      - 'dev'
     paths:
     paths:
       - 'dnsapi/*.sh'
       - 'dnsapi/*.sh'
 
 
@@ -22,6 +20,7 @@ jobs:
               owner: context.repo.owner,
               owner: context.repo.owner,
               repo: context.repo.repo,
               repo: context.repo.repo,
               body: `**Welcome**
               body: `**Welcome**
+                First thing: don't send PR to the master branch, please send to the dev branch instead.
                 Please make sure you've read our [DNS API Dev Guide](../wiki/DNS-API-Dev-Guide) and [DNS-API-Test](../wiki/DNS-API-Test).
                 Please make sure you've read our [DNS API Dev Guide](../wiki/DNS-API-Dev-Guide) and [DNS-API-Test](../wiki/DNS-API-Test).
                 Then reply on this message, otherwise, your code will not be reviewed or merged.
                 Then reply on this message, otherwise, your code will not be reviewed or merged.
                 We look forward to reviewing your Pull request shortly ✨
                 We look forward to reviewing your Pull request shortly ✨

+ 13 - 1
acme.sh

@@ -2519,22 +2519,34 @@ _startserver() {
   _content_len="$(printf "%s" "$content" | wc -c)"
   _content_len="$(printf "%s" "$content" | wc -c)"
   _debug _content_len "$_content_len"
   _debug _content_len "$_content_len"
   _debug "_NC" "$_NC $SOCAT_OPTIONS"
   _debug "_NC" "$_NC $SOCAT_OPTIONS"
+  export _SOCAT_ERR="$(_mktemp)"
   $_NC $SOCAT_OPTIONS SYSTEM:"sleep 1; \
   $_NC $SOCAT_OPTIONS SYSTEM:"sleep 1; \
 echo 'HTTP/1.0 200 OK'; \
 echo 'HTTP/1.0 200 OK'; \
 echo 'Content-Length\: $_content_len'; \
 echo 'Content-Length\: $_content_len'; \
 echo ''; \
 echo ''; \
-printf '%s' '$content';" &
+printf '%s' '$content';" 2>"$_SOCAT_ERR" &
   serverproc="$!"
   serverproc="$!"
+  if [ -f "$_SOCAT_ERR" ]; then
+    if grep "Permission denied" "$_SOCAT_ERR" >/dev/null; then
+      _err "socat: $(cat $_SOCAT_ERR)"
+      _err "Can not listen for user: $(whoami)"
+      _err "Maybe try with root again?"
+      rm -f "$_SOCAT_ERR"
+      return 1
+    fi
+  fi
 }
 }
 
 
 _stopserver() {
 _stopserver() {
   pid="$1"
   pid="$1"
   _debug "pid" "$pid"
   _debug "pid" "$pid"
   if [ -z "$pid" ]; then
   if [ -z "$pid" ]; then
+    rm -f "$_SOCAT_ERR"
     return
     return
   fi
   fi
 
 
   kill $pid
   kill $pid
+  rm -f "$_SOCAT_ERR"
 
 
 }
 }