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()
627 security_context_t new_context, const char *ttyn) in send_audit_message() argument
645 msg, NULL, NULL, ttyn, success); in send_audit_message()
663 __attribute__ ((unused)), const char *ttyn in send_audit_message() argument
678 static int relabel_tty(const char *ttyn, security_context_t new_context, in relabel_tty() argument
687 if (!ttyn) in relabel_tty()
696 fd = open(ttyn, O_RDWR | O_NONBLOCK); in relabel_tty()
698 fprintf(stderr, _("Error! Could not open %s.\n"), ttyn); in relabel_tty()
706 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
716 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
725 enforcing ? "Error" : "Warning", ttyn); in relabel_tty()
751 static int restore_tty_label(int fd, const char *ttyn, in restore_tty_label() argument
758 if (!ttyn) in restore_tty_label()
766 fprintf(stderr, "Could not fgetfilecon %s.\n", ttyn); in restore_tty_label()
771 fprintf(stderr, _("%s changed labels.\n"), ttyn); in restore_tty_label()
777 _("Warning! Could not restore context for %s\n"), ttyn); in restore_tty_label()
792 static int parse_command_line_arguments(int argc, char **argv, char *ttyn, in parse_command_line_arguments() argument
858 if (ttyn) { in parse_command_line_arguments()
891 send_audit_message(0, old_context, new_con, ttyn); in parse_command_line_arguments()
943 send_audit_message(0, old_context, new_con, ttyn); in parse_command_line_arguments()
1004 char *ttyn = NULL; /* tty path */ in main() local
1072 ttyn = ttyname(STDIN_FILENO); in main()
1073 if (!ttyn || *ttyn == '\0') { in main()
1078 if (parse_command_line_arguments(argc, argv, ttyn, old_context, in main()
1126 if (!authenticate_via_pam(ttyn, pam_handle)) in main()
1133 send_audit_message(0, old_context, new_context, ttyn); in main()
1143 fd = relabel_tty(ttyn, new_context, &tty_context, &new_tty_context); in main()
1160 if (restore_tty_label(fd, ttyn, tty_context, new_tty_context)) in main()
1183 if (restore_tty_label(fd, ttyn, tty_context, new_tty_context)) { in main()
1220 if (ttyn) { in main()
1225 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1229 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1233 fd = open(ttyn, O_RDWR | O_NONBLOCK); in main()
1270 if (send_audit_message(1, old_context, new_context, ttyn)) in main()