From e6e26a02e78e7aaaf9581980fcd142afd32e4332 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 22 Jun 2009 01:18:51 +0200 Subject: [PATCH] Added a known crash for the admin only to use if compiled with CRASH_DEBUG enabled. --- src/commands.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/commands.c b/src/commands.c index 55ed8c4..e9f777f 100644 --- a/src/commands.c +++ b/src/commands.c @@ -19,6 +19,8 @@ #include "uhub.h" +#define CRASH_DEBUG 1 + typedef int (*command_handler)(struct hub_info* hub, struct user* user, const char* message); struct commands_handler @@ -182,6 +184,15 @@ static int command_myip(struct hub_info* hub, struct user* user, const char* mes return command_status(hub, user, "myip", tmp); } +#ifdef CRASH_DEBUG +static int command_crash(struct hub_info* hub, struct user* user, const char* message) +{ + void (*crash)(void) = NULL; + crash(); + return 0; +} +#endif + int command_dipatcher(struct hub_info* hub, struct user* user, const char* message) { size_t n = 0; @@ -213,6 +224,9 @@ static struct commands_handler command_handlers[] = { { "reload", 6, cred_admin, command_reload, "Reload configuration files." }, { "shutdown", 8, cred_admin, command_shutdown, "Shutdown hub." }, { "myip", 4, cred_guest, command_myip, "Show your own IP." }, +#ifdef CRASH_DEBUG + { "crash", 5, cred_admin, command_crash, "Crash the hub (DEBUG)." }, +#endif { 0, 0, cred_none, command_help, "" } };