pgjdbc / pgjdbc

@@ -495,9 +495,9 @@
Loading
495 495
    /* SSPI negotiation state, if used */
496 496
    ISSPIClient sspiClient = null;
497 497
498 -
    //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.2"
498 +
    //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
499 499
    /* SCRAM authentication state, if used */
500 -
    org.postgresql.jre8.sasl.ScramAuthenticator scramAuthenticator = null;
500 +
    org.postgresql.jre7.sasl.ScramAuthenticator scramAuthenticator = null;
501 501
    //#endif
502 502
503 503
    try {
@@ -661,8 +661,8 @@
Loading
661 661
              case AUTH_REQ_SASL:
662 662
                LOGGER.log(Level.FINEST, " <=BE AuthenticationSASL");
663 663
664 -
                //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.2"
665 -
                scramAuthenticator = new org.postgresql.jre8.sasl.ScramAuthenticator(user, password, pgStream);
664 +
                //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
665 +
                scramAuthenticator = new org.postgresql.jre7.sasl.ScramAuthenticator(user, password, pgStream);
666 666
                scramAuthenticator.processServerMechanismsAndInit();
667 667
                scramAuthenticator.sendScramClientFirstMessage();
668 668
                // This works as follows:
@@ -674,12 +674,12 @@
Loading
674 674
                          "SCRAM authentication is not supported by this driver. You need JDK >= 8 and pgjdbc >= 42.2.0 (not \".jre\" versions)",
675 675
                          areq), PSQLState.CONNECTION_REJECTED);
676 676
                  //#endif
677 -
                  //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.2"
677 +
                  //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
678 678
                }
679 679
                break;
680 680
                //#endif
681 681
682 -
              //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.2"
682 +
              //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.1"
683 683
              case AUTH_REQ_SASL_CONTINUE:
684 684
                scramAuthenticator.processServerFirstMessage(msgLen - 4 - 4);
685 685
                break;
686 686
imilarity index 85%
687 687
ename from pgjdbc/src/main/java/org/postgresql/jre8/sasl/ScramAuthenticator.java
688 688
ename to pgjdbc/src/main/java/org/postgresql/jre7/sasl/ScramAuthenticator.java

@@ -3,7 +3,7 @@
Loading
3 3
 * See the LICENSE file in the project root for more information.
4 4
 */
5 5
6 -
package org.postgresql.jre8.sasl;
6 +
package org.postgresql.jre7.sasl;
7 7
8 8
import org.postgresql.core.PGStream;
9 9
import org.postgresql.util.GT;
@@ -36,7 +36,6 @@
Loading
36 36
  private ScramSession.ServerFirstProcessor serverFirstProcessor;
37 37
  private ScramSession.ClientFinalProcessor clientFinalProcessor;
38 38
39 -
  @FunctionalInterface
40 39
  private interface BodySender {
41 40
    void sendBody(PGStream pgStream) throws IOException;
42 41
  }
@@ -44,7 +43,7 @@
Loading
44 43
  private void sendAuthenticationMessage(int bodyLength, BodySender bodySender)
45 44
      throws IOException {
46 45
    pgStream.sendChar('p');
47 -
    pgStream.sendInteger4(Integer.BYTES + bodyLength);
46 +
    pgStream.sendInteger4(Integer.SIZE / Byte.SIZE + bodyLength);
48 47
    bodySender.sendBody(pgStream);
49 48
    pgStream.flush();
50 49
  }
@@ -94,15 +93,18 @@
Loading
94 93
    LOGGER.log(Level.FINEST, " FE=> SASLInitialResponse( {0} )", clientFirstMessage);
95 94
96 95
    String scramMechanismName = scramClient.getScramMechanism().getName();
97 -
    byte[] scramMechanismNameBytes = scramMechanismName.getBytes(StandardCharsets.UTF_8);
98 -
    byte[] clientFirstMessageBytes = clientFirstMessage.getBytes(StandardCharsets.UTF_8);
96 +
    final byte[] scramMechanismNameBytes = scramMechanismName.getBytes(StandardCharsets.UTF_8);
97 +
    final byte[] clientFirstMessageBytes = clientFirstMessage.getBytes(StandardCharsets.UTF_8);
99 98
    sendAuthenticationMessage(
100 99
        (scramMechanismNameBytes.length + 1) + 4 + clientFirstMessageBytes.length,
101 -
        s -> {
102 -
          s.send(scramMechanismNameBytes);
103 -
          s.sendChar(0); // List terminated in '\0'
104 -
          s.sendInteger4(clientFirstMessageBytes.length);
105 -
          s.send(clientFirstMessageBytes);
100 +
        new BodySender() {
101 +
          @Override
102 +
          public void sendBody(PGStream pgStream) throws IOException {
103 +
            pgStream.send(scramMechanismNameBytes);
104 +
            pgStream.sendChar(0); // List terminated in '\0'
105 +
            pgStream.sendInteger4(clientFirstMessageBytes.length);
106 +
            pgStream.send(clientFirstMessageBytes);
107 +
          }
106 108
        }
107 109
    );
108 110
  }
@@ -132,10 +134,15 @@
Loading
132 134
    String clientFinalMessage = clientFinalProcessor.clientFinalMessage();
133 135
    LOGGER.log(Level.FINEST, " FE=> SASLResponse( {0} )", clientFinalMessage);
134 136
135 -
    byte[] clientFinalMessageBytes = clientFinalMessage.getBytes(StandardCharsets.UTF_8);
137 +
    final byte[] clientFinalMessageBytes = clientFinalMessage.getBytes(StandardCharsets.UTF_8);
136 138
    sendAuthenticationMessage(
137 139
        clientFinalMessageBytes.length,
138 -
        s -> s.send(clientFinalMessageBytes)
140 +
        new BodySender() {
141 +
          @Override
142 +
          public void sendBody(PGStream pgStream) throws IOException {
143 +
            pgStream.send(clientFinalMessageBytes);
144 +
          }
145 +
        }
139 146
    );
140 147
  }
141 148
Files Complexity Coverage
pgjdbc/src/main/java/org/postgresql 57.01% 66.40%
Project Totals (179 files) 57.01% 66.40%
Notifications are pending CI completion. Waiting for GitHub's status webhook to queue notifications. Push notifications now.
4112.10
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
4112.9
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
4112.13
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
4112.11
TRAVIS_JDK_VERSION=zulujdk7
TRAVIS_OS_NAME=linux
4112.14
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
4112.17
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
4112.15
TRAVIS_JDK_VERSION=oraclejdk8
TRAVIS_OS_NAME=linux
1
codecov:
2
  notify:
3
    after_n_builds: 10
4
    require_ci_to_pass: false
5
comment:
6
  layout: header, changes, diff
7
coverage:
8
  status:
9
    patch: false
10
  range: "60...100"
11
ignore:
12
  - "**/translation/message*.java"
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading