tmi2_fluffos_v2/
tmi2_fluffos_v2/bin/
tmi2_fluffos_v2/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/ChangeLog.old/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/Win32/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/simuls/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/clone/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/command/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/data/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/master/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/log/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/compiler/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/efuns/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/operators/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/u/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/tmp/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/windows/
tmi2_fluffos_v2/lib/
tmi2_fluffos_v2/lib/adm/
tmi2_fluffos_v2/lib/adm/daemons/languages/
tmi2_fluffos_v2/lib/adm/daemons/network/I3/
tmi2_fluffos_v2/lib/adm/daemons/virtual/
tmi2_fluffos_v2/lib/adm/daemons/virtual/template/
tmi2_fluffos_v2/lib/adm/news/
tmi2_fluffos_v2/lib/adm/obj/
tmi2_fluffos_v2/lib/adm/obj/master/
tmi2_fluffos_v2/lib/adm/priv/
tmi2_fluffos_v2/lib/adm/shell/
tmi2_fluffos_v2/lib/adm/tmp/
tmi2_fluffos_v2/lib/cmds/
tmi2_fluffos_v2/lib/d/
tmi2_fluffos_v2/lib/d/Conf/
tmi2_fluffos_v2/lib/d/Conf/adm/
tmi2_fluffos_v2/lib/d/Conf/boards/
tmi2_fluffos_v2/lib/d/Conf/cmds/
tmi2_fluffos_v2/lib/d/Conf/data/
tmi2_fluffos_v2/lib/d/Conf/logs/
tmi2_fluffos_v2/lib/d/Conf/obj/
tmi2_fluffos_v2/lib/d/Conf/text/help/
tmi2_fluffos_v2/lib/d/Fooland/adm/
tmi2_fluffos_v2/lib/d/Fooland/data/
tmi2_fluffos_v2/lib/d/Fooland/data/attic/
tmi2_fluffos_v2/lib/d/Fooland/items/
tmi2_fluffos_v2/lib/d/TMI/
tmi2_fluffos_v2/lib/d/TMI/adm/
tmi2_fluffos_v2/lib/d/TMI/boards/
tmi2_fluffos_v2/lib/d/TMI/data/
tmi2_fluffos_v2/lib/d/TMI/rooms/
tmi2_fluffos_v2/lib/d/grid/
tmi2_fluffos_v2/lib/d/grid/adm/
tmi2_fluffos_v2/lib/d/grid/data/
tmi2_fluffos_v2/lib/d/std/
tmi2_fluffos_v2/lib/d/std/adm/
tmi2_fluffos_v2/lib/data/adm/
tmi2_fluffos_v2/lib/data/adm/daemons/
tmi2_fluffos_v2/lib/data/adm/daemons/doc_d/
tmi2_fluffos_v2/lib/data/adm/daemons/emoted/
tmi2_fluffos_v2/lib/data/adm/daemons/network/http/
tmi2_fluffos_v2/lib/data/adm/daemons/network/services/mail_q/
tmi2_fluffos_v2/lib/data/adm/daemons/network/smtp/
tmi2_fluffos_v2/lib/data/adm/daemons/news/archives/
tmi2_fluffos_v2/lib/data/attic/connection/
tmi2_fluffos_v2/lib/data/attic/user/
tmi2_fluffos_v2/lib/data/std/connection/b/
tmi2_fluffos_v2/lib/data/std/connection/l/
tmi2_fluffos_v2/lib/data/std/user/a/
tmi2_fluffos_v2/lib/data/std/user/b/
tmi2_fluffos_v2/lib/data/std/user/d/
tmi2_fluffos_v2/lib/data/std/user/f/
tmi2_fluffos_v2/lib/data/std/user/l/
tmi2_fluffos_v2/lib/data/std/user/x/
tmi2_fluffos_v2/lib/data/u/d/dm/working/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/smtp/
tmi2_fluffos_v2/lib/doc/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/interactive/
tmi2_fluffos_v2/lib/doc/driverdoc/concepts/
tmi2_fluffos_v2/lib/doc/driverdoc/driver/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/arrays/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/buffers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/compile/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/ed/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/filesystem/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/floats/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/functions/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/general/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/mappings/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/numbers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/parsing/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/constructs/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/preprocessor/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/types/
tmi2_fluffos_v2/lib/doc/driverdoc/platforms/
tmi2_fluffos_v2/lib/doc/mudlib/
tmi2_fluffos_v2/lib/ftp/
tmi2_fluffos_v2/lib/include/driver/
tmi2_fluffos_v2/lib/log/
tmi2_fluffos_v2/lib/log/driver/
tmi2_fluffos_v2/lib/obj/net/
tmi2_fluffos_v2/lib/obj/shells/
tmi2_fluffos_v2/lib/obj/tools/
tmi2_fluffos_v2/lib/std/adt/
tmi2_fluffos_v2/lib/std/board/
tmi2_fluffos_v2/lib/std/body/
tmi2_fluffos_v2/lib/std/fun/
tmi2_fluffos_v2/lib/std/living/
tmi2_fluffos_v2/lib/std/object/
tmi2_fluffos_v2/lib/std/shop/
tmi2_fluffos_v2/lib/std/socket/
tmi2_fluffos_v2/lib/std/user/
tmi2_fluffos_v2/lib/std/virtual/
tmi2_fluffos_v2/lib/student/
tmi2_fluffos_v2/lib/student/kalypso/
tmi2_fluffos_v2/lib/student/kalypso/armor/
tmi2_fluffos_v2/lib/student/kalypso/rooms/
tmi2_fluffos_v2/lib/student/kalypso/weapons/
tmi2_fluffos_v2/lib/u/l/leto/
tmi2_fluffos_v2/lib/u/l/leto/cmds/
tmi2_fluffos_v2/lib/www/errors/
tmi2_fluffos_v2/lib/www/gateways/
tmi2_fluffos_v2/lib/www/images/
tmi2_fluffos_v2/old/
tmi2_fluffos_v2/win32/
// This file is part of the TMI mudlib distribution.
// Please include this header if you use this code.
// Written by Buddha@TMI, modularized and revised (92-05-01)
// Expanded to use a superior security system by Buddha (92-05-31)
// Temporary flag attribute system added by Watcher (93-02-21)
// Prop_logic written by Pallando (93-03-20)
// Calls to delete_access() added by Pallando (94-03-26)
// NB - This file does not make use of the full potential of prop_logic yet.

#ifdef SECURE
#include <priv.h>
#include <driver/origin.h>
inherit "std/priv";
#endif /* SECURE */

mapping ob_data; // obscure name so it won't break code
static mapping tmp_ob_data; //	Temporary flag attrib mapping

#include <uid.h>
#include "/std/object/prop_logic.c"

// A basic init function.

void init_ob() {
        if( !ob_data ) ob_data = ([]);
        if( !tmp_ob_data ) tmp_ob_data = ([]);
}

//  A query of the data sets ... for admins and root access only.

mapping query_ob_data() { 
   if(!adminp(geteuid(previous_object())) &&
       geteuid(previous_object()) != ROOT_UID)  return 0;
#ifdef SECURE
  return copy(ob_data);
#else
  return ob_data;
#endif
}

mapping query_temp_ob_data() {
   if(!adminp(geteuid(previous_object())) &&
      geteuid(previous_object()) != ROOT_UID)  return 0;
#ifdef SECURE
  return copy(tmp_ob_data);
#else
   return tmp_ob_data;
#endif
}


// The generic set(label, value) function.
// You can specify elements deeper in the tree by passing a chain of elements
// separated by slashes...  thus, use could be:
// set("short", "a generic object");
// set("limb/left leg/hp", 63);

nomask varargs int set( string label, mixed value, int access_level ) {
        if( !ob_data ) init_ob();
        if( !label ) return 0;
     while( label[0] == '/' && strlen(label) > 1 )
	label = label[1..<1];
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return 0;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_write(label, previous_object()))
            return 0;
#endif
#endif /* SECURE */
        _set( ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}), value );
#ifdef SECURE
        if( access_level ) set_access( label, access_level );
#endif /* SECURE */
        return 1;
}

varargs int set_temp( string label, mixed value, int access_level ) {
        if( !tmp_ob_data ) init_ob();
        if( !label ) return 0;
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return 0;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_write(label, previous_object()))
            return 0;
#endif
#endif /* SECURE */
        _set( tmp_ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}), value );
#ifdef SECURE
        if( access_level ) set_access( label, access_level );
#endif /* SECURE */
        return 1;
}





varargs void delete( string label ) {
        if( !ob_data ) init_ob();
        if( !label ) return 0;
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_write(label, previous_object()))
            return;
#endif
	delete_access( label );
#endif /* SECURE */
        _delete( ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}) );
}

varargs void delete_temp( string label ) {
        if( !label ) return 0;
        if( !tmp_ob_data ) init_ob();
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
            !valid_write(label, previous_object()))
            return;
#endif
	delete_access( label );
#endif /* SECURE */
        _delete( tmp_ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}) );
}





// This is for querying data.
// If you wish to make certain parts of the structure private,
// then redefine this, and use check for the private section, before
// returning ::query().

nomask mixed query( string label ) {
        mixed value;
        string func, arg;

        if( !ob_data ) init_ob();
        if( !label ) return 0;
#ifdef SECURE
#if 0
        if( !valid_read( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_read(label, previous_object()))
            return;
#endif
#endif /* SECURE */
        value = _query( ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}) );
#ifdef SECURE
        value = copy( value );
#endif /* SECURE */
        if( stringp( value ) && sscanf( value, "@@%s", func ) ) {
// Mobydick added the next line as a security patch on 5-24-94. It means,
// basically, you can't call_other except to functions beginning "query_".
		if (func[0..5]!="query_") return 0 ;
                if( sscanf( func, "%s:%s", func, arg ) )
                        return call_other( this_object(), func, arg );
                else
                        return call_other( this_object(), func );
        }
        return value;
}

nomask mixed query_temp( string label ) {
        mixed value;
        string func, arg;
        
        if( !tmp_ob_data ) init_ob();
        if( !label ) return 0;
#ifdef SECURE
#if 0
        if( !valid_read( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_read(label, previous_object()))
            return;
#endif
#endif /* SECURE */
        value = _query( tmp_ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}) );
#ifdef SECURE
        value = copy( value );
#endif /* SECURE */
        if( stringp( value ) && sscanf( value, "@@%s", func ) ) {
                if( sscanf( func, "%s:%s", func, arg ) )
                        return call_other( this_object(), func, arg );
                else
                        return call_other( this_object(), func );
        }
        return value;
}




// This one is just for adding to arrays and mappings..
// (though actually it will work for integers, strings, etc)
// This needs to be more thoroughly tested but it seems to work.
// to call it, use the "level1/level2/level3" format of the other functions.

void add( string label, mixed arg ) {
        mixed foo;
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_write(label, previous_object()))
            return;
#endif
#endif /* SECURE */
        foo = query( label );
        if( !foo ) set( label, arg );
        else set( label, foo + arg );
        return;
}

void add_temp( string label, mixed arg ) {
        mixed foo;
#ifdef SECURE
#if 0
        if( !valid_write( label, previous_object() ) ) return;
#else
        if (origin() != ORIGIN_LOCAL &&
              !valid_write(label, previous_object()))
            return;
#endif
#endif /* SECURE */
        foo = query_temp( label );
        if( !foo ) set_temp( label, arg );
        else set_temp( label, foo + arg );
        return;
}

/* EOF */