/* */ public boolean checkPermission( Principal paramPrincipal, String paramString, Permission paramPermission) /* */ { /* 253 */ for (Enumeration localEnumeration = this.entryList.elements(); localEnumeration.hasMoreElements(); ) { /* 254 */ AclEntryImpl localAclEntryImpl = (AclEntryImpl) localEnumeration.nextElement(); /* 255 */ if ((localAclEntryImpl.getPrincipal().equals(paramPrincipal)) && /* 256 */ (localAclEntryImpl.checkPermission(paramPermission)) && (localAclEntryImpl.checkCommunity(paramString))) return true; /* */ } /* 258 */ return false; /* */ }
/** Converts the input configuration file into ACL. */ private void readAuthorizedListFile() { alwaysAuthorized = false; if (authorizedListFile == null) { if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp( Level.FINER, SnmpAcl.class.getName(), "readAuthorizedListFile", "alwaysAuthorized set to true"); } alwaysAuthorized = true; } else { // Read the file content Parser parser = null; try { parser = new Parser(new FileInputStream(getAuthorizedListFile())); } catch (FileNotFoundException e) { if (SNMP_LOGGER.isLoggable(Level.FINEST)) { SNMP_LOGGER.logp( Level.FINEST, SnmpAcl.class.getName(), "readAuthorizedListFile", "The specified file was not found, authorize everybody"); } alwaysAuthorized = true; return; } try { JDMSecurityDefs n = parser.SecurityDefs(); n.buildAclEntries(owner, acl); n.buildTrapEntries(trapDestList); n.buildInformEntries(informDestList); } catch (ParseException e) { if (SNMP_LOGGER.isLoggable(Level.FINEST)) { SNMP_LOGGER.logp( Level.FINEST, SnmpAcl.class.getName(), "readAuthorizedListFile", "Got parsing exception", e); } throw new IllegalArgumentException(e.getMessage()); } catch (Error err) { if (SNMP_LOGGER.isLoggable(Level.FINEST)) { SNMP_LOGGER.logp( Level.FINEST, SnmpAcl.class.getName(), "readAuthorizedListFile", "Got unexpected error", err); } throw new IllegalArgumentException(err.getMessage()); } for (Enumeration<AclEntry> e = acl.entries(); e.hasMoreElements(); ) { AclEntryImpl aa = (AclEntryImpl) e.nextElement(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp( Level.FINER, SnmpAcl.class.getName(), "readAuthorizedListFile", "===> " + aa.getPrincipal().toString()); } for (Enumeration<java.security.acl.Permission> eee = aa.permissions(); eee.hasMoreElements(); ) { java.security.acl.Permission perm = eee.nextElement(); if (SNMP_LOGGER.isLoggable(Level.FINER)) { SNMP_LOGGER.logp( Level.FINER, SnmpAcl.class.getName(), "readAuthorizedListFile", "perm = " + perm); } } } } }