[jcifs] NTLM authentication fails without exception

John Baker jbaker at javasystemsolutions.com
Tue Jun 19 12:56:58 GMT 2007


Hello,

I've used jcifs a number of times for HTTP NTLM authentication, however
I've come across a strange problem. The NTLM authentication process seems
to die and return a 401 to the browser. The SMB message dumps indicate
it's doing something and getting as far as authenticating the user against
the Windows 2003 server, however the logs just stop. There's no exception,
stack trace or anything of signifance elsewhere!

Could anyone take a look at the following and perhaps offer some advice?

Hex dump (until it suddenly stops):

NameQueryRequest[nameTrnId=1,isResponse=false,opCode=QUERY,isAuthAnswer=false,isTruncated=false,isRecurAvailable=false,isRecurDesired=true,isBroadcast=false,resultCode=0,questionCount=1,answerCount=0,authorityCount=0,additionalCount=0,questionName=WW011<1C>,questionType=0x0020,questionClass=IN,recordName=null,recordType=0x0000,recordClass=0x0000,ttl=0,rDataLength=0]
NetBIOS: new data read from socket
00000: 00 01 01 00 00 01 00 00 00 00 00 00 20 46 48 46  |............ FHF|
00010: 48 44 41 44 42 44 42 43 41 43 41 43 41 43 41 43  |HDADBDBCACACACAC|
00020: 41 43 41 43 41 43 41 43 41 43 41 42 4D 00 00 20  |ACACACACACABM.. |
00030: 00 01                                            |..              |

NameQueryResponse[nameTrnId=1,isResponse=true,opCode=QUERY,isAuthAnswer=true,isTruncated=false,isRecurAvailable=false,isRecurDesired=true,isBroadcast=false,resultCode=0,questionCount=0,answerCount=1,authorityCount=0,additionalCount=0,questionName=null,questionType=0x0000,questionClass=IN,recordName=WW011<1C>,recordType=0x0020,recordClass=IN,ttl=300000,rDataLength=6,addrEntry=[Ljcifs.netbios.NbtAddress;@15311bd]
00000: 00 01 85 00 00 00 00 01 00 00 00 00 20 46 48 46  |............ FHF|
00010: 48 44 41 44 42 44 42 43 41 43 41 43 41 43 41 43  |HDADBDBCACACACAC|
00020: 41 43 41 43 41 43 41 43 41 43 41 42 4D 00 00 20  |ACACACACACABM.. |
00030: 00 01 00 04 93 E0 00 06 E0 00 9E 5C BA 56        |.....à..à..\ºV  |

SmbComNegotiate[command=SMB_COM_NEGOTIATE,received=false,errorCode=0,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=29200,uid=0,mid=1,wordCount=0,byteCount=12,wordCount=0,dialects=NT
LM 0.12]
00000: FF 53 4D 42 72 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMBr......À....|
00010: 00 00 00 00 00 00 00 00 00 00 10 72 00 00 01 00  |...........r....|
00020: 00 0C 00 02 4E 54 20 4C 4D 20 30 2E 31 32 00     |....NT LM 0.12. |

New data read: Transport1[WW011<1C>/158.92.186.86:0]
00000: FF 53 4D 42 72 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBr......À....|
00010: 00 00 00 00 00 00 00 00 00 00 10 72 00 00 01 00  |...........r....|

byteCount=38 but readBytesWireFormat returned 18
SmbComNegotiateResponse[command=SMB_COM_NEGOTIATE,received=false,errorCode=0,flags=0x0098,flags2=0xC003,signSeq=0,tid=0,pid=29200,uid=0,mid=1,wordCount=17,byteCount=38,wordCount=17,dialectIndex=0,securityMode=0x7,security=user,encryptedPasswords=true,maxMpxCount=50,maxNumberVcs=1,maxBufferSize=16644,maxRawSize=65536,sessionKey=0x00000000,capabilities=0x0001F3FD,serverTime=Tue
Jun 19 14:07:40 CEST
2007,serverTimeZone=65416,encryptionKeyLength=8,byteCount=38,encryptionKey=0x218F05BCA6C96FAD,oemDomainName=WW011]
00000: FF 53 4D 42 72 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBr......À....|
00010: 00 00 00 00 00 00 00 00 00 00 10 72 00 00 01 00  |...........r....|
00020: 11 00 00 07 32 00 01 00 04 41 00 00 00 00 01     |....2....A..... |

treeConnect: unc=\\WW011\IPC$,service=?????
sessionSetup: accountName=uidg0840,primaryDomain=ww011
SmbComSessionSetupAndX[command=SMB_COM_SESSION_SETUP_ANDX,received=false,errorCode=0,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=29200,uid=0,mid=2,wordCount=13,byteCount=117,andxCommand=0x75,andxOffset=178,snd_buf_size=16644,maxMpxCount=10,VC_NUMBER=1,sessionKey=0,passwordLength=24,unicodePasswordLength=24,capabilities=4180,accountName=uidg0840,primaryDomain=WW011,NATIVE_OS=Windows
2003,NATIVE_LANMAN=jCIFS]
SmbComTreeConnectAndX[command=SMB_COM_TREE_CONNECT_ANDX,received=false,errorCode=0,flags=0x0018,flags2=0x0000,signSeq=0,tid=0,pid=29200,uid=0,mid=0,wordCount=4,byteCount=33,andxCommand=0xFF,andxOffset=0,disconnectTid=false,passwordLength=1,password=,path=\\WW011\IPC$,service=?????]
00000: FF 53 4D 42 73 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMBs......À....|
00010: 00 00 00 00 00 00 00 00 00 00 10 72 00 00 02 00  |...........r....|
00020: 0D 75 00 B2 00 04 41 0A 00 01 00 00 00 00 00 18  |.u.²..A.........|
00030: 00 18 00 00 00 00 00 54 10 00 00 75 00 BC CC D6  |.......T...u.¼ÌÖ|
00040: 16 AB E9 3B E8 67 80 BE D5 CA 16 7C 96 C9 05 D2  |.«é;èg.¾ÕÊ.|.É.Ò|
00050: A4 0A A7 78 89 F3 D5 BA 23 1F 3E 42 18 53 B5 82  |¤.§x.óÕº#.>B.Sµ.|
00060: 44 3E 91 4A C6 7F 7E FA 27 2D 24 C5 E8 00 75 00  |D>.JÆ.~ú'-$Åè.u.|
00070: 69 00 64 00 67 00 30 00 38 00 34 00 30 00 00 00  |i.d.g.0.8.4.0...|
00080: 57 00 57 00 30 00 31 00 31 00 00 00 57 00 69 00  |W.W.0.1.1...W.i.|
00090: 6E 00 64 00 6F 00 77 00 73 00 20 00 32 00 30 00  |n.d.o.w.s. .2.0.|
000A0: 30 00 33 00 00 00 6A 00 43 00 49 00 46 00 53 00  |0.3...j.C.I.F.S.|
000B0: 00 00 04 FF 00 00 00 00 00 01 00 21 00 00 5C 00  |...ÿ.......!..\.|
000C0: 5C 00 57 00 57 00 30 00 31 00 31 00 5C 00 49 00  |\.W.W.0.1.1.\.I.|
000D0: 50 00 43 00 24 00 00 00 3F 3F 3F 3F 3F 00        |P.C.$...?????.  |

New data read: Transport1[WW011<1C>/158.92.186.86:0]
00000: FF 53 4D 42 73 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBs......À....|
00010: 00 00 00 00 00 00 00 00 06 08 10 72 02 10 02 00  |...........r....|

SmbComSessionSetupAndXResponse[command=SMB_COM_SESSION_SETUP_ANDX,received=false,errorCode=0,flags=0x0098,flags2=0xC003,signSeq=0,tid=2054,pid=29200,uid=4098,mid=2,wordCount=3,byteCount=140,andxCommand=0x75,andxOffset=181,isLoggedInAsGuest=false,nativeOs=Windows
Server 2003 3790 Service Pack 1,nativeLanMan=Windows Server 2003
5.2,primaryDomain=WW011]
00000: FF 53 4D 42 73 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBs......À....|
00010: 00 00 00 00 00 00 00 00 06 08 10 72 02 10 02 00  |...........r....|
00020: 03 75 00 B5 00 00 00 8C 00 41 57 00 69 00 6E 00  |.u.µ.....AW.i.n.|
00030: 64 00 6F 00 77 00 73 00 20 00 53 00 65 00 72 00  |d.o.w.s. .S.e.r.|
00040: 76 00 65 00 72 00 20 00 32 00 30 00 30 00 33 00  |v.e.r. .2.0.0.3.|
00050: 20 00 33 00 37 00 39 00 30 00 20 00 53 00 65 00  | .3.7.9.0. .S.e.|
00060: 72 00 76 00 69 00 63 00 65 00 20 00 50 00 61 00  |r.v.i.c.e. .P.a.|
00070: 63 00 6B 00 20 00 31 00 00 00 57 00 69 00 6E 00  |c.k. .1...W.i.n.|
00080: 64 00 6F 00 77 00 73 00 20 00 53 00 65 00 72 00  |d.o.w.s. .S.e.r.|
00090: 76 00 65 00 72 00 20 00 32 00 30 00 30 00 33 00  |v.e.r. .2.0.0.3.|
000A0: 20 00 35 00 2E 00 32 00 00 00 57 00 57 00 30 00  | .5...2...W.W.0.|
000B0: 31 00 31 00 00 03 FF 00 C4 00 01 00 06 00 49 50  |1.1...ÿ.Ä.....IP|
000C0: 43 00 00 00                                      |C...            |

web.xml:

      <init-param>
          <param-name>jcifs.netbios.wins</param-name>
          <param-value>158.92.186.86</param-value>
      </init-param>
      <init-param>
          <param-name>jcifs.smb.client.domain</param-name>
          <param-value>ww011</param-value>
      </init-param>
      <init-param>
          <param-name>jcifs.util.loglevel</param-name>
          <param-value>6</param-value>
      </init-param>
        <init-param>
            <param-name>jcifs.smb.client.username</param-name>
            <param-value>uidg0840</param-value>
        </init-param>
        <init-param>
            <param-name>jcifs.smb.client.password</param-name>
            <param-value>weLoveJCifs</param-value>
        </init-param>
      <init-param>
        <param-name>jcifs.encoding</param-name>
        <param-value>cp1252</param-value>
      </init-param>

Any advice would be much appreciated!

Thanks,


John



More information about the jcifs mailing list