Changeset 2009
- Timestamp:
- 03/24/08 15:15:03 (8 months ago)
- Files:
-
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/FSysGenerator.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/custom/CPolicyRefresher.java (modified) (7 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/dictionary/Rdef.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/IDomain.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/translator/SELinuxPolicy.java (modified) (34 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java (modified) (14 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/CDSEditorActionConstants.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/action/AddCustomPolicy.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditor.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/FSysGenerator.java
r1949 r2009 13 13 14 14 import java.io.ByteArrayInputStream; 15 import java.io.InputStream;16 15 import java.util.Iterator; 17 16 import java.util.List; … … 52 51 } 53 52 54 public InputStream getData()53 public ByteArrayInputStream getData() 55 54 { 56 55 return new ByteArrayInputStream(toString().getBytes()); branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/custom/CPolicyRefresher.java
r2004 r2009 29 29 import com.tresys.framework.compiler.policy.Enter; 30 30 import com.tresys.framework.compiler.policy.EntrypointResource; 31 import com.tresys.framework.compiler.policy.IDomain; 31 32 import com.tresys.framework.compiler.policy.IPolicyVisitor; 32 33 import com.tresys.framework.compiler.policy.Policy; … … 34 35 import com.tresys.framework.compiler.policy.UserDomain; 35 36 36 public class CPolicyRefresher implements IPolicyVisitor 37 public class CPolicyRefresher 38 implements IPolicyVisitor 37 39 { 38 Set mKey; 39 StringBuffer mPrefix; 40 private final Set mKey; 41 private final String m_sModuleName; 42 private final String m_sPrefix; 40 43 41 public CPolicyRefresher (Set keyset, StringBuffer buffer)44 public CPolicyRefresher (Set keyset, String i_sPrefix, String i_sModuleName) 42 45 { 43 46 mKey = keyset; 44 mPrefix = buffer; 47 m_sModuleName = i_sModuleName; 48 m_sPrefix = i_sPrefix; 45 49 } 46 50 47 public void PostVisit(Policy i_policy) {48 }51 public void PostVisit(Policy i_policy) 52 {} 49 53 50 public void PreVisit(Policy i_policy) {51 }54 public void PreVisit(Policy i_policy) 55 {} 52 56 53 public void Visit(Ability i_ability) {54 }57 public void Visit(Ability i_ability) 58 {} 55 59 56 public void Visit(AccessBaseResource i_access) { 57 58 } 60 public void Visit(AccessBaseResource i_access) 61 {} 59 62 60 63 public void Visit(AccessBoolean i_access) 61 { 62 } 64 {} 63 65 64 66 public void Visit(AccessResource i_access) 65 67 { 66 //TODO::implement 67 System.out.println (i_access.GetNameToken ()); 68 IDomain domain = i_access.getDomain (); 69 Resource resource = (Resource) i_access.getResource (); 70 71 for (Iterator rdefitr = i_access.GetAccessRdefs ().iterator (); rdefitr.hasNext (); ) 72 { 73 Rdef rdef = (Rdef) rdefitr.next (); 74 75 StringBuffer sCustomName = new StringBuffer(50); 76 sCustomName.append (m_sPrefix).append ("access_"); 77 sCustomName.append (m_sModuleName).append ("_").append(domain.getOutputName ()); 78 sCustomName.append ("_").append(resource.getOutputName ()).append("_").append(rdef.GetOutputName()); 79 80 if (mKey.contains(sCustomName.toString ())) 81 i_access.markCustomized(); 82 else 83 i_access.removeCustomization(); 84 85 } 68 86 } 69 87 70 88 public void Visit(BaseDomain domain) 71 { 72 } 89 {} 73 90 74 91 public void Visit(BaseResource resource) 75 { 76 } 92 {} 77 93 78 94 public void Visit(Comment i_comment) 79 { 80 } 95 {} 81 96 82 97 public void Visit(Conditional i_conditional) 83 { 84 } 98 {} 85 99 86 100 public void Visit(ControlResource i_resource) … … 91 105 public void Visit(Domain i_domain) 92 106 { 93 String name = m Prefix + "_" + i_domain.getName ();107 String name = m_sPrefix + m_sModuleName + "_" + i_domain.getOutputName (); 94 108 boolean state = mKey.contains(name); 95 109 if( state ) … … 102 116 { 103 117 //TODO::implement 104 boolean state = mKey.contains(i_enter.getEndDomain().get Name());118 boolean state = mKey.contains(i_enter.getEndDomain().getOutputName()); 105 119 if( state ) 106 120 i_enter.markCustomized(); … … 112 126 { 113 127 //TODO::implement 114 boolean state = mKey.contains(point.get Name());128 boolean state = mKey.contains(point.getOutputName()); 115 129 if( state ) 116 130 point.markCustomized(); … … 130 144 { 131 145 Rdef rdef = (Rdef) itr.next(); 132 StringBuffer temp = new StringBuffer(mPrefix); 146 StringBuffer temp = new StringBuffer(100); 147 temp.append (m_sPrefix); 148 temp.append (m_sModuleName); 133 149 temp.append("_"); 134 temp.append(i_resource.get Name ());150 temp.append(i_resource.getOutputName ()); 135 151 temp.append("_"); 136 152 temp.append(rdef.GetOutputName()); … … 142 158 143 159 int size = 0; 144 for (Iterator itr = template_names.iterator(); itr.hasNext();)160 for (Iterator itr = template_names.iterator(); itr.hasNext();) 145 161 { 146 162 StringBuffer sb = (StringBuffer)itr.next(); 147 if ( mKey.contains(sb.toString()))163 if (mKey.contains(sb.toString())) 148 164 ++size; 149 165 } 150 166 151 if ( size == template_names.size())167 if (size == template_names.size()) 152 168 i_resource.markCustomized(); 153 169 else branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/dictionary/Rdef.java
r1949 r2009 189 189 public boolean AddToAllSelf (PermVector map) 190 190 { 191 // add if t evector association hasnt been previously defined191 // add if the vector association hasn't been previously defined 192 192 if (accessAllSelf.containsKey (map.getObjectClass ())) 193 193 { branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java
r1991 r2009 184 184 else 185 185 { 186 m_sType = parent.get Name().replaceAll("\\.", "_") + "_" + m_subName + "_t";186 m_sType = parent.getOutputName() + "_" + m_subName + "_t"; 187 187 } 188 188 } … … 295 295 return parent.getName() + "." + m_subName; 296 296 return m_subName; 297 } 298 299 /** 300 * get name in a way that is safe to use in an interface/template name 301 * @return 302 */ 303 public String getOutputName () 304 { 305 return getName ().replaceAll("\\.", "_"); 297 306 } 298 307 branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/IDomain.java
r1989 r2009 71 71 72 72 public String getName(); 73 public String getOutputName (); 73 74 74 75 public String getSubName(); branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/translator/SELinuxPolicy.java
r2004 r2009 93 93 implements IPolicyVisitor 94 94 { 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 95 private final static String XML_START = "##############################################"; 96 private final static String XML_SUMMARY_OPEN = "## <summary>"; 97 private final static String XML_SUMMARY_CLOSE = "## </summary>"; 98 private final static String XML_PARAM_OPEN = "## <param name = "; 99 private final static String XML_PARAM_CLOSE = "## </param>"; 100 101 public final static String CUSTOM_PREFIX = "cds_custom_"; 102 106 103 private final Linkage m_linkage; 107 104 private final boolean m_bGeneratePolicyTemplate; … … 110 107 private boolean m_errorEncountered = false; 111 108 112 private final String m_moduleName; 113 private final String mCPolicyMacroPrefix; 109 private final String m_sModuleName; 114 110 115 111 final private ByteArrayOutputStream m_dataPolicy = new ByteArrayOutputStream (); … … 125 121 private TreeSet/*<String>*/m_dirPermSet = new TreeSet/*<String>*/(); 126 122 127 public SELinuxPolicy (Linkage _linkage, String _moduleName, File fcFile)123 public SELinuxPolicy (Linkage _linkage, String i_sModuleName, File fcFile) 128 124 { 129 125 m_linkage = _linkage; 130 m_ moduleName = _moduleName;126 m_sModuleName = i_sModuleName; 131 127 m_hasFileContext = false; 132 128 m_bGeneratePolicyTemplate = false; 133 mCPolicyMacroPrefix = null;134 129 135 130 if(fcFile != null && fcFile.exists()) … … 141 136 } 142 137 143 public SELinuxPolicy (Linkage i_linkage, boolean i_bGenerateTemplates, String prefix)138 public SELinuxPolicy (Linkage i_linkage, boolean i_bGenerateTemplates, String i_sModuleName) 144 139 { 145 140 m_linkage = i_linkage; 146 141 m_bGeneratePolicyTemplate = i_bGenerateTemplates; 147 m_moduleName = "template"; 148 mCPolicyMacroPrefix = prefix; 149 } 150 142 m_sModuleName = i_sModuleName; 143 } 151 144 152 145 protected void finalize () … … 201 194 202 195 m_bufferPolicy.print("# SEFramework policy output\n"); 203 m_linkage.InitPolicy(m_bufferPolicy, m_ moduleName);196 m_linkage.InitPolicy(m_bufferPolicy, m_sModuleName); 204 197 m_bufferPolicy.print("# These types are generated by the framework for internal use\n"); 205 198 … … 228 221 229 222 // String sCustomName = "customize_" + i_resource.getName () + "_" + rdef.GetOutputName(); 230 String sCustomName = mCPolicyMacroPrefix + "_" + i_resource.getName () + "_" + rdef.GetOutputName();223 String sCustomName = CUSTOM_PREFIX + m_sModuleName + "_" + i_resource.getOutputName () + "_" + rdef.GetOutputName(); 231 224 232 225 if (m_bGeneratePolicyTemplate) 233 226 { 234 227 outStream = m_bufferInterfaces; 235 StringBuffer buffer = new StringBuffer(200); 236 outStream.println(); 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); 228 outStream.println (); 229 outStream.println (XML_START); 230 outStream.println (XML_SUMMARY_OPEN); 231 outStream.println ("## Customization for resource " + i_resource.getName ()); 232 outStream.println (XML_SUMMARY_CLOSE); 233 outStream.print (XML_PARAM_OPEN); 234 outStream.println ("'resource'>"); 235 outStream.println ("## Type of resource being customized"); 236 outStream.println (XML_PARAM_CLOSE); 237 outStream.println (); 238 outStream.println ("template(`" + sCustomName + "',`"); 248 239 } 249 240 … … 290 281 PrintStream outStream = m_bufferPolicy; 291 282 283 String sCustomName = CUSTOM_PREFIX + m_sModuleName + "_" + i_domain.getOutputName (); 292 284 if (m_bGeneratePolicyTemplate) 293 285 { 294 286 outStream = m_bufferInterfaces; 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); 287 outStream.println (); 288 outStream.println (XML_START); 289 outStream.println (XML_SUMMARY_OPEN); 290 outStream.println ("## Customization for domain " + i_domain.getName ()); 291 outStream.println (XML_SUMMARY_CLOSE); 292 outStream.print (XML_PARAM_OPEN); 293 outStream.println ("'domain'>"); 294 outStream.println ("## Type for domain being customized"); 295 outStream.println (XML_PARAM_CLOSE); 296 outStream.println (); 297 outStream.println ("template(`" + sCustomName + "',`"); 311 298 } 312 299 … … 324 311 if (!m_bGeneratePolicyTemplate && i_domain.hasCustomization ()) 325 312 { 326 String sCustomName = mCPolicyMacroPrefix + i_domain.getName () + "(" + sType + ")"; 327 outStream.println (sCustomName); 313 outStream.print (sCustomName); 314 outStream.print ("("); 315 outStream.print (sType); 316 outStream.println (")"); 328 317 } 329 318 … … 331 320 { 332 321 m_linkage.MakeDomain (sType, outStream); 333 StringBuffer buffer = new StringBuffer(200); 334 OutputAbilities (i_domain, buffer); 335 outStream.print(buffer); 322 OutputAbilities (i_domain, outStream); 336 323 } 337 324 … … 407 394 if (i_domain.GetChildren().size() > 0) 408 395 { 409 StringBuffer buffer = new StringBuffer(100); 410 makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), buffer); 411 outStream.print(buffer); 396 makeAllowsOnSelf(i_domain, rdef.getAccessAllResource(), outStream); 412 397 } 413 398 } … … 514 499 PrintStream outStream = m_bufferPolicy; 515 500 516 if (!m_bGeneratePolicyTemplate && i_entryPoint.hasCustomization ()) 517 { 518 String buffer = mCPolicyMacroPrefix + i_entryPoint.getName () + "(" + i_entryPoint.getType () + ")"; 519 outStream.println (buffer); 520 return; 521 } 522 501 String sCustomName = CUSTOM_PREFIX + m_sModuleName + i_entryPoint.getOutputName (); 502 523 503 if (m_bGeneratePolicyTemplate) 524 504 { 525 505 outStream = m_bufferInterfaces; 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); 506 outStream.println (); 507 outStream.println (XML_START); 508 outStream.println (XML_SUMMARY_OPEN); 509 outStream.println ("## Customization for entrypoint " + i_entryPoint.getName ()); 510 outStream.println (XML_SUMMARY_CLOSE); 511 outStream.print (XML_PARAM_OPEN); 512 outStream.println ("'entrypoint'>"); 513 outStream.println ("## Entrypoint Resource being customized"); 514 outStream.println (XML_PARAM_CLOSE); 515 outStream.print ("template(`'"); 516 outStream.print (sCustomName); 517 outStream.println ("',`"); 540 518 } 541 519 … … 549 527 m_bufferPolicy.println("type " + sType + ";"); 550 528 } 551 529 530 if (!m_bGeneratePolicyTemplate && i_entryPoint.hasCustomization ()) 531 { 532 outStream.print (sCustomName); 533 outStream.print ("("); 534 outStream.print (i_entryPoint.getType ()); 535 outStream.println (")"); 536 } 537 552 538 // this call obtains the actual definition of the type 553 539 m_linkage.MakeEntrypoint(sType, outStream); … … 563 549 { 564 550 boolean isBoolean = false; 565 StringBuffer buffer = new StringBuffer(200);551 566 552 if(i_access.getBool () != null) 567 553 { 568 buffer.append("if(").append(i_access.getBool().image).append(") {");554 m_bufferPolicy.println ("if(" + i_access.getBool().image + ") {"); 569 555 570 556 isBoolean = true; 571 557 if (i_access.getOnOrOff ().booleanValue () == false) 572 buffer.append("} else {");573 } 574 575 buffer.append("# CDSFramework access (domain baseresource verb): ");576 buffer.append(i_access.toString().replace(Utility.DELIM, ' '));558 m_bufferPolicy.println ("} else {"); 559 } 560 561 m_bufferPolicy.print("# CDSFramework access (domain baseresource verb): "); 562 m_bufferPolicy.println (i_access.toString().replace(Utility.DELIM, ' ')); 577 563 578 564 IDomain domain = i_access.getDomain(); … … 581 567 582 568 // This gets all global interface calls in the verb 583 callInterfaces(domain, i_access.GetInterfaces(), buffer);569 callInterfaces(domain, i_access.GetInterfaces(), m_bufferPolicy); 584 570 585 571 // for each AccessDefn associated with this AccessResource bundle … … 589 575 BaseAccessDefn axxDefn = (BaseAccessDefn) accessDefns.next(); 590 576 591 callInterfaces(domain, axxDefn.GetAllInterfaces().values(), buffer);577 callInterfaces(domain, axxDefn.GetAllInterfaces().values(), m_bufferPolicy); 592 578 593 579 // for each AccessTarget associated with this AccessDefn … … 601 587 { 602 588 case Target.self: 603 makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), buffer);589 makeAllowsOnSelf(domain, axxTarget.GetPermVectors(), m_bufferPolicy); 604 590 break; 605 591 case Target.other_read: … … 620 606 { 621 607 Component entry = (Component) iter4.next(); 622 makeAllows(domain, entry, axxTarget.GetPermVectors(), buffer);608 makeAllows(domain, entry, axxTarget.GetPermVectors(), m_bufferPolicy); 623 609 } 624 610 } … … 626 612 } 627 613 628 if(isBoolean) 629 { 630 buffer.append ("}"); 631 buffer.append (NEWLINE); 632 } 633 m_bufferPolicy.print (buffer); 614 if (isBoolean) 615 { 616 m_bufferPolicy.println ("}"); 617 } 634 618 } 635 619 … … 678 662 679 663 StringBuffer sCustomName = new StringBuffer(50); 680 sCustomName.append( mCPolicyMacroPrefix).append(domain.getName ());681 sCustomName.append("_").append(resource.get Name ()).append("_").append(rdef.GetOutputName());664 sCustomName.append(CUSTOM_PREFIX).append ("access_").append (m_sModuleName).append ("_").append(domain.getOutputName ()); 665 sCustomName.append("_").append(resource.getOutputName ()).append("_").append(rdef.GetOutputName()); 682 666 683 667 if (m_bGeneratePolicyTemplate) 684 668 { 685 669 outStream = m_bufferInterfaces; 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); 670 outStream.println (); 671 outStream.println (XML_START); 672 outStream.println (XML_SUMMARY_OPEN); 673 outStream.print ("## Customization for access domain: " + domain.getName () + " resource: "); 674 outStream.println (resource.getName () + " rdef: " + rdef.GetOutputName()); 675 outStream.println (XML_SUMMARY_CLOSE); 676 outStream.print (XML_PARAM_OPEN); 677 outStream.println ("'domain'>"); 678 outStream.println ("## Domain accessing resource"); 679 outStream.println (XML_PARAM_CLOSE); 680 outStream.print (XML_PARAM_OPEN); 681 outStream.println ("'resource'>"); 682 outStream.println ("## Resource being accessed"); 683 outStream.println (XML_PARAM_CLOSE); 684 outStream.println ("template(`" + sCustomName + "',`"); 702 685 } 703 686 … … 740 723 { 741 724 // Rdef rdef = axxDefn.getAccessDefnGroup ().getRdef (); 742 StringBuffer buffer = new StringBuffer(100);743 725 if (rdef.GetSysResourceState (SystemResourceTypes.file) != SysResourceState.No) 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); 726 generateParentSearchPerms (i_access.getDomain (), resource, false, outStream); 727 } 728 729 730 // Create the perms for other 731 for (Iterator iter2 = axxDefn.getAccessTargets().values().iterator(); iter2.hasNext(); ) 732 { 733 AccessTarget axxTarget = (AccessTarget) iter2.next(); 734 Integer /*Target*/target = axxTarget.getTargetName(); 735 Map accesses = null; 736 switch(target.intValue()) 737 { 738 case Target.other_read: 739 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.read); 740 break; 741 case Target.other_write: 742 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.write); 743 break; 744 case Target.other_readwrite: 745 accesses = ((Resource)i_access.getResource()).GetAccessMap(Verb.readwrite); 746 break; 747 } 748 749 if (accesses != null) 750 { 751 for (Iterator iter3 = accesses.keySet().iterator(); iter3.hasNext(); ) 752 { 753 Component entry = (Component) iter3.next(); 754 makeAllows(i_access.getDomain(), entry, axxTarget.GetPermVectors(), outStream); 755 } 756 } 780 757 } 781 758 … … 841 818 public void Visit (BaseDomain domain) 842 819 { 843 StringBuffer buffer = new StringBuffer(70); 844 buffer.append("optional_policy(`"); 845 buffer.append("\tgen_require(`"); 846 buffer.append("\t\ttype ").append(domain.getType()).append(";"); 847 buffer.append("\t\trole ").append(domain.getRole()).append(";"); 848 buffer.append("\t')"); 820 m_bufferPolicy.println ("optional_policy(`"); 821 m_bufferPolicy.println ("\tgen_require(`"); 822 m_bufferPolicy.println ("\t\ttype " + domain.getType() + ";"); 823 m_bufferPolicy.println ("\t\trole " + domain.getRole() + ";"); 824 m_bufferPolicy.println ("\t')"); 849 825 850 OutputAbilities (domain, buffer);851 buffer.append(NEWLINE).append("')");852 m_bufferPolicy.println(buffer);826 OutputAbilities (domain, m_bufferPolicy); 827 m_bufferPolicy.println (); 828 m_bufferPolicy.println ("')"); 853 829 } 854 830 … … 868 844 { 869 845 m_linkage.MakeUserDomain (dom.getName (), m_bufferPolicy); 870 StringBuffer buffer = new StringBuffer(100); 871 OutputAbilities (dom, buffer); 872 m_bufferPolicy.print(buffer); 846 OutputAbilities (dom, m_bufferPolicy); 873 847 } 874 848 … … 885 859 } 886 860 887 private void OutputAbilities (IDomain i_domain, StringBuffer buffer)861 private void OutputAbilities (IDomain i_domain, PrintStream i_outputStream) 888 862 { 889 863 for (Iterator itr = i_domain.getAbilities().values().iterator(); itr.hasNext(); ) 890 864 { 891 865 Ability ability = (Ability) itr.next(); 892 buffer.append("#Framework ability: ").append(ability.getName()).append("\n"); 893 makeAllowsOnSelf (i_domain, ability.GetPermVectors(), buffer); 894 callInterfaces (i_domain, ability.getAllInterfaces().values(), buffer); 895 buffer.append("#End of Framework ability: ").append(ability.getName()).append("\n"); 896 } 897 } 898 899 private void callInterfaces(IDomain domain, Collection interfaces, StringBuffer buffer) 866 i_outputStream.print ("#Framework ability: "); 867 i_outputStream.println (ability.getName()); 868 makeAllowsOnSelf (i_domain, ability.GetPermVectors(), i_outputStream); 869 callInterfaces (i_domain, ability.getAllInterfaces().values(), i_outputStream); 870 i_outputStream.print ("#End of Framework ability: "); 871 i_outputStream.println (ability.getName()); 872 } 873 } 874 875 private void callInterfaces(IDomain domain, Collection interfaces, PrintStream stream) 900 876 { 901 877 if (interfaces == null) … … 910 886 { 911 887 Interface currInterface = (Interface) interfaceItr.next(); 912 buffer.append(currInterface.getName()).append("("); 888 stream.prin
