Skip to content

Commit

Permalink
feat: secure objects moved from /lib/core to /lib/core/secure (cannot…
Browse files Browse the repository at this point in the history
… be updated)
  • Loading branch information
neverbot committed Sep 2, 2024
1 parent 67a2b76 commit a84b480
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 33 deletions.
1 change: 1 addition & 0 deletions mudlib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
!/save/ventures/ventures.o
/save/issues/issues.o
/save/games/*
!/save/secure/secure.o

# tmp files
/tmp/*
Expand Down
12 changes: 6 additions & 6 deletions mudlib/include/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#define DRIVER "/lib/core/driver"
#define AUTO "/lib/core/auto"

#define MUDOS_PATH "/lib/core/mudos"
#define MUDOS "/lib/core/mudos"
#define MUDOS_PATH "/lib/core/secure/mudos"
#define MUDOS "/lib/core/secure/mudos"
#define FILTERS "/lib/core/filters"
// #define MUDOS find_object(DRIVER)->mudos()

Expand All @@ -17,10 +17,10 @@
#define DRIVER_LONG_LOGS

#define ERROR_HANDLER "/lib/core/errors"
#define USER_HANDLER "/lib/core/users"
#define OBJECT_HANDLER "/lib/core/objects"
#define SINGLETON_HANDLER "/lib/core/singletons"
#define BINARY_HANDLER "/lib/core/binaries"
#define USER_HANDLER "/lib/core/secure/users"
#define OBJECT_HANDLER "/lib/core/secure/objects"
#define SINGLETON_HANDLER "/lib/core/secure/singletons"
#define BINARY_HANDLER "/lib/core/secure/binaries"

// driver messages
#define DRIVER_RUNTIME_ERROR 0
Expand Down
2 changes: 1 addition & 1 deletion mudlib/include/living/living.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


#define LIVING_HANDLER "/lib/core/livings"
#define LIVING_HANDLER "/lib/core/secure/livings"
#define RANKING_OB "/obj/handlers/ranking"
4 changes: 2 additions & 2 deletions mudlib/include/mud/secure.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// Objects
// old /secure/master
#define MASTER "/lib/core/secure"
#define SECURE_OB "/lib/core/secure"
#define DEBUGGER_OB "/lib/core/debugger"
#define SECURE_OB "/lib/core/secure/secure"
#define DEBUGGER_OB "/lib/core/secure/debugger"
#define SECURE_SAVE_PATH "/save/secure/secure.o"
// old /secure/ftp_access
#define FTPACC "/lib/net/ftp_access"
Expand Down
7 changes: 5 additions & 2 deletions mudlib/lib/core/efuns/move.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include <kernel.h>
#include <basic/move.h>
#include <areas/common.h>

Expand Down Expand Up @@ -203,8 +204,10 @@ static nomask int destruct(varargs object ob)
for (i = 0; i < sizeof(shadows); i++)
destruct(shadows[i]);

if ((strlen(ob_name) >= 10) && (ob_name[0..9] == "/lib/core/"))
{
if ((strlen(ob_name) >= 10) && (strlen(ob_name) >= 17) &&
(ob_name[0..16] == "/lib/core/secure/") &&
(previous_object(1) != find_object(DRIVER)))
{
stderr(" *** destruct: <" + ob_name + "> error, core objects refuse to be destroyed\n");
return 0;
}
Expand Down
15 changes: 8 additions & 7 deletions mudlib/lib/core/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// locked out domain masters at Baldrick's request ... Raskolnikov 96
// Converted to game object for Hexagon, neverbot 12/2020

#include <mud/secure.h>
#include <language.h>

// game description
Expand Down Expand Up @@ -76,7 +77,7 @@ void create()
// games closed by default
open = false;

seteuid("/lib/core/secure"->creator_file(file_name(this_object())));
seteuid(SECURE_OB->creator_file(file_name(this_object())));
restore_object(file_name(this_object()), 1);

if (pointerp(members))
Expand All @@ -102,18 +103,18 @@ void dest_me() { destruct(this_object()); }

void save_me()
{
seteuid("/lib/core/secure"->get_root_uid());
seteuid(SECURE_OB->get_root_uid());
save_object(file_name(this_object()), 1);
seteuid("/lib/core/secure"->creator_file(file_name(this_object())));
seteuid(SECURE_OB->creator_file(file_name(this_object())));
}

// Hamlet added arg here...
int query_dom_manip(varargs string euid)
{
if (!euid) euid = geteuid(this_player(1));
if ((euid == query_game_coordinator()) ||
("/lib/core/secure"->query_admin(euid) &&
"/lib/core/secure"->high_programmer(geteuid(this_player()))))
(SECURE_OB->query_admin(euid) &&
SECURE_OB->high_programmer(geteuid(this_player()))))
return 1;
if (lower_case(euid) == game_name) return 1;
return 0;
Expand Down Expand Up @@ -176,8 +177,8 @@ int valid_write(string *path, string euid, string funct)
/* lock out domain masters unless its a high programmer
* Raskolnikov Nov 96
*/
if ("/lib/core/secure"->query_admin(euid) &&
"/lib/core/secure"->high_programmer(geteuid(this_player())))
if (SECURE_OB->query_admin(euid) &&
SECURE_OB->high_programmer(geteuid(this_player())))
return 1;
switch(path[2])
{
Expand Down
12 changes: 6 additions & 6 deletions mudlib/lib/core/secure/bastards.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void create()
access = ([ ]);
suspended = ([ ]);
banished = ([ ]);
restore_object(file_name(this_object()), 1);
restore_object(SECURE_SAVE_PATH, 1);
preferred = ({ });
} /* create() */

Expand Down Expand Up @@ -262,7 +262,7 @@ int change_access(string *address, string ident, int level, string reason)
access = add_access(access, address, ident, level);
if (!access)
access = ([ ]);
save_object(file_name(this_object()),1);
save_object(SECURE_SAVE_PATH, 1);
switch (level) {
case NO_NEW :
reason = "no new for "+reason;
Expand Down Expand Up @@ -290,7 +290,7 @@ int suspend_person(string str, int tim)
if (file_size("/save/players/"+str[0..0]+"/"+str+".o") < 0)
return 0;
suspended[str] = time()+tim;
save_object(file_name(this_object()),1);
save_object(SECURE_SAVE_PATH, 1);
write_file("/log/SUSPEND", str+" suspended until "+ctime(time()+tim)+
" by "+this_player()->query_name()+".\n");
return 1;
Expand All @@ -301,7 +301,7 @@ int unsuspend_person(string str)
if (!SECURE->query_admin(geteuid(previous_object())))
return 0;
suspended = m_delete(suspended, str);
save_object(file_name(this_object()),1);
save_object(SECURE_SAVE_PATH, 1);
// Radix...
write_file("/log/SUSPEND", str+" unsuspended by "+
this_player()->query_name()+".\n");
Expand All @@ -321,7 +321,7 @@ int banish_playername(string str, string reason)
return 0;
*/
banished[str] = reason;
save_object(file_name(this_object()),1);
save_object(SECURE_SAVE_PATH, 1);
write_file("/log/BANISHED", str+" banished because of " + reason +
" by "+this_player()->query_name()+".\n");
return 1;
Expand All @@ -332,7 +332,7 @@ int unbanish_playername(string str)
if (!SECURE->query_admin(geteuid(previous_object())))
return 0;
banished = m_delete(banished, str);
save_object(file_name(this_object()),1);
save_object(SECURE_SAVE_PATH, 1);
write_file("/log/BANISHED", str+" unbanished.\n");
return 1;
} /* unbanish playername */
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void create()
{
// anti-cloning
// this file will be inherited by mudos.c
if (file_name(this_object()) != "/lib/core/mudos")
if (file_name(this_object()) != "/lib/core/secure/mudos")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static mapping _livings;
void create()
{
// anti-cloning
if (file_name(this_object()) != "/lib/core/livings")
if (file_name(this_object()) != "/lib/core/secure/livings")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
4 changes: 2 additions & 2 deletions mudlib/lib/core/mudos.c → mudlib/lib/core/secure/mudos.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <mud/mudos.h>
#include <mud/config.h>

inherit hb "/lib/core/heart_beats";
inherit hb "/lib/core/secure/heart_beats";

// current execution context
private static object initiator_user, initiator_player, initiator_object;
Expand All @@ -21,7 +21,7 @@ private static mixed ** call_outs;
void create()
{
// anti-cloning
if (file_name(this_object()) != "/lib/core/mudos")
if (file_name(this_object()) != "/lib/core/secure/mudos")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
void create()
{
// anti-cloning
if (file_name(this_object()) != "/lib/core/objects")
if (file_name(this_object()) != "/lib/core/secure/objects")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ void create()

#include "/lib/core/secure/preload.c"


int query_admin(string str)
{
return ((positions[str] == POS_ADMIN) || (is_administrator(str)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static mapping _handlers;
void create()
{
// anti-cloning
if (file_name(this_object()) != "/lib/core/singletons")
if (file_name(this_object()) != "/lib/core/secure/singletons")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
2 changes: 1 addition & 1 deletion mudlib/lib/core/users.c → mudlib/lib/core/secure/users.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static mapping _players;
void create()
{
// anti-cloning
if (file_name(this_object()) != "/lib/core/users")
if (file_name(this_object()) != "/lib/core/secure/users")
{
write("This object cannot be cloned.\n");
destruct(this_object());
Expand Down
2 changes: 1 addition & 1 deletion mudlib/lib/user/roles/.lang.es.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define _LANG_CODER_OBJECT_DO_NOT_UPDATE "¡Tu NO updateas eso! " + \
"(no se pueden updatear objetos interactive()).\n"
#define _LANG_CODER_OBJECT_DO_NOT_UPDATE_CORE "¡Tu NO updateas eso! " + \
"(no se pueden updatear objetos core.\n"
"(no se pueden updatear objetos core).\n"
#define _LANG_CODER_OBJECT_NAME_BROKEN "Ups. Tu "+itemname+" acaba de romperse.\n"
#define _LANG_CODER_OBJECT_BROKEN "Ups. Algo que tenías acaba de romperse.\n"
#define _LANG_CODER_OBJECT_UPDATED "Actualizado: "
Expand Down

0 comments on commit a84b480

Please sign in to comment.