safe.c File Reference
`#include "ruby/ruby.h"`
`#include "vm_core.h"`

Go to the source code of this file.

## Macros

#define | SAFE_LEVEL_MAX 4

## Functions

int | rb_safe_level (void)
void | rb_set_safe_level_force (int safe)
void | rb_set_safe_level (int level)
static VALUE | safe_getter (void)
static void | safe_setter (VALUE val)
void | rb_secure (int level)
void | rb_secure_update (VALUE obj)
void | rb_insecure_operation (void)
void | rb_check_safe_obj (VALUE x)
void | rb_check_safe_str (VALUE x)
void | Init_safe (void)

## Macro Definition Documentation

#define SAFE_LEVEL_MAX 4

Definition at line 20 of file safe.c.

Referenced by rb_set_safe_level(), and safe_setter().

## Function Documentation

void Init_safe | ( | void |  | ) |

Definition at line 132 of file safe.c.

References rb_define_virtual_variable(), safe_getter(), and safe_setter().

void rb_check_safe_obj | ( | VALUE | x | ) |

Definition at line 113 of file safe.c.

References OBJ_TAINTED, rb_insecure_operation(), rb_safe_level, and rb_secure().

Referenced by constant_arg(), rb_check_safe_str(), and rb_dlcfunc_call().

void rb_check_safe_str | ( | VALUE | x | ) |

Definition at line 122 of file safe.c.

References rb_check_safe_obj(), rb_eTypeError, rb_obj_classname(), rb_raise(), T_STRING, and TYPE.

void rb_insecure_operation | ( | void |  | ) |

Definition at line 101 of file safe.c.

References rb_eSecurityError, rb_frame_callee(), rb_id2name(), and rb_raise().

Referenced by argf_inplace_mode_set(), rb_check_safe_obj(), and rb_get_path_check().

int rb_safe_level | ( | void |  | ) |

Definition at line 28 of file safe.c.

References GET_THREAD.

void rb_secure | ( | int | level | ) |

Definition at line 79 of file safe.c.

References rb_eSecurityError, rb_frame_callee(), rb_id2name(), rb_raise(), and rb_safe_level.

Referenced by apply2files(), bsock_do_not_rev_lookup_set(), bsock_do_not_reverse_lookup_set(), bsock_setsockopt(), check_dirname(), check_gid_switch(), check_uid_switch(), create_dummy_encoding_for_tk_core(), create_encoding_table_core(), curses_init_screen(), dir_s_chdir(), dlhandle_sym(), env_assoc(), env_delete(), env_each_pair(), env_empty_p(), env_fetch(), env_has_key(), env_has_value(), env_inspect(), env_key(), env_keys(), env_rassoc(), env_select(), env_shift(), env_size(), env_to_a(), env_to_hash(), env_update(), env_values(), env_values_at(), etc_getgrgid(), etc_getgrnam(), etc_getlogin(), etc_getpwuid(), etc_group(), etc_passwd(), ev_advise(), fdbm_modify(), fev_off_event(), fole_free(), fole_initialize(), fole_respond_to(), fole_s_connect(), fole_s_const_load(), gc_stress_set(), get_pid(), get_ppid(), hist_delete_at(), hist_each(), hist_empty_p(), hist_get(), hist_length(), hist_pop(), hist_push(), hist_push_method(), hist_shift(), id2ref(), io_write(), ip_allow_ruby_exit_set(), ip_create_slave(), ip_evloop_abort_on_exc_set(), ip_invoke_immediate(), ip_restart(), iseq_eval(), iseq_s_compile(), iseq_s_compile_file(), iseq_s_compile_option_set(), iseq_s_disasm(), iseq_to_a(), lib_evloop_abort_on_exc_set(), lib_restart(), mSyslog_close(), mSyslog_set_mask(), ole_types_from_typelib(), os_each_obj(), proc_detach(), proc_wait(), proc_waitall(), rb_alias(), rb_check_safe_obj(), rb_define_const(), rb_dir_getwd(), rb_dl_free(), rb_dl_malloc(), rb_dl_ptr2value(), rb_dl_realloc(), rb_dlcfunc_new(), rb_dlhandle_initialize(), rb_dlptr_malloc(), rb_dlptr_new2(), rb_dlptr_s_allocate(), rb_exec_arg_addopt(), rb_export_method(), rb_f_abort(), rb_f_exit(), rb_f_exit_bang(), rb_f_getenv(), rb_f_kill(), rb_f_srand(), rb_f_trace_var(), rb_f_untrace_var(), rb_file_chmod(), rb_file_chown(), rb_file_executable_p(), rb_file_executable_real_p(), rb_file_flock(), rb_file_identical_p(), rb_file_lstat(), rb_file_readable_p(), rb_file_readable_real_p(), rb_file_s_chmod(), rb_file_s_chown(), rb_file_s_ftype(), rb_file_s_lstat(), rb_file_s_rename(), rb_file_s_stat(), rb_file_s_umask(), rb_file_s_unlink(), rb_file_s_utime(), rb_file_symlink_p(), rb_file_writable_p(), rb_file_writable_real_p(), rb_gdbm_modify(), rb_include_module(), rb_io_autoclose_p(), rb_io_ctl(), rb_io_initialize(), rb_io_reopen(), rb_io_set_autoclose(), rb_io_syswrite(), rb_io_write_nonblock(), rb_iseq_disasm(), rb_load_internal(), rb_obj_taint(), rb_obj_trust(), rb_obj_untaint(), rb_obj_untrust(), rb_realpath_internal(), rb_remove_history(), rb_secure_update(), rb_stat(), rb_stat_init(), rb_thread_abort_exc_set(), rb_thread_kill(), rb_thread_priority_set(), rb_thread_s_abort_exc_set(), rb_undef(), readline_readline(), readline_s_get_completion_case_fold(), readline_s_get_completion_proc(), readline_s_set_completion_case_fold(), readline_s_set_completion_proc(), readline_s_set_input(), readline_s_set_output(), remove_method(), rsock_bsock_send(), rsock_s_accept(), rsock_s_accept_nonblock(), rsock_sock_listen(), set_eventloop_tick(), set_eventloop_weight(), set_eventloop_window_mode(), set_no_event_wait(), sig_trap(), sock_initialize(), sock_s_gethostbyname(), syslog_write(), tcp_s_gethostbyname(), test_check(), thgroup_add(), top_include(), udp_bind(), udp_connect(), udp_init(), udp_send(), window_initialize(), and writable().

void rb_secure_update | ( | VALUE | obj | ) |

Definition at line 94 of file safe.c.

References OBJ_TAINTED, and rb_secure().

Referenced by rb_dlcfunc_call().

void rb_set_safe_level | ( | int | level | ) |

Definition at line 40 of file safe.c.

References GET_THREAD, rb_thread_struct::safe_level, and SAFE_LEVEL_MAX.

Referenced by callq_safelevel_handler(), evq_safelevel_handler(), ivq_safelevel_handler(), and process_options().

void rb_set_safe_level_force | ( | int | safe | ) |

Definition at line 34 of file safe.c.

References GET_THREAD.

Referenced by autoload_node(), rb_eval_cmd(), rb_exec_end_proc(), rb_method_call(), rb_require_safe(), and reset_safe().

static VALUE safe_getter | ( | void |  | ) |

static

Definition at line 53 of file safe.c.

References INT2NUM(), and rb_safe_level.

Referenced by Init_safe().

static void safe_setter | ( | VALUE | val | ) |

static

Definition at line 59 of file safe.c.

References GET_THREAD, NUM2INT, rb_eSecurityError, rb_raise(), rb_warning(), rb_thread_struct::safe_level, and SAFE_LEVEL_MAX.

Referenced by Init_safe().