Skip to content

Commit 2450267

Browse files
authored
Merge pull request #494 from rdebath/master
Bugfixes for json_awk and nslookup
2 parents 2ad785c + 86e2792 commit 2450267

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

getssl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
813813
return
814814
fi
815815

816-
res=$(nslookup -debug=1 -type=soa -type=ns "$gad_d" ${gad_s})
816+
res=$(nslookup -debug -type=soa -type=ns "$gad_d" ${gad_s})
817817

818818
if [[ "$(echo "$res" | grep -c "Non-authoritative")" -gt 0 ]]; then
819819
# this is a Non-authoritative server, need to check for an authoritative one.
@@ -826,9 +826,9 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
826826
fi
827827

828828
if [[ -z "$gad_s" ]]; then
829-
res=$(nslookup -debug=1 -type=soa -type=ns "$gad_d")
829+
res=$(nslookup -debug -type=soa -type=ns "$gad_d")
830830
else
831-
res=$(nslookup -debug=1 -type=soa -type=ns "$gad_d" "${gad_s}")
831+
res=$(nslookup -debug -type=soa -type=ns "$gad_d" "${gad_s}")
832832
fi
833833

834834
if [[ "$(echo "$res" | grep -c "canonical name")" -gt 0 ]]; then
@@ -1027,7 +1027,7 @@ info() { # write out info as long as the quiet flag has not been set.
10271027

10281028
json_awk() { # AWK json converter used for API2 - needs tidying up ;)
10291029
# shellcheck disable=SC2086
1030-
echo $1 | awk '
1030+
echo "$1" | tr -d '\n' | awk '
10311031
{
10321032
tokenize($0) # while(get_token()) {print TOKEN}
10331033
if (0 == parse()) {
@@ -1173,8 +1173,8 @@ function scream(msg) {
11731173
}
11741174
11751175
function tokenize(a1,pq,pb,ESCAPE,CHAR,STRING,NUMBER,KEYWORD,SPACE) {
1176-
SPACE="[[:space:]]+"
1177-
gsub(/"[^[:cntrl:]"\\]*((\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})[^[:cntrl:]"\\]*)*"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[[:space:]]+|./, "\n&", a1)
1176+
SPACE="[ \t\n]+"
1177+
gsub(/"[^\001-\037"\\]*((\\[^u\001-\037]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])[^\001-\037"\\]*)*"|-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?|null|false|true|[ \t\n]+|./, "\n&", a1)
11781178
gsub("\n" SPACE, "\n", a1)
11791179
sub(/^\n/, "", a1)
11801180
ITOKENS=0 # get_token() helper

0 commit comments

Comments
 (0)