Skip to content

Commit

Permalink
Set sessionKey whenever we have it from authentication (Fixes #792) (#…
Browse files Browse the repository at this point in the history
…800)

This should fix the NPE that occurs when authenticating with guest or anonymous credentials and the server treating it as a regular account
  • Loading branch information
hierynomus authored Dec 9, 2024
1 parent cdc3d3a commit 36d74b0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 36d74b0

Please sign in to comment.