Changeset 2666

Show
Ignore:
Timestamp:
04/22/08 13:14:36 (7 months ago)
Author:
pebenito
Message:

fcglob: add a copy of libselinux with context validation disabled so the python wrapper can be used again. handle stat errors better.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fcglob/Makefile

    r2583 r2666  
    6666XMLLINT ?= $(BINDIR)/xmllint 
    6767SECHECK ?= $(BINDIR)/sechecker 
    68 FCGLOB ?= $(PYTHON) $(support)/fcglob/fcglob.py 
    6968 
    7069# interpreters and aux tools 
     
    106105# so policycoreutils updates are not required (RHEL4) 
    107106genhomedircon := $(PYTHON) -E $(support)/genhomedircon 
     107 
     108libselinux := $(support)/fcglob/libselinux/src/libselinux.so.1 
     109fcglob ?= env LD_LIBRARY_PATH="$(dir $(libselinux))" $(PYTHON) $(support)/fcglob/fcglob.py 
    108110 
    109111# documentation paths 
  • branches/fcglob/Rules.monolithic

    r2607 r2666  
    193193$(homedir_template): $(fc) 
    194194 
    195 $(fct): $(fc) 
    196         $(CC) support/fcglob/matchpathcon.c -o support/fcglob/matchpathcon -lselinux 
    197         $(verbose) $(FCGLOB) create $@ $^ 
    198  
    199 globtest: $(fct) 
    200         $(verbose) $(FCGLOB) test $^ file_contexts.orig/file_contexts / 
     195$(libselinux): 
     196        $(verbose) $(MAKE) -C $(@D) 
     197 
     198$(fct): $(fc) $(libselinux) 
     199        $(verbose) $(fcglob) create $@ $< 
     200 
     201globtest: $(fct) $(libselinux) 
     202        $(verbose) $(fcglob) test $< file_contexts.orig/file_contexts / 
    201203 
    202204######################################## 
     
    261263        rm -f *.res 
    262264        rm -fR $(tmpdir) 
     265        $(MAKE) -C $(dir $(libselinux)) clean 
    263266 
    264267.PHONY: default policy install load reload enableaudit checklabels restorelabels relabel check longcheck clean 
  • branches/fcglob/support/fcglob/fcglob.py

    r2608 r2666  
    2828import fctree 
    2929 
    30 #import selinux 
    31 import subprocess 
     30import selinux 
    3231 
    3332class FCException(Exception): 
     
    11181117                tree.unpickle(args[0]) 
    11191118 
    1120                 #selinux.matchpathcon_init(args[1]) 
     1119                selinux.matchpathcon_init(args[1]) 
    11211120 
    11221121                for fi in args[2:]: 
     
    11241123                        fs = "--" 
    11251124                        if not flags.PRETEND: 
    1126                                 st = os.stat(fi) 
     1125                                try:                        
     1126                                        st = os.stat(fi) 
     1127                                except: 
     1128                                        debug("os.stat(%s) failed" % fi) 
     1129                                        continue 
     1130 
    11271131                                fs = fstype2string(st.st_mode) 
    11281132 
     
    11331137 
    11341138                        match = tree.matchpathcon(fc) 
    1135                         mp = subprocess.Popen(["./support/fcglob/matchpathcon", args[1] , fi], stdout=subprocess.PIPE, close_fds=True) 
    1136                         mp.wait() 
    1137                         origmatch = mp.stdout.readline().strip() 
    1138                         #origmatch = selinux.matchpathcon(fi, st.st_mode) 
     1139                        origmatch = selinux.matchpathcon(fi, st.st_mode)[1] 
     1140 
     1141                        if origmatch == None: 
     1142                               origmatch = "<<none>>" 
    11391143 
    11401144                        # output the matched node 
     
    11571161 
    11581162                gc.set_threshold(20000) 
     1163 
     1164                selinux.matchpathcon_init(args[1]) 
    11591165 
    11601166                for root, dirs, files in os.walk(args[2]): 
     
    11691175                                                st = os.stat(fi) 
    11701176                                        except: 
     1177                                                debug("os.stat(%s) failed" % fi) 
    11711178                                                continue 
     1179 
    11721180                                        fs = fstype2string(st.st_mode) 
    11731181 
     
    11781186 
    11791187                                match = tree.matchpathcon(fc) 
    1180                                 mp = subprocess.Popen(["./support/fcglob/matchpathcon", args[1], fi], stdout=subprocess.PIPE, close_fds=True) 
    1181                                 mp.wait() 
    1182                                 origmatch = mp.stdout.readline().strip() 
     1188                                origmatch = selinux.matchpathcon(fi, st.st_mode)[1] 
     1189 
     1190                                if origmatch == None: 
     1191                                        origmatch = "<<none>>" 
    11831192 
    11841193                                if origmatch != match.item.label: