VALID_SA.C

LIB3/SECURE/MASTER/VALID_SA.C · 1003 B

From the archive nm4dos.zip

Download the archive   « Back to the archive contents

/* /secure/master/valid_save_binaries.c */

int     add_save_binary( string str )
{
    if( high_programmer( geteuid( previous_object() ) ) )
    {
	/* check to see if it's a real file */
	if( read_file( str, 1 ) )
	{
	    save_binaries[ str ] = 1;
	    save_object( "/secure/master" );
	    return 1;
	}
    }
    return 0;
}				/* add_save_binary() */


int     remove_save_binary( string str )
{
    if( high_programmer( geteuid( previous_object() ) ) )
    {
	if( save_binaries[ str ] == 1 )
	{
	    map_delete( save_binaries, str );
	    save_object( "/secure/master" );
	    return 1;
	}
    }
    return 0;
}				/* remove_save_binary() */


int     valid_save_binary( string str )
{
    string  junk;

    if( sscanf( str, "/std/basic/%s", junk ) == 1 )
    {
	return 1;
    }

    if( sscanf( str, "/std/living/%s", junk ) == 1 )
    {
	return 1;
    }

    return save_binaries[ str ] == 1;
}				/* valid_save_binary() */


/* query save binarys */
mapping qsb()
{
    return save_binaries;
}

Site Stats

Snippets: 1791
Codebases: 571