Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/selinux/runcon.c


Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/selinux/runcon.c

    r2725 r3232  
    2929 * Licensed under GPLv2, see file LICENSE in this source tree.
    3030 */
    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
    3253#include <selinux/context.h>
    3354#include <selinux/flask.h>
     
    3657
    3758static context_t runcon_compute_new_context(char *user, char *role, char *type, char *range,
    38                         char *command, int compute_trans)
     59            char *command, int compute_trans)
    3960{
    4061    context_t con;
     
    4970        if (getfilecon(command, &file_context) < 0)
    5071            bb_error_msg_and_die("can't retrieve attributes of '%s'",
    51                          command);
     72                    command);
    5273        if (security_compute_create(cur_context, file_context,
    53                         SECCLASS_PROCESS, &new_context))
     74                    SECCLASS_PROCESS, &new_context))
    5475            bb_error_msg_and_die("unable to compute a new context");
    5576        cur_context = new_context;
     
    127148    if (security_check_context(context_str(con)))
    128149        bb_error_msg_and_die("'%s' is not a valid context",
    129                      context_str(con));
     150                context_str(con));
    130151
    131152    if (setexeccon(context_str(con)))
    132153        bb_error_msg_and_die("can't set up security context '%s'",
    133                      context_str(con));
     154                context_str(con));
    134155
    135     execvp(argv[0], argv);
    136     bb_perror_msg_and_die("can't execute '%s'", argv[0]);
     156    BB_EXECVP_or_die(argv);
    137157}
Note: See TracChangeset for help on using the changeset viewer.