From 92cad90b9abe9801df5a734189669ad38c8f35ca Mon Sep 17 00:00:00 2001 From: nveid Date: Tue, 10 Apr 2007 06:33:38 +0000 Subject: [PATCH] Safer ufun support removed and do_reboot moved to bsd.c to allow better console compiling. (cherry picked from commit 8dd0b033e241a227ad6cf5e2e2c97ebee88119a0) --- game/txt/changes/0.73 | 4 +++ hdrs/conf.h | 2 -- hdrs/dbdefs.h | 2 +- src/bsd.c | 61 ++++++++++++++++++++++++++++++++++++++++++- src/conf.c | 3 --- src/wiz.c | 59 ----------------------------------------- 6 files changed, 65 insertions(+), 66 deletions(-) diff --git a/game/txt/changes/0.73 b/game/txt/changes/0.73 index fb6b6d9..240aacf 100644 --- a/game/txt/changes/0.73 +++ b/game/txt/changes/0.73 @@ -10,6 +10,10 @@ CobraMUSH Version 0.73 controlling ability over the object the function is on. [RLB] * Slight formatting fix for privileged WHO [AEJ] * netmud and console are now built from the same source [AEJ] + * do_reboot moved to bsd.c to allow netmud/console compiling to + happen more smoothly. [RLB] + * safer_ufun config option support removed. Behavior is to now act + as if safer_ufun is always on. [RLB] Flags: * LEAVE_BEHIND - When a player leaves the location of someone they're flowing with this flag it unfollows diff --git a/hdrs/conf.h b/hdrs/conf.h index 24b3299..f9c5141 100644 --- a/hdrs/conf.h +++ b/hdrs/conf.h @@ -191,7 +191,6 @@ struct options_table { dbref base_room; /**< Room which floating checks consider as the base */ dbref default_home; /**< Home for the homeless */ int use_dns; /**< Should we use DNS lookups? */ - int safer_ufun; /**< Should we require security for ufun calls? */ char dump_warning_1min[256]; /**< 1 minute nonforking dump warning message */ char dump_warning_5min[256]; /**< 5 minute nonforking dump warning message */ int noisy_whisper; /**< Does whisper default to whisper/noisy? */ @@ -407,7 +406,6 @@ int cf_time(const char *opt, const char *val, void *loc, int maxval, #define NO_FORK (!options.forking_dump) #define PLAYER_NAME_SPACES (options.player_name_spaces) #define MAX_ALIASES (options.max_aliases) -#define SAFER_UFUN (options.safer_ufun) #define NOISY_WHISPER (options.noisy_whisper) #define POSSESSIVE_GET (options.possessive_get) #define POSSGET_ON_DISCONNECTED (options.possessive_get_d) diff --git a/hdrs/dbdefs.h b/hdrs/dbdefs.h index 20b1763..c643456 100644 --- a/hdrs/dbdefs.h +++ b/hdrs/dbdefs.h @@ -214,7 +214,7 @@ extern dbref first_free; /* pointer to free list */ /* This is carefully ordered, from most to least likely. Hopefully. */ -#define CanEval(x,y) (!(SAFER_UFUN) || !Admin(y) || God(x) || \ +#define CanEval(x,y) (!Admin(y) || God(x) || \ ((Director(x) || (Admin(x) && !Director(y))) && !God(y))) /* AF_PUBLIC overrides SAFER_UFUN */ diff --git a/src/bsd.c b/src/bsd.c index 1a50010..bf47b96 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -183,7 +183,7 @@ static CLIENT_DEFAULTS client_maps[] = { {"TINYFUGUE", CONN_PROMPT}, {NULL, -1} }; -#endif +#endif /* COMPILE_CONSOLE */ /** Is this descriptor connected to a telnet-compatible terminal? */ @@ -5672,3 +5672,62 @@ static int do_su_exit(DESC *d) { return 1; } else return 0; } + +/* this should be in wiz.c but console.c likes it here better */ + +/** Reboot the game without disconnecting players. + * \verbatim + * This implements @shutdown/reboot, which performs a dump, saves + * information about which player is associated with which socket, + * and then re-execs the mush process without closing the sockets. + * \endverbatim + * \param player the enactor. + * \param flag if 0, normal dump; if 1, paranoid dump. + */ +void +do_reboot(dbref player, int flag) +{ + if (player == NOTHING) { + flag_broadcast(0, 0, + T + ("GAME: Reboot w/o disconnect from game account, please wait.")); + } else { + flag_broadcast(0, 0, + T + ("GAME: Reboot w/o disconnect by %s, please wait."), + Name(Owner(player))); + } + if (flag) { + globals.paranoid_dump = 1; + globals.paranoid_checkpt = db_top / 5; + if (globals.paranoid_checkpt < 1) + globals.paranoid_checkpt = 1; + } +#ifdef HAS_OPENSSL + close_ssl_connections(); +#endif + sql_shutdown(); + shutdown_queues(); + fork_and_dump(0); +#ifndef PROFILING +#ifndef WIN32 + /* Some broken libcs appear to retain the itimer across exec! + * So we make sure that if we get a SIGPROF in our next incarnation, + * we ignore it until our proper handler is set up. + */ + ignore_signal(SIGPROF); +#endif +#endif + dump_reboot_db(); +#if !defined(COMPILE_CONSOLE) && defined(INFO_SLAVE) + kill_info_slave(); +#endif + local_shutdown(); + end_all_logs(); +#ifndef WIN32 + execl("netmush", "netmush", confname, NULL); +#else + execl("cobramush.exe", "cobramush.exe", "/run", NULL); +#endif /* WIN32 */ + exit(1); /* Shouldn't ever get here, but just in case... */ +} diff --git a/src/conf.c b/src/conf.c index be216e1..9fd6626 100644 --- a/src/conf.c +++ b/src/conf.c @@ -392,8 +392,6 @@ COBRA_CONF conftable[] = { "flags"} , - {"safer_ufun", cf_bool, &options.safer_ufun, 2, 0, "funcs"} - , {"function_side_effects", cf_bool, &options.function_side_effects, 2, 0, "funcs"} , @@ -1133,7 +1131,6 @@ conf_default_set(void) strcpy(options.channel_flags, ""); options.warn_interval = 3600; options.use_dns = 1; - options.safer_ufun = 1; strcpy(options.dump_warning_1min, T("GAME: Database will be dumped in 1 minute.")); strcpy(options.dump_warning_5min, diff --git a/src/wiz.c b/src/wiz.c index 766957d..2b28957 100644 --- a/src/wiz.c +++ b/src/wiz.c @@ -1720,65 +1720,6 @@ FUNCTION(fun_playermem) safe_integer(tot, buff, bp); } - -/** Reboot the game without disconnecting players. - * \verbatim - * This implements @shutdown/reboot, which performs a dump, saves - * information about which player is associated with which socket, - * and then re-execs the mush process without closing the sockets. - * \endverbatim - * \param player the enactor. - * \param flag if 0, normal dump; if 1, paranoid dump. - */ -void -do_reboot(dbref player, int flag) -{ - if (player == NOTHING) { - flag_broadcast(0, 0, - T - ("GAME: Reboot w/o disconnect from game account, please wait.")); - } else { - flag_broadcast(0, 0, - T - ("GAME: Reboot w/o disconnect by %s, please wait."), - Name(Owner(player))); - } - if (flag) { - globals.paranoid_dump = 1; - globals.paranoid_checkpt = db_top / 5; - if (globals.paranoid_checkpt < 1) - globals.paranoid_checkpt = 1; - } -#ifdef HAS_OPENSSL - close_ssl_connections(); -#endif - sql_shutdown(); - shutdown_queues(); - fork_and_dump(0); -#ifndef PROFILING -#ifndef WIN32 - /* Some broken libcs appear to retain the itimer across exec! - * So we make sure that if we get a SIGPROF in our next incarnation, - * we ignore it until our proper handler is set up. - */ - ignore_signal(SIGPROF); -#endif -#endif - dump_reboot_db(); -#ifdef INFO_SLAVE - kill_info_slave(); -#endif - local_shutdown(); - end_all_logs(); -#ifndef WIN32 - execl("netmush", "netmush", confname, NULL); -#else - execl("cobramush.exe", "cobramush.exe", "/run", NULL); -#endif /* WIN32 */ - exit(1); /* Shouldn't ever get here, but just in case... */ -} - - static int fill_search_spec(dbref player, const char *owner, int nargs, const char **args, struct search_spec *spec) -- 2.30.2