[DGD] Re: Out of curiosity...
Frank Schmidt
Frank.Schmidt at stud.idb.hist.no
Mon May 25 18:25:29 CEST 1998
Having those functions in the auto-object is excactly what my "MudOS-alike
for DGD"-package does. It is designed to use as few functions, as many
macros for simulating MudOS, and as few variables in the auto object as
possible. The behaviour (ie if you want inventories, actions... etc) is
configurable in a headerfile called config.h.
The package is free and locatable at:
http://colargol.idb.hist.no/~franks/MudOSa4DGD-1.1b.tar.gz
(Shout if you know a good ftp-site it can reside on.)
Now, concerning the security issue with call_other()s in the auto object,
or any "special privileged objects", my solution was:
----------- snip -----------
/* check wether <f> is a DriverLib filename? */
#define IS_DRIVER_SOURCE(f) (strcocmp(_DGD_DIR, (f)))
/* call from a DriverLib program? */
#define DRIVER_PRIV() (IS_DRIVER_SOURCE(previous_program()) && \
previous_function() != "__call_other")
/* call another object failing all DRIVER_PRIV and AUTO_PRIV checks */
static varargs mixed __call_other(mixed var1, mixed var2, mixed args...) {
return ::call_other(var1, var2, args...);
}
----------- snip -----------
Having this, all filter_array(), sort_array(), map_array() and functions
like them can use __call_other(), and won't gain access to privileged
objects/functions. It is a tiny bit overhead when calling with
__call_other() and checking for privilege, but I think it can be
neglected: The check is only made in special "driver objects", and using
array-functions instead of loops is a far better solution I believe. (in
terms of potential optimization, readability, preventing bugs and making
it easier for coders)
Btw, is the auto object precompilable?
And how do you precompile? :-)
Regards,
Frank Schmidt
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list