git: 9front

Download patch

ref: b5a43e50b4310ca27ab105e74161c7fe1819ac2f
parent: 4ea7500929d2f1afb261e46c011f2970ea23261b
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
 	}
--