]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Fixing output for .br domains when expiry date is not available on domain-check
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 10 Sep 2012 14:38:35 +0000 (11:38 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 10 Sep 2012 14:38:35 +0000 (11:38 -0300)
files/bin/domain-check

index 90d522f5398cd856ce925cc419d22bd546afe444..ebefb6b27b677635b256f732e160a433bf87609d 100755 (executable)
@@ -8,6 +8,10 @@
 #
 # Revision History:
 #
+#  Version 1.11
+#    Fixing mail program path -- Silvio Rhatto <rhatto at riseup dot net>
+#    Fixing output for .br domains when expiry date is not available -- Silvio Rhatto <rhatto at riseup dot net>
+#
 #  Version 1.10
 #    Do not add extra line on quiet mode -- Silvio Rhatto <rhatto at riseup dot net>
 #
@@ -332,9 +336,14 @@ check_domain_status()
     #echo $DOMAINDATE # debug 
     if [ "${TLDTYPE}" == "br" ]; # for .br domain
     then
-            # Convert the date to seconds
-            DOMAINJULIAN=`$DATE -d ${DOMAINDATE} "+%-m %-d %-Y"`
-            DOMAINJULIAN=`date2julian ${DOMAINJULIAN}`
+            # If registro.br outputs in reduced mode when query limits are
+            # reached, the whois server does not output expiry information.
+            if [ ! -z "${DOMAINDATE}" ];
+            then
+              # Convert the date to seconds
+              DOMAINJULIAN=`$DATE -d ${DOMAINDATE} "+%-m %-d %-Y"`
+              DOMAINJULIAN=`date2julian ${DOMAINJULIAN}`
+            fi
     else
             # Whois data should be in the following format: "13-feb-2006"
             IFS="-"
@@ -347,15 +356,24 @@ check_domain_status()
     fi
 
     # Get the diff between NOW and the expiration date
-    DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN})
+    if [ ! -z "${DOMAINJULIAN}" ];
+    then
+            DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN})
+    else
+            # We have no information
+            DOMAINDIFF="undef"
+    fi
 
-    if [ "${TLDTYPE}" == "br" ]; # for .br domain
+    if [ "${TLDTYPE}" == "br" ] && [ ! -z "${DOMAINDATE}" ]; # for .br domain
     then    
             # Fix domain date for displaying
             DOMAINDATE=`$DATE -d ${DOMAINDATE} +"%m-%b-%Y"`
     fi
 
-    if [ ${DOMAINDIFF} -lt 0 ]
+    if [ ${DOMAINDIFF} == 'undef' ];
+    then
+          prints ${DOMAIN} "No info" "$?" "?" ${REGISTRAR}
+    elif [ ${DOMAINDIFF} -lt 0 ]
     then
           if [ "${ALARM}" = "TRUE" ]
           then