OPENDJ-1235: Migrate configuration framework
* move AddressMask to opendj-core
2 files deleted
9 files modified
| | |
| | | Templates for processing IP address mask properties. |
| | | --> |
| | | <xsl:template match="adm:ip-address-mask" mode="java-value-imports"> |
| | | <import>org.opends.server.types.AddressMask</import> |
| | | <import>org.forgerock.opendj.ldap.AddressMask</import> |
| | | </xsl:template> |
| | | <xsl:template match="adm:ip-address-mask" mode="java-value-type"> |
| | | <xsl:value-of select="'AddressMask'" /> |
| | |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.messages.AdminMessages.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.PrintWriter; |
| | |
| | | import java.util.List; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.ldap.Rdn; |
| | | |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.SynchronousStrategy; |
| | | import org.opends.server.protocols.ldap.LDAPConnectionHandler; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | |
| | | |
| | | |
| | |
| | | ifNull(value); |
| | | |
| | | try { |
| | | return AddressMask.decode(value); |
| | | } catch (ConfigException e) { |
| | | return AddressMask.valueOf(value); |
| | | } catch (LocalizedIllegalArgumentException e) { |
| | | // TODO: it would be nice to throw the cause. |
| | | throw PropertyException.illegalPropertyValueException(this, value); |
| | | } |
| | |
| | | |
| | | import java.net.InetAddress; |
| | | |
| | | import org.opends.server.types.AddressMask; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.authorization.dseecompat.Aci; |
| | |
| | | import java.net.InetAddress; |
| | | import java.util.Collection; |
| | | |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.opends.server.types.AuthenticationType; |
| | | import org.opends.server.types.DN; |
| | | |
| | |
| | | InetAddress ipAddr = connection.getRemoteAddress(); |
| | | |
| | | if (!deniedClients.isEmpty() |
| | | && AddressMask.maskListContains(ipAddr, deniedClients)) |
| | | && AddressMask.matchesAny(deniedClients, ipAddr)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (!allowedClients.isEmpty() |
| | | && !AddressMask.maskListContains(ipAddr, allowedClients)) |
| | | && !AddressMask.matchesAny(allowedClients, ipAddr)) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | /** |
| | |
| | | // Check client address. |
| | | final InetAddress ipAddr = connection.getRemoteAddress(); |
| | | if (!clientAddressNotEqualTo.isEmpty() |
| | | && AddressMask.maskListContains(ipAddr, clientAddressNotEqualTo)) |
| | | && AddressMask.matchesAny(clientAddressNotEqualTo, ipAddr)) |
| | | { |
| | | return false; |
| | | } |
| | | if (!clientAddressEqualTo.isEmpty() |
| | | && !AddressMask.maskListContains(ipAddr, clientAddressEqualTo)) |
| | | && !AddressMask.matchesAny(clientAddressEqualTo, ipAddr)) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.util.Base64; |
| | |
| | | Collection<AddressMask> allowedClients = config.getAllowedClient(); |
| | | Collection<AddressMask> deniedClients = config.getDeniedClient(); |
| | | if (!deniedClients.isEmpty() |
| | | && AddressMask.maskListContains(clientAddr, deniedClients)) |
| | | && AddressMask.matchesAny(deniedClients, clientAddr)) |
| | | { |
| | | clientConnection.disconnect(DisconnectReason.CONNECTION_REJECTED, false, |
| | | ERR_CONNHANDLER_DENIED_CLIENT.get(clientConnection |
| | |
| | | // there is whether the client is on that list. If |
| | | // not, then reject the connection. |
| | | if (!allowedClients.isEmpty() |
| | | && !AddressMask.maskListContains(clientAddr, allowedClients)) |
| | | && !AddressMask.matchesAny(allowedClients, clientAddr)) |
| | | { |
| | | clientConnection.disconnect(DisconnectReason.CONNECTION_REJECTED, false, |
| | | ERR_CONNHANDLER_DISALLOWED_CLIENT.get(clientConnection |
| | |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.SSLEngine; |
| | | |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ConnectionHandlerCfg; |
| | |
| | | // Check to see if the client is on the denied list. |
| | | // If so, then reject it immediately. |
| | | if ((!deniedClients.isEmpty()) |
| | | && AddressMask.maskListContains(clientAddr, deniedClients)) |
| | | && AddressMask.matchesAny(deniedClients, clientAddr)) |
| | | { |
| | | clientConnection.disconnect(DisconnectReason.CONNECTION_REJECTED, |
| | | currentConfig.isSendRejectionNotice(), ERR_CONNHANDLER_DENIED_CLIENT |
| | |
| | | // there is whether the client is on that list. If |
| | | // not, then reject the connection. |
| | | if ((!allowedClients.isEmpty()) |
| | | && (!AddressMask.maskListContains(clientAddr, allowedClients))) |
| | | && (!AddressMask.matchesAny(allowedClients, clientAddr))) |
| | | { |
| | | clientConnection.disconnect(DisconnectReason.CONNECTION_REJECTED, |
| | | currentConfig.isSendRejectionNotice(), |
| | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.NetworkGroupCfgDefn.AllowedAuthMethod; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.opends.server.types.AuthenticationType; |
| | | import org.opends.server.types.DN; |
| | | import org.testng.Assert; |
| | |
| | | @DataProvider(name = "testData") |
| | | public Object[][] createTestData() throws Exception |
| | | { |
| | | AddressMask matchAnything = AddressMask.decode("*.*.*.*"); |
| | | AddressMask matchNothing = AddressMask.decode("0.0.0.0"); |
| | | AddressMask matchAnything = AddressMask.valueOf("*.*.*.*"); |
| | | AddressMask matchNothing = AddressMask.valueOf("0.0.0.0"); |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, false, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |