Changeset 2004

Show
Ignore:
Timestamp:
03/19/08 14:15:29 (8 months ago)
Author:
apatel
Message:

work in progress....
custom policy feture is somewhat working.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Access.java

    r1991 r2004  
    1919import com.tresys.framework.compiler.dictionary.Verb; 
    2020 
    21 public abstract class Access  
     21public abstract class Access 
    2222        implements IPolicyVisitable, ICustomPolicy 
    2323{ 
     
    3333 
    3434        /** the verb associated defining the type of access */ 
    35         protected Integer /*Verb*/m_verb; 
     35        protected Integer /* Verb */m_verb; 
    3636 
    3737        protected final AbstractToken Token; 
    38          
    39         private boolean mIsModified; 
    40  
    41         public Access(IDomain dom, IResource res, Integer /*Verb*/verb, 
    42                                         AbstractToken token, AbstractToken bool, Boolean activeOnBool) { 
     38 
     39        public Access (IDomain dom, IResource res, Integer /* Verb */verb, AbstractToken token, AbstractToken bool, Boolean activeOnBool) 
     40        { 
    4341                Domain = dom; 
    4442                resource = res; 
     
    4745                m_bool = bool; 
    4846                m_onOrOff = activeOnBool; 
    49                mIsModified = false; 
    50         } 
    51  
    52         public boolean equals(Object arg0)
    53                 if(!(arg0 instanceof Access)) 
     47        } 
     48 
     49        public boolean equals (Object arg0) 
     50       
     51                if (! (arg0 instanceof Access)) 
    5452                        return false; 
    5553 
    5654                Access access = (Access) arg0; 
    57                 if(!access.m_verb.equals(this.m_verb)) 
     55                if (!access.m_verb.equals (this.m_verb)) 
    5856                        return false; 
    5957 
    60                 if(!access.Domain.equals(this.Domain)) 
     58                if (!access.Domain.equals (this.Domain)) 
    6159                        return false; 
    6260 
     
    6462        } 
    6563 
    66         public AbstractToken GetNameToken() { 
     64        public AbstractToken GetNameToken () 
     65        { 
    6766                return Token; 
    6867        } 
    6968 
    70         public void setVerb(Integer i_nVerb) { 
     69        public void setVerb (Integer i_nVerb) 
     70        { 
    7171                m_verb = i_nVerb; 
    7272        } 
    7373 
    7474        /** 
    75          * setResource - update the resource for this access.  
    76          * Will modify the list of accesses for the resource. 
     75         * setResource - update the resource for this access. Will modify the list 
     76         * of accesses for the resource. 
    7777         */ 
    7878        public void setResource (IResource i_Component) 
    7979        { 
    80                 Policy pol = resource.getPolicy(); 
    81                 if (pol != null) 
    82                         pol.Remove(this); 
    83                 else 
    84                         resource.Remove(this); 
     80                Policy pol = resource.getPolicy (); 
     81                if (pol != null) 
     82                        pol.Remove (this); 
     83                else 
     84                        resource.Remove (this); 
    8585                resource = i_Component; 
    86                 pol = resource.getPolicy(); 
    87                 if (pol != null) 
    88                         pol.AddAccess(this); 
    89                 else 
    90                         resource.Add(this); 
    91         } 
    92  
    93         /** 
    94          * setDomain - update the domain for this access. 
    95          * Will modify the list of accesses for the domain. 
     86                pol = resource.getPolicy (); 
     87                if (pol != null) 
     88                        pol.AddAccess (this); 
     89                else 
     90                        resource.Add (this); 
     91        } 
     92 
     93        /** 
     94         * setDomain - update the domain for this access. Will modify the list of 
     95         * accesses for the domain. 
     96         *  
    9697         * @param i_domain 
    9798         */ 
     
    100101                Policy pol = Domain.getPolicy (); 
    101102                if (pol != null) 
    102                         pol.Remove(this); 
    103                 else 
    104                         Domain.Remove(this); 
     103                        pol.Remove (this); 
     104                else 
     105                        Domain.Remove (this); 
    105106                Domain = i_domain; 
    106                 pol = Domain.getPolicy(); 
    107                 if (pol != null) 
    108                         pol.AddAccess(this); 
    109                 else 
    110                         Domain.Add(this); 
    111         } 
    112  
    113         public abstract void Accept(IPolicyVisitor i_visitor); 
     107                pol = Domain.getPolicy (); 
     108                if (pol != null) 
     109                        pol.AddAccess (this); 
     110                else 
     111                        Domain.Add (this); 
     112        } 
     113 
     114        public abstract void Accept (IPolicyVisitor i_visitor); 
    114115 
    115116        /** 
     
    117118         */ 
    118119        public abstract void ResetToDefaults (); 
    119          
     120 
    120121        /** 
    121122         * clear all access definitions from the access 
    122123         */ 
    123124        public abstract void ClearAccess (); 
    124          
     125 
    125126        /** 
    126127         * Get collection of all accesses assigned to the access 
     128         *  
    127129         * @return collection based on the type of access 
    128130         */ 
     
    131133        /** 
    132134         * Set the access definitions to hose passed in. 
    133          * @param i_accessDefns - collection of access definitions to set to the access, all others will be cleared 
     135         *  
     136         * @param i_accessDefns - 
     137         *            collection of access definitions to set to the access, all 
     138         *            others will be cleared 
    134139         * @throws VerbMismatchException 
    135140         * @throws UnrevokableException 
     
    137142        public abstract void SetAccessDefns (Collection i_accessDefns) 
    138143                throws VerbMismatchException, UnrevokableException; 
    139          
     144 
    140145        /** 
    141146         * is the access definition at the default state 
     147         *  
    142148         * @return true/false 
    143149         */ 
    144150        public abstract boolean isDefault (); 
    145151 
    146         public AbstractToken getBool()  
     152        public AbstractToken getBool () 
    147153        { 
    148154                return m_bool; 
    149155        } 
    150156 
    151         public void setBool(AbstractToken i_bool)  
     157        public void setBool (AbstractToken i_bool) 
    152158        { 
    153159                m_bool = i_bool; 
     
    156162        } 
    157163 
    158         public Boolean getOnOrOff()  
     164        public Boolean getOnOrOff () 
    159165        { 
    160166                return m_onOrOff; 
    161167        } 
    162168 
    163         public void setOnOrOff(Boolean orOff)  
     169        public void setOnOrOff (Boolean orOff) 
    164170        { 
    165171                m_onOrOff = orOff; 
    166172        } 
    167173 
    168         public IDomain getDomain()  
     174        public IDomain getDomain () 
    169175        { 
    170176                return Domain; 
    171177        } 
    172178 
    173         public IResource getResource()  
     179        public IResource getResource () 
    174180        { 
    175181                return resource; 
    176182        } 
    177183 
    178         public String getVerb()  
    179         { 
    180                 return Verb.toString(m_verb); 
    181         } 
    182  
    183         public Integer verb()  
     184        public String getVerb () 
     185        { 
     186                return Verb.toString (m_verb); 
     187        } 
     188 
     189        public Integer verb () 
    184190        { 
    185191                return m_verb; 
    186192        } 
    187193         
    188         public boolean supportsCustomPolicy() 
    189         { 
    190                 return true; 
    191         } 
    192          
    193         public boolean hasCustomization() 
    194         { 
    195                 return mIsModified; 
    196         } 
    197          
     194        public boolean hasCustomization () 
     195        { 
     196                return false; 
     197        } 
    198198        public void markCustomized () 
    199199        { 
    200                 mIsModified = true; 
    201         } 
    202          
     200        } 
    203201        public void removeCustomization () 
    204202        { 
    205                 mIsModified = false; 
     203        } 
     204        public boolean supportsCustomPolicy () 
     205        { 
     206                return false; 
    206207        } 
    207208 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/AccessResource.java

    r1995 r2004  
    1515import com.tresys.framework.compiler.AbstractToken; 
    1616import com.tresys.framework.compiler.Utility; 
     17import com.tresys.framework.compiler.custom.ICustomPolicy; 
    1718import com.tresys.framework.compiler.dictionary.AccessDefn; 
    1819import com.tresys.framework.compiler.dictionary.AccessDefnGroup; 
     
    4546 */ 
    4647public final class AccessResource  
    47         extends Access  
     48        extends Access 
    4849{ 
    4950 
     
    5253         */ 
    5354        final private Map/*<rdef, Map<accessDefn>>*/accessDefs = new HashMap (); 
     55         
     56        private boolean mIsCustomized; 
    5457 
    5558        /** 
     
    6972                ResetToDefaults(); 
    7073                checkForUnrevokables(); 
     74                mIsCustomized = false; 
    7175        } 
    7276 
     
    339343 
    340344        } 
     345         
     346        public boolean hasCustomization () 
     347        { 
     348                return mIsCustomized; 
     349        } 
     350        public void markCustomized () 
     351        { 
     352                mIsCustomized = true; 
     353        } 
     354        public void removeCustomization () 
     355        { 
     356                mIsCustomized = false; 
     357        } 
     358        public boolean supportsCustomPolicy () 
     359        { 
     360                return true; 
     361        } 
    341362} 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Conditional.java

    r1991 r2004  
    1414public class Conditional  
    1515        extends Component 
    16         implements IResource, ICustomPolicy 
     16        implements IResource 
    1717{ 
    1818        protected boolean defaultState; 
     
    5656                i_visitor.Visit(this); 
    5757        } 
    58          
    59         public boolean supportsCustomPolicy() 
    60         { 
    61                 return true; 
    62         } 
    63          
    64         public boolean hasCustomization() 
    65         { 
    66                 return mIsModified; 
    67         } 
    68          
    69         public void markCustomized () 
    70         { 
    71                 mIsModified = true; 
    72         } 
    73          
    74         public void removeCustomization () 
    75         { 
    76                 mIsModified = false; 
    77         } 
    78  
    7958} 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/translator/SELinuxPolicy.java

    r1995 r2004  
    44# Authors:  Garth Boyst <gboyst@tresys.com> 
    55#                       Dave Sugar <dsugar@tresys.com> 
     6#                       Anand Patel <apatel@tresys.com> 
    67# 
    78# TranslatorSeLinux.java 
     
    9293        implements IPolicyVisitor 
    9394{        
     95        public final static String NEWLINE = System.getProperty("line.separator"); 
     96         
     97 
     98        private final static String XML_START = "##############################################"+ NEWLINE; 
     99        private final static String XML_SUMMARY_OPEN = "## <summary>"+ NEWLINE; 
     100        private final static String XML_SUMMARY_CLOSE = "## </summary>"+ NEWLINE; 
     101        private final static String XML_PARAM_OPEN = "## <param name ="; 
     102        private final static String XML_PARAM_CLOSE = "## </param>"+ NEWLINE; 
     103         
     104         
     105 
    94106        private final Linkage m_linkage; 
    95107        private final boolean m_bGeneratePolicyTemplate; 
     
    99111         
    100112        private final String m_moduleName; 
     113        private final String mCPolicyMacroPrefix; 
    101114         
    102115        final private ByteArrayOutputStream m_dataPolicy = new ByteArrayOutputStream (); 
     
    118131                m_hasFileContext = false; 
    119132                m_bGeneratePolicyTemplate = false; 
     133                mCPolicyMacroPrefix = null; 
    120134         
    121135                if(fcFile != null && fcFile.exists())  
     
    127141        } 
    128142         
    129         public SELinuxPolicy (Linkage i_linkage, boolean i_bGenerateTemplates
     143        public SELinuxPolicy (Linkage i_linkage, boolean i_bGenerateTemplates, String prefix
    130144        { 
    131145                m_linkage = i_linkage; 
    132146                m_bGeneratePolicyTemplate = i_bGenerateTemplates; 
    133147                m_moduleName = "template"; 
    134         } 
     148                mCPolicyMacroPrefix = prefix; 
     149        } 
     150         
    135151         
    136152        protected void finalize () 
     
    211227                        String sType = i_resource.GetTypeWithDictionaryObject(rdef.GetName()); 
    212228 
    213                         String sCustomName = "customize_" + i_resource.getName () + "_" + rdef.GetOutputName();  
     229//                      String sCustomName = "customize_" + i_resource.getName () + "_" + rdef.GetOutputName(); 
     230                        String sCustomName = mCPolicyMacroPrefix + "_" + i_resource.getName () + "_" + rdef.GetOutputName(); 
    214231 
    215232                        if (m_bGeneratePolicyTemplate) 
    216233                        { 
    217234                                outStream = m_bufferInterfaces; 
     235                                StringBuffer buffer = new StringBuffer(200); 
    218236                                outStream.println(); 
    219                                 outStream.println("########################"); 
    220                                 outStream.println("##<summary>"); 
    221                                 outStream.println("## Customization for resource " + i_resource.getName ());  
    222                                 outStream.println("##</summary>"); 
    223                                 outStream.println("##<param name='resource'>"); 
    224                                 outStream.println("## Type of resource being customized"); 
    225                                 outStream.println("##</param>"); 
    226                                 outStream.println("template(`" + sCustomName + "',`"); 
     237                                buffer.append(XML_START); 
     238                                buffer.append(XML_SUMMARY_OPEN); 
     239                                buffer.append("## Customization for resource ").append(i_resource.getName ()).append (NEWLINE);  
     240                                buffer.append(XML_SUMMARY_CLOSE); 
     241                                buffer.append(XML_PARAM_OPEN); 
     242                                buffer.append("'resource'>").append (NEWLINE); 
     243                                buffer.append("## Type of resource being customized").append (NEWLINE); 
     244                                buffer.append(XML_PARAM_CLOSE); 
     245                                buffer.append("template(`").append(sCustomName).append("',`"); 
     246                                buffer.append (NEWLINE); 
     247                                outStream.print (buffer); 
    227248                        } 
    228249 
     
    272293                { 
    273294                        outStream = m_bufferInterfaces; 
    274                         outStream.println(); 
    275                         outStream.println("########################"); 
    276                         outStream.println("##<summary>"); 
    277                         outStream.println("## Customization for domain " + i_domain.getName ());  
    278                         outStream.println("##</summary>"); 
    279                         outStream.println("##<param name='domain'>"); 
    280                         outStream.println("## Domain being customized"); 
    281                         outStream.println("##</param>"); 
    282                         outStream.println("template(`customize_" + i_domain.getName () + "',`"); 
     295                        StringBuffer buffer = new StringBuffer(150); 
     296                        buffer.append(NEWLINE); 
     297                         
     298                        buffer.append(XML_START); 
     299                        buffer.append(XML_SUMMARY_OPEN); 
     300                        buffer.append("## Customization for domain ").append(i_domain.getName ()).append(NEWLINE);  
     301                        buffer.append(XML_SUMMARY_CLOSE); 
     302                        buffer.append(XML_PARAM_OPEN); 
     303                        buffer.append("'domain'>").append(NEWLINE); 
     304                        buffer.append("## Type of resource being customized").append(NEWLINE); 
     305                        buffer.append(XML_PARAM_CLOSE); 
     306                        StringBuffer sCustomName = new StringBuffer("template(`"); 
     307                        sCustomName.append(mCPolicyMacroPrefix).append("_").append(i_domain.getName ()).append("',`"); 
     308                        sCustomName.append(NEWLINE); 
     309                        buffer.append(sCustomName); 
     310                        outStream.print (buffer); 
    283311                } 
    284312                 
     
    296324                if (!m_bGeneratePolicyTemplate && i_domain.hasCustomization ()) 
    297325                { 
    298                         outStream.println ("customize_" + i_domain.getName () + "(" + sType + ")"); 
     326                        String sCustomName = mCPolicyMacroPrefix + i_domain.getName () + "(" + sType + ")"; 
     327                        outStream.println (sCustomName); 
    299328                } 
    300329 
     
    302331                { 
    303332                        m_linkage.MakeDomain (sType, outStream); 
    304                         OutputAbilities (i_domain, outStream); 
     333                        StringBuffer buffer = new StringBuffer(200); 
     334                        OutputAbilities (i_domain, buffer); 
     335                        outStream.print(buffer); 
    305336                } 
    306337 
     
    376407                                        if (i_domain.GetChildren().size() > 0)  
    377408                                        { 
    378                                                 makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), outStream); 
     409                                                StringBuffer buffer = new StringBuffer(100); 
     410                                                makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), buffer); 
     411                                                outStream.print(buffer); 
    379412                                        } 
    380413                                } 
     
    483516                if (!m_bGeneratePolicyTemplate && i_entryPoint.hasCustomization ()) 
    484517                { 
    485                         outStream.println ("customize_" + i_entryPoint.getName () + "(" + i_entryPoint.getType () + ")"); 
     518                        String buffer = mCPolicyMacroPrefix + i_entryPoint.getName () + "(" + i_entryPoint.getType () + ")"; 
     519                        outStream.println (buffer); 
    486520                        return; 
    487521                } 
     
    490524                { 
    491525                        outStream = m_bufferInterfaces; 
    492                         outStream.println(); 
    493                         outStream.println("########################"); 
    494                         outStream.println("##<summary>"); 
    495                         outStream.println("## Customization for entrypoint " + i_entryPoint.getName ());  
    496                         outStream.println("##</summary>"); 
    497                         outStream.println("##<param name='entrypoint'>"); 
    498                         outStream.println("## Entrypoint Resource being customized"); 
    499                         outStream.println("##</param>"); 
    500                         outStream.println("template(`customize_" + i_entryPoint.getName () + "',`"); 
     526         
     527                        StringBuffer buffer = new StringBuffer(200); 
     528                        buffer.append(XML_START); 
     529                        buffer.append(XML_SUMMARY_OPEN); 
     530                        buffer.append("## Customization for entrypoint ").append(i_entryPoint.getName ()).append(NEWLINE);  
     531                        buffer.append(XML_SUMMARY_CLOSE); 
     532                        buffer.append(XML_PARAM_OPEN); 
     533                        buffer.append("'entrypoint'>").append(NEWLINE); 
     534                        buffer.append("## Entrypoint Resource being customized").append(NEWLINE); 
     535                        buffer.append(XML_PARAM_CLOSE); 
     536                        buffer.append("template(`'"); 
     537                        buffer.append(mCPolicyMacroPrefix).append("_").append(i_entryPoint.getName ()).append("',`"); 
     538                        buffer.append(NEWLINE); 
     539                        outStream.print(buffer); 
    501540                } 
    502541                 
     
    524563        { 
    525564                boolean isBoolean = false; 
    526                  
     565                StringBuffer buffer = new StringBuffer(200); 
    527566                if(i_access.getBool () != null) 
    528567                { 
    529                         m_bufferPolicy.println ("if(" + i_access.getBool().image + ") {"); 
     568                        buffer.append("if(").append(i_access.getBool().image).append(") {"); 
    530569 
    531570                        isBoolean = true; 
    532571                        if (i_access.getOnOrOff ().booleanValue () == false) 
    533                                 m_bufferPolicy.println ("} else {"); 
    534                 } 
    535                  
    536                 m_bufferPolicy.println("# CDSFramework access (domain baseresource verb): " + i_access.toString().replace(Utility.DELIM, ' ')); 
     572                                buffer.append("} else {"); 
     573                } 
     574                 
     575                buffer.append("# CDSFramework access (domain baseresource verb): "); 
     576                buffer.append(i_access.toString().replace(Utility.DELIM, ' ')); 
    537577                 
    538578                IDomain domain = i_access.getDomain(); 
     
    541581 
    542582                // This gets all global interface calls in the verb 
    543                 callInterfaces(domain, i_access.GetInterfaces(), m_bufferPolicy); 
     583                callInterfaces(domain, i_access.GetInterfaces(), buffer); 
    544584 
    545585                // for each AccessDefn associated with this AccessResource bundle 
     
    549589                        BaseAccessDefn axxDefn = (BaseAccessDefn) accessDefns.next(); 
    550590 
    551                         callInterfaces(domain, axxDefn.GetAllInterfaces().values(), m_bufferPolicy); 
     591                        callInterfaces(domain, axxDefn.GetAllInterfaces().values(), buffer); 
    552592 
    553593                        // for each AccessTarget associated with this AccessDefn 
     
    561601                                { 
    562602                                        case Target.self: 
    563                                                 makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), m_bufferPolicy); 
     603                                                makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), buffer); 
    564604                                                break; 
    565605                                        case Target.other_read: 
     
    580620                                        { 
    581621                                                Component entry = (Component) iter4.next(); 
    582                                                 makeAllows(domain, entry, axxTarget.GetPermVectors(), m_bufferPolicy); 
     622                                                makeAllows(domain, entry, axxTarget.GetPermVectors(), buffer); 
    583623                                        } 
    584624                                } 
     
    588628                if(isBoolean) 
    589629                { 
    590                         m_bufferPolicy.print ("}\n"); 
    591                 } 
     630                        buffer.append ("}"); 
     631                        buffer.append (NEWLINE); 
     632                } 
     633                m_bufferPolicy.print (buffer); 
    592634        } 
    593635 
     
    635677                        Rdef rdef = (Rdef) rdefitr.next (); 
    636678 
    637                         String sCustomName = "customize_access_" + domain.getName () + "_" + resource.getName () + "_" + rdef.GetOutputName();  
     679                        StringBuffer sCustomName = new StringBuffer(50); 
     680                        sCustomName.append(mCPolicyMacroPrefix).append(domain.getName ()); 
     681                        sCustomName.append("_").append(resource.getName ()).append("_").append(rdef.GetOutputName());  
    638682                         
    639683                        if (m_bGeneratePolicyTemplate) 
    640684                        { 
    641685                                outStream = m_bufferInterfaces; 
    642                                 outStream.println(); 
    643                                 outStream.println("########################"); 
    644                                 outStream.println("##<summary>"); 
    645                                 outStream.println("## Customization for access domain: " + domain.getName () + " resource: " + resource.getName () + " rdef: " + rdef.GetOutputName());  
    646                                 outStream.println("##</summary>"); 
    647                                 outStream.println("##<param name='domain'>"); 
    648                                 outStream.println("## Domain accessing resource"); 
    649                                 outStream.println("##</param>"); 
    650                                 outStream.println("##<param name='resource'>"); 
    651                                 outStream.println("## Resource being accessed"); 
    652                                 outStream.println("##</param>"); 
    653                                 outStream.println("template(`" + sCustomName + "',`"); 
     686                                StringBuffer buffer = new StringBuffer(400); 
     687                                buffer.append(XML_START); 
     688                                buffer.append(XML_SUMMARY_OPEN); 
     689                                buffer.append("## Customization for access domain: ").append(domain.getName ()).append(" resource: ").append(NEWLINE); 
     690                                buffer.append(resource.getName ()).append(" rdef: ").append(rdef.GetOutputName()).append(NEWLINE);  
     691                                buffer.append(XML_SUMMARY_CLOSE); 
     692                                buffer.append(XML_PARAM_OPEN); 
     693                                buffer.append("'domain'>").append(NEWLINE); 
     694                                buffer.append("## Domain accessing resource").append(NEWLINE); 
     695                                buffer.append(XML_PARAM_CLOSE); 
     696                                buffer.append(XML_PARAM_OPEN); 
     697                                buffer.append("'resource'>").append(NEWLINE); 
     698                                buffer.append("## Resource being accessed").append(NEWLINE); 
     699                                buffer.append(XML_PARAM_CLOSE); 
     700                                buffer.append("template(`").append(sCustomName).append("',`").append(NEWLINE); 
     701                                outStream.print (buffer); 
    654702                        } 
    655703 
     
    662710                        AccessDefnGroup axxGroup = axxDefn.getAccessDefnGroup (); 
    663711                         
    664                         String templateName = "framework_" 
    665                                 + axxGroup.getRdef().GetOutputName() + "_" 
    666                                 + axxGroup.getName() + "_" 
    667                                 + axxDefn.getName(); 
     712                        StringBuffer templateName = new StringBuffer(90); 
     713                        templateName.append("framework_"); 
     714                        templateName.append(axxGroup.getRdef().GetOutputName ()).append("_"); 
     715                        templateName.append(axxGroup.getName()).append("_"); 
     716                        templateName.append(axxDefn.getName()); 
    668717 
    669718                        if (!m_bGeneratePolicyTemplate && i_access.hasCustomization ()) 
    670719                        { 
    671                                 templateName = sCustomName; 
    672                         } 
    673                          
    674                         outStream.print (templateName + "(" + sDomType + ","); 
     720                                templateName = new StringBuffer(sCustomName); 
     721                        } 
     722                        templateName.append("(").append(sDomType).append(","); 
    675723                        String sResType = "$2"; 
    676724                         
     
    686734                                } 
    687735                        } 
    688                          
    689                         outStream.println (sResType + ")"); 
     736                        templateName.append(sResType).append(")"); 
     737                        outStream.println (templateName); 
    690738                         
    691739                        if (!(resource instanceof ControlResource)) 
    692740                        { 
    693741//                              Rdef rdef = axxDefn.getAccessDefnGroup ().getRdef (); 
     742                                StringBuffer buffer = new StringBuffer(100); 
    694743                                if (rdef.GetSysResourceState (SystemResourceTypes.file) != SysResourceState.No) 
    695                                         generateParentSearchPerms (i_access.getDomain (), resource, false, outStream); 
    696                         } 
    697                          
    698                          
    699                         // Create the perms for other 
    700                         for (Iterator iter2 = axxDefn.getAccessTargets().values().iterator(); iter2.hasNext(); )  
    701                         { 
    702                                 AccessTarget axxTarget = (AccessTarget) iter2.next(); 
    703                                 Integer /*Target*/target = axxTarget.getTargetName(); 
    704                                 Map accesses = null; 
    705                                 switch(target.intValue())  
    706                                 { 
    707                                         case Target.other_read: 
    708                                                 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.read); 
    709                                                 break; 
    710                                         case Target.other_write: 
    711                                                 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.write); 
    712                                                 break; 
    713                                         case Target.other_readwrite: 
    714                                                 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.readwrite); 
    715                                                 break; 
    716                                 } 
    717                                  
    718                                 if (accesses != null)  
    719                                 { 
    720                                         for (Iterator iter3 = accesses.keySet().iterator(); iter3.hasNext(); )  
    721                                         { 
    722                                                 Component entry = (Component) iter3.next(); 
    723                                                 makeAllows(i_access.getDomain(), entry, axxTarget.GetPermVectors(), outStream); 
    724                                         }        
    725                                 } 
     744                                        generateParentSearchPerms (i_access.getDomain (), resource, false, buffer); 
     745                                outStream.print (buffer); 
     746                        } 
     747                         
     748                         
     749                        { 
     750                                StringBuffer buffer = new StringBuffer(100); 
     751                                // Create the perms for other 
     752                                for (Iterator iter2 = axxDefn.getAccessTargets().values().iterator(); iter2.hasNext(); )  
     753                                { 
     754                                        AccessTarget axxTarget = (AccessTarget) iter2.next(); 
     755                                        Integer /*Target*/target = axxTarget.getTargetName(); 
     756                                        Map accesses = null; 
     757                                        switch(target.intValue())  
     758                                        { 
     759                                                case Target.other_read: 
     760                                                        accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.read); 
     761                                                        break; 
     762                                                case Target.other_write: 
     763                                                        accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.write); 
     764                                                        break; 
     765                                                case Target.other_readwrite: 
     766                                                        accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.readwrite); 
     767                                                        break; 
     768                                        } 
     769                                         
     770                                        if (accesses != null)  
     771                                        { 
     772                                                for (Iterator iter3 = accesses.keySet().iterator(); iter3.hasNext(); )  
     773                                                { 
     774                                                        Component entry = (Component) iter3.next(); 
     775                                                        makeAllows(i_access.getDomain(), entry, axxTarget.GetPermVectors(), buffer); 
     776                                                }        
     777                                        } 
     778                                } 
     779                                outStream.print (buffer); 
    726780                        } 
    727781                         
     
    741795                                List paths = resource.GetSystemResources (rdef); 
    742796 
     797                                StringBuffer path_buffer = new StringBuffer(100); 
    743798                                // make transition for each of the paths 
    744799                                for (Iterator itr = paths.iterator (); itr.hasNext (); ) 
     
    762817                                        } 
    763818