[jcifs] Patch for session security support
Gerrit Meinders
meinders at numdata.com
Wed Mar 18 13:11:48 GMT 2009
Using jcifs 1.3.3 we encountered a problem connecting to a share on an
old Windows 95 machine. It turns out 'session security' is no longer
supported in newer version of jcifs. This patch restores the support
that was present in jcifs 1.2.1.
--
Gerrit Meinders
meinders at numdata.com Numdata BV
www.numdata.com Nijverheidsstraat 8-02
tel: +31 545 477 152 P.O. Box 175 KvK-no: 08050030
fax: +31 545 481 538 7150 AD Eibergen Regio: Oost-Nederland
-------------- next part --------------
--- src/jcifs/smb/SmbComSessionSetupAndX.java 2009-03-13 19:00:37.000000000 +0100
+++ src/jcifs/smb/SmbComSessionSetupAndX.java 2009-03-18 13:41:19.000000000 +0100
@@ -43,7 +43,8 @@
sessionKey = session.transport.sessionKey;
- if (session.transport.server.security == SECURITY_USER) {
+ int security = session.transport.server.security;
+ if (security == SECURITY_USER) {
if (cred instanceof NtlmPasswordAuthentication) {
NtlmPasswordAuthentication auth = (NtlmPasswordAuthentication)cred;
@@ -81,6 +82,20 @@
} else {
throw new SmbException("Unsupported credential type");
}
+ } else if (security == SECURITY_SHARE) {
+ if (cred instanceof NtlmPasswordAuthentication) {
+ // no password in session setup
+ lmHash = new byte[0];
+ ntHash = new byte[0];
+
+ NtlmPasswordAuthentication auth = (NtlmPasswordAuthentication)cred;
+ accountName = auth.username;
+ if (useUnicode)
+ accountName = accountName.toUpperCase();
+ primaryDomain = auth.domain.toUpperCase();
+ } else {
+ throw new SmbException("Unsupported credential type");
+ }
} else {
throw new SmbException("Unsupported");
}
More information about the jcifs
mailing list