[jcifs] ipv6 bug in jcifs.netbios.NbtAddress

Pascal Rigaux Pascal.Rigaux at univ-paris1.fr
Wed Aug 26 08:15:44 UTC 2015


Then throw an exception if localInetAddress is ipv6 ? saying use  
-Djava.net.preferIPv4Stack=true ?

"Christopher R. Hertel" <crh at ubiqx.mn.org> a écrit :

> See RFC1001/1002.  The NBT protocol has IPv4 address fields hard-coded.
> You can't map an IPv6 address to/from an NBT Address.
>
> Chris -)-----
>
> On Tue, Aug 25, 2015 at 5:07 AM, Pascal Rigaux <pascal.rigaux at univ-paris1.fr
>> wrote:
>
>> Hi,
>>
>> We've been wondering why our server was doing weird accesses to Poland.
>> The culprit is in
>> https://jcifs.samba.org/src/src/jcifs/netbios/NbtAddress.java, hashCode
>> is used on a InetAddress:
>>
>>   localhost = new NbtAddress(localName, localInetAddress.hashCode(), ...)
>>
>> In ipv4, it's ok (
>> https://github.com/samskivert/ikvm-openjdk/blob/master/jdk/src/share/classes/java/net/Inet4Address.java#L330-L332
>> )
>> but not in ipv6 (
>> https://github.com/samskivert/ikvm-openjdk/blob/master/jdk/src/share/classes/java/net/Inet6Address.java#L642
>> )
>>
>> Context:
>> - SPNEGO implemented in CAS server (
>> https://wiki.jasig.org/display/CASUM/SPNEGO)
>> - NTLM unused but somehow some firefox are sending NTLMSSP instead of
>> Kerberos, which caused accesses to weird servers which drops the request,
>> blocking our server :-(
>> I hope it's clear enough... I unfortunately had to look at things i really
>> do not master...
>>
>> cu,
>> Pascal Rigaux.
>>
>>
>> Test case:
>>
>> import java.net.InetAddress;
>> class Test {
>>    static int fromHex(String s, int offset) {
>>         return Integer.parseInt(s.substring(offset, offset + 2), 16);
>>    }
>>    public static void main(String[] args) throws
>> java.net.UnknownHostException {
>>        InetAddress i = InetAddress.getLocalHost();
>>        String s = Integer.toHexString(i.hashCode());
>>        System.out.println(fromHex(s, 0) + "." + fromHex(s, 2) + "." +
>> fromHex(s, 4) + "." + fromHex(s, 6));
>>    }
>> }
>>
>> % javac Test.java
>> % java Test
>> 83.6.6.183
>> % java -Djava.net.preferIPv4Stack=true Test
>> 193.55.96.57
>>
>> (precision: the server has ipv6 2001:660:3305::57)
>>
>> --
>> Ce message a ete verifie par MailScanner
>> pour des virus ou des polluriels et rien de
>> suspect n'a ete trouve.
>>
>>
>>
>
>
> --
> "Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
> Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
> jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
> ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
> OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org
>
> --
> Ce message a ete verifie par MailScanner
> pour des virus ou des polluriels et rien de
> suspect n'a ete trouve.




-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.




More information about the jCIFS mailing list