diff --git a/src/main/java/com/hierynomus/smbj/connection/SMBSessionBuilder.java b/src/main/java/com/hierynomus/smbj/connection/SMBSessionBuilder.java index 65b6eb74..54f47484 100644 --- a/src/main/java/com/hierynomus/smbj/connection/SMBSessionBuilder.java +++ b/src/main/java/com/hierynomus/smbj/connection/SMBSessionBuilder.java @@ -163,7 +163,7 @@ private Session setupSession(BuilderContext ctx) throws IOException { SessionContext context = session.getSessionContext(); processAuthenticationToken(ctx, response.getSecurityBuffer()); - if (!ctx.authContext.isAnonymous() && !ctx.authContext.isGuest()) { + if (ctx.sessionKey != null) { context.setSessionKey(new SecretKeySpec(ctx.sessionKey, HMAC_SHA256_ALGORITHM)); } if (dialect == SMB2Dialect.SMB_3_1_1) {