Lines Matching refs:ttyn

185 int authenticate_via_pam(const char *ttyn, pam_handle_t * pam_handle)  in authenticate_via_pam()  argument
192 if (ttyn) { in authenticate_via_pam()
193 if (strncmp(ttyn, "/dev/", 5) == 0) in authenticate_via_pam()
194 tty_name = ttyn + 5; in authenticate_via_pam()
196 tty_name = ttyn; in authenticate_via_pam()
647 security_context_t new_context, const char *ttyn) in send_audit_message() argument
665 msg, NULL, NULL, ttyn, success); in send_audit_message()
683 __attribute__ ((unused)), const char *ttyn in send_audit_message() argument
698 static int relabel_tty(const char *ttyn, security_context_t new_context, in relabel_tty() argument
707 if (!ttyn) in relabel_tty()
716 fd = open(ttyn, O_RDWR | O_NONBLOCK); in relabel_tty()
718 fprintf(stderr, _("Error! Could not open %s.\n"), ttyn); in relabel_tty()
724 fprintf(stderr, _("Error! Could not clear O_NONBLOCK on %s\n"), ttyn); in relabel_tty()
732 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
742 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
751 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
777 static int restore_tty_label(int fd, const char *ttyn, in restore_tty_label() argument
784 if (!ttyn) in restore_tty_label()
792 fprintf(stderr, "Could not fgetfilecon %s.\n", ttyn); in restore_tty_label()
797 fprintf(stderr, _("%s changed labels.\n"), ttyn); in restore_tty_label()
803 _("Warning! Could not restore context for %s\n"), ttyn); in restore_tty_label()
818 static int parse_command_line_arguments(int argc, char **argv, char *ttyn, in parse_command_line_arguments() argument
884 if (ttyn) { in parse_command_line_arguments()
917 send_audit_message(0, old_context, new_con, ttyn); in parse_command_line_arguments()
969 send_audit_message(0, old_context, new_con, ttyn); in parse_command_line_arguments()
1030 char *ttyn = NULL; /* tty path */ in main() local
1098 ttyn = ttyname(STDIN_FILENO); in main()
1099 if (!ttyn || *ttyn == '\0') { in main()
1104 if (parse_command_line_arguments(argc, argv, ttyn, old_context, in main()
1153 if (!authenticate_via_pam(ttyn, pam_handle)) in main()
1160 send_audit_message(0, old_context, new_context, ttyn); in main()
1170 fd = relabel_tty(ttyn, new_context, &tty_context, &new_tty_context); in main()
1187 if (restore_tty_label(fd, ttyn, tty_context, new_tty_context)) in main()
1210 if (restore_tty_label(fd, ttyn, tty_context, new_tty_context)) { in main()
1247 if (ttyn) { in main()
1252 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1259 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1266 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1305 if (send_audit_message(1, old_context, new_context, ttyn)) { in main()