Changeset 2010

Show
Ignore:
Timestamp:
03/25/08 11:32:05 (8 months ago)
Author:
dsugar
Message:

this should complete the first pass for the custom policy stuff.
There are probably some problems left in the translator, but this seem to basically work.

Files:

Legend:

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

    r2009 r2010  
    3131import com.tresys.framework.compiler.policy.IDomain; 
    3232import com.tresys.framework.compiler.policy.IPolicyVisitor; 
     33import com.tresys.framework.compiler.policy.IResource; 
    3334import com.tresys.framework.compiler.policy.Policy; 
    3435import com.tresys.framework.compiler.policy.Resource; 
     
    6768        { 
    6869                IDomain domain = i_access.getDomain (); 
    69                 Resource resource = (Resource) i_access.getResource (); 
     70                IResource resource = i_access.getResource (); 
    7071 
    7172                for (Iterator rdefitr = i_access.GetAccessRdefs ().iterator (); rdefitr.hasNext (); ) 
     
    100101        public void Visit(ControlResource i_resource)  
    101102        { 
    102                 //TODO::implement 
     103                String sCustomName = m_sPrefix + m_sModuleName + "_" + i_resource.getOutputName (); 
     104                boolean state = mKey.contains(sCustomName); 
     105                if (state) 
     106                        i_resource.markCustomized(); 
     107                else 
     108                        i_resource.removeCustomization(); 
    103109        } 
    104110 
     
    115121        public void Visit(Enter i_enter)  
    116122        { 
    117                 //TODO::implement 
    118                 boolean state = mKey.contains(i_enter.getEndDomain().getOutputName());  
    119                 if( state ) 
     123                IDomain startDomain = i_enter.getStartDomain (); 
     124                Domain endDomain = i_enter.getEndDomain (); 
     125                EntrypointResource enter = i_enter.getEntryPoint (); 
     126                 
     127                StringBuffer sCustomName = new StringBuffer (100); 
     128                sCustomName.append (m_sPrefix).append ("transition_").append (m_sModuleName).append ("_"); 
     129                sCustomName.append (startDomain.getOutputName ()).append ("_").append (endDomain.getOutputName ()); 
     130                sCustomName.append ("_").append (enter.getOutputName ()); 
     131 
     132                boolean state = mKey.contains(sCustomName.toString ());  
     133                if (state) 
    120134                        i_enter.markCustomized(); 
    121135                else 
     
    125139        public void Visit(EntrypointResource point)  
    126140        { 
    127                 //TODO::implement 
    128                 boolean state = mKey.contains(point.getOutputName());  
    129                 if( state
     141                String sName = m_sPrefix + m_sModuleName + "_" + point.getOutputName();  
     142                boolean state = mKey.contains(sName);  
     143                if (state
    130144                        point.markCustomized(); 
    131145                else 
     
    171185        } 
    172186 
    173         public void Visit(UserDomain dom)  
     187        public void Visit(UserDomain i_domain)  
    174188        { 
     189                String sCustomName = m_sPrefix + m_sModuleName + "_" + i_domain.getOutputName (); 
     190                boolean state = mKey.contains(sCustomName); 
     191                if (state) 
     192                        i_domain.markCustomized(); 
     193                else 
     194                        i_domain.removeCustomization(); 
    175195        } 
    176196} 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/linkage/Linkage.java

    r1989 r2010  
    1414 
    1515import java.io.IOException; 
    16 import java.io.PrintStream; 
    1716import java.util.Collection; 
    1817import java.util.HashMap; 
     
    2019 
    2120import com.tresys.framework.compiler.policy.Ability; 
    22 import com.tresys.framework.compiler.mls.MLSLevel; 
    2321import com.tresys.framework.compiler.mls.MLSSupport; 
    2422import com.tresys.framework.compiler.policy.BaseDomain; 
    2523import com.tresys.framework.compiler.policy.BaseResource; 
    26 import com.tresys.framework.compiler.policy.Conditional; 
    27 import com.tresys.framework.compiler.policy.IMLSSetting; 
    2824 
    2925/** 
     
    8177        } 
    8278         
    83         /** 
    84          * This method should return a string that may perform some basic 
    85          * policy initialization tasks.  It will be called once before any 
    86          * policy translation is performed. 
    87          */ 
    88         public void InitPolicy(PrintStream ps, String moduleName)  
    89         { 
    90                 ps.print("SEFramework_header(" + moduleName + ")\n"); 
    91         } 
    92  
    93         /* 
    94          * This method should return a string that may perform some basic 
    95          * interface initialization tasks. 
    96          */ 
    97         public void InitInterface(PrintStream ps)  
    98         { 
    99                 ps.print("## <summary>SEFramework generated interface.</summary>\n"); 
    100         } 
    101  
    102         /** 
    103          * This method should return a string that may perform some basic 
    104          * file context initialization tasks.  It will be called once before any 
    105          * translation is performed. 
    106          */ 
    107         public void InitFileContext(PrintStream ps)  
    108         {} 
    109  
    110         /** 
    111          * This method should return a string that may perform some basic 
    112          * initialization tasks.  It will be called once before any 
    113          * translation is performed. 
    114          */ 
    115         public void InitNetwork(PrintStream ps)  
    116         {} 
    117  
    118         /** 
    119          * This takes a string (domain name) and returns 
    120          * a string defining that domain relative to the underlying 
    121          * policy. 
    122          *  
    123          * @param name  Name of domain to define in underlying policy language. 
    124          * @return              String defining the domain in the underlying policy language. 
    125          */ 
    126         public void MakeDomain(String name, PrintStream ps)  
    127         { 
    128                 // TODO currently only allows the system to start our domains 
    129                 ps.print("SEFramework_domain(" + name + ")\n"); 
    130         } 
    131  
    132         /** 
    133          * This takes a string (resource name) and appends 
    134          * a string defining that resource relative to the underlying 
    135          * policy. 
    136          *  
    137          * @param name  Name of resource to define in underlying policy language. 
    138          * @return              String defining the domain in the underlying policy language. 
    139          */ 
    140         public void MakeResource(String name, PrintStream ps)  
    141         { 
    142                 ps.print("SEFramework_resource(" + name + ")\n"); 
    143         } 
    144  
    145         /** 
    146          * This takes a string (entrypoint name) and returns 
    147          * a string defining that entrypoint relative to the underlying 
    148          * policy. 
    149          *  
    150          * @param name  Name of ep to define in underlying policy language. 
    151          * @return              String defining the domain in the underlying policy language. 
    152          */ 
    153         public void MakeEntrypoint(String name, PrintStream ps)  
    154         { 
    155                 ps.print("SEFramework_entrypoint(" + name + ")\n"); 
    156         } 
    157  
    158         /** 
    159          * Assign a type to the file attribute. 
    160          *  
    161          * @param       String type 
    162          * @return  Assignment statement 
    163          */ 
    164         public void MakeFileType(String type, PrintStream ps)  
    165         { 
    166                 ps.print("SEFramework_files_type(" + type + ")\n"); 
    167         } 
    168  
    169         /** 
    170          * Makes a file context entry for a directory 
    171          *  
    172          * @param path          The path for the context entry. 
    173          * @param con           The context for the context entry. 
    174          */ 
    175         public void MakeDirContext(String path, String con, IMLSSetting i_mls, PrintStream ps)  
    176         { 
    177                 String sSensitivity = "s0"; 
    178                 if (i_mls != null && m_MLSSupport != null) 
    179                 { 
    180                         MLSLevel level = m_MLSSupport.getLevel (i_mls.getMLSLabel ()); 
    181                         if (level != null) 
    182                                 sSensitivity = level.getRange (); 
    183                 } 
    184                  
    185                  
    186                 ps.print("SEFramework_dir_context(" + path + ", " + con + ", " + sSensitivity + ")\n"); 
    187         } 
    188  
    189         /** 
    190          * Makes a boolean in the base policy 
    191          *  
    192          * @param con           The context for the context entry. 
    193          */ 
    194         public void MakeBoolean(Conditional bool, PrintStream ps)  
    195         { 
    196                 ps.print("bool " + bool.getName() + " " + bool.getDefaultState() 
    197                         + ";\n"); 
    198                 ps.print("genfscon selinuxfs /boolean/" + bool.getName() 
    199                         + " system_u:object_r:" + bool.getType()); 
    200         } 
    201  
    202         /** 
    203          * Makes a file context entry 
    204          *  
    205          * @param path          The path for the context entry. 
    206          * @param con           The context for the context entry. 
    207          */ 
    208         public void MakeFileContext(String path, String con, IMLSSetting i_mls, PrintStream ps)  
    209         { 
    210                 String sSensitivity = "s0"; 
    211                 if (i_mls != null && m_MLSSupport != null) 
    212                 { 
    213                         MLSLevel level = m_MLSSupport.getLevel (i_mls.getMLSLabel ()); 
    214                         if (level != null) 
    215                                 sSensitivity = level.getRange (); 
    216                 } 
    217                  
    218                 ps.print("SEFramework_file_context(" + path + ", " + con + ", " + sSensitivity + ")\n"); 
    219         } 
    220  
    221         public void MakeUserDomain(String name, PrintStream ps)  
    222         { 
    223                 ps.print("SEFramework_user_domain(" + name + ")\n"); 
    224         } 
    225  
    226         public void CanReadBoolean(String domain, String boolType, PrintStream ps)  
    227         { 
    228                 ps 
    229                         .print("SEFramework_read_boolean(" + domain + ", " + boolType 
    230                                 + ")\n"); 
    231         } 
    232  
    233         public void CanWriteBoolean(String domain, String boolType, PrintStream ps)  
    234         { 
    235                 ps.print("SEFramework_set_boolean(" + domain + ", " + boolType + ")\n"); 
    236         } 
    237  
    23879        public void SetBaseResources(Collection newBaseResources)  
    23980        { 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java

    r2009 r2010  
    303303        public String getOutputName () 
    304304        { 
    305                 return getName ().replaceAll("\\.", "_")
     305                return getName ().replaceAll("\\.", "_").replaceAll ("@", "_AT_")
    306306        } 
    307307 
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/IResource.java

    r1825 r2010  
    44|*| Author:     David Sugar <dsugar@tresys.com> 
    55|*|   
    6 |*| Version: @version@ 
     6|*| $Rev$ 
     7|*| $Date$ 
    78|*| 
    89|*| Simple interface to be able to group the various resource type classes in a common interface 
     
    2223        public boolean IsDescendant (IDomain i_domain); 
    2324        public String getName (); 
     25        public String getOutputName (); 
    2426        public Domain getParent (); 
    2527         
  • branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/translator/SELinuxPolicy.java

    r2009 r2010  
    6161import com.tresys.framework.compiler.linkage.libselinuxjava.selinux; 
    6262import com.tresys.framework.compiler.linkage.libselinuxjava.selinuxConstants; 
     63import com.tresys.framework.compiler.mls.MLSLevel; 
    6364import com.tresys.framework.compiler.policy.Ability; 
    6465import com.tresys.framework.compiler.policy.Access; 
     
    9899        private final static String XML_PARAM_OPEN = "## <param name = "; 
    99100        private final static String XML_PARAM_CLOSE = "## </param>"; 
     101        private final static String SINGLE_INDENT = "\t"; 
    100102         
    101103        public final static String CUSTOM_PREFIX = "cds_custom_"; 
     
    128130                m_bGeneratePolicyTemplate = false; 
    129131         
    130                 if(fcFile != null && fcFile.exists())  
     132                if (fcFile != null && fcFile.exists())  
    131133                { 
    132134                        selinux.framework_ignore_invalid_con(); 
     
    189191        public void PreVisit (Policy i_policy) 
    190192        { 
    191                 m_linkage.InitInterface(m_bufferInterfaces); 
    192                 m_bufferInterfaces.print("\n# SEFramework generated interface\n\n"); 
    193  
    194                  
    195                 m_bufferPolicy.print("# SEFramework policy output\n"); 
    196                 m_linkage.InitPolicy(m_bufferPolicy, m_sModuleName); 
     193                InitInterface (m_bufferInterfaces, null); 
     194                m_bufferInterfaces.println("# SEFramework generated interface"); 
     195                m_bufferInterfaces.println (); 
     196 
     197                 
     198                m_bufferPolicy.println ("# SEFramework policy output"); 
     199                InitPolicy(m_bufferPolicy, m_sModuleName, null); 
    197200                m_bufferPolicy.print("# These types are generated by the framework for internal use\n"); 
    198201                 
    199202                for (Iterator iter = i_policy.getFrameworkBooleans().values().iterator(); iter.hasNext(); )  
    200203                { 
    201                         m_linkage.MakeBoolean((Conditional) iter.next(), m_bufferPolicy); 
     204                        MakeBoolean((Conditional) iter.next(), m_bufferPolicy, null); 
    202205                } 
    203206        } 
     
    235238                                outStream.println ("## Type of resource being customized"); 
    236239                                outStream.println (XML_PARAM_CLOSE); 
    237                                 outStream.println (); 
    238240                                outStream.println ("template(`" + sCustomName + "',`"); 
    239241                        } 
    240242 
     243                        String sIndent = null; 
    241244                        if (m_bGeneratePolicyTemplate) 
     245                        { 
    242246                                sType = "$1"; 
     247                                sIndent = SINGLE_INDENT; 
     248                        } 
    243249 
    244250 
     
    254260                        else 
    255261                        { 
    256                                 m_linkage.MakeResource(sType, outStream); 
     262                                MakeResource(sType, outStream, sIndent); 
    257263                         
    258264                                if (rdef.GetSysResourceState (SystemResourceTypes.dir) != SysResourceState.No 
    259265                                        || rdef.GetSysResourceState (SystemResourceTypes.file) != SysResourceState.No) 
    260266                                { 
    261                                         m_linkage.MakeFileType(sType, outStream); 
     267                                        MakeFileType(sType, outStream, sIndent); 
    262268                                        Domain currComp = i_resource.getParent (); 
    263269                                        while (currComp != null)  
    264270                                        { 
    265                                                 m_linkage.MakeFileType(currComp.getType (), outStream); 
     271                                                MakeFileType(currComp.getType (), outStream, sIndent); 
    266272                                                currComp = currComp.getParent(); 
    267273                                        } 
     
    294300                        outStream.println ("## Type for domain being customized"); 
    295301                        outStream.println (XML_PARAM_CLOSE); 
    296                         outStream.println (); 
    297302                        outStream.println ("template(`" + sCustomName + "',`"); 
    298303                } 
    299304                 
     305                String sType = i_domain.getType (); 
     306                String sIndent = new String (); 
     307                if (m_bGeneratePolicyTemplate) 
     308                { 
     309                        sType = "$1"; 
     310                        sIndent = SINGLE_INDENT; 
     311                } 
     312                 
     313                outStream.print (sIndent); 
    300314                outStream.println("#Framework domain: " + i_domain.getName()); 
    301315 
     
    305319                } 
    306320                 
    307                 String sType = i_domain.getType (); 
    308                 if (m_bGeneratePolicyTemplate) 
    309                         sType = "$1"; 
    310321 
    311322                if (!m_bGeneratePolicyTemplate && i_domain.hasCustomization ()) 
     
    319330                if (m_bGeneratePolicyTemplate || !i_domain.hasCustomization ()) 
    320331                { 
    321                         m_linkage.MakeDomain (sType, outStream); 
    322                         OutputAbilities (i_domain, outStream); 
    323                 } 
    324  
    325                 if (i_domain.GetChildren().isEmpty())  
     332                        MakeDomain (sType, outStream, sIndent); 
     333                        OutputAbilities (i_domain, outStream, sIndent); 
     334                } 
     335 
     336                if ((m_bGeneratePolicyTemplate || !i_domain.hasCustomization ()) && i_domain.GetChildren().isEmpty())  
    326337                { 
    327338                        for (Iterator iter = i_domain.GetRdefs().values().iterator(); iter.hasNext(); )  
     
    370381                                                if (targParent == i_domain)  
    371382                                                { 
     383                                                        outStream.print (sIndent); 
    372384                                                        outStream.println ("framework_" + rdef.GetOutputName () + "_owner_resource(" + sSrcType + ", " + sRdefType + ")"); 
    373385//                                                      policyStream.print("allow " + srcParent.getType() + " " 
     
    379391                                                        if (srcParent.getType().equals (targParent.getType())) 
    380392                                                        { 
     393                                                                outStream.print (sIndent); 
    381394                                                                outStream.println ("framework_" + rdef.GetOutputName () + "_owner_resource(" + sSrcType + ", self)"); 
    382395//                                                              policyStream.print("allow " + srcParent.getType() + " self:" + classAndPerms + ";\n"); 
     
    384397                                                        else 
    385398                                                        { 
     399                                                                outStream.print (sIndent); 
    386400                                                                outStream.println ("framework_" + rdef.GetOutputName () + "_owner_resource(" + sSrcType + ", " + sTargType + ")"); 
    387401//                                                              policyStream.print("allow " + srcParent.getType() + " " + targParent.getType() + ":" + classAndPerms + ";\n"); 
     
    394408                                        if (i_domain.GetChildren().size() > 0)  
    395409                                        { 
    396                                                 makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), outStream); 
     410                                                makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), outStream, sIndent); 
    397411                                        } 
    398412                                } 
     
    404418                                        if (i_domain.GetChildren().size() == 0)  
    405419                                        { 
    406                                                 m_linkage.MakeFileType(i_domain.GetTypeWithDictionaryObject(rdef.GetName()), outStream); 
     420                                                MakeFileType(i_domain.GetTypeWithDictionaryObject(rdef.GetName()), outStream, sIndent); 
    407421                                        }  
    408422                                        else  
    409423                                        { 
    410                                                 m_linkage.MakeFileType(i_domain.getType(), outStream); 
     424                                                MakeFileType(i_domain.getType(), outStream, sIndent); 
    411425                                        } 
    412426                                         
     
    414428                                        while (currDom != null)  
    415429                                        { 
    416                                                 m_linkage.MakeFileType(currDom.getType(), outStream); 
     430                                                MakeFileType(currDom.getType(), outStream, sIndent); 
    417431                                                currDom = currDom.getParent(); 
    418432                                        } 
     
    420434                        } 
    421435                } 
    422                 outStream.println("#End of Framework domain: " + i_domain.getName()); 
     436                 
     437                 
     438                if (m_bGeneratePolicyTemplate || !i_domain.hasCustomization ()) 
     439                { 
     440                        outStream.print (sIndent); 
     441                        outStream.println("#End of Framework domain: " + i_domain.getName()); 
     442                } 
    423443 
    424444                if (m_bGeneratePolicyTemplate) 
     
    457477                } 
    458478 
     479                 
     480                IDomain endDomain = i_enter.getEndDomain (); 
     481                EntrypointResource enter = i_enter.getEntryPoint (); 
     482                 
     483                String sStartType = startDomain.getType (); 
     484                String sEndType = endDomain.getType (); 
     485                String sEntryType = enter.getType (); 
     486                 
     487                PrintStream outStream = m_bufferPolicy; 
     488 
     489                StringBuffer sCustomName = new StringBuffer (100); 
     490                sCustomName.append (CUSTOM_PREFIX).append ("transition_").append (m_sModuleName).append ("_"); 
     491                sCustomName.append (startDomain.getOutputName ()).append ("_").append (endDomain.getOutputName ()); 
     492                sCustomName.append ("_").append (enter.getOutputName ()); 
     493                 
     494                if (m_bGeneratePolicyTemplate) 
     495                { 
     496                        sStartType = "$1"; 
     497                        sEndType = "$2"; 
     498                        sEntryType = "$3"; 
     499 
     500                        outStream = m_bufferInterfaces; 
     501                        outStream.println (); 
     502                        outStream.println (XML_START); 
     503                        outStream.println (XML_SUMMARY_OPEN); 
     504                        outStream.print ("## Customization for enter from domain: " + startDomain.getName () + " to: "); 
     505                        outStream.println (endDomain.getName () + " through entry point : " + enter.getName());  
     506                        outStream.println (XML_SUMMARY_CLOSE); 
     507                        outStream.print (XML_PARAM_OPEN); 
     508                        outStream.println ("'start_domain'>"); 
     509                        outStream.println ("## Source Domain type"); 
     510                        outStream.println (XML_PARAM_CLOSE); 
     511                        outStream.print (XML_PARAM_OPEN); 
     512                        outStream.println ("'end_domain'>"); 
     513                        outStream.println ("## Ending Domain Type"); 
     514                        outStream.println (XML_PARAM_CLOSE); 
     515                        outStream.print (XML_PARAM_OPEN); 
     516                        outStream.println ("'entrypoint'>"); 
     517                        outStream.println ("## Entry Point type"); 
     518                        outStream.println (XML_PARAM_CLOSE); 
     519                        outStream.println ("template(`" + sCustomName + "',`"); 
     520                } 
     521 
     522                String sIndent = ""; 
     523                if (m_bGeneratePolicyTemplate) 
     524                        sIndent = SINGLE_INDENT; 
     525                 
    459526                for (Iterator itr = i_enter.GetEntryAccessDefns().iterator(); itr.hasNext(); )  
    460527                { 
    461528                        EntryAccessDefn entryDef = (EntryAccessDefn) itr.next(); 
    462                         m_bufferPolicy.print("framework_enter_" + entryDef.getName () + "("); 
    463                         m_bufferPolicy.print(i_enter.getStartDomain().getType() + ", "); 
    464                         m_bufferPolicy.print(i_enter.getEndDomain().getType() + ", "); 
    465                         m_bufferPolicy.println(i_enter.getEntryPoint().getType() + ")"); 
     529                        if (m_bGeneratePolicyTemplate || !i_enter.hasCustomization ()) 
     530                        { 
     531                                outStream.print (sIndent); 
     532                                outStream.print ("framework_enter_" + entryDef.getName () + "("); 
     533                                outStream.print (sStartType + ", "); 
     534                                outStream.print (sEndType + ", "); 
     535                                outStream.println (sEntryType + ")"); 
     536                        } 
    466537                } 
    467538                 
    468539                // only create type transition rules for non-decomposed domains 
    469                 if(i_enter.getStartDomain().GetChildren().size() == 0 
     540                if (i_enter.getStartDomain().GetChildren().size() == 0 
    470541                        && i_enter.getEndDomain().GetChildren().size() == 0)  
    471542                { 
    472                         m_bufferPolicy.print("type_transition " 
    473                                 + i_enter.getStartDomain().getType() + " " 
    474                                 + i_enter.getEntryPoint().getType() + ":process " 
    475                                 + i_enter.getEndDomain().getType() + ";\n"); 
    476                         if(i_enter.getStartDomain() instanceof BaseDomain)  
    477                         { 
    478                                 propogateRole(i_enter.getEndDomain(), ((BaseDomain) i_enter.getStartDomain()).getRole()); 
     543                        if (m_bGeneratePolicyTemplate || !i_enter.hasCustomization ()) 
     544                        { 
     545                                outStream.print (sIndent); 
     546                                outStream.println ("type_transition " 
     547                                        + sStartType + " " 
     548                                        + sEntryType + ":process " 
     549                                        + sEndType + ";"); 
     550                        } 
     551                         
     552                        if (i_enter.getStartDomain() instanceof BaseDomain)  
     553                        { 
     554                                propogateRole (i_enter.getEndDomain(), ((BaseDomain) i_enter.getStartDomain()).getRole()); 
    479555                        }  
    480                         else if(i_enter.getStartDomain() instanceof UserDomain)  
    481                         { 
    482                                 propogateRole(i_enter.getEndDomain(), ((UserDomain) i_enter.getStartDomain()).getRole()); 
    483                         } 
    484                 } 
    485  
     556                        else if (i_enter.getStartDomain() instanceof UserDomain)  
     557                        { 
     558                                propogateRole (i_enter.getEndDomain(), ((UserDomain) i_enter.getStartDomain()).getRole()); 
     559                        } 
     560                } 
     561 
     562                if (!m_bGeneratePolicyTemplate && i_enter.hasCustomization ()) 
     563                { 
     564                        outStream.print (sCustomName); 
     565                        outStream.print ("("); 
     566                        outStream.print (sStartType); 
     567                        outStream.print (","); 
     568                        outStream.print (sEndType); 
     569                        outStream.print (","); 
     570                        outStream.print (sEntryType); 
     571                        outStream.println (")"); 
     572                } 
     573                 
     574                if (m_bGeneratePolicyTemplate) 
     575                        outStream.println ("')"); 
     576                 
    486577                if (i_enter.getStartDomain() instanceof BaseDomain) 
    487578                { 
    488                         m_bufferPolicy.println("\n')"); 
    489                 } 
    490  
    491                 if(isBoolean) 
     579                        m_bufferPolicy.println (); 
     580                        m_bufferPolicy.println ("')"); 
     581                } 
     582 
     583                if (isBoolean) 
    492584                { 
    493585                        m_bufferPolicy.println ("}"); 
     
    499591                PrintStream outStream = m_bufferPolicy; 
    500592 
    501                 String sCustomName = CUSTOM_PREFIX + m_sModuleName + i_entryPoint.getOutputName ();  
     593                String sCustomName = CUSTOM_PREFIX + m_sModuleName + "_" + i_entryPoint.getOutputName ();  
    502594                 
    503595                if (m_bGeneratePolicyTemplate) 
     
    513605                        outStream.println ("## Entrypoint Resource being customized"); 
    514606                        outStream.println (XML_PARAM_CLOSE); 
    515                         outStream.print ("template(`'"); 
     607                        outStream.print ("template(`"); 
    516608                        outStream.print (sCustomName); 
    517609                        outStream.println ("',`"); 
     
    519611                 
    520612                String sType = i_entryPoint.getType (); 
     613                String sIndent = null; 
    521614                if (m_bGeneratePolicyTemplate) 
     615                { 
    522616                        sType = "$1"; 
     617                        sIndent = SINGLE_INDENT; 
     618                } 
    523619                 
    524620                if (!m_bGeneratePolicyTemplate) 
     
    536632                } 
    537633 
    538                 // this call obtains the actual definition of the type 
    539                 m_linkage.MakeEntrypoint(sType, outStream); 
    540                 m_linkage.MakeFileType(sType, outStream); 
    541  
     634                if (m_bGeneratePolicyTemplate || !i_entryPoint.hasCustomization ()) 
     635                { 
     636                        // this call obtains the actual definition of the type 
     637                        MakeEntrypoint(sType, outStream, sIndent); 
     638                        MakeFileType(sType, outStream, sIndent); 
     639                } 
     640                 
    542641                if (m_bGeneratePolicyTemplate) 
    543642                { 
     
    567666 
    568667                // This gets all global interface calls in the verb 
    569                 callInterfaces(domain, i_access.GetInterfaces(), m_bufferPolicy); 
     668                callInterfaces(domain, i_access.GetInterfaces(), m_bufferPolicy, null); 
    570669 
    571670                // for each AccessDefn associated with this AccessResource bundle 
     
    575674                        BaseAccessDefn axxDefn = (BaseAccessDefn) accessDefns.next(); 
    576675 
    577                         callInterfaces(domain, axxDefn.GetAllInterfaces().values(), m_bufferPolicy); 
     676                        callInterfaces(domain, axxDefn.GetAllInterfaces().values(), m_bufferPolicy, null); 
    578677 
    579678                        // for each AccessTarget associated with this AccessDefn 
     
    587686                                { 
    588687                                        case Target.self: 
    589                                                 makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), m_bufferPolicy); 
     688                                                makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), m_bufferPolicy, null); 
    590689                                                break; 
    591690                                        case Target.other_read: 
     
    606705                                        { 
    607706                                                Component entry = (Component) iter4.next(); 
    608                                                 makeAllows(domain, entry, axxTarget.GetPermVectors(), m_bufferPolicy); 
     707                                                makeAllows(domain, entry, axxTarget.GetPermVectors(), m_bufferPolicy, null); 
    609708                                        } 
    610709                                } 
     
    648747                Resource resource = (Resource) i_access.getResource (); 
    649748                String sDomType = domain.getType (); 
     749                String sIndent = new String (); 
    650750                if (m_bGeneratePolicyTemplate) 
     751                { 
    651752                        sDomType = "$1"; 
     753                        sIndent = SINGLE_INDENT; 
     754                } 
    652755 
    653756                // for each AccessTarget associated with this AccessDefn 
     
    685788                        } 
    686789 
    687  
    688790                        Collection accessDefns = i_access.GetAccessDefns (rdef); 
    689791                        for (Iterator axxDefs = accessDefns.iterator (); axxDefs.hasNext (); ) 
    690                  
    691                 { 
    692                         AccessDefn axxDefn = (AccessDefn) axxDefs.next(); 
    693                         AccessDefnGroup axxGroup = axxDefn.getAccessDefnGroup (); 
    694                          
    695                         StringBuffer templateName = new StringBuffer(90); 
    696                         templateName.append("framework_"); 
    697                         templateName.append(axxGroup.getRdef().GetOutputName ()).append("_"); 
    698                         templateName.append(axxGroup.getName()).append("_"); 
    699                         templateName.append(axxDefn.getName()); 
    700  
    701                         if (!m_bGeneratePolicyTemplate && i_access.hasCustomization ()) 
    702                         { 
    703                                 templateName = new StringBuffer(sCustomName); 
    704                         } 
    705                         templateName.append("(").append(sDomType).append(","); 
    706                         String sResType = "$2"; 
    707                          
    708                         if (!m_bGeneratePolicyTemplate) 
    709                         { 
    710                                 if (resource instanceof ControlResource)  
    711                                 { 
    712                                         sResType = ((ControlResource)resource).getType(); 
    713                                 }  
    714                                 else  
    715                                 { 
    716                                         sResType = resource.GetTypeWithDictionaryObject(axxDefn.getAccessDefnGroup().getRdef().GetName()); 
    717                                 } 
    718                         } 
    719                         templateName.append(sResType).append(")"); 
    720                         outStream.println (templateName); 
    721                          
    722                         if (!(resource instanceof ControlResource)) 
    723                         { 
    724 //                              Rdef rdef = axxDefn.getAccessDefnGroup ().getRdef (); 
    725                                 if (rdef.GetSysResourceState (SystemResourceTypes.file) != SysResourceState.No) 
    726                                         generateParentSearchPerms (i_access.getDomain (), resource, false, outStream); 
    727     &