Skip to content

Commit

Permalink
Merge pull request #79 from MariaDB/1.4.0-merge
Browse files Browse the repository at this point in the history
[misc] checkstyle correction + documentation GSSAPI
  • Loading branch information
rusher committed Mar 30, 2016
2 parents 85fa733 + 71c2d54 commit b14d9c4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 36 deletions.
33 changes: 0 additions & 33 deletions documentation/plugin/GSSAPI.md
Expand Up @@ -88,36 +88,3 @@ Value: 1
* "GSSException: No valid credentials provided (Mechanism level: Clock skew too great (37))". The Kerberos protocol requires the time of the client
and server to match: if the system clocks of the client does not match that of the KDC server, authentication will fail with this kind of error.
The simplest way to synchronize the system clocks is to use a Network Time Protocol (NTP) server.










### from unix
On unix the driver use native java GSS implementation, so the initial credential should be acquired beforehand. That is, call kinit prior to connect.
The kerberos client packet must be installed.

on debian like :
```script
apt-get update
apt-get install krb5-config krb5-user
```

on cent-os
```script
yum install krb5-libs krb5-workstation
```

Some java properties are needed :

| property | Description|
| ------------ |:----------------|
| **sun.security.jgss.native** | Mandatory. Must always be set to true*|
| **java.security.krb5.realm** |Optional. This permit to indicate REALM name (if not defined by DNS). example : EXAMPLE.COM|
| **java.security.krb5.kdc** | Optional. This permit to indicate kdc dns (if not defined by DNS). example : kdc.example.com|

2 changes: 1 addition & 1 deletion src/main/java/org/mariadb/jdbc/MariaDbStatement.java
Expand Up @@ -128,7 +128,7 @@ public MariaDbStatement clone() throws CloneNotSupportedException {
MariaDbStatement clone = (MariaDbStatement) super.clone();
clone.connection = connection;
clone.protocol = protocol;
clone.timerTask = null;
clone.timerTaskFuture = null;
clone.batchQueries = new ArrayList<>();
clone.cachedExecutionResults = new ArrayDeque<>();
clone.executionResult = null;
Expand Down
Expand Up @@ -460,6 +460,7 @@ private void handleConnectionPhases() throws QueryException {
ExceptionMapper.SqlStates.CONNECTION_EXCEPTION.getSqlState(), e);
}
}

private void authentication(byte serverLanguage, int clientCapabilities, byte[] seed, byte packetSeq, String plugin, int serverCapabilities)
throws QueryException, IOException {
final SendHandshakeResponsePacket cap = new SendHandshakeResponsePacket(this.username,
Expand Down Expand Up @@ -488,7 +489,8 @@ private void authentication(byte serverLanguage, int clientCapabilities, byte[]
interfaceSendPacket = AuthenticationProviderHolder.getAuthenticationProvider()
.processAuthPlugin(packetFetcher, plugin, password, authData, packetFetcher.getLastPacketSeq() + 1);
} else {
interfaceSendPacket = new SendOldPasswordAuthPacket(this.password, Utils.copyWithLength(seed, 8), packetFetcher.getLastPacketSeq() + 1);
interfaceSendPacket = new SendOldPasswordAuthPacket(this.password, Utils.copyWithLength(seed, 8),
packetFetcher.getLastPacketSeq() + 1);
}
interfaceSendPacket.send(writer);
interfaceSendPacket.handleResultPacket(packetFetcher);
Expand Down
Expand Up @@ -408,7 +408,8 @@ public boolean readNextValue(List<byte[][]> values) throws IOException, QueryExc
//There is always a OK packet after a callable output result, but mysql 5.6-7
//is sending a bad "more result" flag (without setting more packet to true)
//so force the value, since this will corrupt connection.
protocol.setMoreResults(callableResult || (((buffer.buf[2] & 0xff) + ((buffer.buf[3] & 0xff) << 8)) & ServerStatus.MORE_RESULTS_EXISTS) != 0,
protocol.setMoreResults(callableResult
|| (((buffer.buf[2] & 0xff) + ((buffer.buf[3] & 0xff) << 8)) & ServerStatus.MORE_RESULTS_EXISTS) != 0,
isBinaryEncoded);
protocol = null;
packetFetcher = null;
Expand Down

0 comments on commit b14d9c4

Please sign in to comment.