# # CyBex Safe Source Command from #TCL @ QuakeNet - starting 11.Feb.2004 - last update 12.Feb.2004 # any suggestion? write to safe-source-command@cybex.has.nolife.org # this script is under GPL and its free, but if it is not the last stable version # on my site > http://cybex.b0rk.de/files/tcl/myown/stable/ < i dont give you support # or any help # # this script, makes every "source " command safe to protect your eggdrop # and result a full error and fault, but continue. # please make sure, you load it before your other scripts, then everything # after is safe. # and it make safe for wrong die command, change format to: # "die 1 reason" .. you must give 1 and a reason to command, # on other use, comes only warnings in logfiles ## use this forceload only when u make changes on script, never on eggdrop startup !! set forceload 0 if {[info command source_r]=="" || $forceload} { if {!$forceload || [info command source_r]==""} { putcmdlog "rename source for internal use" rename source source_r } #putcmdlog "init new source proc" proc source {{fileName ""}} { if {$fileName==""} { return "Tcl error: wrong # args: should be \"source fileName\"" } if {[file exist $fileName] && [file readable $fileName]} { set ::filename $fileName set num [catch {namespace eval :: {source_r $filename} } msg] unset ::filename if {$num=="0"} { if {$msg!=""} {putlog $msg} } { putlog "ERROR $num: \"$msg\" in $fileName" putlog $::errorInfo } } { return "Tcl error: file $fileName not exist or readable" } } } if {[info command die_r]=="" || $forceload} { if {!$forceload || [info command die_r]==""} { putcmdlog "rename die for internal use" rename die die_r } #putcmdlog "init new die proc" proc die {{sure 0} {text ""}} { if {$sure!="1" || $text==""} { putlog "WARNING: Someone wants kill the bot in wrong format \"die $text\" !" return } die_r $text } }