Changeset 2025
- Timestamp:
- 04/01/08 09:03:55 (8 months ago)
- Files:
-
- branches/custome_policy/framework-plugin/.project (modified) (1 diff)
- branches/custome_policy/framework-plugin/.settings/org.eclipse.jdt.ui.prefs (modified) (1 diff)
- branches/custome_policy/framework-plugin/plugin.xml (modified) (2 diffs)
- branches/custome_policy/framework-plugin/resources/dictionary/dictionary.fdic (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/ErrorHandler.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/PolicyGenerator.java (modified) (14 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/mls/MLSSupport.java (modified) (4 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/ComponentWithDictObjects.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Enter.java (modified) (11 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java (modified) (8 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/PolicyParser.jj (modified) (10 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/PolicyValidator.java (modified) (4 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/SystemResourceValidator.java (modified) (11 diffs, 1 prop)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/systemResources/SystemResourcesParser.jj (modified) (3 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/actions/Messages.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/actions/ToggleBackflowArrowsAction.java (copied) (copied from trunk/framework-plugin/src/com/tresys/framework/plugin/actions/ToggleBackflowArrowsAction.java)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/actions/ToggleMLSColorAction.java (copied) (copied from trunk/framework-plugin/src/com/tresys/framework/plugin/actions/ToggleMLSColorAction.java)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/actions/messages.properties (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/AccessCheckBuilder.java (modified) (21 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkBuilder.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java (modified) (4 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java (modified) (7 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/builder/messages.properties (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditor.java (modified) (11 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditorActionBarContributor.java (modified) (3 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/Messages.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/messages.properties (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ControlResourceShape.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/EntryConnection.java (modified) (4 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/EntryPointShape.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ResourceShape.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/Shape.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/UserDomainShape.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/AccessEditPart.java (modified) (9 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyEditPart.java (modified) (9 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/editor/properties/ComboFieldEditor.java (modified) (2 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/preferences/GraphicEditorPreferences.java (modified) (4 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/preferences/Messages.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/preferences/PreferenceInitializer.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/preferences/messages.properties (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/views/action/TranslateSystem.java (modified) (1 diff)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/views/properties/PolicyPropertySorter.java (modified) (3 diffs)
- branches/custome_policy/framework-plugin/src/com/tresys/framework/plugin/wizards/shape/ResourceShapePropertyPage.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/custome_policy/framework-plugin/.project
r1542 r2025 4 4 <comment>JavaCC Nature</comment> 5 5 <projects> 6 <project>libselinuxjava</project> 6 7 </projects> 7 8 <buildSpec> branches/custome_policy/framework-plugin/.settings/org.eclipse.jdt.ui.prefs
r1989 r2025 1 # Mon Mar 03 14:34:58 EST 20081 #Thu Mar 13 15:53:52 EDT 2008 2 2 eclipse.preferences.version=1 3 3 formatter_profile=_Project Format branches/custome_policy/framework-plugin/plugin.xml
r1989 r2025 328 328 name="%MLSSettingsProperties" 329 329 objectClass="org.eclipse.core.resources.IProject"> 330 <filter 331 name="nature" 332 value="com.tresys.cdsframework.FrameworkNature"> 333 </filter> 330 334 </page> 331 335 </extension> … … 536 540 id="com.tresys.slide.perspective"> 537 541 </perspectiveShortcut> 542 <view 543 closeable="true" 544 id="com.tresys.slide.plugin.views.PolicyExplorerView" 545 minimized="false" 546 moveable="true" 547 relationship="stack" 548 relative="com.tresys.cdsframework.plugin.views.navigator.FrameworkNavigator" 549 showTitle="true" 550 standalone="false" 551 visible="false"> 552 </view> 538 553 </perspectiveExtension> 539 554 </extension> branches/custome_policy/framework-plugin/resources/dictionary/dictionary.fdic
r1989 r2025 75 75 } 76 76 } 77 new78 [desc : "Create new file or directory in directory w/type transition"]79 {80 resource {81 dir { read getattr lock search ioctl add_name remove_name write }82 file { create }83 lnk_file { create }84 }85 transition {86 dir87 file88 lnk_file89 }90 }77 # new 78 # [desc : "Create new file or directory in directory w/type transition"] 79 # { 80 # resource { 81 # dir { read getattr lock search ioctl add_name remove_name write } 82 # file { create } 83 # lnk_file { create } 84 # } 85 # transition { 86 # dir 87 # file 88 # lnk_file 89 # } 90 # } 91 91 } 92 92 } … … 98 98 owner { 99 99 resource { 100 file { append getattr ioctl link lock read rename setattr unlink write }101 lnk_file { append getattr ioctl link lock read rename setattr unlink write }100 file { append create getattr ioctl link lock read rename setattr unlink write } 101 lnk_file { append create getattr ioctl link lock read rename setattr unlink write } 102 102 } 103 103 } branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/ErrorHandler.java
r1989 r2025 28 28 static final public int ERROR_INVALID_ACCESS = 19; 29 29 static final public int ERROR_BOOLEAN_WRAP = 20; 30 static final public int ERROR_MISSING_DIRECTORY = 21;31 static final public int ERROR_MISSING_NETWORK = 22;32 static final public int ERROR_MISSING_ENTER = 23;33 30 static final public int ERROR_DOMAIN_HAS_CHILDREN_AND_RDEF = 24; 34 31 static final public int ERROR_UNDEFINED_COMPONENT = 25; 35 32 static final public int ERROR_NO_PARENT_PATH = 26; 36 33 static final public int ERROR_RDEF_NOT_DEFINED = 27; 37 static final public int ERROR_ENTRYPOINT_MISSING_FILE = 28;38 34 static final public int ERROR_DUPLICATE_ACCESS = 29; 39 35 static final public int ERROR_UNABLE_TO_GET_TYPE_FROM_PATH = 30; … … 42 38 static final public int ERROR_CONSTRAINT_ACCESS_DENIED = 32; 43 39 static final public int ERROR_RBAC_ACCESS_DENIED = 33; 40 41 static final public int ERROR_MISSING_DIRECTORY = 40; 42 static final public int ERROR_DUPLICATE_DIRECTORY = 41; 43 static final public int ERROR_MISSING_FILE = 42; 44 static final public int ERROR_DUPLICATE_FILE = 43; 45 static final public int ERROR_MISSING_ENTER = 44; 46 static final public int ERROR_DUPLICATE_ENTER_PATH = 45; 47 static final public int ERROR_ENTRYPOINT_MISSING_FILE = 45; 48 static final public int ERROR_MISSING_NETWORK = 49; 44 49 45 50 protected int warningCount = 0; branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/PolicyGenerator.java
r1989 r2025 47 47 private StringBuffer m_bufConnection; 48 48 49 private static char newLine = '\n';49 private static String newLine = System.getProperty("line.separator"); 50 50 51 51 public PolicyGenerator() … … 58 58 public void Visit(Resource i_resource) 59 59 { 60 StringBuffer buf = new StringBuffer( );60 StringBuffer buf = new StringBuffer(150); 61 61 buf.append("resource " + i_resource.getName()); 62 62 … … 86 86 public void Visit(Domain i_domain) 87 87 { 88 StringBuffer buf = new StringBuffer( );88 StringBuffer buf = new StringBuffer(150); 89 89 buf.append("domain " + i_domain.getName()); 90 90 … … 131 131 public void Visit(EntrypointResource i_ep) 132 132 { 133 StringBuffer buf = new StringBuffer( );133 StringBuffer buf = new StringBuffer(100); 134 134 135 135 buf.append("entrypoint "); … … 146 146 public void Visit(AccessResource i_access) 147 147 { 148 StringBuffer buf = new StringBuffer( );148 StringBuffer buf = new StringBuffer(150); 149 149 150 150 AbstractToken bool = i_access.getBool(); … … 195 195 public void Visit(AccessBaseResource i_access) 196 196 { 197 StringBuffer buf = new StringBuffer( );197 StringBuffer buf = new StringBuffer(100); 198 198 199 199 AbstractToken bool = i_access.getBool(); … … 242 242 public void Visit(BaseDomain i_baseDomain) 243 243 { 244 StringBuffer buf = new StringBuffer( );244 StringBuffer buf = new StringBuffer(50); 245 245 246 246 buf.append("basedomain " + i_baseDomain.getName()); … … 254 254 public void Visit(UserDomain i_userDom) 255 255 { 256 StringBuffer buf = new StringBuffer( );256 StringBuffer buf = new StringBuffer(50); 257 257 258 258 buf.append("userdomain " + i_userDom.getName()); … … 283 283 public void Visit(BaseResource i_baseResource) 284 284 { 285 StringBuffer buf = new StringBuffer( );285 StringBuffer buf = new StringBuffer(50); 286 286 287 287 buf.append("baseresource " + i_baseResource.getName()); … … 297 297 public void Visit(Enter i_enter) 298 298 { 299 StringBuffer buf = new StringBuffer( );299 StringBuffer buf = new StringBuffer(150); 300 300 301 301 AbstractToken bool = i_enter.getBool(); … … 313 313 } 314 314 315 Set entryAccessDefns = i_enter.GetEntryAccessDefns(); 316 String sEntryAccessDefinitions = ""; 317 for (Iterator itr = entryAccessDefns.iterator(); itr.hasNext(); ) 318 { 319 EntryAccessDefn entryAccessDefn = (EntryAccessDefn) itr.next(); 320 sEntryAccessDefinitions += entryAccessDefn.getName () + " "; 321 } 322 323 if (sEntryAccessDefinitions.length() > 0) 324 sEntryAccessDefinitions = " { " + sEntryAccessDefinitions + "}"; 315 StringBuffer sEntryAccessDefinitions = new StringBuffer (); 316 if (!i_enter.usesDefaults ()) 317 { 318 Set entryAccessDefns = i_enter.GetEntryAccessDefns(); 319 for (Iterator itr = entryAccessDefns.iterator(); itr.hasNext(); ) 320 { 321 EntryAccessDefn entryAccessDefn = (EntryAccessDefn) itr.next(); 322 sEntryAccessDefinitions.append (entryAccessDefn.getName ()).append (" "); 323 } 324 325 if (sEntryAccessDefinitions.length() > 0) 326 { 327 sEntryAccessDefinitions.insert (0, " { "); 328 sEntryAccessDefinitions.append ("}"); 329 } 330 } 325 331 326 332 buf.append("enter "); … … 330 336 buf.append(" "); 331 337 buf.append(i_enter.getEntryPoint().getName()); 332 buf.append(sEntryAccessDefinitions );338 buf.append(sEntryAccessDefinitions.toString ()); 333 339 buf.append(";"); 334 340 … … 359 365 public void Visit(Conditional i_conditional) 360 366 { 361 StringBuffer buf = new StringBuffer( );367 StringBuffer buf = new StringBuffer(50); 362 368 363 369 buf.append("boolean "); … … 375 381 public void Visit(ControlResource i_resource) 376 382 { 377 StringBuffer buf = new StringBuffer( );383 StringBuffer buf = new StringBuffer(50); 378 384 Rdef rdef = i_resource.getRdef(); 379 385 if (rdef == null) branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/mls/MLSSupport.java
r1989 r2025 21 21 package com.tresys.framework.compiler.mls; 22 22 23 import java.io.ByteArrayOutputStream; 23 24 import java.io.File; 24 25 import java.io.FileInputStream; 26 import java.io.FileNotFoundException; 25 27 import java.io.FileOutputStream; 26 28 import java.io.IOException; 27 29 import java.io.InputStream; 30 import java.io.PrintStream; 28 31 import java.util.Collection; 29 32 import java.util.Enumeration; … … 68 71 { 69 72 73 public static final String MLS_SystemHigh = "mls_systemhigh"; 74 public static final String MLS_SystemLow = "mls_systemlow"; 75 70 76 private static final String MLS_ELEMENT_NAME = "mls"; 71 77 72 78 private static final String LEVEL_ELEMENT_NAME = "level"; 73 74 private static final String DEFAULT_MLS_SYSTEM_HIGH_RANGE = "mls_systemhigh";75 76 private static final String DEFAULT_MLS_SYSTEM_LOW_RANGE = "mls_systemlow";77 79 78 80 private static final String DEFAULT_MLS_HIGH_COLOR_VALUE = "0xff0000"; … … 137 139 _file = new File(fileName); 138 140 139 MLSLevel mls = new MLSLevel(DEFAULT_MLS_LOW_LEVEL_NAME, DEFAULT_MLS_SYSTEM_LOW_RANGE);141 MLSLevel mls = new MLSLevel(DEFAULT_MLS_LOW_LEVEL_NAME, MLS_SystemLow); 140 142 mls.setColor (DEFAULT_MLS_LOW_COLOR_VALUE); 141 143 mls.setOrder (this.size ()); 142 144 this.add (mls); 143 145 144 mls = new MLSLevel(DEFAULT_MLS_HIGH_LEVEL_NAME, DEFAULT_MLS_SYSTEM_HIGH_RANGE);146 mls = new MLSLevel(DEFAULT_MLS_HIGH_LEVEL_NAME, MLS_SystemHigh); 145 147 mls.setColor (DEFAULT_MLS_HIGH_COLOR_VALUE); 146 148 mls.setOrder (this.size ()); … … 298 300 299 301 /** 302 * Generate the setrans.conf file from the MLSSupport 303 * @param i_nNumSensitivites - max number of sensitivities that are available 304 * @param i_nNumCategories - max number of categories that are available 305 * @throws FileNotFoundException 306 */ 307 public ByteArrayOutputStream generateSETransConf (Integer i_nNumSensitivites, Integer i_nNumCategories) 308 { 309 ByteArrayOutputStream outStream = new ByteArrayOutputStream (); 310 311 PrintStream output = new PrintStream (outStream); 312 313 output.println ("#"); 314 output.println ("# Multi-Category Security translation table for SELinux"); 315 output.println ("#"); 316 output.println ("# This file was generated by CDS Framework from the settings in the MLS project property sheet"); 317 output.println ("#"); 318 output.println ("# Uncomment the following to disable translation library"); 319 output.println ("# disable=1"); 320 output.println ("#"); 321 322 for (Iterator itr = iterator (); itr.hasNext (); ) 323 { 324 MLSLevel level = (MLSLevel) itr.next (); 325 String sRange = level.getRange (); 326 String sName = level.getName (); 327 328 output.print (fixSensitivity (sRange, i_nNumSensitivites, i_nNumCategories)); 329 output.print ('='); 330 output.println (sName); 331 } 332 output.flush (); 333 334 return outStream; 335 } 336 337 /** 338 * Return the real MLS/MCS sensitivity based on the one passed in at the max numbers 339 * @param i_sSensitivity - sensitivity string mls_systemlow, mls_systemhigh, 340 * @param i_nNumSensitivites - max number of sensitivities that are available 341 * @param i_nNumCategories - max number of categories that are available 342 * @return string converted to real sensitivity 343 */ 344 public static final String fixSensitivity (String i_sSensitivity, Integer i_nNumSensitivites, Integer i_nNumCategories) 345 { 346 StringBuffer sResult = new StringBuffer (i_sSensitivity); 347 if (i_nNumCategories != null && i_nNumSensitivites != null) 348 { 349 if (MLS_SystemHigh.equals (i_sSensitivity)) 350 { 351 sResult = new StringBuffer (25); 352 sResult.append ("s").append (Math.max (0, i_nNumSensitivites.intValue () -1)); 353 sResult.append (":c0.c").append (Math.max (0, i_nNumCategories.intValue () -1)); 354 } 355 else if (MLS_SystemLow.equals (i_sSensitivity)) 356 { 357 sResult = new StringBuffer ("s0"); 358 } 359 } 360 else if (i_nNumCategories != null) 361 { 362 sResult = new StringBuffer ("s0"); 363 if (MLS_SystemHigh.equals (i_sSensitivity)) 364 { 365 sResult.append (":c0.c").append (Math.max (0, i_nNumCategories.intValue () -1)); 366 } 367 } 368 return sResult.toString (); 369 } 370 371 /** 300 372 * getNames 301 373 * branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/ComponentWithDictObjects.java
r1995 r2025 44 44 implements IMLSSetting, ICustomPolicy 45 45 { 46 pr otectedfinal Map/*<String, Rdef>*/assocRdefs; // associated rdefs47 48 pr otectedfinal Map/*<Rdef, Token>*/assocRdefsLocations; // associated Rdef locations49 50 pr otectedfinal Map/*<IDictionaryObject, List<SystemResource>>*/sysResources; // associated system resources51 52 pr otectedMLSLevel m_MLSLevel = null;46 private final Map/*<String, Rdef>*/assocRdefs; // associated rdefs 47 48 private final Map/*<Rdef, Token>*/assocRdefsLocations; // associated Rdef locations 49 50 private final Map/*<IDictionaryObject, List<SystemResource>>*/sysResources; // associated system resources 51 52 private MLSLevel m_MLSLevel = null; 53 53 54 54 /** branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Enter.java
r1991 r2025 55 55 * The individual entrypoint accesses that will combine to form the enter. 56 56 */ 57 private Set/*<EntryAccessDefn>*/m_accessDefs; 58 59 private boolean m_usesDefault; 57 private final Set/*<EntryAccessDefn>*/m_accessDefs = new TreeSet (); 60 58 61 59 protected final AbstractToken m_token; … … 74 72 */ 75 73 public Enter(IDomain i_start, Domain i_end, EntrypointResource i_ep, 76 AbstractToken i_token, AbstractToken i_bool, Boolean i_activeOnBool) { 74 AbstractToken i_token, AbstractToken i_bool, Boolean i_activeOnBool) 75 { 77 76 m_domain_start = i_start; 78 77 m_domain_end = i_end; 79 78 m_entrypoint_resource = i_ep; 80 79 m_token = i_token; 81 m_usesDefault = true; 82 m_accessDefs = i_ep.EPDictDef.GetDefaultAccessDefns(); 80 m_accessDefs.addAll (i_ep.EPDictDef.GetDefaultAccessDefns()); 83 81 m_bool = i_bool; 84 82 m_onOrOff = i_activeOnBool; … … 91 89 * keyed by name 92 90 */ 93 public Set /*<EntryAccessDefn>*/GetEntryAccessDefns() { 91 public Set /*<EntryAccessDefn>*/GetEntryAccessDefns() 92 { 94 93 return m_accessDefs; 95 94 } … … 112 111 * <code>false</code> otherwise 113 112 */ 114 public boolean AddEntryAccessDefn(EntryAccessDefn i_defn) { 115 if(m_usesDefault) { 116 m_accessDefs = new TreeSet/*<EntryAccessDefn>*/(); 117 m_usesDefault = false; 118 } 113 public boolean AddEntryAccessDefn(EntryAccessDefn i_defn) 114 { 119 115 return m_accessDefs.add(i_defn); 120 116 } … … 125 121 } 126 122 123 public void ClearEntryAccessDefns () 124 { 125 m_accessDefs.clear (); 126 } 127 127 128 128 /** … … 131 131 * @return String representation of instance. 132 132 */ 133 public String toString() { 133 public String toString() 134 { 134 135 return m_domain_start.toString() + Utility.DELIM 135 136 + m_domain_end.toString() + Utility.DELIM … … 143 144 * @return True if this enter is a subset, false otherwise. 144 145 */ 145 public boolean IsSubsetOf(Enter i_other) {146 Set/*<EntryAccessDefn>*/otherAccessDefs = i_other147 .GetEntryAccessDefns();146 public boolean IsSubsetOf(Enter i_other) 147 { 148 Set/*<EntryAccessDefn>*/otherAccessDefs = i_other.GetEntryAccessDefns(); 148 149 149 150 /*for (EntryAccessDefn defn : accessDefs)*/ 150 Iterator iter = m_accessDefs.iterator();151 while(iter.hasNext()){151 for (Iterator iter = m_accessDefs.iterator(); iter.hasNext(); ) 152 { 152 153 EntryAccessDefn defn = (EntryAccessDefn) iter.next(); 153 if(!otherAccessDefs.contains(defn)) { 154 if (!otherAccessDefs.contains(defn)) 155 { 154 156 return false; 155 157 } … … 158 160 } 159 161 160 public AbstractToken GetNameToken() { 162 public AbstractToken GetNameToken() 163 { 161 164 return m_token; 162 165 } 163 166 164 public IDomain getStartDomain() { 167 public IDomain getStartDomain() 168 { 165 169 return m_domain_start; 166 170 } 167 171 168 public Domain getEndDomain() { 172 public Domain getEndDomain() 173 { 169 174 return m_domain_end; 170 175 } 171 176 172 public EntrypointResource getEntryPoint() { 177 public EntrypointResource getEntryPoint() 178 { 173 179 return m_entrypoint_resource; 174 180 } 175 181 176 public void Accept(IPolicyVisitor i_visitor) { 182 public void Accept(IPolicyVisitor i_visitor) 183 { 177 184 i_visitor.Visit(this); 178 185 } 179 186 180 public AbstractToken getBool() { 187 public AbstractToken getBool() 188 { 181 189 return m_bool; 182 190 } … … 186 194 } 187 195 188 public void setOnOrOff(Boolean i_orOff) { 196 public void setOnOrOff(Boolean i_orOff) 197 { 189 198 m_onOrOff = i_orOff; 190 199 } 191 200 192 public boolean equals(Object i_obj) {193 201 public boolean equals(Object i_obj) 202 { 194 203 if(!(i_obj instanceof Enter)) 195 204 return false; … … 210 219 return true; 211 220 } 212 213 public boolean usesDefaults() { 214 return m_usesDefault; 221 222 public void ResetToDefaults () 223 { 224 m_accessDefs.clear (); 225 m_accessDefs.addAll (m_entrypoint_resource.EPDictDef.GetDefaultAccessDefns()); 226 } 227 228 public boolean usesDefaults() 229 { 230 return m_accessDefs.equals (m_entrypoint_resource.EPDictDef.GetDefaultAccessDefns ()); 215 231 } 216 232 … … 239 255 mIsModified = false; 240 256 } 241 242 243 257 } branches/custome_policy/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java
r1949 r2025 210 210 public boolean Add(Resource res) 211 211 { 212 if(GetComponent(res.getName()) != null) 213 { 214 res.getToken().Error( 215 "The component \"" + res.getName() + "\" is already defined"); 212 if (GetComponent(res.getName()) != null) 213 { 214 res.getToken().Error ("The component \"" + res.getName() + "\" is already defined"); 216 215 return false; 217 216 } 218 217 219 if (res.getParent() != null)218 if (res.getParent() != null) 220 219 { 221 220 res.getParent().AddChild(res); … … 237 236 * <code>false</code> otherwise. 238 237 */ 239 public boolean Add(EntrypointResource ep) 240 { 241 if(GetComponent(ep.getName()) != null) 242 { 243 ep.getToken().Error( 244 "The component \"" + ep.getName() + "\" is already defined"); 238 public boolean Add (EntrypointResource ep) 239 { 240 if (GetComponent(ep.getName()) != null) 241 { 242 ep.getToken().Error("The component \"" + ep.getName() + "\" is already defined"); 245 243 return false; 246 244 } … … 270 268 if(axx.getResource().IsDescendant(axx.getDomain ())) 271 269 { 272 axx.Token 273 .Error("Constraint violation: a domain cannot access its children"); 270 axx.Token.Error("Constraint violation: a domain cannot access its children"); 274 271 return false; 275 272 } … … 279 276 if(resourceParent != null && !axx.getDomain ().IsDescendant(resourceParent)) 280 277 { 281 axx.Token 282 .Error("Constraint violation: a domain cannot access a resource enclosed in another domain"); 278 axx.Token.Error("Constraint violation: a domain cannot access a resource enclosed in another domain"); 283 279 return false; 284 280 } … … 401 397 * @param dobj The dictionary object the system resource is associated with. 402 398 * @param sysres The system resource. 403 * @return <code>null</code> on succ cess, Component399 * @return <code>null</code> on success, Component 404 400 * already associated with specified resource on failure. 405 401 */ 406 public boolean Add (ComponentWithDictObjects comp, IDictionaryObject dobj,407 SystemResource sysres)408 {409 if (sysResources.containsKey(sysres))402 public boolean Add (ComponentWithDictObjects comp, IDictionaryObject dobj, SystemResource sysres) 403 { 404 comp.AddSystemResource (dobj, sysres); 405 if (sysResources.containsKey (sysres)) 410 406 { 411 407 return false; … … 413 409 sysResources.put(sysres, comp); 414 410 415 comp.AddSystemResource(dobj, sysres);416 411 return true; 417 412 } … … 423 418 * @param dobj The dictionary object the system resource is associated with. 424 419 * @param sysres The file resource. 425 * @return <code>null</code> on succ cess, Component420 * @return <code>null</code> on success, Component 426 421 * already associated with specified resource on failure. 427 422 */ 428 public boolean Add (EntrypointResource ep, FileResource sysres)429 { 430 if (sysResources.containsKey(sysres))423 public boolean Add (EntrypointResource ep, FileResource sysres) 424 { 425 if (sysResources.containsKey(sysres)) 431 426 { 432 427 return false; 433 428 } 434 sysResources.put (sysres, ep);435 436 ep.AddSystemResource (sysres);429 sysResources.put (sysres, ep); 430 431 ep.AddSystemResource (sysres); 437 432 return true; 438 433 } … … 443 438 * @return the map of components 444 439 */ 445 public Map/*<String, Component>*/getComponents ()446 { 447 HashMap allComponents = new HashMap ();448 Iterator itr = topLevelComponents.values ().iterator();449 getAllDecendants (itr, allComponents);440 public Map/*<String, Component>*/getComponents () 441 { 442 HashMap allComponents = new HashMap (); 443 &
