[jcifs] Patch for session security support

Michael B Allen ioplex at gmail.com
Wed Mar 18 18:10:18 GMT 2009


This is applied and released in 1.3.7 available on the JCIFS website now.

Thanks,
Mike

On Wed, Mar 18, 2009 at 9:11 AM, Gerrit Meinders <meinders at numdata.com> wrote:
> 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
>
>
> --- 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");
>         }
>
>



-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jcifs mailing list