Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/selinux


Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
Location:
branches/2.2.9/mindi-busybox/selinux
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/selinux/Config.in

    r1765 r2725  
     1# DO NOT EDIT. This file is generated from Config.src
    12#
    23# For a description of the syntax of this configuration file,
     
    45#
    56
    6 menu "Selinux Utilities"
     7menu "SELinux Utilities"
    78    depends on SELINUX
     9
     10
    811
    912config CHCON
     
    1720    bool "Enable long options"
    1821    default y
    19     depends on CHCON && GETOPT_LONG
     22    depends on CHCON && LONG_OPTS
    2023    help
    2124      Support long options for the chcon applet.
     
    6871    bool "Enable long options"
    6972    default y
    70     depends on RUNCON && GETOPT_LONG
     73    depends on RUNCON && LONG_OPTS
    7174    help
    7275      Support long options for the runcon applet.
     
    105108      the specified binary policy) for setfiles. Requires libsepol.
    106109
     110config SETSEBOOL
     111    bool "setsebool"
     112    default n
     113    depends on SELINUX
     114    help
     115      Enable support for change boolean.
     116      semanage and -P option is not supported yet.
     117
     118config SESTATUS
     119    bool "sestatus"
     120    default n
     121    depends on SELINUX
     122    help
     123      Displays the status of SELinux.
     124
    107125endmenu
    108 
  • branches/2.2.9/mindi-busybox/selinux/Kbuild

    r1765 r2725  
     1# DO NOT EDIT. This file is generated from Kbuild.src
    12# Makefile for busybox
    23#
     
    45# Copyright (C) 2007 by KaiGai Kohei <kaigai@kaigai.gr.jp>
    56#
    6 # Licensed under the GPL v2, see the file LICENSE in this tarball.
     7# Licensed under GPLv2, see file LICENSE in this source tree.
    78
    89lib-y:=
     10
     11
    912lib-$(CONFIG_CHCON)     += chcon.o
    1013lib-$(CONFIG_GETENFORCE)    += getenforce.o
     
    1720lib-$(CONFIG_SETFILES)      += setfiles.o
    1821lib-$(CONFIG_RESTORECON)    += setfiles.o
     22lib-$(CONFIG_SETSEBOOL)     += setsebool.o
     23lib-$(CONFIG_SESTATUS)      += sestatus.o
  • branches/2.2.9/mindi-busybox/selinux/chcon.c

    r1765 r2725  
    55 *
    66 * Copyright (C) 2006 - 2007 KaiGai Kohei <kaigai@kaigai.gr.jp>
     7 *
     8 * Licensed under GPLv2, see file LICENSE in this source tree.
    79 */
    810#include <getopt.h>
     
    2931static char *specified_context = NULL;
    3032
    31 static int change_filedir_context(const char *fname, struct stat *stbuf, void *userData, int depth)
     33static int FAST_FUNC change_filedir_context(
     34        const char *fname,
     35        struct stat *stbuf UNUSED_PARAM,
     36        void *userData UNUSED_PARAM,
     37        int depth UNUSED_PARAM)
    3238{
    3339    context_t context = NULL;
     
    4450    if (status < 0 && errno != ENODATA) {
    4551        if ((option_mask32 & OPT_QUIET) == 0)
    46             bb_error_msg("cannot obtain security context: %s", fname);
     52            bb_error_msg("can't obtain security context: %s", fname);
    4753        goto skip;
    4854    }
    4955
    5056    if (file_context == NULL && specified_context == NULL) {
    51         bb_error_msg("cannot apply partial context to unlabeled file %s", fname);
     57        bb_error_msg("can't apply partial context to unlabeled file %s", fname);
    5258        goto skip;
    5359    }
     
    5763                             user, role, type, range);
    5864        if (!context) {
    59             bb_error_msg("cannot compute security context from %s", file_context);
     65            bb_error_msg("can't compute security context from %s", file_context);
    6066            goto skip;
    6167        }
     
    7076    context_string = context_str(context);
    7177    if (!context_string) {
    72         bb_error_msg("cannot obtain security context in text expression");
     78        bb_error_msg("can't obtain security context in text expression");
    7379        goto skip;
    7480    }
     
    8591            printf(!fail
    8692                   ? "context of %s changed to %s\n"
    87                    : "failed to change context of %s to %s\n",
     93                   : "can't change context of %s to %s\n",
    8894                   fname, context_string);
    8995        }
     
    9197            rc = TRUE;
    9298        } else if ((option_mask32 & OPT_QUIET) == 0) {
    93             bb_error_msg("failed to change context of %s to %s",
     99            bb_error_msg("can't change context of %s to %s",
    94100                     fname, context_string);
    95101        }
     
    121127#endif
    122128
    123 int chcon_main(int argc, char **argv);
    124 int chcon_main(int argc, char **argv)
     129int chcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     130int chcon_main(int argc UNUSED_PARAM, char **argv)
    125131{
    126132    char *reference_file;
  • branches/2.2.9/mindi-busybox/selinux/getenforce.c

    r1765 r2725  
    55 * Port to BusyBox  Hiroshi Shinji <shiroshi@my.email.ne.jp>
    66 *
     7 * Licensed under GPLv2, see file LICENSE in this source tree.
    78 */
    89
    910#include "libbb.h"
    1011
    11 int getenforce_main(int argc, char **argv);
    12 int getenforce_main(int argc, char **argv)
     12int getenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     13int getenforce_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
    1314{
    1415    int rc;
  • branches/2.2.9/mindi-busybox/selinux/getsebool.c

    r1765 r2725  
    55 * Port to BusyBox  Hiroshi Shinji <shiroshi@my.email.ne.jp>
    66 *
     7 * Licensed under GPLv2, see file LICENSE in this source tree.
    78 */
    89
    910#include "libbb.h"
    1011
    11 int getsebool_main(int argc, char **argv);
     12int getsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    1213int getsebool_main(int argc, char **argv)
    1314{
     
    2526        rc = security_get_boolean_names(&names, &len);
    2627        if (rc)
    27             bb_perror_msg_and_die("cannot get boolean names");
     28            bb_perror_msg_and_die("can't get boolean names");
    2829
    2930        if (!len) {
     
    5455        if (pending != active)
    5556            printf(" pending: %s", (pending ? "on" : "off"));
    56         putchar('\n');
     57        bb_putchar('\n');
    5758    }
    5859
  • branches/2.2.9/mindi-busybox/selinux/load_policy.c

    r1765 r2725  
    11/*
    22 * load_policy
    3  * This implementation is based on old load_policy to be small.
    43 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
     4 *
     5 * Licensed under GPLv2, see file LICENSE in this source tree.
    56 */
    67#include "libbb.h"
    78
    8 int load_policy_main(int argc, char **argv);
    9 int load_policy_main(int argc, char **argv)
     9int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     10int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
    1011{
    11     int fd;
    12     struct stat st;
    13     void *data;
    14     if (argc != 2) {
     12    int rc;
     13
     14    if (argv[1]) {
    1515        bb_show_usage();
    1616    }
    1717
    18     fd = xopen(argv[1], O_RDONLY);
    19     if (fstat(fd, &st) < 0) {
    20         bb_perror_msg_and_die("can't fstat");
    21     }
    22     data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
    23     if (data == MAP_FAILED) {
    24         bb_perror_msg_and_die("can't mmap");
    25     }
    26     if (security_load_policy(data, st.st_size) < 0) {
     18    rc = selinux_mkload_policy(1);
     19    if (rc < 0) {
    2720        bb_perror_msg_and_die("can't load policy");
    2821    }
  • branches/2.2.9/mindi-busybox/selinux/matchpathcon.c

    r1765 r2725  
    44 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
    55 *
     6 * Licensed under GPLv2, see file LICENSE in this source tree.
    67 */
    78#include "libbb.h"
     
    1819        printf("%s\t%s\n", path, buf);
    1920    else
    20         printf("%s\n", buf);
     21        puts(buf);
    2122
    2223    freecon(buf);
     
    3031#define OPT_VERIFY      (1<<4)  /* -V */
    3132
    32 int matchpathcon_main(int argc, char **argv);
    33 int matchpathcon_main(int argc, char **argv)
     33int matchpathcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     34int matchpathcon_main(int argc UNUSED_PARAM, char **argv)
    3435{
    3536    int error = 0;
  • branches/2.2.9/mindi-busybox/selinux/runcon.c

    r1765 r2725  
    2626 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
    2727 *                  - based on coreutils-5.97 (in Fedora Core 6)
     28 *
     29 * Licensed under GPLv2, see file LICENSE in this source tree.
    2830 */
    2931#include <getopt.h>
     
    4042
    4143    if (getcon(&cur_context))
    42         bb_error_msg_and_die("cannot get current context");
     44        bb_error_msg_and_die("can't get current context");
    4345
    4446    if (compute_trans) {
     
    4648
    4749        if (getfilecon(command, &file_context) < 0)
    48             bb_error_msg_and_die("cannot retrieve attributes of '%s'",
     50            bb_error_msg_and_die("can't retrieve attributes of '%s'",
    4951                         command);
    5052        if (security_compute_create(cur_context, file_context,
     
    5860        bb_error_msg_and_die("'%s' is not a valid context", cur_context);
    5961    if (user && context_user_set(con, user))
    60         bb_error_msg_and_die("failed to set new user '%s'", user);
     62        bb_error_msg_and_die("can't set new user '%s'", user);
    6163    if (type && context_type_set(con, type))
    62         bb_error_msg_and_die("failed to set new type '%s'", type);
     64        bb_error_msg_and_die("can't set new type '%s'", type);
    6365    if (range && context_range_set(con, range))
    64         bb_error_msg_and_die("failed to set new range '%s'", range);
     66        bb_error_msg_and_die("can't set new range '%s'", range);
    6567    if (role && context_role_set(con, role))
    66         bb_error_msg_and_die("failed to set new role '%s'", role);
     68        bb_error_msg_and_die("can't set new role '%s'", role);
    6769
    6870    return con;
     
    8890#define OPTS_CONTEXT_COMPONENT      (OPTS_ROLE | OPTS_TYPE | OPTS_USER | OPTS_RANGE)
    8991
    90 int runcon_main(int argc, char **argv);
    91 int runcon_main(int argc, char **argv)
     92int runcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     93int runcon_main(int argc UNUSED_PARAM, char **argv)
    9294{
    9395    char *role = NULL;
     
    128130
    129131    if (setexeccon(context_str(con)))
    130         bb_error_msg_and_die("cannot set up security context '%s'",
     132        bb_error_msg_and_die("can't set up security context '%s'",
    131133                     context_str(con));
    132134
    133135    execvp(argv[0], argv);
    134 
    135     bb_perror_msg_and_die("cannot execute '%s'", argv[0]);
     136    bb_perror_msg_and_die("can't execute '%s'", argv[0]);
    136137}
  • branches/2.2.9/mindi-busybox/selinux/selinuxenabled.c

    r1765 r2725  
    55 * Port to BusyBox  Hiroshi Shinji <shiroshi@my.email.ne.jp>
    66 *
     7 * Licensed under GPLv2, see file LICENSE in this source tree.
    78 */
    89#include "libbb.h"
    910
    10 int selinuxenabled_main(int argc, char **argv);
    11 int selinuxenabled_main(int argc, char **argv)
     11int selinuxenabled_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     12int selinuxenabled_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
    1213{
    1314    return !is_selinux_enabled();
  • branches/2.2.9/mindi-busybox/selinux/setenforce.c

    r1765 r2725  
    55 * Port to BusyBox  Hiroshi Shinji <shiroshi@my.email.ne.jp>
    66 *
     7 * Licensed under GPLv2, see file LICENSE in this source tree.
    78 */
    89
     
    2021};
    2122
    22 int setenforce_main(int argc, char **argv);
    23 int setenforce_main(int argc, char **argv)
     23int setenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     24int setenforce_main(int argc UNUSED_PARAM, char **argv)
    2425{
    2526    int i, rc;
    2627
    27     if (argc != 2)
     28    if (!argv[1] || argv[2])
    2829        bb_show_usage();
    2930
  • branches/2.2.9/mindi-busybox/selinux/setfiles.c

    r1765 r2725  
    3636    int nerr;
    3737    struct edir excludeArray[MAX_EXCLUDES];
    38 };
    39 
     38} FIX_ALIASING;
    4039#define G (*(struct globals*)&bb_common_bufsiz1)
    4140void BUG_setfiles_globals_too_big(void);
     
    10099
    101100
    102 static void qprintf(const char *fmt, ...)
     101static void qprintf(const char *fmt UNUSED_PARAM, ...)
    103102{
    104103    /* quiet, do nothing */
     
    113112}
    114113
    115 static void add_exclude(const char *const directory)
     114static void add_exclude(const char *directory)
    116115{
    117116    struct stat sb;
     
    120119    if (directory == NULL || directory[0] != '/') {
    121120        bb_error_msg_and_die("full path required for exclude: %s", directory);
    122 
    123121    }
    124122    if (lstat(directory, &sb)) {
     
    285283            count = (count % (80*0x400));
    286284            if (count == 0)
    287                 fputc('\n', stdout);
    288             fputc('*', stdout);
    289             fflush(stdout);
     285                bb_putchar('\n');
     286            bb_putchar('*');
     287            fflush_all();
    290288        }
    291289    }
     
    348346        if (verbose > 1 || !user_only_changed) {
    349347            bb_info_msg("%s: reset %s context %s->%s",
    350                 applet_name, my_file, context ?: "", newcon);
     348                applet_name, my_file, context ? context : "", newcon);
    351349        }
    352350    }
     
    392390 * the directory traversal.
    393391 */
    394 static int apply_spec(const char *file,
    395               struct stat *sb, void *userData, int depth)
     392static int FAST_FUNC apply_spec(
     393        const char *file,
     394        struct stat *sb,
     395        void *userData UNUSED_PARAM,
     396        int depth UNUSED_PARAM)
    396397{
    397398    if (!follow_mounts) {
     
    487488}
    488489
    489 int setfiles_main(int argc, char **argv);
    490 int setfiles_main(int argc, char **argv)
     490int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     491int setfiles_main(int argc UNUSED_PARAM, char **argv)
    491492{
    492493    struct stat sb;
     
    542543    } else { /* setfiles */
    543544        flags = getopt32(argv, "de:f:ilnpqr:svo:FW"
    544                 USE_FEATURE_SETFILES_CHECK_OPTION("c:"),
     545                IF_FEATURE_SETFILES_CHECK_OPTION("c:"),
    545546            &exclude_dir, &input_filename, &rootpath, &out_filename,
    546                  USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
     547                 IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
    547548            &verbose);
    548549    }
     550    argv += optind;
    549551
    550552#if ENABLE_FEATURE_SETFILES_CHECK_OPTION
     
    552554        FILE *policystream;
    553555
    554         policystream = xfopen(policyfile, "r");
     556        policystream = xfopen_for_read(policyfile);
    555557        if (sepol_set_policydb_from_file(policystream) < 0) {
    556558            bb_error_msg_and_die("sepol_set_policydb_from_file on %s", policyfile);
     
    573575        outfile = stdout;
    574576        if (NOT_LONE_CHAR(out_filename, '-')) {
    575             outfile = xfopen(out_filename, "w");
     577            outfile = xfopen_for_write(out_filename);
    576578        }
    577579    }
     
    593595           checking against a binary policy file. */
    594596        set_matchpathcon_canoncon(&canoncon);
    595         if (argc == 1)
     597        if (!argv[0])
    596598            bb_show_usage();
    597         if (stat(argv[optind], &sb) < 0) {
    598             bb_perror_msg_and_die("%s", argv[optind]);
    599         }
     599        xstat(argv[0], &sb);
    600600        if (!S_ISREG(sb.st_mode)) {
    601             bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]);
     601            bb_error_msg_and_die("spec file %s is not a regular file", argv[0]);
    602602        }
    603603        /* Load the file contexts configuration and check it. */
    604         rc = matchpathcon_init(argv[optind]);
     604        rc = matchpathcon_init(argv[0]);
    605605        if (rc < 0) {
    606             bb_perror_msg_and_die("%s", argv[optind]);
    607         }
    608 
    609         optind++;
    610 
     606            bb_simple_perror_msg_and_die(argv[0]);
     607        }
    611608        if (nerr)
    612             exit(1);
     609            exit(EXIT_FAILURE);
     610        argv++;
    613611    }
    614612
     
    618616
    619617        if (NOT_LONE_CHAR(input_filename, '-'))
    620             f = xfopen(input_filename, "r");
     618            f = xfopen_for_read(input_filename);
    621619        while ((len = getline(&buf, &buf_len, f)) > 0) {
    622620            buf[len - 1] = '\0';
     
    626624            fclose_if_not_stdin(f);
    627625    } else {
    628         if (optind >= argc)
     626        if (!argv[0])
    629627            bb_show_usage();
    630         for (i = optind; i < argc; i++) {
     628        for (i = 0; argv[i]; i++) {
    631629            errors |= process_one(argv[i]);
    632630        }
Note: See TracChangeset for help on using the changeset viewer.