From 4080322dc9196fc29164ba6c9da8b7cb3dc7a60b Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 16 Sep 2018 12:43:21 +0200 Subject: [PATCH] cpurc: handle multiple auth servers --- rc/bin/cpurc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/rc/bin/cpurc b/rc/bin/cpurc index f1d4dfd99..4708c1953 100755 --- a/rc/bin/cpurc +++ b/rc/bin/cpurc @@ -94,21 +94,20 @@ if not if(test -d /cfg/default/service) serviced=/cfg/default/service if not serviced=/rc/bin/service -if(~ $#auth 0){ - auth=`{ndb/query sys $sysname auth} - . <{ndb/ipquery sys $sysname auth | sed 's, +,\n,g'} -} -switch($auth){ -case `{ echo $sysname; ndb/query sys $sysname dom - if(test -r /net/ipselftab){ - for(i in `{awk '/u\ *$/{print $1}' /net/ipselftab}){ - echo $i; ndb/ipquery ip $i dom; ndb/ipquery ip $i sys - } | sed 's,[^ ]+=,,g'}} - +if(~ $#auth 0) + auth=`{ndb/ipquery sys $sysname auth | sed 's,auth=,,g'} +if(@{ + for(a in `{ndb/ipquery sys $sysname ip sys dom | sed 's,(ip|sys|dom)=,,g'}){ + if(~ $a $auth) + exit '' + } + exit 'no' +}){ # cpu+auth server auth/keyfs -wp -m /mnt/keys /adm/keys aux/listen -q -t /rc/bin/service.auth -d $serviced tcp -case * +} +if not { # cpu server aux/listen -q -d $serviced tcp }