Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/selinux/chcon.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/chcon.c

    r2725 r3232  
    88 * Licensed under GPLv2, see file LICENSE in this source tree.
    99 */
    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
    1143#include <selinux/context.h>
    1244
     
    6193    if (specified_context == NULL) {
    6294        context = set_security_context_component(file_context,
    63                              user, role, type, range);
     95                            user, role, type, range);
    6496        if (!context) {
    6597            bb_error_msg("can't compute security context from %s", file_context);
     
    90122        if ((option_mask32 & OPT_VERBOSE) || ((option_mask32 & OPT_CHANHES) && !fail)) {
    91123            printf(!fail
    92                    ? "context of %s changed to %s\n"
    93                    : "can't change context of %s to %s\n",
    94                    fname, context_string);
     124                ? "context of %s changed to %s\n"
     125                : "can't change context of %s to %s\n",
     126                fname, context_string);
    95127        }
    96128        if (!fail) {
     
    98130        } else if ((option_mask32 & OPT_QUIET) == 0) {
    99131            bb_error_msg("can't change context of %s to %s",
    100                      fname, context_string);
     132                    fname, context_string);
    101133        }
    102134    } else if (option_mask32 & OPT_VERBOSE) {
     
    150182    if (option_mask32 & OPT_REFERENCE) {
    151183        /* FIXME: lgetfilecon() should be used when '-h' is specified.
    152            But current implementation follows the original one. */
     184         * But current implementation follows the original one. */
    153185        if (getfilecon(reference_file, &specified_context) < 0)
    154186            bb_perror_msg_and_die("getfilecon('%s') failed", reference_file);
     
    170202
    171203        if (recursive_action(fname,
    172                      1<<option_mask32 & OPT_RECURSIVE,
    173                      change_filedir_context,
    174                      change_filedir_context,
    175                      NULL, 0) != TRUE)
     204                    1<<option_mask32 & OPT_RECURSIVE,
     205                    change_filedir_context,
     206                    change_filedir_context,
     207                    NULL, 0) != TRUE)
    176208            errors = 1;
    177209    }
Note: See TracChangeset for help on using the changeset viewer.