Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/selinux/chcon.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/selinux/chcon.c
r2725 r3232 8 8 * Licensed under GPLv2, see file LICENSE in this source tree. 9 9 */ 10 #include <getopt.h> 10 11 //usage:#define chcon_trivial_usage 12 //usage: "[OPTIONS] CONTEXT FILE..." 13 //usage: "\n chcon [OPTIONS] [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE..." 14 //usage: IF_FEATURE_CHCON_LONG_OPTIONS( 15 //usage: "\n chcon [OPTIONS] --reference=RFILE FILE..." 16 //usage: ) 17 //usage:#define chcon_full_usage "\n\n" 18 //usage: "Change the security context of each FILE to CONTEXT\n" 19 //usage: IF_FEATURE_CHCON_LONG_OPTIONS( 20 //usage: "\n -v,--verbose Verbose" 21 //usage: "\n -c,--changes Report changes made" 22 //usage: "\n -h,--no-dereference Affect symlinks instead of their targets" 23 //usage: "\n -f,--silent,--quiet Suppress most error messages" 24 //usage: "\n --reference=RFILE Use RFILE's group instead of using a CONTEXT value" 25 //usage: "\n -u,--user=USER Set user/role/type/range in the target" 26 //usage: "\n -r,--role=ROLE security context" 27 //usage: "\n -t,--type=TYPE" 28 //usage: "\n -l,--range=RANGE" 29 //usage: "\n -R,--recursive Recurse" 30 //usage: ) 31 //usage: IF_NOT_FEATURE_CHCON_LONG_OPTIONS( 32 //usage: "\n -v Verbose" 33 //usage: "\n -c Report changes made" 34 //usage: "\n -h Affect symlinks instead of their targets" 35 //usage: "\n -f Suppress most error messages" 36 //usage: "\n -u USER Set user/role/type/range in the target security context" 37 //usage: "\n -r ROLE" 38 //usage: "\n -t TYPE" 39 //usage: "\n -l RNG" 40 //usage: "\n -R Recurse" 41 //usage: ) 42 11 43 #include <selinux/context.h> 12 44 … … 61 93 if (specified_context == NULL) { 62 94 context = set_security_context_component(file_context, 63 95 user, role, type, range); 64 96 if (!context) { 65 97 bb_error_msg("can't compute security context from %s", file_context); … … 90 122 if ((option_mask32 & OPT_VERBOSE) || ((option_mask32 & OPT_CHANHES) && !fail)) { 91 123 printf(!fail 92 93 94 124 ? "context of %s changed to %s\n" 125 : "can't change context of %s to %s\n", 126 fname, context_string); 95 127 } 96 128 if (!fail) { … … 98 130 } else if ((option_mask32 & OPT_QUIET) == 0) { 99 131 bb_error_msg("can't change context of %s to %s", 100 132 fname, context_string); 101 133 } 102 134 } else if (option_mask32 & OPT_VERBOSE) { … … 150 182 if (option_mask32 & OPT_REFERENCE) { 151 183 /* FIXME: lgetfilecon() should be used when '-h' is specified. 152 184 * But current implementation follows the original one. */ 153 185 if (getfilecon(reference_file, &specified_context) < 0) 154 186 bb_perror_msg_and_die("getfilecon('%s') failed", reference_file); … … 170 202 171 203 if (recursive_action(fname, 172 173 174 175 204 1<<option_mask32 & OPT_RECURSIVE, 205 change_filedir_context, 206 change_filedir_context, 207 NULL, 0) != TRUE) 176 208 errors = 1; 177 209 }
Note:
See TracChangeset
for help on using the changeset viewer.