|
@@ -804,6 +804,25 @@ func debugHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
804
|
804
|
case "STOPCPUPROFILE":
|
805
|
805
|
pprof.StopCPUProfile()
|
806
|
806
|
rb.Notice(fmt.Sprintf("CPU profiling stopped"))
|
|
807
|
+
|
|
808
|
+ case "CRASHSERVER":
|
|
809
|
+ if !client.HasRoleCapabs("oper:rehash") {
|
|
810
|
+ rb.Notice(client.t("You must have rehash permissions in order to execute DEBUG CRASHSERVER"))
|
|
811
|
+ return false
|
|
812
|
+ }
|
|
813
|
+ code := unregisterConfirmationCode(server.name, server.ctime)
|
|
814
|
+ if len(msg.Params) == 1 || msg.Params[1] != code {
|
|
815
|
+ rb.Notice(fmt.Sprintf(client.t("To crash the server, issue the following command: /DEBUG CRASHSERVER %s"), code))
|
|
816
|
+ return false
|
|
817
|
+ }
|
|
818
|
+ go func() {
|
|
819
|
+ // intentional nil dereference on a new goroutine, bypassing recover-from-errors
|
|
820
|
+ var i, j *int
|
|
821
|
+ *i = *j
|
|
822
|
+ }()
|
|
823
|
+
|
|
824
|
+ default:
|
|
825
|
+ rb.Notice(client.t("Unrecognized DEBUG subcommand"))
|
807
|
826
|
}
|
808
|
827
|
return false
|
809
|
828
|
}
|