Home | History | Annotate | Download | only in utils
      1 #include <errno.h>
      2 #include <unistd.h>
      3 #include <stdio.h>
      4 #include <stdlib.h>
      5 #include <getopt.h>
      6 #include <errno.h>
      7 #include <string.h>
      8 #include <sys/types.h>
      9 #include <sys/stat.h>
     10 #include <selinux/selinux.h>
     11 
     12 static __attribute__ ((__noreturn__)) 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