diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:25:05 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 07:25:05 +0000 |
commit | f433d710d0ab3b367cc4a851cdfb81c5405bb7f8 (patch) | |
tree | 5d6a14de43873b9ddaec533051b942cf89c201ce /io.c | |
parent | 55c141c6247a4d8c052c0d57f59ddaa29e3e523a (diff) |
* object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
(rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
test/ruby/test_object.rb, test/ruby/test_string.rb,
test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
Object#untrusted?.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -227,8 +227,8 @@ rb_eof_error(void) VALUE rb_io_taint_check(VALUE io) { - if (!OBJ_TAINTED(io) && rb_safe_level() >= 4) - rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO"); + if (!OBJ_UNTRUSTED(io) && rb_safe_level() >= 4) + rb_raise(rb_eSecurityError, "Insecure: operation on trusted IO"); rb_check_frozen(io); return io; } @@ -2819,7 +2819,7 @@ rb_io_close(VALUE io) static VALUE rb_io_close_m(VALUE io) { - if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) { + if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) { rb_raise(rb_eSecurityError, "Insecure: can't close"); } rb_io_check_closed(RFILE(io)->fptr); @@ -2902,7 +2902,7 @@ rb_io_close_read(VALUE io) rb_io_t *fptr; VALUE write_io; - if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) { + if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) { rb_raise(rb_eSecurityError, "Insecure: can't close"); } GetOpenFile(io, fptr); @@ -2962,7 +2962,7 @@ rb_io_close_write(VALUE io) rb_io_t *fptr; VALUE write_io; - if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) { + if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) { rb_raise(rb_eSecurityError, "Insecure: can't close"); } write_io = GetWriteIO(io); @@ -4430,7 +4430,8 @@ io_reopen(VALUE io, VALUE nfile) off_t pos = 0; nfile = rb_io_get_io(nfile); - if (rb_safe_level() >= 4 && (!OBJ_TAINTED(io) || !OBJ_TAINTED(nfile))) { + if (rb_safe_level() >= 4 && + (!OBJ_UNTRUSTED(io) || !OBJ_UNTRUSTED(nfile))) { rb_raise(rb_eSecurityError, "Insecure: can't reopen"); } GetOpenFile(io, fptr); |