Merge pull request #2691 from stelian42/fix-keysearch

Fix parsing of EOL in keyserver answer
This commit is contained in:
Vincent Breitmoser 2021-04-16 14:02:04 +02:00 committed by GitHub
commit 2d45528f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ import static java.util.Locale.ENGLISH;
public class HkpKeyserverClient implements KeyserverClient {
private static final Pattern INFO_LINE = Pattern
.compile("^info:1:([0-9]*)\n", Pattern.CASE_INSENSITIVE);
.compile("^info:1:([0-9]*)\r?\n", Pattern.CASE_INSENSITIVE);
/**
* uid:%escaped uid string%:%creationdate%:%expirationdate%:%flags%
@ -82,11 +82,11 @@ public class HkpKeyserverClient implements KeyserverClient {
*/
private static final Pattern UID_LINE = Pattern
.compile("(uid:" + // group 1
"([^:\n]*)" + // group 2
"([^:\r?\n]*)" +// group 2
"(?::([0-9]*)" + // group 3
"(?::([0-9]*)" + // group 4
"(?::(((?=(r(?!(.?r))|d(?!(.?d))|e(?!(.?e))))[rde]){0,3})" + // group 5
")?)?)?\n)",
")?)?)?\r?\n)",
Pattern.CASE_INSENSITIVE);
/**
@ -128,7 +128,7 @@ public class HkpKeyserverClient implements KeyserverClient {
"(?::([0-9]*)" + // group 5
"(?::([0-9]*)" + // group 6
"(?::((?:(?=(?:r(?!(.?r))|d(?!(.?d))|e(?!(.?e))))[rde]){0,3})" + // group 7
")?)?)?)?)?\n)"// pub line
")?)?)?)?)?\r\n)"// pub line
+ "(" + UID_LINE.pattern() + // group 11
"+)", // one or more uid lines
Pattern.CASE_INSENSITIVE