-/* $OpenBSD: sshpty.c,v 1.19 2006/03/25 13:17:03 djm Exp $ */
+/* $OpenBSD: sshpty.c,v 1.27 2007/09/11 04:36:29 stevesk Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include "includes.h"
-#include <sys/ioctl.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#include <sys/stat.h>
#include <signal.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <grp.h>
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
+#include <pwd.h>
+#include <stdarg.h>
+#include <string.h>
#include <termios.h>
#ifdef HAVE_UTIL_H
# include <util.h>
-#endif /* HAVE_UTIL_H */
+#endif
+#include <unistd.h>
#include "sshpty.h"
#include "log.h"
fatal("stat(%.100s) failed: %.100s", tty,
strerror(errno));
+#ifdef WITH_SELINUX
+ ssh_selinux_setup_pty(pw->pw_name, tty);
+#endif
+
if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
if (chown(tty, pw->pw_uid, gid) < 0) {
if (errno == EROFS &&