]> granicus.if.org Git - sudo/commitdiff
Use O_NOCTTY when opening a tty.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 16 May 2016 17:00:31 +0000 (11:00 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 16 May 2016 17:00:31 +0000 (11:00 -0600)
src/selinux.c

index f0b9fbc02a7a9feb74a8779aaed4f71afaf6fcb8..096ff747e2b8938c71bfa42ee54813f9e523269f 100644 (file)
@@ -160,7 +160,7 @@ relabel_tty(const char *ttyn, int ptyfd)
 
     /* If sudo is not allocating a pty for the command, open current tty. */
     if (ptyfd == -1) {
-       se_state.ttyfd = open(ttyn, O_RDWR|O_NONBLOCK);
+       se_state.ttyfd = open(ttyn, O_RDWR|O_NOCTTY|O_NONBLOCK);
        if (se_state.ttyfd == -1) {
            sudo_warn(U_("unable to open %s, not relabeling tty"), ttyn);
            goto bad;
@@ -208,7 +208,7 @@ relabel_tty(const char *ttyn, int ptyfd)
     } else {
        /* Re-open tty to get new label and reset std{in,out,err} */
        close(se_state.ttyfd);
-       se_state.ttyfd = open(ttyn, O_RDWR|O_NONBLOCK);
+       se_state.ttyfd = open(ttyn, O_RDWR|O_NOCTTY|O_NONBLOCK);
        if (se_state.ttyfd == -1) {
            sudo_warn(U_("unable to open %s"), ttyn);
            goto bad;