hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
713 stars 180 forks source link

smb2 and smb3 config #639

Closed tooptoop4 closed 3 years ago

tooptoop4 commented 3 years ago

how to set smbconfig so that it supports reading from both smb2 and smb3? I guess below won't be able to read from both types?

SmbConfig
                            .builder()
                            .withMultiProtocolNegotiate(true).withDfsEnabled(true)
                            .withTransportLayerFactory(new AsyncDirectTcpTransportFactory<>())
                            .withSigningRequired(true).withSecurityProvider(new BCSecurityProvider()).build();

File smbFileRead = share.openFile(filePath, EnumSet.of(AccessMask.GENERIC_READ), null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null);
hierynomus commented 3 years ago

Yes, this should be enough, as the default setting for withDialects includes both SMB2 and SMB3 dialects.

tooptoop4 commented 3 years ago

even these names with 2 in it? SMB2ShareAccess and SMB2CreateDisposition

hierynomus commented 3 years ago

Yes, SMB3 is just an extension of the SMB2 dialect. All class names are taken directly from the specification, they do not interfere with the SMB3 compatibility.

hierynomus commented 3 years ago

Does thsi answer your question?