mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

floblanc
31.45.2008 e9ef19dfebcad16bb1268b36c1f07c9882cc7341
The network group defines resource limits for maximum search size and maximum search time. These limits also exist at the directory server level.

The following fix ensures that:
- if such limits exist at the network group level, they are applied
- if they are not defined at the network group level, the directory server limits apply.

3 files modified
24 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/ResourceLimits.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java
@@ -1102,8 +1102,14 @@
  public void setUnauthenticated()
  {
    setAuthenticationInfo(new AuthenticationInfo());
    this.sizeLimit          = DirectoryServer.getSizeLimit();
    this.timeLimit          = DirectoryServer.getTimeLimit();
    this.sizeLimit = networkGroup.getSearchSizeLimit();
    if (this.sizeLimit == -1) {
        this.sizeLimit = DirectoryServer.getSizeLimit();
    }
    this.timeLimit = networkGroup.getSearchDurationLimit();
    if (this.timeLimit == -1) {
      this.timeLimit = DirectoryServer.getTimeLimit();
    }
  }
@@ -1796,7 +1802,13 @@
      // The client connection inherits the resource limits
      sizeLimit = networkGroup.getSearchSizeLimit();
      if (sizeLimit == -1) {
        sizeLimit = DirectoryServer.getSizeLimit();
      }
      timeLimit = networkGroup.getSearchDurationLimit();
      if (timeLimit == -1) {
        timeLimit = DirectoryServer.getTimeLimit();
      }
    }
  }
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -681,7 +681,7 @@
    if (resourceLimits != null) {
      return resourceLimits.getSizeLimit();
    }
    return 0;
    return -1;
  }
  /**
@@ -693,7 +693,7 @@
    if (resourceLimits != null) {
      return resourceLimits.getTimeLimit();
    }
    return 0;
    return -1;
  }
  /**
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/ResourceLimits.java
@@ -108,8 +108,8 @@
    maxOpsPerConnection = 0;
    maxConcurrentOpsPerConnection = 0;
    searchSizeLimit = 0;
    searchTimeLimit = 0;
    searchSizeLimit = -1;
    searchTimeLimit = -1;
    minSearchSubstringLength = 0;
    numConnections = 0;
    connectionsPerIpMap = new HashMap<String, Integer>();