diff options
author | edp <none@none> | 2006-09-24 18:22:18 -0700 |
---|---|---|
committer | edp <none@none> | 2006-09-24 18:22:18 -0700 |
commit | 2f85acbe87cc794db02b1617c049b5f0950b0cb9 (patch) | |
tree | 9e7016c0534b2d1dce29c586e0ba86bbfc1db560 /usr/src | |
parent | 468f746cc700b507592bdf4849bdcc9d7ada0bd2 (diff) | |
download | illumos-gate-2f85acbe87cc794db02b1617c049b5f0950b0cb9.tar.gz |
6474418 opens of linux pts devices are broken for non-root users
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/ioctl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/ioctl.c b/usr/src/lib/brand/lx/lx_brand/common/ioctl.c index c80bf162ab..b6a6b79ad1 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/ioctl.c +++ b/usr/src/lib/brand/lx/lx_brand/common/ioctl.c @@ -1189,6 +1189,7 @@ static int ict_gptn(int fd, struct stat *stat, int cmd, char *cmd_str, intptr_t arg) { int ptyno, *ptynop = (int *)arg; + pt_own_t pto; assert(cmd == LX_TIOCGPTN); assert(getmajor(stat->st_rdev) == ioc_translator_ptm.idt_major); @@ -1196,6 +1197,18 @@ ict_gptn(int fd, struct stat *stat, int cmd, char *cmd_str, intptr_t arg) /* This operation is only valid for the lx_ptm device. */ ptyno = LX_PTM_DEV_TO_PTS(stat->st_rdev); + /* + * We'd like to just use grantpt() directly, but we can't since + * it assumes the fd node that's passed to it is a ptm node, + * and in our case it's an lx_ptm node. It also relies on + * naming services to get the current process group name. + * Hence we have to invoke the PT_OWNER ioctl directly here. + */ + pto.pto_ruid = getuid(); + pto.pto_rgid = getgid(); + if (ioctl_istr(fd, PT_OWNER, "PT_OWNER", &pto, sizeof (pto)) != 0) + return (-EACCES); + /* Copy out the data. */ if (uucopy(&ptyno, ptynop, sizeof (ptyno)) != 0) return (-errno); |