Skip to content

Commit

Permalink
Merge pull request #137 from acesar/upgrade-smbj-0.8.0
Browse files Browse the repository at this point in the history
upgrade smbj 0.8.0
  • Loading branch information
bli-r7 authored Aug 31, 2018
2 parents 60f7243 + b6ac769 commit 377c504
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.settings/
target/
dcerpc.iml
.idea
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<thirdparty.hamcrest.version>1.3</thirdparty.hamcrest.version>
<thirdparty.junit.version>4.12</thirdparty.junit.version>
<thirdparty.mockito.version>1.10.19</thirdparty.mockito.version>
<thirdparty.smbj.version>0.7.0</thirdparty.smbj.version>
<thirdparty.smbj.version>0.8.0</thirdparty.smbj.version>
<thirdparty.testng.version>6.11</thirdparty.testng.version>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/rapid7/helper/smbj/io/SMB2Exception.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public class SMB2Exception extends IOException {
private final long statusCode;

public SMB2Exception(final SMB2Header header, final String message) {
super(String.format("%s returned %s (%d/%d): %s", header.getMessage(), header.getStatus(), header.getStatus().getValue(), header.getStatusCode(), message));
status = header.getStatus();
super(String.format("%s returned %s (%d/%d): %s", header.getMessage(), header.getStatusCode(), header.getStatusCode(), header.getStatusCode(), message));

status = NtStatus.valueOf(header.getStatusCode());
statusCode = header.getStatusCode();
failedCommand = header.getMessage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public <T extends SMB2Packet> T sendAndRead(final SMB2Packet packet, final EnumS
final Future<T> future = send(packet);
final T responsePacket = read(future);
final SMB2Header responseHeader = responsePacket.getHeader();
final NtStatus responseStatus = responseHeader.getStatus();
final NtStatus responseStatus = NtStatus.valueOf(responseHeader.getStatusCode());
if (!ok.contains(responseStatus)) {
throw new SMB2Exception(responseHeader, "expected=" + ok);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rapid7/helper/smbj/share/NamedPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public byte[] transact(final byte[] inBuffer) throws IOException {
} catch (final IOException exception) {
throw new SMBRuntimeException(exception);
}
final NtStatus status = response.getHeader().getStatus();
final NtStatus status = NtStatus.valueOf(response.getHeader().getStatusCode());
if (status.equals(NtStatus.STATUS_BUFFER_OVERFLOW)) {
outBuffer.write(read());
}
Expand All @@ -87,7 +87,7 @@ public byte[] read() throws IOException {
} catch (final IOException exception) {
throw new SMBRuntimeException(exception);
}
final NtStatus status = response.getHeader().getStatus();
final NtStatus status = NtStatus.valueOf(response.getHeader().getStatusCode());
if (!status.equals(NtStatus.STATUS_BUFFER_OVERFLOW)) {
break;
}
Expand Down

0 comments on commit 377c504

Please sign in to comment.