Added support for validation of incoming FINGERPRINT attribtues
This commit is contained in:
parent
2f3a192612
commit
4ce221186e
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.ice4j.attribute;
|
package org.ice4j.attribute;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import java.util.zip.*;
|
import java.util.zip.*;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
@ -235,13 +236,21 @@ public class FingerprintAttribute
|
|||||||
CRC32 checksum = new CRC32();
|
CRC32 checksum = new CRC32();
|
||||||
checksum.update(messageHead, mhOffset, mhLen);
|
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();
|
long realChecksum = checksum.getValue();
|
||||||
|
|
||||||
//CRC failure.
|
|
||||||
if (realChecksum != crc)
|
if (realChecksum != crc)
|
||||||
throw new StunException(StunException.ILLEGAL_ARGUMENT,
|
throw new StunException(StunException.ILLEGAL_ARGUMENT,
|
||||||
"An incoming message arrived with a wrong FINGERPRINT "
|
"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.");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user