selinux/policycoreutils/mcstrans/utils/transcon.c
Xavier Toth c89625db93 Add mcstrans to policycoreutils
SELinux Project contribution of mcstrans. mcstrans is a userland package
specific to SELinux which allows system administrators to define
sensitivity levels and categories and provides a daemon for their
translation into human readable form. This version is a merge of Joe
Nalls git tree ( http://github.com/joenall/mcstrans) and patches
supplied by Dan Walsh and others at RedHat.

Ted

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2010-07-21 15:40:00 -04:00

31 lines
538 B
C

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
#include <errno.h>
#include <string.h>
#include <selinux/selinux.h>
#include "mcstrans.h"
void usage(const char *progname)
{
fprintf(stderr, "usage: %s context\n", progname);
exit(1);
}
int main(int argc, char **argv) {
security_context_t scon;
if ( argc != 2 ) usage(argv[0]);
if (init_translations()==0) {
if(trans_context(argv[1],&scon) == 0) {
printf("%s\n", scon);
freecon(scon);
return 0;
}
}
printf("Failed\n");
return -1;
}