Changeset 234

Show
Ignore:
Timestamp:
04/19/07 13:55:35 (2 years ago)
Author:
jbrindle
Message:

update to upstream trunk 2007-04-19

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • upstream/selinux/checkpolicy/ChangeLog

    r222 r234  
     12.0.2 2007-04-12 
     2        * Merged checkmodule man page fix from Dan Walsh. 
     3 
    142.0.1 2007-02-20 
    25        * Merged patch to allow dots in class identifiers from Caleb Case. 
  • upstream/selinux/checkpolicy/VERSION

    r222 r234  
    1 2.0.1 
     12.0.2 
  • upstream/selinux/checkpolicy/checkmodule.8

    r10 r234  
    44.SH SYNOPSIS 
    55.B checkmodule 
    6 .I "[-b] [-d] [-m] [-M] [-o output_file] [input_file]" 
     6.I "[-b] [-m] [-M] [-V] [-o output_file] [input_file]" 
    77.SH "DESCRIPTION" 
    88This manual page describes the 
     
    2626module file.  This option is a development/debugging aid. 
    2727.TP 
    28 .B \-d 
    29 Enter debug mode after loading the policy.  This option is a  
    30 development/debugging aid. 
    31 .TP 
    3228.B \-m 
    3329Generate a non-base policy module. 
     
    3531.B \-M 
    3632Enable the MLS/MCS support when checking and compiling the policy module. 
     33.TP 
     34.B \-V 
     35 Show policy versions created by this program 
    3736.TP 
    3837.B \-o filename 
  • upstream/selinux/checkpolicy/test/Makefile

    r10 r234  
    1010override CFLAGS += -I$(INCLUDEDIR) 
    1111 
    12 LDLIBS=-lfl -lselinux $(LIBDIR)/libsepol.a -L$(LIBDIR) 
     12LDLIBS=-lfl -lsepol -lselinux $(LIBDIR)/libsepol.a -L$(LIBDIR) 
    1313 
    1414all: dispol dismod 
  • upstream/selinux/libselinux/ChangeLog

    r222 r234  
     12.0.13 2007-04-12 
     2        * Merged rpm_execcon python binding fix, matchpathcon man page fix, and getsebool -a handling for EACCES from Dan Walsh. 
     3 
     42.0.12 2007-04-09 
     5        * Merged support for getting initial contexts from James Carter. 
     6 
     72.0.11 2007-04-05 
     8        * Merged userspace AVC patch to follow kernel's behavior for permissive mode in caching previous denials from Eamon Walsh. 
     9 
     10 
     112.0.10 2007-04-05 
     12        * Merged sidput(NULL) patch from Eamon Walsh. 
     13 
    1142.0.9 2007-03-30 
    215        * Merged class/av string conversion and avc_compute_create patch from Eamon Walsh. 
  • upstream/selinux/libselinux/VERSION

    r222 r234  
    1 2.0.9 
     12.0.13 
  • upstream/selinux/libselinux/include/selinux/avc.h

    r222 r234  
    7878 */ 
    7979        int sidput(security_id_t sid); 
     80 
     81/** 
     82 * avc_get_initial_sid - get SID for an initial kernel security identifier 
     83 * @name: input name of initial kernel security identifier 
     84 * @sid: pointer to a SID reference 
     85 * 
     86 * Get the context for an initial kernel security identifier specified by  
     87 * @name using security_get_initial_context() and then call  
     88 * avc_context_to_sid() to get the corresponding SID. 
     89 */ 
     90        int avc_get_initial_sid(const char * name, security_id_t * sid); 
    8091 
    8192/* 
  • upstream/selinux/libselinux/include/selinux/selinux.h

    r222 r234  
    189189/* Load a policy configuration. */ 
    190190        extern int security_load_policy(void *data, size_t len); 
     191 
     192/* Get the context of an initial kernel security identifier by name.   
     193   Caller must free via freecon */ 
     194        extern int security_get_initial_context(const char * name,  
     195                                                security_context_t * con); 
     196        extern int security_get_initial_context_raw(const char * name,  
     197                                                    security_context_t * con); 
    191198 
    192199/* 
  • upstream/selinux/libselinux/man/man3/avc_context_to_sid.3

    r222 r234  
    44.TH "avc_context_to_sid" "3" "27 May 2004" "" "SE Linux API documentation" 
    55.SH "NAME" 
    6 avc_context_to_sid, avc_sid_to_context, sidput, sidget \- obtain and manipulate SELinux security ID's. 
     6avc_context_to_sid, avc_sid_to_context, sidput, sidget, avc_get_initial_sid \- obtain and manipulate SELinux security ID's. 
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
     
    1717.sp 
    1818.BI "int sidput(security_id_t " sid ");" 
     19.sp 
     20.BI "int avc_get_initial_sid(const char *" name ", security_id_t *" sid ");" 
     21.sp 
    1922.SH "DESCRIPTION" 
    2023Security ID's (SID's) are reference-counted, opaque representations of security contexts.   
     
    4548by 1.  If the count ever reaches zero, the SID becomes 
    4649invalid and must not be used any further. 
     50 
     51.B avc_get_initial_sid 
     52returns a SID for the kernel initial security identifier specified by  
     53.I name 
    4754 
    4855.SH "RETURN VALUE" 
  • upstream/selinux/libselinux/man/man3/security_compute_av.3

    r222 r234  
    11.TH "security_compute_av" "3" "1 January 2004" "russell@coker.com.au" "SE Linux API documentation" 
    22.SH "NAME" 
    3 security_compute_av, security_compute_create, security_compute_relabel, security_compute_user \- query 
     3security_compute_av, security_compute_create, security_compute_relabel, 
     4security_compute_user, security_get_initial_context \- query 
    45the SELinux policy database in the kernel. 
    56 
     
    1617.sp 
    1718.BI "int security_compute_user(security_context_t "scon ", const char *" username ", security_context_t **" con ); 
     19.sp 
     20.BI "int security_get_initial_context(const char *" name ", security_context_t 
     21"con ); 
    1822.sp 
    1923.BI "int checkPasswdAccess(access_vector_t " requested ); 
     
    4549.B get_ordered_context_list. 
    4650 
     51.B security_get_initial_context 
     52is used to get the context of a kernel initial security identifier specified by  
     53.I name 
     54 
    4755.B checkPasswdAccess 
    4856This functions is a helper functions that allows you to check for a permission in the passwd class. checkPasswdAccess uses getprevcon() for the source and target security contexts. 
  • upstream/selinux/libselinux/man/man8/matchpathcon.8

    r222 r234  
    2929.SH "SEE ALSO" 
    3030.BR selinux "(8), " 
    31 .BR mathpathcon "(3), "  
     31.BR matchpathcon "(3), "  
  • upstream/selinux/libselinux/src/avc.c

    r222 r234  
    273273{ 
    274274        int rc; 
     275        if (!sid) 
     276            return 0; 
    275277        avc_get_lock(avc_lock); 
    276278        rc = sid_dec_refcnt(sid); 
    277279        avc_release_lock(avc_lock); 
     280        return rc; 
     281} 
     282 
     283int avc_get_initial_sid(const char * name, security_id_t * sid) 
     284{ 
     285        int rc; 
     286        security_context_t con; 
     287 
     288        rc = security_get_initial_context_raw(name, &con); 
     289        if (rc < 0) 
     290                return rc; 
     291        rc = avc_context_to_sid_raw(con, sid); 
     292 
     293        freecon(con); 
     294 
    278295        return rc; 
    279296} 
     
    9831000        denied = requested & ~(ae->avd.allowed); 
    9841001 
    985         if ((!requested || denied) && avc_enforcing) { 
    986                 errno = EACCES; 
    987                 rc = -1; 
     1002        if (!requested || denied) { 
     1003                if (avc_enforcing) { 
     1004                        errno = EACCES; 
     1005                        rc = -1; 
     1006                } else 
     1007                        ae->avd.allowed |= requested; 
    9881008        } 
    9891009 
  • upstream/selinux/libselinux/src/avc_internal.c

    r222 r234  
    164164                                     avc_prefix, msg->val); 
    165165                                avc_enforcing = msg->val; 
     166                                if (avc_enforcing && (rc = avc_ss_reset(0)) < 0) { 
     167                                        avc_log 
     168                                            ("%s:  cache reset returned %d (errno %d)\n", 
     169                                             avc_prefix, rc, errno); 
     170                                        goto out; 
     171                                } 
    166172                                break; 
    167173                        } 
     
    264270                                     avc_prefix, msg->val); 
    265271                                avc_enforcing = msg->val; 
     272                                if (avc_enforcing && (ret = avc_ss_reset(0)) < 0) { 
     273                                        avc_log 
     274                                            ("%s:  cache reset returned %d (errno %d)\n", 
     275                                             avc_prefix, ret, errno); 
     276                                        goto out; 
     277                                } 
    266278                                break; 
    267279                        } 
  • upstream/selinux/libselinux/src/selinux_internal.h

    r222 r234  
    7777hidden_proto(selinux_raw_to_trans_context); 
    7878hidden_proto(selinux_trans_to_raw_context); 
     79hidden_proto(security_get_initial_context); 
     80hidden_proto(security_get_initial_context_raw); 
    7981 
    8082extern int load_setlocaldefs hidden; 
  • upstream/selinux/libselinux/src/selinuxswig.i

    r222 r234  
    116116extern int selinux_check_passwd_access(access_vector_t requested); 
    117117extern int checkPasswdAccess(access_vector_t requested); 
     118 
     119// This tells SWIG to treat char ** as a special case 
     120%typemap(python,in) char ** { 
     121  /* Check if is a list */ 
     122  if (PyList_Check($input)) { 
     123    int size = PyList_Size($input); 
     124    int i = 0; 
     125    $1 = (char **) malloc((size+1)*sizeof(char *)); 
     126    if ($1 == NULL) { 
     127        PyErr_SetString(PyExc_MemoryError,"Out of memory"); 
     128        return NULL; 
     129    } 
     130    for (i = 0; i < size; i++) { 
     131      PyObject *o = PyList_GetItem($input,i); 
     132      if (PyString_Check(o)) 
     133        $1[i] = PyString_AsString(PyList_GetItem($input,i)); 
     134      else { 
     135        PyErr_SetString(PyExc_TypeError,"list must contain strings"); 
     136        free($1); 
     137        return NULL; 
     138      } 
     139    } 
     140    $1[i] = 0; 
     141  } else { 
     142    PyErr_SetString(PyExc_TypeError,"not a list"); 
     143    return NULL; 
     144  } 
     145} 
     146 
    118147extern int rpm_execcon(unsigned int verified,  
    119148                       const char *filename,  
    120                        char *const argv[], char *const envp[]); 
     149                       char **, char **); 
    121150 
    122151extern int is_context_customizable (security_context_t scontext); 
  • upstream/selinux/libselinux/src/selinuxswig_wrap.c

    r222 r234  
    41464146  unsigned int arg1 ; 
    41474147  char *arg2 = (char *) 0 ; 
    4148   char **arg3
    4149   char **arg4
     4148  char **arg3 = (char **) 0
     4149  char **arg4 = (char **) 0
    41504150  int result; 
    41514151  unsigned int val1 ; 
     
    41544154  char *buf2 = 0 ; 
    41554155  int alloc2 = 0 ; 
    4156   void *argp3 = 0 ; 
    4157   int res3 = 0 ; 
    4158   void *argp4 = 0 ; 
    4159   int res4 = 0 ; 
    41604156  PyObject * obj0 = 0 ; 
    41614157  PyObject * obj1 = 0 ; 
     
    41744170  } 
    41754171  arg2 = (char *)(buf2); 
    4176   res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_p_char, 0 |  0 ); 
    4177   if (!SWIG_IsOK(res3)) { 
    4178     SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rpm_execcon" "', argument " "3"" of type '" "char *const []""'");  
    4179   }  
    4180   arg3 = (char **)(argp3); 
    4181   res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_p_char, 0 |  0 ); 
    4182   if (!SWIG_IsOK(res4)) { 
    4183     SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "rpm_execcon" "', argument " "4"" of type '" "char *const []""'");  
    4184   }  
    4185   arg4 = (char **)(argp4); 
    4186   result = (int)rpm_execcon(arg1,(char const *)arg2,(char *const (*))arg3,(char *const (*))arg4); 
     4172  { 
     4173    /* Check if is a list */ 
     4174    if (PyList_Check(obj2)) { 
     4175      int size = PyList_Size(obj2); 
     4176      int i = 0; 
     4177      arg3 = (char **) malloc((size+1)*sizeof(char *)); 
     4178      if (arg3 == NULL) { 
     4179        PyErr_SetString(PyExc_MemoryError,"Out of memory"); 
     4180        return NULL; 
     4181      } 
     4182      for (i = 0; i < size; i++) { 
     4183        PyObject *o = PyList_GetItem(obj2,i); 
     4184        if (PyString_Check(o)) 
     4185        arg3[i] = PyString_AsString(PyList_GetItem(obj2,i)); 
     4186        else { 
     4187          PyErr_SetString(PyExc_TypeError,"list must contain strings"); 
     4188          free(arg3); 
     4189          return NULL; 
     4190        } 
     4191      } 
     4192      arg3[i] = 0; 
     4193    } else { 
     4194      PyErr_SetString(PyExc_TypeError,"not a list"); 
     4195      return NULL; 
     4196    } 
     4197  } 
     4198  { 
     4199    /* Check if is a list */ 
     4200    if (PyList_Check(obj3)) { 
     4201      int size = PyList_Size(obj3); 
     4202      int i = 0; 
     4203      arg4 = (char **) malloc((size+1)*sizeof(char *)); 
     4204      if (arg4 == NULL) { 
     4205        PyErr_SetString(PyExc_MemoryError,"Out of memory"); 
     4206        return NULL; 
     4207      } 
     4208      for (i = 0; i < size; i++) { 
     4209        PyObject *o = PyList_GetItem(obj3,i); 
     4210        if (PyString_Check(o)) 
     4211        arg4[i] = PyString_AsString(PyList_GetItem(obj3,i)); 
     4212        else { 
     4213          PyErr_SetString(PyExc_TypeError,"list must contain strings"); 
     4214          free(arg4); 
     4215          return NULL; 
     4216        } 
     4217      } 
     4218      arg4[i] = 0; 
     4219    } else { 
     4220      PyErr_SetString(PyExc_TypeError,"not a list"); 
     4221      return NULL; 
     4222    } 
     4223  } 
     4224  result = (int)rpm_execcon(arg1,(char const *)arg2,arg3,arg4); 
    41874225  resultobj = SWIG_From_int((int)(result)); 
    41884226  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); 
  • upstream/selinux/libselinux/utils/getsebool.c

    r10 r234  
    1515int main(int argc, char **argv) 
    1616{ 
    17         int i, rc = 0, active, pending, len = 0, opt; 
     17        int i, get_all = 0, rc = 0, active, pending, len = 0, opt; 
    1818        char **names; 
    1919 
     
    4040                                return 0; 
    4141                        } 
     42                        get_all = 1; 
    4243                        break; 
    4344                default: 
     
    7374                active = security_get_boolean_active(names[i]); 
    7475                if (active < 0) { 
     76                        if (get_all && errno == EACCES)  
     77                                continue; 
    7578                        fprintf(stderr, "Error getting active value for %s\n", 
    7679                                names[i]); 
  • upstream/selinux/libsepol/ChangeLog

    r222 r234  
     12.0.3 2007-04-13 
     2        * Merged add boolmap argument to expand_module_avrules() from Chris PeBenito. 
     3 
    142.0.2 2007-03-30 
    25        * Merged fix from Karl to remap booleans at expand time to  
  • upstream/selinux/libsepol/VERSION

    r222 r234  
    1 2.0.2 
     12.0.3 
  • upstream/selinux/libsepol/include/sepol/policydb/expand.h

    r10 r234  
    3131 
    3232/* 
    33  * Expand only the avrules for a module. It is valid for this function to 
    34  * expand base into itself (i.e.  base == out); the typemap for this special 
    35  * case should map type[i] to i+1.  This function optionally expands neverallow 
    36  * rules. If neverallow rules are expanded, there is no need to copy them and 
    37  * doing so could cause duplicate entries when base == out. If the neverallow 
    38  * rules are not expanded, they are just copied to the destination policy so 
    39  * that assertion checking can be performed after expand. No assertion or 
    40  * hierarchy checking is performed by this function. 
     33 * Expand only the avrules for a module. It is valid for this function 
     34 * to expand base into itself (i.e.  base == out); the typemap for 
     35 * this special case should map type[i] to i+1.  Likewise the boolmap 
     36 * should map bool[i] to i + 1.  This function optionally expands 
     37 * neverallow rules. If neverallow rules are expanded, there is no 
     38 * need to copy them and doing so could cause duplicate entries when 
     39 * base == out.  If the neverallow rules are not expanded, they are 
     40 * just copied to the destination policy so that assertion checking 
     41 * can be performed after expand.  No assertion or hierarchy checking 
     42 * is performed by this function. 
    4143 */ 
    4244extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, 
    43                                  policydb_t * out, uint32_t * typemap, 
     45                                 policydb_t * out, uint32_t * typemap, uint32_t * boolmap, 
    4446                                 int verbose, int expand_neverallow); 
    4547/* 
  • upstream/selinux/libsepol/src/expand.c

    r222 r234  
    21992199 */ 
    22002200int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, 
    2201                           policydb_t * out, uint32_t * typemap, int verbose, 
     2201                          policydb_t * out, uint32_t * typemap, 
     2202                          uint32_t * boolmap, int verbose, 
    22022203                          int expand_neverallow) 
    22032204{ 
     
    22092210        state.out = out; 
    22102211        state.typemap = typemap; 
     2212        state.boolmap = boolmap; 
    22112213        state.handle = handle; 
    22122214        state.verbose = verbose; 
  • upstream/selinux/policycoreutils/ChangeLog

    r222 r234  
     12.0.9 2007-04-12 
     2        * Merged seobject setransRecords patch to return the first alias from Xavier Toth. 
     3 
     42.0.8 2007-04-10 
     5        * Merged updates to sepolgen-ifgen from Karl MacMillan. 
     6 
    172.0.7 2007-03-01 
    28        * Merged restorecond init script LSB compliance patch from Steve Grubb. 
  • upstream/selinux/policycoreutils/VERSION

    r222 r234  
    1 2.0.7 
     12.0.9 
  • upstream/selinux/policycoreutils/audit2allow/sepolgen-ifgen

    r222 r234  
    4646                      help="location of the interface header files") 
    4747    parser.add_option("-v", "--verbose", action="store_true", default=False, 
    48                       help="print debuging output")                       
     48                      help="print debuging output") 
     49    parser.add_option("-d", "--debug", action="store_true", default=False, 
     50                     help="extra debugging output") 
    4951    options, args = parser.parse_args() 
    5052     
     
    6870 
    6971    try: 
    70         headers = refparser.parse_headers(options.headers, output=log
     72        headers = refparser.parse_headers(options.headers, output=log, debug=options.debug
    7173    except ValueError, e: 
    7274        print "error parsing headers" 
  • upstream/selinux/policycoreutils/secon/Makefile

    r10 r234  
    1010CFLAGS ?= $(WARNS) -O1 
    1111override CFLAGS += -DVERSION=\"$(VERSION)\" -I$(INCLUDEDIR)  
    12 LDLIBS = -lselinux -L$(LIBDIR) 
     12LDLIBS = -lsepol -lselinux -L$(LIBDIR) 
    1313 
    1414all: secon 
  • upstream/selinux/policycoreutils/semanage/seobject.py

    r222 r234  
    155155                                self.comments.append(r) 
    156156                                continue 
    157                         self.ddict[i[0]] = i[1] 
     157                        if self.ddict.has_key(i[0]) == 0: 
     158                               self.ddict[i[0]] = i[1] 
    158159 
    159160        def get_all(self): 
  • upstream/selinux/sepolgen/ChangeLog

    r222 r234  
     11.0.8 2007-04-10 
     2        * Merged updates to sepolgen parser and tools from Karl MacMillan. 
     3          This includes improved debugging support, handling of interface  
     4          calls with list parameters, support for role transition rules, 
     5          updated range transition rule support, and looser matching. 
     6 
    171.0.7 2007-03-26 
    28        * Merged patch to discard self from types when generating requires from Karl MacMillan. 
  • upstream/selinux/sepolgen/VERSION

    r222 r234  
    1 1.0.7 
     11.0.8 
  • upstream/selinux/sepolgen/src/sepolgen/interfaces.py

    r222 r234  
    366366                return None 
    367367            else: 
    368                 return ifcall.args[num - 1] 
     368                arg = ifcall.args[num - 1] 
     369                if isinstance(arg, list): 
     370                    return arg 
     371                else: 
     372                    return [arg] 
    369373        else: 
    370             return id 
     374            return [id] 
    371375 
    372376    def map_add_av(self, ifv, av, ifcall): 
    373         src_type = self.map_param(av.src_type, ifcall) 
    374         if src_type is None: 
     377        src_types = self.map_param(av.src_type, ifcall) 
     378        if src_types is None: 
    375379            return 
    376380 
    377         tgt_type = self.map_param(av.tgt_type, ifcall) 
    378         if tgt_type is None: 
     381        tgt_types = self.map_param(av.tgt_type, ifcall) 
     382        if tgt_types is None: 
    379383            return 
    380384 
    381         obj_class = self.map_param(av.obj_class, ifcall) 
    382         if obj_class is None: 
     385        obj_classes = self.map_param(av.obj_class, ifcall) 
     386        if obj_classes is None: 
    383387            return 
    384388 
     
    389393                continue 
    390394            else: 
    391                 new_perms.add(p) 
     395                new_perms.update(p) 
    392396        if len(new_perms) == 0: 
    393397            return 
    394398 
    395         ifv.access.add(src_type, tgt_type, obj_class, new_perms) 
    396  
    397  
     399        for src_type in src_types: 
     400            for tgt_type in tgt_types: 
     401                for obj_class in obj_classes: 
     402                    ifv.access.add(src_type, tgt_type, obj_class, new_perms) 
    398403 
    399404    def do_expand_ifcalls(self, interface, if_by_name): 
  • upstream/selinux/sepolgen/src/sepolgen/matching.py

    r222 r234  
    5151 
    5252class MatchList: 
    53     DEFAULT_THRESHOLD = 10
     53    DEFAULT_THRESHOLD = 12
    5454    def __init__(self): 
    5555        # Match objects that pass the threshold 
  • upstream/selinux/sepolgen/src/sepolgen/refparser.py

    r222 r234  
    3636import refpolicy 
    3737import access 
     38import defaults 
    3839 
    3940import lex 
     
    6061    'TILDE', 
    6162    'ASTERISK', 
    62     'PERIOD', 
    6363    'AMP', 
    6464    'BAR', 
     
    9090    'TYPE_MEMBER', 
    9191    'RANGE_TRANSITION', 
     92    'ROLE_TRANSITION', 
    9293    #   refpolicy keywords 
    9394    'OPT_POLICY', 
     
    9697    'GEN_REQ', 
    9798    'TEMPLATE', 
    98     'REFPOLICYWARN', 
    9999    #   m4 
    100100    'IFDEF', 
     
    129129    'type_member' : 'TYPE_MEMBER', 
    130130    'range_transition' : 'RANGE_TRANSITION', 
     131    'role_transition' : 'ROLE_TRANSITION', 
    131132    # refpolicy keywords 
    132133    'optional_policy' : 'OPT_POLICY', 
     
    135136    'gen_require' : 'GEN_REQ', 
    136137    'template' : 'TEMPLATE', 
    137     'refpolicywarn' : 'REFPOLICYWARN', 
    138138    # M4 
    139139    'ifndef' : 'IFNDEF', 
     
    159159t_TILDE     = r'\~' 
    160160t_ASTERISK  = r'\*' 
    161 t_PERIOD    = r'\.' 
    162161t_AMP       = r'\&' 
    163162t_BAR       = r'\|' 
     
    176175    t.lineno += 1 
    177176 
     177def t_refpolicywarn(t): 
     178    r'refpolicywarn\(.*\n' 
     179    # Ignore refpolicywarn statements - they sometimes 
     180    # contain text that we can't parse. 
     181    t.lineno += 1 
     182     
    178183def t_IDENTIFIER(t): 
    179     r'[a-zA-Z_\$\-][a-zA-Z0-9_\.\$\*]*' 
     184    r'[a-zA-Z_\$][a-zA-Z0-9_\.\$\*]*' 
    180185    # Handle any keywords 
    181186    t.type = reserved.get(t.value,'IDENTIFIER') 
     
    312317        p[0] = [str] 
    313318 
     319def p_interface_call_param(p): 
     320    '''interface_call_param : IDENTIFIER 
     321                            | IDENTIFIER MINUS IDENTIFIER 
     322                            | nested_id_set 
     323    ''' 
     324    # Intentionally let single identifiers pass through 
     325    # List means set, non-list identifier 
     326    if len(p) == 2: 
     327        p[0] = p[1] 
     328    else: 
     329        p[0] = [p[1], "-" + p[3]] 
     330 
     331def p_interface_call_param_list(p): 
     332    '''interface_call_param_list : interface_call_param 
     333                                 | interface_call_param_list COMMA interface_call_param 
     334    ''' 
     335    if len(p) == 2: 
     336        p[0] = [p[1]] 
     337    else: 
     338        p[0] = p[1] + [p[3]] 
     339 
     340 
    314341def p_comma_list(p): 
    315342    '''comma_list : nested_id_list 
     
    407434    p[0] = [x] 
    408435 
    409 def p_refpolicywarn_stmts(p): 
    410     '''refpolicywarn_stmts : names 
    411                            | refpolicywarn_stmts names 
    412                            | OPAREN 
    413                            | refpolicywarn_stmts OPAREN 
    414                            | CPAREN 
    415                            | refpolicywarn_stmts CPAREN 
    416                            | PERIOD 
    417                            | refpolicywarn_stmts PERIOD 
    418     ''' 
    419  
    420 def p_refpolicywarn(p): 
    421     '''refpolicywarn : REFPOLICYWARN OPAREN TICK refpolicywarn_stmts SQUOTE CPAREN''' 
    422     pass 
    423  
    424436def p_interface_call(p): 
    425     'interface_call : IDENTIFIER OPAREN comma_list CPAREN' 
     437    'interface_call : IDENTIFIER OPAREN interface_call_param_list CPAREN' 
    426438    i = refpolicy.InterfaceCall(ifname=p[1]) 
    427439 
     
    456468                   | type_def 
    457469                   | typealias_def 
    458                    | refpolicywarn 
    459470                   | attribute_def 
    460471                   | range_transition_def 
     472                   | role_transition_def 
    461473    ''' 
    462474    p[0] = [p[1]] 
     
    593605 
    594606def p_range_transition_def(p): 
    595     '''range_transition_def : RANGE_TRANSITION names names COLON names mls_range_def SEMI''' 
     607    '''range_transition_def : RANGE_TRANSITION names names COLON names mls_range_def SEMI 
     608                            | RANGE_TRANSITION names names names SEMI''' 
     609    pass 
     610 
     611def p_role_transition_def(p): 
     612    '''role_transition_def : ROLE_TRANSITION names names names SEMI''' 
    596613    pass 
    597614 
     
    641658    if error is not None: 
    642659        msg = 'could not parse text: "%s"' % error 
    643         print msg 
    644660        raise ValueError(msg) 
    645661    return m 
     
    685701        modname = os.path.splitext(name) 
    686702        modules.append((modname[0], root)) 
    687         all_modules, support_macros = list_headers(DEFAULT_HEADERS_ROOT
     703        all_modules, support_macros = list_headers(defaults.headers()
    688704    else: 
    689705        modules, support_macros = list_headers(root) 
     
    742758            else: 
    743759                parse_file(x[1], m) 
    744         except ValueError: 
     760        except ValueError, e: 
     761            o(str(e) + "\n") 
    745762            failures.append(x[1]) 
    746763            continue 
  • upstream/selinux/sepolgen/src/sepolgen/refpolicy.py

    r222 r234  
    580580        self.comments = [] 
    581581 
    582     def to_string(self): 
    583         return self.to_string() 
    584  
    585582    def matches(self, other): 
    586583        if self.ifname != other.ifname: 
     
    597594        i = 0 
    598595        for a in self.args: 
     596            if isinstance(a, list): 
     597                str = list_to_space_str(a) 
     598            else: 
     599                str = a 
     600                 
    599601            if i != 0: 
    600                 s = s + ", %s" % a 
     602                s = s + ", %s" % str 
    601603            else: 
    602                 s = s + a 
     604                s = s + str 
    603605            i += 1 
    604606        return s + ")"