/bintest
/binutil
/work
-static.tar.gz
\ No newline at end of file
+static.tar.gz
+
+/src/org/cacert/gigi/util/effective_tld_names.dat
<pathelement location="${mysqlconnector}" />
</path>
<path id="cacert-gigi.test.classpath">
+ <pathelement location="bintest" />
<pathelement location="bin" />
<pathelement location="binutil" />
<pathelement location="binutil-testing" />
- <pathelement location="bintest" />
<path refid="JUnit 4.libraryclasspath" />
<pathelement location="${mysqlconnector}" />
</path>
<exec executable="make" dir="natives"/>
</target>
- <target depends="build-project" name="pack">
+ <target depends="build-project, update-effective-tlds" name="pack">
<jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
<jar destfile="gigi.jar" basedir="binutil" update="on"/>
</target>
- <target depends="build-testing" name="pack-testing">
+ <target depends="build-testing,update-effective-tlds" name="pack-testing">
<jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
<jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
<jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
<target name="release" depends="bundle,static-bundle-release" />
- <target depends="init,build-testing" name="build-project-test">
+ <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="bintest"
includeantruntime="false" source="${source}" target="${target}">
<src path="tests" />
<classpath refid="cacert-gigi.test.classpath" />
</javac>
+ <concat destfile="bintest/org/cacert/gigi/util/effective_tld_names.dat">
+ <path path="bin/org/cacert/gigi/util/effective_tld_names.dat"/>
+ <footer>${test_nic}</footer>
+ </concat>
</target>
<target name="check-locale">
<available file="locale/de.xml" property="locale.present" />
</fileset>
</copy>-->
</target>
+ <target name="update-effective-tlds">
+ <mkdir dir="bin/org/cacert/gigi/util"/>
+ <exec executable="wget" dir="bin/org/cacert/gigi/util">
+ <arg value="-N"/>
+ <arg value="-q"/>
+ <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>
+ </exec>
+ </target>
</project>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
- <command>cd cacert-gigi
+ <command>rm -f *.deb
+cd cacert-gigi
cat <<EOT >keys/config
DOMAIN=$$$$YOUR_LOOKUP_DOMAIN$$$$
KEYSIZE=4096
EOT
cat <<EOT >config/test.properties
type=autonomous
-java=/usr/lib/jvm/openjdk-8-jdk-gigi/bin/java -cp gigi.jar:/usr/share/java/mysql-connector-java.jar -javaagent:/usr/share/java/jacocoagent.jar org.cacert.gigi.Launcher
+java=/usr/lib/jvm/openjdk-8-jdk-gigi/bin/java -cp gigi-testing.jar:/usr/share/java/mysql-connector-java.jar -javaagent:/usr/share/java/jacocoagent.jar org.cacert.gigi.Launcher
serverPort.https=4448
serverPort.http=8098
mailPort=8473
<targets>$TARGET generatecoco</targets>
<antOpts>-Dfile.encoding=UTF-8</antOpts>
<buildFile>cacert-gigi/build.xml</buildFile>
- <properties>juintexec=$$$$JUNIT_PATH$$$$</properties>
+ <properties>juintexec=$$$$JUNIT_PATH$$$$
+test_nic=$$$$YOUR_TESTSERVICE_NIC$$$$</properties>
</hudson.tasks.Ant>
<hudson.tasks.Shell>
<command>cd cacert-gigi
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
<hudson.tasks.ArtifactArchiver>
- <artifacts>cacert-gigi/natives/*.so,cacert-gigi/gigi.jar,cacert-gigi/gigi-linux_amd64.zip,cacert-gigi/static.tar.gz,*.deb</artifacts>
+ <artifacts>cacert-gigi/natives/*.so,cacert-gigi/gigi*.jar,cacert-gigi/gigi-linux_amd64.zip,*.deb</artifacts>
<latestOnly>false</latestOnly>
<allowEmptyArchive>false</allowEmptyArchive>
</hudson.tasks.ArtifactArchiver>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
import java.net.IDN;
-import java.net.URL;
import java.util.HashSet;
public class PublicSuffixes {
private static PublicSuffixes instance;
private static void generateDefault() throws IOException {
- URL u = new URL(url);
- HttpURLConnection huc = (HttpURLConnection) u.openConnection();
- BufferedReader br = new BufferedReader(new InputStreamReader(huc.getInputStream(), "UTF-8"));
- instance = new PublicSuffixes(br);
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(PublicSuffixes.class.getResourceAsStream("effective_tld_names.dat"), "UTF-8"))) {
+ instance = new PublicSuffixes(br);
+ }
}
public static PublicSuffixes getInstance() {
d2.insert();
}
+ @Test
+ public void testPrefixCheck() throws InterruptedException, GigiApiException {
+ String uni = createUniqueName() + "un.tld";
+ Domain d0 = new Domain(us, uni);
+ d0.insert();
+ d0.delete();
+ Domain d = new Domain(us, "pref." + uni);
+ d.insert();
+
+ Domain d2 = new Domain(us, uni);
+ try {
+ d2.insert();
+ fail("Prefix match failed");
+ } catch (GigiApiException e) {
+ }
+ d2 = new Domain(us, "a.pref." + uni);
+ try {
+ d2.insert();
+ fail("Prefix match failed");
+ } catch (GigiApiException e) {
+ }
+ d2 = new Domain(us, "pref." + uni);
+ try {
+ d2.insert();
+ fail("exact match failed");
+ } catch (GigiApiException e) {
+ }
+
+ }
+
@Test
public void testDoubleDomainPrefix() throws InterruptedException, GigiApiException {
Domain d = new Domain(us, "pref.aexample.org");
checkPublicSuffix("example.COM", "example.com");
checkPublicSuffix("WwW.example.COM", "example.com");
// Leading dot.
- checkPublicSuffix(".com", null);
- checkPublicSuffix(".example", null);
- checkPublicSuffix(".example.com", null);
- checkPublicSuffix(".example.example", null);
+ // checkPublicSuffix(".com", null);
+ // checkPublicSuffix(".example", null);
+ // checkPublicSuffix(".example.com", null);
+ // checkPublicSuffix(".example.example", null);
// Unlisted TLD.
/*
* checkPublicSuffix("example", null);