(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ubhost) op: assign_op.Equal rhs: {<unbound-host>} spids: [16] ) ] ) (command.ShFunction name: usage body: (BraceGroup children: [ (C {<echo>} {(DQ <'usage: update-anchor [-r hs] [-b] <zone name> <trust anchor file>'>)}) (C {<echo>} {(DQ <' performs an update of trust anchor file'>)}) (C {<echo>} {(DQ <' the trust anchor file is overwritten with the latest keys'>)}) (C {<echo>} {(DQ <' the trust anchor file should contain only keys for one zone'>)}) (C {<echo>} {(DQ <' -b causes keyfile to be made in bind format.'>)}) (C {<echo>} {(DQ <' without -b the file is made in unbound format.'>)}) (C {<echo>} {(DQ <' '>)}) (C {<echo>} {(DQ <'alternate:'>)}) (C {<echo>} {(DQ <' update-anchor [-r hints] [-b] -d directory'>)}) (C {<echo>} {(DQ <' update all <zone>.anchor files in the directory.'>)}) (C {<echo>} {(DQ <' '>)}) (C {<echo>} {(DQ <' name the files br.anchor se.anchor ..., and include them in'>)}) (C {<echo>} {(DQ <' the validating resolver config file.'>)}) (C {<echo>} {(DQ <' put keys for the root in a file with the name root.anchor.'>)}) (C {<echo>} {(DQ )}) (C {<echo>} {(DQ <'-r root.hints\tuse different root hints. Strict option order.'>)}) (C {<echo>} {(DQ )}) (C {<echo>} {(DQ <'Exit code 0 means anchors updated, 1 no changes, others are errors.'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<2>}) ] ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_Pound '$#')} {<-eq>} {<0>}) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<usage>})] spids: [160 171] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:bindformat) op: assign_op.Equal rhs: {(DQ <no>)} spids: [178] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filearg) op: assign_op.Equal rhs: {(SQ <-f>)} spids: [183] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:roothints) op: assign_op.Equal rhs: {(DQ )} spids: [188] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<X> (DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <X-r>)}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:roothints) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [214] ) ] ) (C {<shift>}) ] spids: [192 208] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<X> (DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <X-b>)}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:bindformat) op: assign_op.Equal rhs: {(DQ <yes>)} spids: [246] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filearg) op: assign_op.Equal rhs: {(SQ <-F>)} spids: [252] ) ] ) ] spids: [224 240] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_Pound '$#')} {<-ne>} {<2>}) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<echo>} {(DQ <'arguments wrong.'>)}) (C {<usage>})] spids: [259 270] ) ] ) (command.ShFunction name: do_update body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:zonename) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [298] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:keyfile) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [304] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmpfile) op: assign_op.Equal rhs: {(DQ <'/tmp/update-anchor.'> ($ Id.VSub_Dollar '$$'))} spids: [310] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmp2) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$tmpfile') <.2>} spids: [317] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tmp3) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$tmpfile') <.3>} spids: [322] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:rh) op: assign_op.Equal rhs: {(DQ )} spids: [327] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-n>} {(DQ ($ Id.VSub_DollarName '$roothints'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'server: root-hints: \''> ($ Id.VSub_DollarName '$roothints') <'\''>)} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tmp3')} ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:rh) op: assign_op.Equal rhs: {(DQ <'-C '> ($ Id.VSub_DollarName '$tmp3'))} spids: [359] ) ] ) ] spids: [332 343] ) ] ) (command.Simple words: [ {($ Id.VSub_DollarName '$ubhost')} {<-v>} {($ Id.VSub_DollarName '$rh')} {($ Id.VSub_DollarName '$filearg')} {(DQ ($ Id.VSub_DollarName '$keyfile'))} {<-t>} {<DNSKEY>} {(DQ ($ Id.VSub_DollarName '$zonename'))} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$tmpfile')} ) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_QMark '$?')} {<-ne>} {<0>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<rm>} {<-f>} {($ Id.VSub_DollarName '$tmpfile')}) (C {<echo>} { (DQ <'Error: Could not update zone '> ($ Id.VSub_DollarName '$zonename') <' anchor file '> ($ Id.VSub_DollarName '$keyfile') ) } ) (C {<echo>} {(DQ <'Cause: '> ($ Id.VSub_DollarName '$ubhost') <' lookup failed'>)}) (C {<echo>} {(DQ <' (Is the domain decommissioned? Is connectivity lost?)'>)}) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<2>} ) ] spids: [393 404] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [{<grep>} {(SQ <'(secure)$'>)} {($ Id.VSub_DollarName '$tmpfile')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<Id.Lit_Colon ':'>})] spids: [454 471] ) ] else_action: [ (C {<rm>} {<-f>} {($ Id.VSub_DollarName '$tmpfile')}) (C {<echo>} { (DQ <'Error: Could not update zone '> ($ Id.VSub_DollarName '$zonename') <' anchor file '> ($ Id.VSub_DollarName '$keyfile') ) } ) (C {<echo>} {(DQ <'Cause: result of lookup was not secure'>)}) (C {<echo>} { (DQ <' (keys too far out of date? domain changed ownership? need root hints?)'> ) } ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<3>} ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_DollarName '$bindformat')} {<Id.Lit_Equals '='>} {(DQ <yes>)} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(SQ <'trusted-keys {'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [ {<grep>} {(SQ <' has DNSKEY record 257'>)} {($ Id.VSub_DollarName '$tmpfile')} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Pipeline children: [ (C {<grep>} {(SQ <'(secure)$'>)} {($ Id.VSub_DollarName '$tmpfile')}) (C {<grep>} {(SQ <' has DNSKEY record 257'>)}) (C {<sed>} {<-e>} {(SQ <'s/ (secure)$/";/'>)}) (C {<sed>} {<-e>} { (SQ < 's/ has DNSKEY record \\([0-9]*\\) \\([0-9]*\\) \\([0-9]*\\) /. \\1 \\2 \\3 "/' > ) } ) (C {<sed>} {<-e>} {(SQ <'s/^\\.\\././'>)}) (command.Simple words: [{<sort>}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) ] negated: F ) ] spids: [554 571] ) ] else_action: [ (command.Pipeline children: [ (C {<grep>} {(SQ <'(secure)$'>)} {($ Id.VSub_DollarName '$tmpfile')}) (C {<sed>} {<-e>} {(SQ <'s/ (secure)$/";/'>)}) (C {<sed>} {<-e>} { (SQ < 's/ has DNSKEY record \\([0-9]*\\) \\([0-9]*\\) \\([0-9]*\\) /. \\1 \\2 \\3 "/' > ) } ) (C {<sed>} {<-e>} {(SQ <'s/^\\.\\././'>)}) (command.Simple words: [{<sort>}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) ] negated: F ) ] ) (command.Simple words: [{<echo>} {(SQ <'};'>)}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) ] spids: [521 534] ) ] else_action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [ {<grep>} {(SQ <' has DNSKEY record 257'>)} {($ Id.VSub_DollarName '$tmpfile')} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Pipeline children: [ (C {<grep>} {(SQ <'(secure)$'>)} {($ Id.VSub_DollarName '$tmpfile')}) (C {<grep>} {(SQ <' has DNSKEY record 257'>)}) (C {<sed>} {<-e>} {(SQ <'s/ (secure)$//'>)}) (C {<sed>} {<-e>} {(SQ <'s/ has DNSKEY record /. IN DNSKEY /'>)}) (C {<sed>} {<-e>} {(SQ <'s/^\\.\\././'>)}) (command.Simple words: [{<sort>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) ] negated: F ) ] spids: [731 748] ) ] else_action: [ (command.Pipeline children: [ (C {<grep>} {(SQ <'(secure)$'>)} {($ Id.VSub_DollarName '$tmpfile')}) (C {<sed>} {<-e>} {(SQ <'s/ (secure)$//'>)}) (C {<sed>} {<-e>} {(SQ <'s/ has DNSKEY record /. IN DNSKEY /'>)}) (C {<sed>} {<-e>} {(SQ <'s/^\\.\\././'>)}) (command.Simple words: [{<sort>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$tmp2'))} ) ] do_fork: T ) ] negated: F ) ] ) ] ) (command.Simple words: [{<diff>} {($ Id.VSub_DollarName '$tmp2')} {($ Id.VSub_DollarName '$keyfile')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_QMark '$?')} {<-eq>} {<1>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<cat>} {($ Id.VSub_DollarName '$tmp2')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$keyfile')} ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:no_updated) op: assign_op.Equal rhs: {<0>} spids: [935] ) ] ) (C {<echo>} { (DQ ($ Id.VSub_DollarName '$zonename') <' key file '> ($ Id.VSub_DollarName '$keyfile') <' updated.'> ) } ) ] spids: [909 920] ) ] else_action: [ (C {<echo>} { (DQ ($ Id.VSub_DollarName '$zonename') <' key file '> ($ Id.VSub_DollarName '$keyfile') <' unchanged.'> ) } ) ] ) (C {<rm>} {<-f>} {($ Id.VSub_DollarName '$tmpfile')} {($ Id.VSub_DollarName '$tmp2')} {($ Id.VSub_DollarName '$tmp3')} ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:no_updated) op: assign_op.Equal rhs: {<1>} spids: [979] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<X> (DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <X-d>)}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tdir) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [1001] ) ] ) (C {<echo>} {(DQ <'start updating in '> ($ Id.VSub_Number '$2'))}) (command.ForEach iter_names: [x] iterable: (for_iter.Words words: [{($ Id.VSub_DollarName '$tdir') <'/'> <Id.Lit_Star '*'> <.anchor>}] ) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<basename>} {(DQ ($ Id.VSub_DollarName '$x'))}) ) } {<Id.Lit_Equals '='>} {(DQ <root.anchor>)} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:zname) op: assign_op.Equal rhs: {(DQ <.>)} spids: [1054] ) ] ) ] spids: [1030 1051] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:zname) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<basename>} {(DQ ($ Id.VSub_DollarName '$x'))} {<.anchor>}) ) } spids: [1063] ) ] ) ] ) (C {<do_update>} {(DQ ($ Id.VSub_DollarName '$zname'))} {(DQ ($ Id.VSub_DollarName '$x'))} ) ] ) ) (C {<echo>} {(DQ <'done updating in '> ($ Id.VSub_Number '$2'))}) ] spids: [982 998] ) ] else_action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<X> (DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} {(DQ <X.>)}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:zname) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [1127] ) ] ) ] spids: [1108 1124] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:zname) op: assign_op.Equal rhs: { (DQ (command_sub left_token: <Id.Left_Backtick '`'> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_Number '$1')}) (C {<sed>} {<-e>} {(SQ <'s/\\.$//'>)}) ] negated: F ) ) ) } spids: [1140] ) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:kfile) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [1167] ) ] ) (C {<do_update>} {($ Id.VSub_DollarName '$zname')} {($ Id.VSub_DollarName '$kfile')}) ] ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {($ Id.VSub_DollarName '$no_updated')} ) ] )