1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/pty/pty.c (getDevice): add nomesg argument.

(get_device_once): add nomesg argument.  chmod slave tty to 0600
  if nomesg.  more error tests.
  (no_mesg): new function.
  (pty_open): make slave tty's mode 0600.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-12-16 11:39:17 +00:00
parent 3ea21e47c1
commit e27fbfbc98
3 changed files with 90 additions and 80 deletions

View file

@ -99,23 +99,11 @@ class TestPTY < Test::Unit::TestCase
end
def test_stat_slave
# If grantpt is used, the slave device is changed as follows.
# owner: real UID
# group: an unspecified value (e.g. tty)
# mode: 0620 (rw--w----)
#
# The group is not testable because unspecified.
#
# The mode is testable but the condition is relaxed because other
# pty functions (openpty, _getpty, etc.) may not use 0620.
# But no one can read from the tty, I hope (for security reason).
#
PTY.open {|master, slave|
s = File.stat(slave.path)
assert_equal(Process.uid, s.uid)
assert_equal(0600, s.mode & 0755)
assert_equal(0600, s.mode & 0777)
}
end
end if defined? PTY