Skip to content

Commit 377c504

Browse files
authored
Merge pull request #137 from acesar/upgrade-smbj-0.8.0
upgrade smbj 0.8.0
2 parents 60f7243 + b6ac769 commit 377c504

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.settings/
44
target/
55
dcerpc.iml
6+
.idea

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<thirdparty.hamcrest.version>1.3</thirdparty.hamcrest.version>
5050
<thirdparty.junit.version>4.12</thirdparty.junit.version>
5151
<thirdparty.mockito.version>1.10.19</thirdparty.mockito.version>
52-
<thirdparty.smbj.version>0.7.0</thirdparty.smbj.version>
52+
<thirdparty.smbj.version>0.8.0</thirdparty.smbj.version>
5353
<thirdparty.testng.version>6.11</thirdparty.testng.version>
5454
<maven.compiler.target>1.7</maven.compiler.target>
5555
<maven.compiler.source>1.7</maven.compiler.source>

src/main/java/com/rapid7/helper/smbj/io/SMB2Exception.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public class SMB2Exception extends IOException {
3030
private final long statusCode;
3131

3232
public SMB2Exception(final SMB2Header header, final String message) {
33-
super(String.format("%s returned %s (%d/%d): %s", header.getMessage(), header.getStatus(), header.getStatus().getValue(), header.getStatusCode(), message));
34-
status = header.getStatus();
33+
super(String.format("%s returned %s (%d/%d): %s", header.getMessage(), header.getStatusCode(), header.getStatusCode(), header.getStatusCode(), message));
34+
35+
status = NtStatus.valueOf(header.getStatusCode());
3536
statusCode = header.getStatusCode();
3637
failedCommand = header.getMessage();
3738
}

src/main/java/com/rapid7/helper/smbj/io/SMB2SessionMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public <T extends SMB2Packet> T sendAndRead(final SMB2Packet packet, final EnumS
9494
final Future<T> future = send(packet);
9595
final T responsePacket = read(future);
9696
final SMB2Header responseHeader = responsePacket.getHeader();
97-
final NtStatus responseStatus = responseHeader.getStatus();
97+
final NtStatus responseStatus = NtStatus.valueOf(responseHeader.getStatusCode());
9898
if (!ok.contains(responseStatus)) {
9999
throw new SMB2Exception(responseHeader, "expected=" + ok);
100100
}

src/main/java/com/rapid7/helper/smbj/share/NamedPipe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public byte[] transact(final byte[] inBuffer) throws IOException {
7070
} catch (final IOException exception) {
7171
throw new SMBRuntimeException(exception);
7272
}
73-
final NtStatus status = response.getHeader().getStatus();
73+
final NtStatus status = NtStatus.valueOf(response.getHeader().getStatusCode());
7474
if (status.equals(NtStatus.STATUS_BUFFER_OVERFLOW)) {
7575
outBuffer.write(read());
7676
}
@@ -87,7 +87,7 @@ public byte[] read() throws IOException {
8787
} catch (final IOException exception) {
8888
throw new SMBRuntimeException(exception);
8989
}
90-
final NtStatus status = response.getHeader().getStatus();
90+
final NtStatus status = NtStatus.valueOf(response.getHeader().getStatusCode());
9191
if (!status.equals(NtStatus.STATUS_BUFFER_OVERFLOW)) {
9292
break;
9393
}

0 commit comments

Comments
 (0)