(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PIDDIR)
          op: assign_op.Equal
          rhs: {<'/var/run/samba'>}
          spids: [42]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SAMBAPID)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PIDDIR') <'/samba.pid'>}
          spids: [45]
        )
      ]
    )
    (C {<unset>} {<TMPDIR>})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<test>} {<-x>} {<'/usr/sbin/samba'>} {<-a>} {<-r>} {<'/etc/samba/smb.conf'>})
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
      ]
    )
    (C {<.>} {<'/lib/lsb/init-functions'>})
    (command.Case
      to_match: {(DQ ($ Id.VSub_Number '$1'))}
      arms: [
        (case_arm
          pat_list: [{<start>}]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SERVER_ROLE)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        child: 
                          (command.Pipeline
                            children: [
                              (command.Simple
                                words: [
                                  {<samba-tool>}
                                  {<testparm>}
                                  {<--parameter-name> <Id.Lit_Equals '='> (DQ <'server role'>)}
                                ]
                                redirects: [
                                  (redir
                                    op: <Id.Redir_Great '2>'>
                                    loc: (redir_loc.Fd fd:2)
                                    arg: {<'/dev/null'>}
                                  )
                                ]
                                do_fork: T
                              )
                              (C {<tail>} {<-1>})
                            ]
                            negated: F
                          )
                      )
                    }
                  spids: [98]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$SERVER_ROLE'))} 
                          {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <'active directory domain controller'>)} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [(command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})]
                  spids: [123 141]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {<init_is_upstart>}) terminator:<Id.Op_Semi _>)]
                  action: [(command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})]
                  spids: [153 158]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:KEYFILE)
                  op: assign_op.Equal
                  rhs: {<'/var/lib/samba/private/tls/key.pem'>}
                  spids: [174]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {<Id.Lit_LBracket '['>} {<-e>} {($ Id.VSub_DollarName '$KEYFILE')} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:KEYPERMS)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_Backtick '`'>
                                child: 
                                  (C {<stat>} {<-c>} {<Id.Lit_Other '%'> <a>} 
                                    {($ Id.VSub_DollarName '$KEYFILE')}
                                  )
                              )
                            }
                          spids: [192]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$KEYPERMS'))} 
                              {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <600>)} {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          action: [
                            (C {<echo>} 
                              {
                                (DQ <'wrong permission on '> ($ Id.VSub_DollarName '$KEYFILE') 
                                  <', must be 600'>
                                )
                              }
                            )
                            (C {<echo>} {(DQ <'samba will not start (CVE-2013-4475)'>)})
                            (C {<echo>} 
                              {
                                (DQ 
                                  <
'Removing all tls .pem files will cause an auto-regeneration with the correct permissions.'
                                  >
                                )
                              }
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Exit exit>
                              arg_word: {<1>}
                            )
                          ]
                          spids: [207 225]
                        )
                      ]
                    )
                  ]
                  spids: [178 189]
                )
              ]
            )
            (C {<log_daemon_msg>} {(DQ <'Starting Samba AD DC daemon'>)} {(DQ <samba>)})
            (C {<install>} {<-o>} {<root>} {<-g>} {<root>} {<-m>} {<755>} {<-d>} 
              {($ Id.VSub_DollarName '$PIDDIR')}
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<start-stop-daemon>} {<--start>} {<--quiet>} {<--oknodo>} {<--exec>} 
                              {<'/usr/sbin/samba'>} {<-->} {<-D>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<log_end_msg>} {<1>})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [298 319]
                )
              ]
            )
            (C {<log_end_msg>} {<0>})
          ]
          spids: [94 95 341 -1]
        )
        (case_arm
          pat_list: [{<stop>}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {<init_is_upstart>}) terminator:<Id.Op_Semi _>)]
                  action: [(command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})]
                  spids: [348 353]
                )
              ]
            )
            (C {<log_daemon_msg>} {(DQ <'Stopping Samba AD DC daemon'>)} {(DQ <samba>)})
            (C {<start-stop-daemon>} {<--stop>} {<--quiet>} {<--pidfile>} 
              {($ Id.VSub_DollarName '$SAMBAPID')}
            )
            (C {<sleep>} {<1>})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {<Id.Lit_LBracket '['>} {<-f>} {($ Id.VSub_DollarName '$SAMBAPID')} 
                          {<Id.Lit_RBracket ']'>}
                        )
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [
                                {<ps>}
                                {<h>}
                                {
                                  (command_sub
                                    left_token: <Id.Left_Backtick '`'>
                                    child: (C {<cat>} {($ Id.VSub_DollarName '$SAMBAPID')})
                                  )
                                }
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<'/dev/null'>}
                                )
                              ]
                              do_fork: T
                            )
                          ]
                          negated: T
                        )
                      ]
                    )
                  ]
                  action: [(C {<rm>} {<-f>} {($ Id.VSub_DollarName '$SAMBAPID')})]
                  spids: [396 427]
                )
              ]
            )
            (C {<log_end_msg>} {<0>})
          ]
          spids: [344 345 455 -1]
        )
        (case_arm
          pat_list: [{<restart>} {<force-reload>}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Sentence child:(C {<init_is_upstart>}) terminator:<Id.Op_Semi _>)]
                  action: [(command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})]
                  spids: [464 469]
                )
              ]
            )
            (C {($ Id.VSub_Number '$0')} {<stop>})
            (C {<sleep>} {<1>})
            (C {($ Id.VSub_Number '$0')} {<start>})
          ]
          spids: [458 461 495 -1]
        )
        (case_arm
          pat_list: [{<status>}]
          action: [
            (C {<status_of_proc>} {<-p>} {($ Id.VSub_DollarName '$SAMBAPID')} {<'/usr/sbin/samba'>} 
              {<samba>}
            )
            (command.ControlFlow
              token: <Id.ControlFlow_Exit exit>
              arg_word: {($ Id.VSub_QMark '$?')}
            )
          ]
          spids: [498 499 518 -1]
        )
        (case_arm
          pat_list: [{<Id.Lit_Star '*'>}]
          action: [
            (C {<echo>} 
              {(DQ <'Usage: /etc/init.d/samba-ad-dc {start|stop|restart|force-reload|status}'>)}
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [521 522 537 -1]
        )
      ]
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)