Browse Subversion Repository
Contents of /trunk/1.5.x/ccs-tools/ccstools/ccstools.src/setlevel.c
Parent Directory
| Revision Log
Revision 502 -
( show annotations)
( download)
( as text)
Tue Sep 25 13:33:45 2007 UTC
(16 years, 7 months ago)
by kumaneko
File MIME type: text/x-csrc
File size: 894 byte(s)
1 |
/* |
2 |
* setlevel.c |
3 |
* |
4 |
* TOMOYO Linux's utilities. |
5 |
* |
6 |
* Copyright (C) 2005-2007 NTT DATA CORPORATION |
7 |
* |
8 |
* Version: 1.5.0 2007/09/20 |
9 |
* |
10 |
*/ |
11 |
#include "ccstools.h" |
12 |
|
13 |
int setlevel_main(int argc, char *argv[]) { |
14 |
const char *policy_file = proc_policy_profile; |
15 |
int i, fd; |
16 |
char c; |
17 |
if (access(proc_policy_dir, F_OK)) { |
18 |
fprintf(stderr, "You can't use this command for this kernel.\n"); |
19 |
return 1; |
20 |
} |
21 |
if ((fd = open(policy_file, O_RDWR)) == EOF) { |
22 |
fprintf(stderr, "Can't open %s\n", policy_file); |
23 |
return 1; |
24 |
} else if (write(fd, "", 0) != 0) { |
25 |
fprintf(stderr, "You need to register this program to %s to run this program.\n", proc_policy_manager); |
26 |
return 1; |
27 |
} |
28 |
if (argc > 1) { |
29 |
for (i = 1; i < argc; i++) { |
30 |
write(fd, argv[i], strlen(argv[i])); write(fd, "\n", 1); |
31 |
} |
32 |
} |
33 |
printf("<<< Access Control Status >>>\n"); |
34 |
while (read(fd, &c, 1) == 1) putchar(c); |
35 |
close(fd); |
36 |
return 0; |
37 |
} |
| |