(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LeftVar name:PIDDIR) rhs:{(/var/run/samba)} spids:[42])]
      spids: [42]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LeftVar name:SAMBAPID)
          rhs: {($ VSub_Name "$PIDDIR") (/samba.pid)}
          spids: [45]
        )
      ]
      spids: [45]
    )
    (C {(unset)} {(TMPDIR)})
    (AndOr
      children: [
        (C {(test)} {(-x)} {(/usr/sbin/samba)} {(-a)} {(-r)} {(/etc/samba/smb.conf)})
        (C {(exit)} {(0)})
      ]
      op_id: Op_DPipe
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (Case
      to_match: {(DQ ($ VSub_Number "$1"))}
      arms: [
        (case_arm
          pat_list: [{(start)}]
          action: 
            (CommandList
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LeftVar name:SERVER_ROLE)
                      rhs: 
                        {
                          (CommandSubPart
                            command_list: 
                              (Pipeline
                                children: [
                                  (SimpleCommand
                                    words: [
                                      {(samba-tool)}
                                      {(testparm)}
                                      {(--parameter-name) (Lit_Other "=") (DQ ("server role"))}
                                    ]
                                    redirects: [
                                      (Redirect
                                        op_id: Redir_Great
                                        arg_word: {(/dev/null)}
                                        fd: 2
                                        spids: [110]
                                      )
                                    ]
                                  )
                                  (C {(tail)} {(-1)})
                                ]
                                negated: False
                              )
                            spids: [99 118]
                          )
                        }
                      spids: [98]
                    )
                  ]
                  spids: [98]
                )
                (If
                  arms: [
                    (if_arm
                      cond: 
                        (Sentence
                          command: 
                            (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$SERVER_ROLE"))} 
                              {(KW_Bang "!") (Lit_Other "=")} {(DQ ("active directory domain controller"))} {(Lit_Other "]")}
                            )
                          terminator: <Op_Semi ";">
                        )
                      action: (C {(exit)} {(0)})
                      spids: [-1 139]
                    )
                  ]
                  spids: [-1 147]
                )
                (If
                  arms: [
                    (if_arm
                      cond: (Sentence command:(C {(init_is_upstart)}) terminator:<Op_Semi ";">)
                      action: (C {(exit)} {(1)})
                      spids: [-1 156]
                    )
                  ]
                  spids: [-1 164]
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LeftVar name:KEYFILE)
                      rhs: {(/var/lib/samba/private/tls/key.pem)}
                      spids: [172]
                    )
                  ]
                  spids: [172]
                )
                (If
                  arms: [
                    (if_arm
                      cond: (C {(Lit_Other "[")} {(-e)} {($ VSub_Name "$KEYFILE")} {(Lit_Other "]")})
                      action: 
                        (CommandList
                          children: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LeftVar name:KEYPERMS)
                                  rhs: 
                                    {
                                      (CommandSubPart
                                        command_list: 
                                          (C {(stat)} {(-c)} {(Lit_Other "%") (a)} 
                                            {($ VSub_Name "$KEYFILE")}
                                          )
                                        spids: [191 200]
                                      )
                                    }
                                  spids: [190]
                                )
                              ]
                              spids: [190]
                            )
                            (If
                              arms: [
                                (if_arm
                                  cond: 
                                    (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$KEYPERMS"))} 
                                      {(KW_Bang "!") (Lit_Other "=")} {(DQ (600))} {(Lit_Other "]")}
                                    )
                                  action: 
                                    (CommandList
                                      children: [
                                        (C {(echo)} 
                                          {
                                            (DQ ("wrong permission on ") ($ VSub_Name "$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."
                                              )
                                            )
                                          }
                                        )
                                        (C {(exit)} {(1)})
                                      ]
                                    )
                                  spids: [-1 221]
                                )
                              ]
                              spids: [-1 252]
                            )
                          ]
                        )
                      spids: [-1 187]
                    )
                  ]
                  spids: [-1 255]
                )
                (C {(log_daemon_msg)} {(DQ ("Starting Samba AD DC daemon"))} {(DQ (samba))})
                (C {(install)} {(-o)} {(root)} {(-g)} {(root)} {(-m)} {(755)} {(-d)} {($ VSub_Name "$PIDDIR")})
                (If
                  arms: [
                    (if_arm
                      cond: 
                        (Sentence
                          command: 
                            (Pipeline
                              children: [
                                (C {(start-stop-daemon)} {(--start)} {(--quiet)} {(--oknodo)} {(--exec)} 
                                  {(/usr/sbin/samba)} {(--)} {(-D)}
                                )
                              ]
                              negated: True
                            )
                          terminator: <Op_Semi ";">
                        )
                      action: (CommandList children:[(C {(log_end_msg)} {(1)})(C {(exit)} {(1)})])
                      spids: [-1 315]
                    )
                  ]
                  spids: [-1 328]
                )
                (C {(log_end_msg)} {(0)})
              ]
            )
          spids: [94 95 337 -1]
        )
        (case_arm
          pat_list: [{(stop)}]
          action: 
            (CommandList
              children: [
                (If
                  arms: [
                    (if_arm
                      cond: (Sentence command:(C {(init_is_upstart)}) terminator:<Op_Semi ";">)
                      action: (C {(exit)} {(0)})
                      spids: [-1 349]
                    )
                  ]
                  spids: [-1 357]
                )
                (C {(log_daemon_msg)} {(DQ ("Stopping Samba AD DC daemon"))} {(DQ (samba))})
                (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--pidfile)} {($ VSub_Name "$SAMBAPID")})
                (C {(sleep)} {(1)})
                (If
                  arms: [
                    (if_arm
                      cond: 
                        (AndOr
                          children: [
                            (C {(Lit_Other "[")} {(-f)} {($ VSub_Name "$SAMBAPID")} {(Lit_Other "]")})
                            (Pipeline
                              children: [
                                (SimpleCommand
                                  words: [
                                    {(ps)}
                                    {(h)}
                                    {
                                      (CommandSubPart
                                        command_list: (C {(cat)} {($ VSub_Name "$SAMBAPID")})
                                        spids: [410 414]
                                      )
                                    }
                                  ]
                                  redirects: [
                                    (Redirect
                                      op_id: Redir_Great
                                      arg_word: {(/dev/null)}
                                      fd: -1
                                      spids: [416]
                                    )
                                  ]
                                )
                              ]
                              negated: True
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      action: (C {(rm)} {(-f)} {($ VSub_Name "$SAMBAPID")})
                      spids: [-1 421]
                    )
                  ]
                  spids: [-1 439]
                )
                (C {(log_end_msg)} {(0)})
              ]
            )
          spids: [340 341 449 -1]
        )
        (case_arm
          pat_list: [{(restart)} {(force-reload)}]
          action: 
            (CommandList
              children: [
                (If
                  arms: [
                    (if_arm
                      cond: (Sentence command:(C {(init_is_upstart)}) terminator:<Op_Semi ";">)
                      action: (C {(exit)} {(1)})
                      spids: [-1 463]
                    )
                  ]
                  spids: [-1 471]
                )
                (C {($ VSub_Number "$0")} {(stop)})
                (C {(sleep)} {(1)})
                (C {($ VSub_Number "$0")} {(start)})
              ]
            )
          spids: [452 455 489 -1]
        )
        (case_arm
          pat_list: [{(status)}]
          action: 
            (CommandList
              children: [
                (C {(status_of_proc)} {(-p)} {($ VSub_Name "$SAMBAPID")} {(/usr/sbin/samba)} {(samba)})
                (C {(exit)} {($ VSub_QMark "$?")})
              ]
            )
          spids: [492 493 512 -1]
        )
        (case_arm
          pat_list: [{(Lit_Other "*")}]
          action: 
            (CommandList
              children: [
                (C {(echo)} 
                  {(DQ ("Usage: /etc/init.d/samba-ad-dc {start|stop|restart|force-reload|status}"))}
                )
                (C {(exit)} {(1)})
              ]
            )
          spids: [515 516 531 -1]
        )
      ]
      spids: [85 91 533]
    )
    (C {(exit)} {(0)})
  ]
)