Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/selinux/runcon.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/runcon.c
r2725 r3232 29 29 * Licensed under GPLv2, see file LICENSE in this source tree. 30 30 */ 31 #include <getopt.h> 31 32 //usage:#define runcon_trivial_usage 33 //usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" 34 //usage: "runcon CONTEXT PROG ARGS" 35 //usage:#define runcon_full_usage "\n\n" 36 //usage: "Run PROG in a different security context\n" 37 //usage: "\n CONTEXT Complete security context\n" 38 //usage: IF_FEATURE_RUNCON_LONG_OPTIONS( 39 //usage: "\n -c,--compute Compute process transition context before modifying" 40 //usage: "\n -t,--type=TYPE Type (for same role as parent)" 41 //usage: "\n -u,--user=USER User identity" 42 //usage: "\n -r,--role=ROLE Role" 43 //usage: "\n -l,--range=RNG Levelrange" 44 //usage: ) 45 //usage: IF_NOT_FEATURE_RUNCON_LONG_OPTIONS( 46 //usage: "\n -c Compute process transition context before modifying" 47 //usage: "\n -t TYPE Type (for same role as parent)" 48 //usage: "\n -u USER User identity" 49 //usage: "\n -r ROLE Role" 50 //usage: "\n -l RNG Levelrange" 51 //usage: ) 52 32 53 #include <selinux/context.h> 33 54 #include <selinux/flask.h> … … 36 57 37 58 static context_t runcon_compute_new_context(char *user, char *role, char *type, char *range, 38 59 char *command, int compute_trans) 39 60 { 40 61 context_t con; … … 49 70 if (getfilecon(command, &file_context) < 0) 50 71 bb_error_msg_and_die("can't retrieve attributes of '%s'", 51 72 command); 52 73 if (security_compute_create(cur_context, file_context, 53 74 SECCLASS_PROCESS, &new_context)) 54 75 bb_error_msg_and_die("unable to compute a new context"); 55 76 cur_context = new_context; … … 127 148 if (security_check_context(context_str(con))) 128 149 bb_error_msg_and_die("'%s' is not a valid context", 129 150 context_str(con)); 130 151 131 152 if (setexeccon(context_str(con))) 132 153 bb_error_msg_and_die("can't set up security context '%s'", 133 154 context_str(con)); 134 155 135 execvp(argv[0], argv); 136 bb_perror_msg_and_die("can't execute '%s'", argv[0]); 156 BB_EXECVP_or_die(argv); 137 157 }
Note:
See TracChangeset
for help on using the changeset viewer.