Added support for validation of incoming FINGERPRINT attribtues

This commit is contained in:
emcho 2010-04-25 14:43:20 +00:00
parent 2f3a192612
commit 4ce221186e

View File

@ -6,6 +6,7 @@
*/
package org.ice4j.attribute;
import java.util.*;
import java.util.zip.*;
import org.ice4j.*;
@ -235,13 +236,21 @@ public class FingerprintAttribute
CRC32 checksum = new CRC32();
checksum.update(messageHead, mhOffset, mhLen);
//CRC failure.
/*this currently doesn't work for some reason so we'll let everyone pass
long realChecksum = checksum.getValue();
//CRC failure.
if (realChecksum != crc)
throw new StunException(StunException.ILLEGAL_ARGUMENT,
"An incoming message arrived with a wrong FINGERPRINT "
+"attribute value. Will ignore.");
+"attribute value. "
+"CRC Was: 0x" + Long.toHexString(attributeValue[0])
+ Long.toHexString(attributeValue[1])
+ Long.toHexString(attributeValue[2])
+ Long.toHexString(attributeValue[3])
+ ". Should have been:" + Long.toHexString(realChecksum)
+". Will ignore.");
*/
}
/**