illegal.c~

MudOSa4DGD/mudlib/dgd/sfun/illegal.c~ · 1.1 KB

From the archive MudOSa4DGD-30.06.98.tar.gz

Download the archive   « Back to the archive contents

/*
 * illegal.c
 *
 * SFUN: Illegal operation encountered (security)
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */

#include <objects.h>


/* handle illegal operation */
static varargs void illegal(string msg) {
  if (1) {
    /* security check passed */
    object ob;
    string extra;

    ob=previous_object();
    if (!msg) {
      /* default illegal message */
      msg = "Illegal "+previous_function()+" in "+
        file_name()+".";
    }
    else
      msg += "  ("+previous_function()+" in "+
        file_name()+")";

    /* about source */
    extra = "\n   ";
    extra += ob ? "Called by: "+file_name(ob) : "";
    extra += ", "+previous_function(1)+"()";
#ifdef MUDOS_USER_ID
    extra += " (uid/euid: "+
      getuid(ob)+"/"+geteuid(ob)+")";
    extra += this_player1() ? 
	    "\n   TP1="+geteuid(this_player1()) :
	      "";
#endif

    /* log to file <message> (uid/euid: xxxx/yyyy TP: Zzzz) */
    log_file("ILLEGAL", "\n-->"+msg+extra+"\n");

#ifdef INFORM_DRIVER
    /* report this */
    DRIVER->notify(msg+extra);
#endif

#if 0
    /* finally handle as a catched error */
    catch(error(msg));
#endif
  }
  return;
}

Site Stats

Snippets: 1791
Codebases: 571