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

Jean-Noel Rouvignac
08.06.2015 b8c6b80da1cb6118167a934daa480eb381c59e0e
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java
@@ -183,21 +183,25 @@
    boolean evalHostName(String[] remoteHostName, String[] pat) {
      boolean wildCard=pat[0].equals("*");
      //Check if there is a single wild-card.
      if(pat.length == 1 && wildCard)
      if(pat.length == 1 && wildCard) {
        return true;
      }
      int remoteHnIndex=remoteHostName.length-pat.length;
      if(remoteHnIndex < 0)
      if(remoteHnIndex < 0) {
        return false;
      }
      int patternIndex=0;
      if(!wildCard)
          remoteHnIndex=0;
      else {
      if(!wildCard) {
        remoteHnIndex=0;
      } else {
          patternIndex=1;
          remoteHnIndex++;
      }
      for(int i=remoteHnIndex ;i<remoteHostName.length;i++)
            if(!pat[patternIndex++].equalsIgnoreCase(remoteHostName[i]))
                return false;
      for(int i=remoteHnIndex ;i<remoteHostName.length;i++) {
        if(!pat[patternIndex++].equalsIgnoreCase(remoteHostName[i])) {
          return false;
        }
      }
      return true;
    }