Changeset 159

Show
Ignore:
Timestamp:
01/04/07 13:18:05 (2 years ago)
Author:
ccase
Message:

merged with upstream 2007-01-04

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • upstream/selinux/README

    r10 r159  
    11See selinux-doc/README for build instructions. 
     2-z 
  • upstream/selinux/libselinux/ChangeLog

    r84 r159  
     11.33.3 2007-01-04 
     2        * Merged patch for matchpathcon utility to use file mode information 
     3          when available from Dan Walsh. 
     4 
     51.33.2 2006-11-27 
     6        * Merged patch to compile with -fPIC instead of -fpic from 
     7          Manoj Srivastava to prevent hitting the global offset table 
     8          limit. Patch changed to include libsepol and libsemanage in 
     9          addition to libselinux. 
     10 
    1111.33.1 2006-10-19 
    212        * Merged updated flask definitions from Darrel Goeddel. 
  • upstream/selinux/libselinux/VERSION

    r84 r159  
    1 1.33.1 
     11.33.3 
  • upstream/selinux/libselinux/src/Makefile

    r10 r159  
    4343 
    4444$(SWIGLOBJ): $(SWIGCOUT) 
    45         $(CC) $(CFLAGS) -I$(PYINC) -fpic -DSHARED -c -o $@ $< 
     45        $(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $< 
    4646 
    4747$(SWIGSO): $(SWIGLOBJ) 
     
    5656 
    5757%.lo:  %.c policy.h 
    58         $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 
     58        $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< 
    5959 
    6060$(SWIGCOUT): $(SWIGIF) 
  • upstream/selinux/libselinux/utils/matchpathcon.c

    r10 r159  
    55#include <errno.h> 
    66#include <string.h> 
     7#include <sys/types.h> 
     8#include <sys/stat.h> 
     9#include <sys/errno.h> 
    710#include <selinux/selinux.h> 
    811 
     
    1013{ 
    1114        fprintf(stderr, 
    12                 "usage:  %s [-n] [-f file_contexts] [-p prefix] path...\n", 
     15                "usage:  %s [-N] [-n] [-f file_contexts] [-p prefix] [-V] path...\n", 
    1316                progname); 
    1417        exit(1); 
    1518} 
    1619 
    17 int printmatchpathcon(char *path, int header
     20int printmatchpathcon(char *path, int header, int mode
    1821{ 
    1922        char *buf; 
    20         int rc = matchpathcon(path, 0, &buf); 
     23        int rc = matchpathcon(path, mode, &buf); 
    2124        if (rc < 0) { 
    2225                fprintf(stderr, "matchpathcon(%s) failed: %s\n", path, 
     
    9396        } 
    9497        for (i = optind; i < argc; i++) { 
     98                int mode=0; 
     99                struct stat buf; 
     100                if (lstat(argv[i], &buf) == 0) 
     101                        mode = buf.st_mode; 
     102 
    95103                if (verify) { 
    96104                        if (selinux_file_context_verify(argv[i], 0)) { 
     
    107115                                        printf("%s has context %s, should be ", 
    108116                                               argv[i], con); 
    109                                         error += printmatchpathcon(argv[i], 0); 
     117                                        error += printmatchpathcon(argv[i], 0, mode); 
    110118                                        freecon(con); 
    111119                                } else { 
     
    113121                                            ("actual context unknown: %s, should be ", 
    114122                                             strerror(errno)); 
    115                                         error += printmatchpathcon(argv[i], 0); 
     123                                        error += printmatchpathcon(argv[i], 0,mode); 
    116124                                } 
    117125                        } 
    118126                } else { 
    119                         error += printmatchpathcon(argv[i], header); 
     127                        error += printmatchpathcon(argv[i], header, mode); 
    120128                } 
    121129        } 
  • upstream/selinux/libsemanage/ChangeLog

    r84 r159  
     11.9.1 2006-11-27 
     2        * Merged patch to compile wit -fPIC instead of -fpic from 
     3          Manoj Srivastava to prevent hitting the global offest table 
     4          limit. Patch changed to include libselinux and libsemanage in 
     5          addition to libsepol. 
    161.8 2006-10-17 
    27        * Updated version for release. 
  • upstream/selinux/libsemanage/VERSION

    r84 r159  
    1 1.8 
     11.9.1 
  • upstream/selinux/libsemanage/src/Makefile

    r10 r159  
    4545 
    4646$(SWIGLOBJ): $(SWIGCOUT) 
    47         $(CC) $(CFLAGS) -I$(PYINC) -fpic -DSHARED -c -o $@ $< 
     47        $(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $< 
    4848 
    4949$(SWIGSO): $(SWIGLOBJ) 
     
    7070 
    7171%.lo:  %.c 
    72         $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 
     72        $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< 
    7373 
    7474$(SWIGCOUT): $(SWIGIF) 
  • upstream/selinux/libsepol/ChangeLog

    r119 r159  
     11.15.3 2006-11-27 
     2        * Merged patch to compile wit -fPIC instead of -fpic from 
     3          Manoj Srivastava to prevent hitting the global offest table 
     4          limit. Patch changed to include libselinux and libsemanage in 
     5          addition to libselinux. 
    161.15.2 2006-10-31 
    27        * Merged fix from Karl MacMillan for a segfault when linking 
  • upstream/selinux/libsepol/VERSION

    r119 r159  
    1 1.15.2 
     11.15.3 
  • upstream/selinux/libsepol/src/Makefile

    r28 r159  
    2525 
    2626%.o:  %.c  
    27         $(CC) $(CFLAGS) -fpic -c -o $@ $< 
     27        $(CC) $(CFLAGS) -fPIC -c -o $@ $< 
    2828 
    2929%.lo:  %.c 
    30         $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 
     30        $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< 
    3131 
    3232install: all 
  • upstream/selinux/policycoreutils/ChangeLog

    r141 r159  
     11.33.8 2007-01-04 
     2        * Merged patches from Dan Walsh to: 
     3          - omit the optional name from audit2allow 
     4          - use the installed python version in the Makefiles 
     5          - re-open the tty with O_RDWR in newrole 
     6 
     71.33.7 2007-01-03 
     8        * Patch from Dan Walsh to correctly suppress warnings in load_policy. 
     9         
     101.33.6 2006-11-29 
     11        * Patch from Dan Walsh to add an pam_acct_msg call to run_init 
     12        * Patch from Dan Walsh to fix error code returns in newrole 
     13        * Patch from Dan Walsh to remove verbose flag from semanage man page 
     14        * Patch from Dan Walsh to make audit2allow use refpolicy Makefile 
     15          in /usr/share/selinux/<SELINUXTYPE> 
     16 
     171.33.5 2006-11-27 
     18        * Merged patch from Micheal C Thompson to clean up genhomedircon 
     19          error handling. 
    1201.33.4 2006-11-21 
    221        * Merged po file updates from Dan Walsh. 
  • upstream/selinux/policycoreutils/VERSION

    r141 r159  
    1 1.33.4 
     11.33.8 
  • upstream/selinux/policycoreutils/audit2allow/Makefile

    r10 r159  
    55MANDIR ?= $(PREFIX)/share/man 
    66LOCALEDIR ?= /usr/share/locale 
    7 PYLIBVER ?= python2.4 
     7PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]') 
    88PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER) 
    99 
  • upstream/selinux/policycoreutils/audit2allow/audit2allow

    r10 r159  
    3030        import commands, sys, os, getopt, selinux 
    3131        import gettext 
     32        import re 
    3233        try: 
    3334                gettext.install('policycoreutils') 
     
    6061                sys.exit(1) 
    6162                 
     63        def verify_module(module): 
     64                m = re.findall("[^a-zA-Z0-9]", module) 
     65                if len(m) != 0: 
     66                        usage(_("Alphanumeric Charaters Only")) 
     67                 
    6268        def errorExit(error): 
    6369                sys.stderr.write("%s: " % sys.argv[0]) 
     
    126132                                        usage() 
    127133                                module = a 
     134                                verify_module(module) 
    128135                        if o == "-M": 
    129136                                if module != "" or output_ind  or a[0] == "-": 
    130137                                        usage() 
    131138                                module = a 
     139                                verify_module(module) 
    132140                                outfile = a+".te" 
    133141                                buildPP = 1 
     
    185193                output.flush() 
    186194                if buildPP: 
    187                         cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) 
    188                         print _("Compiling policy"
    189                         print cmd 
    190                         rc = commands.getstatusoutput(cmd
    191                         if rc[0] == 0: 
    192                                 cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module
    193                                if fc_file != ""
    194                                        cmd = "%s -f %s" % (cmd, fc_file) 
    195                                         
     195                        if ref_ind: 
     196                               rc, type = selinux.selinux_getpolicytype(
     197                               cmd = "make -f /usr/share/selinux/%s/include/Makefile %s.pp" % (type, module) 
     198                               print _("Compiling policy"
     199                               print cmd 
     200                                rc = commands.getstatusoutput(cmd
     201                        else
     202                                cmd = "checkmodule %s -m -o %s.mod %s.te" % (get_mls_flag(), module, module) 
     203                                print _("Compiling policy") 
    196204                                print cmd 
    197205                                rc = commands.getstatusoutput(cmd) 
    198206                                if rc[0] == 0: 
    199                                         print _("\n******************** IMPORTANT ***********************\n") 
    200                                         print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) 
    201                                 else: 
    202                                         errorExit(rc[1]) 
     207                                        cmd = "semodule_package -o %s.pp -m %s.mod" % (module, module) 
     208                                        if fc_file != "": 
     209                                                cmd = "%s -f %s" % (cmd, fc_file) 
     210                                         
     211                                        print cmd 
     212                                        rc = commands.getstatusoutput(cmd) 
     213                        if rc[0] == 0: 
     214                                print _("\n******************** IMPORTANT ***********************\n") 
     215                                print (_("In order to load this newly created policy package into the kernel,\nyou are required to execute \n\nsemodule -i %s.pp\n\n") % module) 
    203216                        else: 
    204217                                errorExit(rc[1]) 
  • upstream/selinux/policycoreutils/audit2allow/avc.py

    r84 r159  
    232232                        file = m[0][1] 
    233233                        ret = "\n#%s\n"% self.out() 
    234                         ret += "optional_policy(`%s', `\n" % m[0][1] 
     234                        ret += "optional_policy(`\n"  
    235235                        first = True 
    236236                        for i in m: 
  • upstream/selinux/policycoreutils/load_policy/load_policy.c

    r10 r159  
    5151        if (nargs > 2) 
    5252                usage(argv[0]); 
    53         if (nargs >= 1) { 
    54                 fprintf(stderr, 
    55                         "%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n", 
    56                         argv[0], argv[optind++]); 
     53        if (nargs >= 1 && !quiet) { 
     54                       fprintf(stderr, 
     55                               "%s:  Warning!  Policy file argument (%s) is no longer supported, installed policy is always loaded.  Continuing...\n", 
     56                               argv[0], argv[optind++]); 
    5757        } 
    58         if (nargs == 2) { 
     58        if (nargs == 2 && ! quiet) { 
    5959                fprintf(stderr, 
    6060                        "%s:  Warning!  Boolean file argument (%s) is no longer supported, installed booleans file is always used.  Continuing...\n", 
  • upstream/selinux/policycoreutils/newrole/newrole.c

    r141 r159  
    10691069                int rc; 
    10701070                int exit_code = 0; 
     1071                int status; 
    10711072 
    10721073                do { 
    1073                         rc = wait(NULL); 
     1074                        rc = wait(&status); 
    10741075                } while (rc < 0 && errno == EINTR); 
     1076 
     1077                /* Preserve child exit status, unless there is another error. */ 
     1078                if (WIFEXITED(status)) 
     1079                        exit_code = WEXITSTATUS(status); 
    10751080 
    10761081                if (restore_tty_label(fd, ttyn, tty_context, new_tty_context)) { 
     
    11161121        if (fd != 0) 
    11171122                goto err_close_pam; 
    1118         fd = open(ttyn, O_WRONLY); 
     1123        fd = open(ttyn, O_RDWR); 
    11191124        if (fd != 1) 
    11201125                goto err_close_pam; 
    1121         fd = open(ttyn, O_WRONLY); 
     1126        fd = open(ttyn, O_RDWR); 
    11221127        if (fd != 2) 
    11231128                goto err_close_pam; 
  • upstream/selinux/policycoreutils/run_init/run_init.c

    r10 r159  
    133133        } 
    134134 
     135        /* If we were successful, call pam_acct_mgmt() to reset the 
     136         * pam_tally failcount. 
     137         */ 
     138        if (result && (PAM_SUCCESS != pam_acct_mgmt(pam_handle, 0)) ) { 
     139                fprintf(stderr, _("failed to get account information\n")); 
     140                exit(-1); 
     141        }        
     142 
    135143        /* We're done with PAM.  Free `pam_handle'. */ 
    136144        pam_end(pam_handle, PAM_SUCCESS); 
  • upstream/selinux/policycoreutils/scripts/genhomedircon

    r10 r159  
    2929import gettext 
    3030gettext.install('policycoreutils') 
    31  
    32 try: 
    33         fd = open("/etc/shells", 'r') 
    34         VALID_SHELLS = fd.read().split("\n") 
    35         fd.close() 
    36         if "/sbin/nologin" in VALID_SHELLS: 
    37                 VALID_SHELLS.remove("/sbin/nologin") 
    38         if "" in VALID_SHELLS: 
    39                 VALID_SHELLS.remove("") 
    40 except: 
    41         VALID_SHELLS = ['/bin/sh', '/bin/bash', '/bin/ash', '/bin/bsh', '/bin/ksh', '/usr/bin/ksh', '/usr/bin/pdksh', '/bin/tcsh', '/bin/csh', '/bin/zsh'] 
    4231 
    4332def grep(file, var): 
     
    115104        return "targeted" 
    116105 
    117 def usage(error = ""): 
     106def usage(rc=0, error = ""): 
    118107        if error != "": 
    119108                sys.stderr.write("%s\n" % error) 
     109                rc = 1 
    120110        sys.stderr.write("Usage: %s [ -d selinuxdir ] [-n | --nopasswd] [-t selinuxtype ]\n" % sys.argv[0]) 
    121111        sys.stderr.flush() 
    122         sys.exit(1
     112        sys.exit(rc
    123113 
    124114def warning(warning = ""): 
     
    137127                self.semanaged = semanage_is_managed(self.semanageHandle) 
    138128                if self.semanaged: 
    139                         semanage_connect(self.semanageHandle) 
     129                        rc = semanage_connect(self.semanageHandle) 
     130                        if rc: 
     131                                errorExit("Unable to connect to semanage") 
    140132                        (status, self.ulist) = semanage_user_list(self.semanageHandle) 
    141133                self.type = type 
     
    337329 
    338330        def write(self): 
    339                 try: 
    340                         fd = open(self.getFileContextDir()+"/file_contexts.homedirs", "w") 
    341                         fd.write(self.genoutput()) 
    342                         fd.close() 
    343                 except IOError, error: 
    344                         sys.stderr.write("%s: %s\n" % ( sys.argv[0], error )) 
    345  
     331                fd = open(self.getFileContextDir()+"/file_contexts.homedirs", "w") 
     332                fd.write(self.genoutput()) 
     333                fd.close() 
    346334 
    347335if os.getuid() > 0 or os.geteuid() > 0: 
    348336        print _("You must be root to run %s.") % sys.argv[0] 
    349337        sys.exit(1) 
     338 
     339try: 
     340        fd = open("/etc/shells", 'r') 
     341        VALID_SHELLS = fd.read().split("\n") 
     342        fd.close() 
     343        if "/sbin/nologin" in VALID_SHELLS: 
     344                VALID_SHELLS.remove("/sbin/nologin") 
     345        if "" in VALID_SHELLS: 
     346                VALID_SHELLS.remove("") 
     347except: 
     348        VALID_SHELLS = ['/bin/sh', '/bin/bash', '/bin/ash', '/bin/bsh', '/bin/ksh', '/usr/bin/ksh', '/usr/bin/pdksh', '/bin/tcsh', '/bin/csh', '/bin/zsh'] 
    350349 
    351350# 
     
    370369                if o == '--help'  or o == "-h": 
    371370                        usage() 
    372  
    373  
    374         if type == None: 
    375                 type = getSELinuxType(directory) 
    376  
    377         if len(cmds) != 0: 
    378                 usage() 
    379         selconf = selinuxConfig(directory, type, usepwd) 
    380         selconf.write() 
    381  
    382371except getopt.error, error: 
    383372        errorExit(_("Options Error %s ") % error) 
     373 
     374if type == None: 
     375        type = getSELinuxType(directory) 
     376 
     377if len(cmds) != 0: 
     378        usage(1) 
     379 
     380selconf = selinuxConfig(directory, type, usepwd) 
     381try: 
     382        selconf.write() 
     383except IOError, error: 
     384        sys.stderr.write("%s: %s\n" % ( sys.argv[0], error )) 
     385        sys.exit(1) 
     386 
  • upstream/selinux/policycoreutils/semanage/Makefile

    r10 r159  
    44SBINDIR ?= $(PREFIX)/sbin 
    55MANDIR = $(PREFIX)/share/man 
    6 PYLIBVER ?= python2.4 
     6PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]') 
    77PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER) 
    88 
  • upstream/selinux/policycoreutils/semanage/semanage.8

    r141 r159  
    8383.I                \-T, \-\-trans 
    8484SELinux Translation 
    85 .TP 
    86 .I                \-v, \-\-verbose     
    87 verbose output 
    8885 
    8986.SH EXAMPLE