@Override public boolean isSigningEnforced () { return ( getSecurityMode() & Smb2Constants.SMB2_NEGOTIATE_SIGNING_REQUIRED ) != 0; }
return; Smb2NegotiateRequest negoReq = new Smb2NegotiateRequest(sess.getConfig(), trans.getRequestSecurityMode(nego)); req.setInputData( new ValidateNegotiateInfoRequest( negoReq.getCapabilities(), negoReq.getClientGuid(), (short) negoReq.getSecurityMode(), negoReq.getDialects()));
Smb2NegotiateRequest smb2neg = new Smb2NegotiateRequest(getContext().getConfig(), securityMode); Smb2NegotiateResponse r = null; byte[] negoReqBuffer = null; byte[] negoRespBuffer = null; try { smb2neg.setRequestCredits(Math.max(1, this.desiredCredits - this.credits.availablePermits())); r = smb2neg.initResponse(getContext()); int respLen = r.decode(this.sbuf, 4); r.received();
dstIndex += pad8(dstIndex); SMBUtil.writeInt4(dstIndex - getHeaderStart(), dst, negotitateContextOffsetOffset); for ( NegotiateContextRequest nc : this.negotiateContexts ) { SMBUtil.writeInt2(nc.getContextType(), dst, dstIndex); SMBUtil.writeInt4(0, dst, dstIndex); dstIndex += 4; // Reserved int dataLen = size8(nc.encode(dst, dstIndex)); SMBUtil.writeInt2(dataLen, dst, lenOffset); dstIndex += dataLen;
private static boolean checkPreauthContext ( Smb2NegotiateRequest req, PreauthIntegrityNegotiateContext pc ) { if ( pc.getHashAlgos() == null || pc.getHashAlgos().length != 1 ) { log.error("Server returned no hash selection"); return false; } PreauthIntegrityNegotiateContext rpc = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof PreauthIntegrityNegotiateContext ) { rpc = (PreauthIntegrityNegotiateContext) rnc; } } if ( rpc == null ) { return false; } boolean valid = false; for ( int hash : rpc.getHashAlgos() ) { if ( hash == pc.getHashAlgos()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid hash selection"); return false; } return true; }
this.commonCapabilities = r.getCapabilities() & this.capabilities;
return; Smb2NegotiateRequest negoReq = new Smb2NegotiateRequest(sess.getConfig(), trans.getRequestSecurityMode(nego)); req.setInputData( new ValidateNegotiateInfoRequest( negoReq.getCapabilities(), negoReq.getClientGuid(), (short) negoReq.getSecurityMode(), negoReq.getDialects()));
Smb2NegotiateRequest smb2neg = new Smb2NegotiateRequest(getContext().getConfig(), securityMode); Smb2NegotiateResponse r = null; byte[] negoReqBuffer = null; byte[] negoRespBuffer = null; try { smb2neg.setRequestCredits(Math.max(1, this.desiredCredits - this.credits.availablePermits())); r = smb2neg.initResponse(getContext()); int respLen = r.decode(this.sbuf, 4); r.received();
dstIndex += pad8(dstIndex); SMBUtil.writeInt4(dstIndex - getHeaderStart(), dst, negotitateContextOffsetOffset); for ( NegotiateContextRequest nc : this.negotiateContexts ) { SMBUtil.writeInt2(nc.getContextType(), dst, dstIndex); SMBUtil.writeInt4(0, dst, dstIndex); dstIndex += 4; // Reserved int dataLen = size8(nc.encode(dst, dstIndex)); SMBUtil.writeInt2(dataLen, dst, lenOffset); dstIndex += dataLen;
private static boolean checkEncryptionContext ( Smb2NegotiateRequest req, EncryptionNegotiateContext ec ) { if ( ec.getCiphers() == null || ec.getCiphers().length != 1 ) { log.error("Server returned no cipher selection"); return false; } EncryptionNegotiateContext rec = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof EncryptionNegotiateContext ) { rec = (EncryptionNegotiateContext) rnc; } } if ( rec == null ) { return false; } boolean valid = false; for ( int cipher : rec.getCiphers() ) { if ( cipher == ec.getCiphers()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid cipher selection"); return false; } return true; }
this.commonCapabilities = r.getCapabilities() & this.capabilities;
private static boolean checkEncryptionContext ( Smb2NegotiateRequest req, EncryptionNegotiateContext ec ) { if ( ec.getCiphers() == null || ec.getCiphers().length != 1 ) { log.error("Server returned no cipher selection"); return false; } EncryptionNegotiateContext rec = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof EncryptionNegotiateContext ) { rec = (EncryptionNegotiateContext) rnc; } } if ( rec == null ) { return false; } boolean valid = false; for ( int cipher : rec.getCiphers() ) { if ( cipher == ec.getCiphers()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid cipher selection"); return false; } return true; }
@Override public boolean isSigningEnforced () { return ( getSecurityMode() & Smb2Constants.SMB2_NEGOTIATE_SIGNING_REQUIRED ) != 0; }
private static boolean checkPreauthContext ( Smb2NegotiateRequest req, PreauthIntegrityNegotiateContext pc ) { if ( pc.getHashAlgos() == null || pc.getHashAlgos().length != 1 ) { log.error("Server returned no hash selection"); return false; } PreauthIntegrityNegotiateContext rpc = null; for ( NegotiateContextRequest rnc : req.getNegotiateContexts() ) { if ( rnc instanceof PreauthIntegrityNegotiateContext ) { rpc = (PreauthIntegrityNegotiateContext) rnc; } } if ( rpc == null ) { return false; } boolean valid = false; for ( int hash : rpc.getHashAlgos() ) { if ( hash == pc.getHashAlgos()[ 0 ] ) { valid = true; } } if ( !valid ) { log.error("Server returned invalid hash selection"); return false; } return true; }