shithub: riscv

Download patch

ref: 43eb7eea62595cbb180873e7087a0e4cd8900a9c
parent: d3743d40c2c7d0cfe2d41518dc1d61c2ca277ac9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Nov 29 15:26:12 EST 2021

netaudit: check for sys= attribute to be free of periods

--- a/rc/bin/netaudit
+++ b/rc/bin/netaudit
@@ -16,6 +16,13 @@
 	if not
 		echo ' looks ok'
 }
+fn checksys {
+	echo -n '	'$1'='$2
+	if(~ $2 *.*)
+		echo ' contains a dot, it will be confused for a domain name or ip address'
+	if not
+		echo ' looks ok'
+}
 fn checkdom {
 	echo -n '	'$1'='$2
 	if(! ~ $2 *.*)
@@ -27,10 +34,19 @@
 }
 fn checkhost {
 	if(~ $sysname ''){
-		echo 'sysname= env var is not set'
+		echo 'env var $sysname is not set'
 		exit 'fail'
 	}
+	checksys 'env var $sysname' $sysname
 	echo 'checking this host''s tuple:'
+	sys=`{ndb/ipquery sys $sysname sys | sed 's/sys=//g'}
+	if(! ~ $sysname $sys)
+		echo '	no sys= entry'
+	if not {
+		for(i in $sys){
+			checksys sys $i
+		}
+	}
 	ip=`{ndb/ipquery sys $sysname ip | sed 's/ip=//g'}
 	if(~ $ip '')
 		echo '	no ip= entry'
@@ -118,7 +134,7 @@
 		echo '	no auth server'
 		exit fail
 	}
-	if not if(~ $sysname $auth){
+	if not if(~ $sys $auth){
 		echo '	we are the auth server'
 		authisus=1
 	}