diff --git a/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java b/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java
index 55e76f08d..44be2c97a 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java
@@ -24,15 +24,16 @@
package i2p.susi.dns;
-import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
-import java.io.PrintWriter;
import java.io.Serializable;
+import java.util.Map;
+import java.util.Properties;
import net.i2p.I2PAppContext;
+import net.i2p.data.DataHelper;
+import net.i2p.util.OrderedProperties;
import net.i2p.util.SecureFileOutputStream;
public class ConfigBean implements Serializable {
@@ -84,25 +85,19 @@ public class ConfigBean implements Serializable {
File file = new File( configFileName );
if( file != null && file.isFile() ) {
StringBuilder buf = new StringBuilder();
- BufferedReader br = null;
try {
- br = new BufferedReader( new FileReader( file ) );
- String line;
- while( ( line = br.readLine() ) != null ) {
- buf.append( line );
- buf.append( "\n" );
+ // use loadProps to trim
+ Properties props = new OrderedProperties();
+ DataHelper.loadProps(props, file);
+ for (Map.Entry e : props.entrySet()) {
+ buf.append((String) e.getKey()).append('=')
+ .append((String) e.getValue()).append('\n');
}
config = buf.toString();
saved = true;
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } finally {
- if (br != null)
- try { br.close(); } catch (IOException ioe) {}
}
}
}
@@ -111,27 +106,23 @@ public class ConfigBean implements Serializable {
{
File file = new File( configFileName );
try {
- PrintWriter out = new PrintWriter( new SecureFileOutputStream( file ) );
- out.print( config );
- out.flush();
- out.close();
+ // use loadProps to trim, use storeProps to sort and get line endings right
+ Properties props = new OrderedProperties();
+ DataHelper.loadProps(props, new ByteArrayInputStream(config.getBytes("UTF-8")));
+ DataHelper.storeProps(props, file);
saved = true;
- } catch (FileNotFoundException e) {
+ } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
+
public void setConfig(String config) {
+ // will come from form with \r\n line endings
this.config = config;
this.saved = false;
-
- /*
- * as this is a property file we need a newline at the end of the last line!
- */
- if( ! this.config.endsWith( "\n" ) ) {
- this.config += "\n";
- }
}
+
public String getMessages() {
String message = "";
if( action != null ) {
@@ -155,12 +146,14 @@ public class ConfigBean implements Serializable {
message = "
" + message + "
";
return message;
}
+
public String getSerial()
{
lastSerial = "" + Math.random();
action = null;
return lastSerial;
}
+
public void setSerial(String serial ) {
this.serial = serial;
}
diff --git a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java
index d748a2f78..bd04fecf6 100644
--- a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java
+++ b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java
@@ -24,16 +24,20 @@
package i2p.susi.dns;
+import java.io.ByteArrayInputStream;
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
-import java.util.Properties;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import net.i2p.data.DataHelper;
import net.i2p.util.SecureFileOutputStream;
+import net.i2p.util.SystemVersion;
public class SubscriptionsBean extends BaseBean
{
@@ -55,6 +59,7 @@ public class SubscriptionsBean extends BaseBean
return fileName;
}
+
private void reload()
{
File file = new File( getFileName() );
@@ -69,9 +74,6 @@ public class SubscriptionsBean extends BaseBean
buf.append( "\n" );
}
content = buf.toString();
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -86,15 +88,27 @@ public class SubscriptionsBean extends BaseBean
{
File file = new File( getFileName() );
try {
+ // trim and sort
+ List urls = new ArrayList();
+ InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
+ String line;
+ while ((line = DataHelper.readLine(in)) != null) {
+ line = line.trim();
+ if (line.length() > 0)
+ urls.add(line);
+ }
+ Collections.sort(urls);
PrintWriter out = new PrintWriter( new SecureFileOutputStream( file ) );
- out.print( content );
- out.flush();
+ for (String url : urls) {
+ out.println(url);
+ }
out.close();
- } catch (FileNotFoundException e) {
+ } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
+
public String getMessages() {
String message = "";
if( action != null ) {
@@ -134,25 +148,23 @@ public class SubscriptionsBean extends BaseBean
message = "" + message + "
";
return message;
}
+
public String getSerial()
{
lastSerial = "" + Math.random();
action = null;
return lastSerial;
}
+
public void setSerial(String serial ) {
this.serial = serial;
}
+
public void setContent(String content) {
+ // will come from form with \r\n line endings
this.content = content;
-
- /*
- * as this is a property file we need a newline at the end of the last line!
- */
- if( ! this.content.endsWith( "\n" ) ) {
- this.content += "\n";
- }
}
+
public String getContent()
{
if( content != null )
diff --git a/history.txt b/history.txt
index fa453c121..3d2d2e178 100644
--- a/history.txt
+++ b/history.txt
@@ -2,8 +2,12 @@
* Console: Show log location on /logs even if not opened yet (ticket #905)
* HTTP proxy: Verify nonce count in digest auth
* i2psnark: Use smaller piece size for small torrents
+ * installer: Fix DOS line endings on misc. files (ticket #872)
* Plugins: Track pending plugin clients better, don't hold references,
start delayed clients from SimpleTimer2 instead of Job queue (ticket #670)
+ * SusiDNS:
+ - Trim and sort config form data
+ - Fix DOS line endings on config files in Linux (ticket #872)
2013-04-25 kytv
* Portuguese, Russian, Spanish, and Swedish translation updates from Transifex
diff --git a/installer/resources/blocklist.txt b/installer/resources/blocklist.txt
index 6108d1782..9f9dde18f 100644
--- a/installer/resources/blocklist.txt
+++ b/installer/resources/blocklist.txt
@@ -1,53 +1,53 @@
-#
-# If you have a 'split' directory installation, with configuration
-# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
-# edit the file in the configuration directory, NOT the install directory.
-#
-# Blocking is now enabled by default.
-# To disable blocking, set router.blocklist.enable=false on configadvanced.jsp,
-# or simply delete this file or remove all the entries below, and restart.
-#
-# Add additional entries as desired, sorting not required.
-# This file is only read at router startup.
-# To manually block a router after startup, use the form on http://127.0.0.1:7657/configpeer.jsp
-# Warning - a large list will increase memory usage.
-# Please do not block too broadly, it will segment and harm the network.
-# For example, http://www.bluetack.co.uk/config/splist.zip is very broad and includes Tor users, it is not recommended.
-# A more reasonable list: http://www.bluetack.co.uk/config/level1.zip
-#
-# We have included the bogons from http://www.team-cymru.org/Services/Bogons/http.html ,
-# but you will have to update your blocklist manually if the bogon list changes.
-# You must update this list yourself, it is not overwritten by the update process.
-#
-# * Acceptable formats (IPV4 only):
-# * #comment (# must be in column 1)
-# * comment:IP-IP
-# * comment:morecomments:IP-IP
-# * (comments also allowed before any of the following)
-# * IP-IP
-# * IP/masklength
-# * IP
-# * hostname (DNS looked up at list readin time, not dynamically, so may not be much use)
-# * 44-byte Base64 router hash
-# *
-# * No whitespace allowed after the last ':'.
-# *
-# * For further information and downloads:
-# * http://www.bluetack.co.uk/forums/index.php?autocom=faq&CODE=02&qid=17
-# * http://blocklist.googlepages.com/
-# * http://www.team-cymru.org/Services/Bogons/http.html
-#
-Chinese Floodfill Flooder:159.226.40.7
-Friend of the Chinese Floodfill Flooder:159.226.40.3
-The Team Cymru Bogon List v6.8 03 FEB 2011:0.0.0.0/8
-The Team Cymru Bogon List v6.8 03 FEB 2011:10.0.0.0/8
-The Team Cymru Bogon List v6.8 03 FEB 2011:127.0.0.0/8
-The Team Cymru Bogon List v6.8 03 FEB 2011:169.254.0.0/16
-The Team Cymru Bogon List v6.8 03 FEB 2011:172.16.0.0/12
-The Team Cymru Bogon List v6.8 03 FEB 2011:192.0.0.0/24
-The Team Cymru Bogon List v6.8 03 FEB 2011:192.0.2.0/24
-The Team Cymru Bogon List v6.8 03 FEB 2011:192.168.0.0/16
-The Team Cymru Bogon List v6.8 03 FEB 2011:198.18.0.0/15
-The Team Cymru Bogon List v6.8 03 FEB 2011:198.51.100.0/24
-The Team Cymru Bogon List v6.8 03 FEB 2011:203.0.113.0/24
-The Team Cymru Bogon List v6.8 03 FEB 2011:224.0.0.0/3
+#
+# If you have a 'split' directory installation, with configuration
+# files in ~/.i2p (Linux) or %APPDATA%\I2P (Windows), be sure to
+# edit the file in the configuration directory, NOT the install directory.
+#
+# Blocking is now enabled by default.
+# To disable blocking, set router.blocklist.enable=false on configadvanced.jsp,
+# or simply delete this file or remove all the entries below, and restart.
+#
+# Add additional entries as desired, sorting not required.
+# This file is only read at router startup.
+# To manually block a router after startup, use the form on http://127.0.0.1:7657/configpeer.jsp
+# Warning - a large list will increase memory usage.
+# Please do not block too broadly, it will segment and harm the network.
+# For example, http://www.bluetack.co.uk/config/splist.zip is very broad and includes Tor users, it is not recommended.
+# A more reasonable list: http://www.bluetack.co.uk/config/level1.zip
+#
+# We have included the bogons from http://www.team-cymru.org/Services/Bogons/http.html ,
+# but you will have to update your blocklist manually if the bogon list changes.
+# You must update this list yourself, it is not overwritten by the update process.
+#
+# * Acceptable formats (IPV4 only):
+# * #comment (# must be in column 1)
+# * comment:IP-IP
+# * comment:morecomments:IP-IP
+# * (comments also allowed before any of the following)
+# * IP-IP
+# * IP/masklength
+# * IP
+# * hostname (DNS looked up at list readin time, not dynamically, so may not be much use)
+# * 44-byte Base64 router hash
+# *
+# * No whitespace allowed after the last ':'.
+# *
+# * For further information and downloads:
+# * http://www.bluetack.co.uk/forums/index.php?autocom=faq&CODE=02&qid=17
+# * http://blocklist.googlepages.com/
+# * http://www.team-cymru.org/Services/Bogons/http.html
+#
+Chinese Floodfill Flooder:159.226.40.7
+Friend of the Chinese Floodfill Flooder:159.226.40.3
+The Team Cymru Bogon List v6.8 03 FEB 2011:0.0.0.0/8
+The Team Cymru Bogon List v6.8 03 FEB 2011:10.0.0.0/8
+The Team Cymru Bogon List v6.8 03 FEB 2011:127.0.0.0/8
+The Team Cymru Bogon List v6.8 03 FEB 2011:169.254.0.0/16
+The Team Cymru Bogon List v6.8 03 FEB 2011:172.16.0.0/12
+The Team Cymru Bogon List v6.8 03 FEB 2011:192.0.0.0/24
+The Team Cymru Bogon List v6.8 03 FEB 2011:192.0.2.0/24
+The Team Cymru Bogon List v6.8 03 FEB 2011:192.168.0.0/16
+The Team Cymru Bogon List v6.8 03 FEB 2011:198.18.0.0/15
+The Team Cymru Bogon List v6.8 03 FEB 2011:198.51.100.0/24
+The Team Cymru Bogon List v6.8 03 FEB 2011:203.0.113.0/24
+The Team Cymru Bogon List v6.8 03 FEB 2011:224.0.0.0/3
diff --git a/installer/resources/eepsite/docroot/index.html b/installer/resources/eepsite/docroot/index.html
index 89fc45791..1ae05044d 100644
--- a/installer/resources/eepsite/docroot/index.html
+++ b/installer/resources/eepsite/docroot/index.html
@@ -1,18 +1,18 @@
-
-
-
-
-
-
-
-I2P Anonymous Webserver
-
-
-
-
+
+
+
+
+
+
+
+I2P Anonymous Webserver
+
+
+
+
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 8ab24107c..80cfb9c84 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
- public final static long BUILD = 17;
+ public final static long BUILD = 18;
/** for example "-test" */
public final static String EXTRA = "";