Home | History | Annotate | Download | only in utils
      1 #include <unistd.h>
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 #include <getopt.h>
      5 #include <errno.h>
      6 #include <string.h>
      7 #include <sys/types.h>
      8 #include <sys/stat.h>
      9 #include <sys/errno.h>
     10 #include <selinux/selinux.h>
     11 
     12 static void usage(const char *progname)
     13 {
     14 	fprintf(stderr, "usage:  %s tty_context...\n", progname);
     15 	exit(1);
     16 }
     17 
     18 int main(int argc, char **argv)
     19 {
     20 	int i;
     21 	if (argc < 2)
     22 		usage(argv[0]);
     23 
     24 	for (i = 1; i < argc; i++) {
     25 		switch (selinux_check_securetty_context(argv[i])) {
     26 		case 0:
     27 			printf("%s securetty.\n", argv[i]);
     28 			break;
     29 		default:
     30 			printf("%s not securetty.\n", argv[i]);
     31 			break;
     32 		}
     33 	}
     34 	return 0;
     35 }
     36