Skip to content

Commit ce0baf6

Browse files
author
bwelling
committed
fixes for reading null keys from text and printing flags field
git-svn-id: http://svn.code.sf.net/p/dnsjava/code/trunk@326 c76caeb1-94fd-44dd-870f-0c9d92034fc1
1 parent 643e40a commit ce0baf6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎org/xbill/DNS/KEYRecord.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ public class KEYRecord extends Record {
9696
flags = (short) Integer.decode(st.nextToken()).intValue();
9797
proto = (byte) Integer.parseInt(st.nextToken());
9898
alg = (byte) Integer.parseInt(st.nextToken());
99-
key = base64.fromString(st.nextToken());
99+
/* If this is a null key, there's no key data */
100+
if (!((flags & (NOAUTH|NOCONF)) == (NOAUTH|NOCONF)))
101+
key = base64.fromString(st.nextToken());
102+
else
103+
key = null;
100104
}
101105

102106
/**
@@ -107,7 +111,7 @@ public class KEYRecord extends Record {
107111
StringBuffer sb = toStringNoData();
108112
if (key != null || (flags & (NOAUTH|NOCONF)) == (NOAUTH|NOCONF) ) {
109113
sb.append ("0x");
110-
sb.append (Integer.toHexString(flags));
114+
sb.append (Integer.toHexString(flags & 0xFFFF));
111115
sb.append (" ");
112116
sb.append (proto);
113117
sb.append (" ");

0 commit comments

Comments
 (0)