Skip to content

Commit

Permalink
Merge branch 'AgNO3:master' into Add_symlink_functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
GregBragg authored Aug 26, 2022
2 parents 625d38d + 5a69a23 commit 70f6dd9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
jcifs-ng 2.1.8
- Relax SMB2 tree id check, all but -1 are valid

jcifs-ng 2.1.7
- Handle USER_SESSION_DELETED by resetting/disconnecting the
transport connection (#242,#294)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Latest stable release:
<dependency>
<groupId>eu.agno3.jcifs</groupId>
<artifactId>jcifs-ng</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>jcifs-ng</artifactId>
<groupId>eu.agno3.jcifs</groupId>
<packaging>bundle</packaging>
<version>2.1.8-SNAPSHOT</version>
<version>2.1.9-SNAPSHOT</version>
<description>A pure-java CIFS/SMB client library</description>
<url>https://github.com/AgNO3/jcifs-ng/</url>

Expand Down
20 changes: 16 additions & 4 deletions src/main/java/jcifs/netbios/NameServiceClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,15 @@ NbtAddress[] getAllByName ( Name name, InetAddress addr ) throws UnknownHostExce
NameQueryResponse response = new NameQueryResponse(config);

request.addr = addr != null ? addr : getWINSAddress();
request.isBroadcast = request.addr == null;
request.isBroadcast = request.addr == null || isBroadcastAddress(request.addr);

if ( request.isBroadcast ) {
request.addr = this.baddr;
if ( request.addr == null ) {
request.addr = this.baddr;
}
n = config.getNetbiosRetryCount();
}
else {
request.isBroadcast = false;
n = 1;
}

Expand Down Expand Up @@ -542,7 +543,7 @@ NbtAddress getByName ( Name name, InetAddress addr ) throws UnknownHostException
* because it specifies addr
*/
request.addr = addr; /* if addr ends with 255 flag it bcast */
request.isBroadcast = ( addr.getAddress()[ 3 ] == (byte) 0xFF );
request.isBroadcast = isBroadcastAddress(addr);

int n = this.transportContext.getConfig().getNetbiosRetryCount();
do {
Expand Down Expand Up @@ -638,6 +639,7 @@ else if ( resolverType == ResolverType.RESOLVER_WINS ) {
}



@Override
public NbtAddress[] getNodeStatus ( NetbiosAddress addr ) throws UnknownHostException {
NodeStatusResponse response = new NodeStatusResponse(this.transportContext.getConfig(), addr.unwrap(NbtAddress.class));
Expand Down Expand Up @@ -801,6 +803,16 @@ protected boolean isWINS ( InetAddress svr ) {
}


/**
*
* @param svr
* @return whether the given address is the configured broadcast address
*/
private boolean isBroadcastAddress(InetAddress svr) {
return svr.equals(this.baddr) || svr.getAddress()[3] == (byte) 0xFF;
}


protected InetAddress switchWINS () {
this.nbnsIndex = ( this.nbnsIndex + 1 ) < this.transportContext.getConfig().getWinsServers().length ? this.nbnsIndex + 1 : 0;
return this.transportContext.getConfig().getWinsServers().length == 0 ? null
Expand Down

0 comments on commit 70f6dd9

Please sign in to comment.