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
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 committed Sep 26, 2023
1 parent d549dda commit a1e1d79
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 a1e1d79

Please sign in to comment.