blob: 26a94e9b8840349c6137a6f9a936001ab170272e [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001CONCEPT
2 uids (userids)
3
4DESCRIPTION
5 Every object in the mud is attributed with a user-id 'uid': a string
6 which associates the object with a certain 'user' (aka 'wizard' or
7 'creator', though it is not limited to that). The uid can be 0, which
8 internally is the default-uid.
9
10 The uid serves a dual purpose: on the on hand it is used to gather
11 statistics about the various groups of objects (in the famous
12 'wizlist'), on the other hand the uid can come in handy in the
13 implementation of security systems.
14
15 The uid of an object is assigned at its creation through the
16 driver hooks H_LOAD_UIDS for loaded objects, and H_CLONE_UIDS
17 for cloned objects, and can't be changed afterwards.
18
19 The uid of an object can be queried with the efun getuid() (resp.
20 creator() in compat-mode).
21
22
23 Every object also has a second string attribute, the 'effective
24 userid' or 'euid', which also may be 0. This value was intended to
25 implement a security system based on difference between theoretical
26 and effective permissions. Since the effectiveness of this system is
27 doubtful, the driver enforces such a use only as an option.
28
29 As uids, euids are assigned at an objects creation through
30 the two aformentioned driverhooks. They can be queried with
Zesstra7ea4a032019-11-26 20:11:40 +010031 the efun geteuid() and changed with the efun configure_object
32 (using the OC_EUID option). Calls to the latter are verified by
33 the master lfun privilege_violation().
MG Mud User88f12472016-06-24 23:31:02 +020034
35
36 If the driver is run in 'strict euids' mode, euids are taken
37 more seriously than being just another attribute:
38 - all objects must have a non-0 uid.
39 - objects with a 0 euid can't load or clone other objects.
40 - the backbone uid as returned by master::get_bb_uid() must
41 not be 0.
42
43
44 Userids are assigned at the time of the creation of an object
45 by calling the driverhooks H_LOAD_UIDS and H_CLONE_UIDS:
46
47 mixed <load_uids closure> (string objectname)
48 mixed <clone_uids closure>(object blueprint, string objectname)
49
50 When an object is newly loaded, the H_LOAD_UIDS hook is
51 called with the object name as argument.
Zesstra7ea4a032019-11-26 20:11:40 +010052
MG Mud User88f12472016-06-24 23:31:02 +020053 When an object is cloned, the H_CLONE_UIDS hook is called
54 with the blueprint object as first and the clone's designated
55 name as second argument.
Zesstra7ea4a032019-11-26 20:11:40 +010056
MG Mud User88f12472016-06-24 23:31:02 +020057 In both cases the new object already exists, but has 0 uids.
58
59 For the result, the following possibilities exist (<num> is
60 a non-zero number, <no-string> is anything but a string):
61
62 "<uid>" -> uid = "<uid>", euid = "<uid>"
63 ({ "<uid>", "<euid>" }) -> uid = "<uid>", euid = "<euid>"
64 ({ "<uid>", <no-string> }) -> uid = "<uid>", euid = 0
65
66 If strict-euids is not active, the following results are
67 possible, too:
68
69 <num> -> uid = 'default', euid = 0
70 ({ <num>, "<euid>" }) -> uid = 'default', euid = "<euid>"
71 ({ <num>, <no-string> }) -> uid = 'default', euid = 0
72
73
MG Mud User88f12472016-06-24 23:31:02 +020074 Slightly different rules apply to the (e)uid of the master.
Zesstra7ea4a032019-11-26 20:11:40 +010075 The master's (e)uid is determined by a call to
MG Mud User88f12472016-06-24 23:31:02 +020076 master->get_master_uid():
77
78 "<uid"> -> uid = "<uid>", euid = "<uid>"
79
80 In non-strict-euids mode, more results are possible:
81
82 0 -> uid = 0, euid = 0
83 <num> -> uid = 'default', euid = 0
84
85 If your uids are in general based on filenames, it is wise to return a
86 value here which can not be legally generated from any filename. OSB
87 for example uses 'ze/us'.
88
89 The masters uid is determined only on startup this way, at runtime the
90 uids of a reloaded master determined as for every object by a call to
91 the appropriate driver hooks.
92
93SEE ALSO
Zesstra7ea4a032019-11-26 20:11:40 +010094 native(C), get_root_uid(M), privilege_violation(M),
95 objects(C), clone_object(E), geteuid(E), getuid(E),
96 configure_object(E)