diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index d0932e587e4cf4080670cb82643351c9477eb3a6..e4d42ef16160e9bafd7a5ea0999ebe301845243b 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -371,7 +371,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable if (line.length() == 0) { String ok = getTunnel().getContext().getProperty("i2ptunnel.gzip"); - boolean gzip = true; + boolean gzip = false; if (ok != null) gzip = Boolean.valueOf(ok).booleanValue(); if (gzip) diff --git a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java index bbc0423119bc1692f3afc0e9ee8968553126952c..8c3fe86347dc6d6424f49831cb60eb0242b82ace 100644 --- a/apps/syndie/java/src/net/i2p/syndie/BlogManager.java +++ b/apps/syndie/java/src/net/i2p/syndie/BlogManager.java @@ -240,11 +240,22 @@ public class BlogManager { File cfg = getConfigFile(); return (cfg.exists()); } + + /** + * If true, this syndie instance is meant for just one local user, so we don't need + * to password protect registration, remote.jsp, or admin.jsp + * + */ + public boolean isSingleUser() { + String isSingle = _context.getProperty("syndie.singleUser"); + return ( (isSingle != null) && (Boolean.valueOf(isSingle).booleanValue()) ); + } public String getDefaultProxyHost() { return _context.getProperty("syndie.defaultProxyHost", ""); } public String getDefaultProxyPort() { return _context.getProperty("syndie.defaultProxyPort", ""); } public boolean authorizeAdmin(String pass) { + if (isSingleUser()) return true; String admin = getAdminPasswordHash(); if ( (admin == null) || (admin.trim().length() <= 0) ) return false; @@ -252,15 +263,20 @@ public class BlogManager { return (hash.equals(admin)); } public boolean authorizeRemote(String pass) { + if (isSingleUser()) return true; String rem = getRemotePasswordHash(); if ( (rem == null) || (rem.trim().length() <= 0) ) return false; String hash = Base64.encode(_context.sha().calculateHash(DataHelper.getUTF8(pass.trim())).getData()); return (hash.equals(rem)); } + public boolean authorizeRemote(User user) { + if (isSingleUser()) return true; + return (!user.getAuthenticated() || !user.getAllowAccessRemote()); + } public void configure(String registrationPassword, String remotePassword, String adminPass, String defaultSelector, - String defaultProxyHost, int defaultProxyPort, Properties opts) { + String defaultProxyHost, int defaultProxyPort, boolean isSingleUser, Properties opts) { File cfg = getConfigFile(); Writer out = null; try { @@ -277,6 +293,7 @@ public class BlogManager { out.write("syndie.defaultProxyHost="+defaultProxyHost.trim() + "\n"); if (defaultProxyPort > 0) out.write("syndie.defaultProxyPort="+defaultProxyPort + "\n"); + out.write("syndie.singleUser=" + isSingleUser + "\n"); if (opts != null) { for (Iterator iter = opts.keySet().iterator(); iter.hasNext(); ) { String key = (String)iter.next(); @@ -327,7 +344,7 @@ public class BlogManager { public String register(User user, String login, String password, String registrationPassword, String blogName, String blogDescription, String contactURL) { System.err.println("Register [" + login + "] pass [" + password + "] name [" + blogName + "] descr [" + blogDescription + "] contact [" + contactURL + "] regPass [" + registrationPassword + "]"); String hashedRegistrationPassword = getRegistrationPasswordHash(); - if (hashedRegistrationPassword != null) { + if ( (hashedRegistrationPassword != null) && (!isSingleUser()) ) { try { if (!hashedRegistrationPassword.equals(Base64.encode(_context.sha().calculateHash(registrationPassword.getBytes("UTF-8")).getData()))) return "<span class=\"b_regMsgErr\">Invalid registration password</span>"; diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java index 57607ac760c6674b95bcb36cbfb206a8e3c5a585..ac31b4492a57f8e658d6dd7cc252f98e7427a76c 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java @@ -351,7 +351,7 @@ public class HTMLRenderer extends EventReceiverImpl { _bodyBuffer.append(getSpan("blogArchive")).append(" Archives: "); for (int i = 0; i < locations.size(); i++) { SafeURL surl = (SafeURL)locations.get(i); - if (_user.getAuthenticated() && _user.getAllowAccessRemote()) + if (_user.getAuthenticated() && BlogManager.instance().authorizeRemote(_user) ) _bodyBuffer.append("<a ").append(getClass("blogArchiveView")).append(" href=\"").append(getArchiveURL(blog, surl)).append("\">").append(sanitizeString(surl.toString())).append("</a> "); else _bodyBuffer.append(getSpan("blogArchiveURL")).append(sanitizeString(surl.toString())).append("</span> "); diff --git a/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java b/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java index 597c897b38e3af75a76fff0d43d114657968dc64..fbc3d03587d2cd27941f86d2f417003e9a384394 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java @@ -97,7 +97,7 @@ public class PostBean { _filenames, localStreams, _fileTypes); if (_log.shouldLog(Log.DEBUG)) _log.debug("Posted the entry " + uri.toString() + " (archive = " + _archive + ")"); - if ( (uri != null) && (_user.getAllowAccessRemote()) ) { + if ( (uri != null) && BlogManager.instance().authorizeRemote(_user) ) { PetName pn = _user.getPetNameDB().get(_archive); if (_log.shouldLog(Log.DEBUG)) _log.debug("Archive to petname? " + pn + " (protocol: " + (pn != null ? pn.getProtocol() : "") + ")"); diff --git a/apps/syndie/jsp/admin.jsp b/apps/syndie/jsp/admin.jsp index 59eb76dd023ae60c0871d82e2b16757361e10085..7fd2ae67151b0520b97060d16a0e33a52bf138bd 100644 --- a/apps/syndie/jsp/admin.jsp +++ b/apps/syndie/jsp/admin.jsp @@ -25,11 +25,18 @@ if (!user.getAuthenticated()) { String proxyHost = request.getParameter("proxyhost"); String proxyPort = request.getParameter("proxyport"); String selector = request.getParameter("selector"); + boolean isSingleUser = BlogManager.instance().isSingleUser(); + String singleSet = request.getParameter("singleuser"); + if (singleSet != null) + isSingleUser = true; + else + isSingleUser = false; + if (configured) { - if ( (adminPass != null) && (BlogManager.instance().authorizeAdmin(adminPass)) ) { + if (BlogManager.instance().authorizeAdmin(adminPass)) { int port = -1; try { port = Integer.parseInt(proxyPort); } catch (NumberFormatException nfe) { port = 4444; } - BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, null); + BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, isSingleUser, null); %><span class="b_adminMsgOk">Configuration updated</span><% } else { %><span class="b_adminMsgErr">Invalid admin password. If you lost it, please update your syndie.config.</span><% @@ -37,11 +44,15 @@ if (!user.getAuthenticated()) { } else { int port = -1; try { port = Integer.parseInt(proxyPort); } catch (NumberFormatException nfe) { port = 4444; } - BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, null); + BlogManager.instance().configure(regPass, remotePass, adminPass, selector, proxyHost, port, isSingleUser, null); %><span class="b_adminMsgOk">Configuration saved</span><% } } else { %><form action="admin.jsp" method="POST"> +<em class="b_adminField">Single user?</em> <input type="checkbox" class="b_adminField" name="singleuser" <%=BlogManager.instance().isSingleUser() ? " checked=\"true\" " : ""%> /><br /> +<span class="b_adminDescr">If this is checked, the registration, admin, and remote passwords are unnecessary - anyone +can register and administer Syndie, as well as use any remote functionality. This should not be checked if untrusted +parties can access this web interface.</span><br /> <em class="b_adminField">Registration password:</em> <input class="b_adminField" type="text" name="regpass" size="10" /><br /> <span class="b_adminDescr">Users must specify this password on the registration form to proceed. If this is blank, anyone can register.</span><br /> diff --git a/apps/syndie/jsp/post.jsp b/apps/syndie/jsp/post.jsp index f92a7716dd2b5196604bbf342978b472b62ee2cf..0afc1cc315d83db8ad5572353b92baf81d835dd9 100644 --- a/apps/syndie/jsp/post.jsp +++ b/apps/syndie/jsp/post.jsp @@ -97,7 +97,7 @@ if (!user.getAuthenticated()) { post.renderPreview(out); %><hr /><span class="b_postConfirm"><form action="post.jsp" method="POST"> -Please confirm that the above is ok<% if (user.getAllowAccessRemote()) { %>, and select what additional archives you +Please confirm that the above is ok<% if (BlogManager.instance().authorizeRemote(user)) { %>, and select what additional archives you want the post transmitted to. Otherwise, just hit your browser's back arrow and make changes. <select class="b_postConfirm" name="archive"> diff --git a/apps/syndie/jsp/remote.jsp b/apps/syndie/jsp/remote.jsp index 506280606ab3da43e810a05626eb040e6b96866b..bc47b1a8f3d21aa8cb16daed93685153e13a130b 100644 --- a/apps/syndie/jsp/remote.jsp +++ b/apps/syndie/jsp/remote.jsp @@ -16,7 +16,7 @@ request.setCharacterEncoding("UTF-8"); <jsp:include page="_topnav.jsp" /> <td valign="top" align="left" rowspan="2" class="b_rightnav"><jsp:include page="_rightnav.jsp" /></td></tr> <tr class="b_content"><td valign="top" align="left" colspan="3" class="b_content"><% -if (!user.getAuthenticated() || !user.getAllowAccessRemote()) { +if (!BlogManager.instance().authorizeRemote(user)) { %><span class="b_remoteMsgErr">Sorry, you are not allowed to access remote archives from here. Perhaps you should install Syndie yourself?</span><% } else { %><form action="remote.jsp" method="POST"><span class="b_remoteChooser"><span class="b_remoteChooserField">Import from:</span> <select class="b_remoteChooserNet" name="schema"> diff --git a/build.xml b/build.xml index a11e2e2b3d034bb1cbc306d6a4f89743e4ada650..a4c7e37d195d1b609c9eb73c593e3f54655b9902 100644 --- a/build.xml +++ b/build.xml @@ -46,6 +46,12 @@ <copy file="apps/jetty/jettylib/javax.servlet.jar" todir="build/" /> </target> <target name="buildexe"> + <condition property="osx"> + <os family="mac" /> + </condition> + <ant target="doBuildEXE" /> + </target> + <target name="doBuildEXE" unless="osx"> <jar destfile="./build/launchi2p.jar"> <manifest> <attribute name="Main-Class" value="net.i2p.router.RouterLaunch" /> @@ -115,8 +121,8 @@ </target> <target name="clean" depends="pkgclean" > <delete dir="./build" /> - <delete file="i2pinstall.exe" /> - <delete file="i2p.exe" /> + <delete file="i2pinstall.exe" failonerror="false" quiet="true" /> + <delete file="i2p.exe" failonerror="false" quiet="true" /> </target> <target name="distclean" depends="clean"> <ant dir="core/java/" target="distclean" /> @@ -199,7 +205,7 @@ <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" /> <copy file="build/sam.jar" todir="pkg-temp/lib/" /> <copy file="build/systray.jar" todir="pkg-temp/lib" /> - <copy file="i2p.exe" todir="pkg-temp/" /> + <copy file="i2p.exe" todir="pkg-temp/" failonerror="false" /> <copy file="installer/resources/runplain.sh" todir="pkg-temp/" /> <copy file="apps/systray/java/lib/systray4j.jar" todir="pkg-temp/lib" /> <copy file="apps/systray/java/lib/systray4j.dll" todir="pkg-temp/lib" /> @@ -289,7 +295,7 @@ <copy file="build/sam.jar" todir="pkg-temp/lib/" /> <copy file="build/router.jar" todir="pkg-temp/lib/" /> <copy file="build/routerconsole.jar" todir="pkg-temp/lib/" /> - <copy file="i2p.exe" todir="pkg-temp/" /> + <copy file="i2p.exe" todir="pkg-temp/" failonerror="false" /> <copy file="installer/resources/runplain.sh" todir="pkg-temp/" /> <!-- for the i2p 0.5 release, push jetty 5.2.1 --> @@ -341,6 +347,12 @@ <ant target="installerexe" /> </target> <target name="installerexe"> + <condition property="osx"> + <os family="mac" /> + </condition> + <ant target="doInstallerEXE" /> + </target> + <target name="doInstallerEXE"> <!-- now the installer exe --> <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" diff --git a/history.txt b/history.txt index bf6d62eb0281a29b839aba9b622418be1088d993..6245c45e30431a80aa8a7b40516d7bbb7c537ace 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,16 @@ -$Id: history.txt,v 1.252 2005/09/16 13:28:27 jrandom Exp $ +$Id: history.txt,v 1.253 2005/09/16 16:24:43 jrandom Exp $ + +2005-09-17 jrandom + * Added the natively compiled jbigi and patched java service wrapper for + OS X. Thanks Bill Dorsey for letting me use your machine! + * Don't build i2p.exe or i2pinstall.exe when run on OS X machines, as we + don't bundle the binutils necessary (and there'd be a naming conflict + if we did). + * Added 'single user' functionality to syndie - if the single user + checkbox on the admin page is checked, all users are allowed to control + the instance and sync up with remote syndie nodes. + * Temporarily disable the x-i2p-gzip in i2ptunnel until it is more closely + debugged. 2005-09-16 jrandom * Reject unroutable IPs in SSU like we do for the TCP transport (unless diff --git a/installer/lib/jbigi/README.txt b/installer/lib/jbigi/README.txt index 4c5cfe6594ca48909a23a2c18b591c82f6d972a8..a669b3d2ffb6032d586c367850de752a6762e189 100644 --- a/installer/lib/jbigi/README.txt +++ b/installer/lib/jbigi/README.txt @@ -1,4 +1,7 @@ jbigi.jar was built by jrandom on Aug 21, 2004 with the jbigi and jcpuid native libraries compiled on linux, winXP (w/ MinGW), and freebsd (4.8). The GMP code in jbigi is from GMP-4.1.3 (http://www.swox.com/gmp/), and -was optimized for a variety of CPU architectures. \ No newline at end of file +was optimized for a variety of CPU architectures. + +On Sep 16, 2005, libjbigi-osx-none.jnilib was added to jbigi.jar after +being compiled by jrandom on osx/ppc with GMP-4.1.4. diff --git a/installer/lib/jbigi/jbigi.jar b/installer/lib/jbigi/jbigi.jar index ebc4ba4de92c5f8e4f596868340d3f3ef7dec09a..fd4cd236f79c271fd1cd27ed21d9cf06faca771d 100644 Binary files a/installer/lib/jbigi/jbigi.jar and b/installer/lib/jbigi/jbigi.jar differ diff --git a/installer/lib/jbigi/jbigi.jar.sig b/installer/lib/jbigi/jbigi.jar.sig index a70946bc86698389bf62b0a083652b17c4f43e73..30942d2fd3d474a812a792fa8347d8e53906d8a2 100644 Binary files a/installer/lib/jbigi/jbigi.jar.sig and b/installer/lib/jbigi/jbigi.jar.sig differ diff --git a/installer/lib/wrapper/macosx/i2psvc b/installer/lib/wrapper/macosx/i2psvc index 51be9c749fca9b41984519860c11022f2e855c52..79b975516d5482b047f9c7f5c9eede4877a33cb5 100644 Binary files a/installer/lib/wrapper/macosx/i2psvc and b/installer/lib/wrapper/macosx/i2psvc differ diff --git a/installer/lib/wrapper/macosx/libwrapper.jnilib b/installer/lib/wrapper/macosx/libwrapper.jnilib index 09da61d86dcf3428e25bc285135bee2d5d4bd4ee..3e09fa4907c8314ec50d9ee9e3325a1e173e3458 100644 Binary files a/installer/lib/wrapper/macosx/libwrapper.jnilib and b/installer/lib/wrapper/macosx/libwrapper.jnilib differ diff --git a/installer/lib/wrapper/macosx/readme.txt b/installer/lib/wrapper/macosx/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..722642d4b1b507f5c4ece66c83bb60f5e00b3ed3 --- /dev/null +++ b/installer/lib/wrapper/macosx/readme.txt @@ -0,0 +1,6 @@ +The wrapper in here is built with an osx patch, backported from +the 3.1.2 per + http://sourceforge.net/tracker/index.php?func=detail& + aid=1262323& + group_id=39428& + atid=425187 diff --git a/installer/lib/wrapper/macosx/wrapper.c.diff b/installer/lib/wrapper/macosx/wrapper.c.diff new file mode 100644 index 0000000000000000000000000000000000000000..e6abc048dfb6f516c071ed291836cba5555e9d22 --- /dev/null +++ b/installer/lib/wrapper/macosx/wrapper.c.diff @@ -0,0 +1,78 @@ +--- wrapper_3.1.1_src/src/c/wrapper.c Fri Jul 16 10:29:10 2004 ++++ wrapper_3.1.1_src_modified/src/c/wrapper.c Fri Sep 16 14:55:23 2005 +@@ -312,7 +312,13 @@ + #include <stdio.h> + #include <stdlib.h> + #include <time.h> ++ ++#ifdef MACOSX ++#include <sys/time.h> ++#else + #include <sys/timeb.h> ++#endif ++ + #include <sys/stat.h> + #include "wrapperinfo.h" + #include "wrapper.h" +@@ -760,16 +766,28 @@ + int len; + int pos; + int err; ++ ++ #ifdef MACOSX ++ struct timeval timeBuffer; ++ #else + struct timeb timeBuffer; ++ #endif ++ + long startTime; + int startTimeMillis; + long now; + int nowMillis; + long durr; + ++#ifdef MACOSX ++ gettimeofday(&timeBuffer, NULL); ++ startTime = now = timeBuffer.tv_sec; ++ startTimeMillis = nowMillis = timeBuffer.tv_usec / 1000; ++#else + ftime( &timeBuffer ); + startTime = now = timeBuffer.time; + startTimeMillis = nowMillis = timeBuffer.millitm; ++#endif + + /* + log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "now=%ld, nowMillis=%d", now, nowMillis); +@@ -900,9 +918,15 @@ + } + + /* Get the time again */ ++#ifdef MACOSX ++ gettimeofday(&timeBuffer, NULL); ++ now = timeBuffer.tv_sec; ++ nowMillis = timeBuffer.tv_usec / 1000; ++#else + ftime( &timeBuffer ); + now = timeBuffer.time; + nowMillis = timeBuffer.millitm; ++#endif + } + /* + log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "done durr=%ld", durr); +@@ -2250,10 +2274,15 @@ + * Calculates a tick count using the system time. + */ + DWORD wrapperGetSystemTicks() { ++#ifdef MACOSX ++ struct timeval timeBuffer; ++ gettimeofday(&timeBuffer, NULL); ++ return (timeBuffer.tv_sec * 1000 + timeBuffer.tv_usec/1000) / WRAPPER_TICK_MS; ++#else + struct timeb timeBuffer; +- + ftime( &timeBuffer ); + return (timeBuffer.time * 1000 + timeBuffer.millitm) / WRAPPER_TICK_MS; ++#endif + } + + /** diff --git a/installer/lib/wrapper/macosx/wrapper_unix.c.diff b/installer/lib/wrapper/macosx/wrapper_unix.c.diff new file mode 100644 index 0000000000000000000000000000000000000000..60053ed5c7262d6dfefe1f4b707a30179d2352df --- /dev/null +++ b/installer/lib/wrapper/macosx/wrapper_unix.c.diff @@ -0,0 +1,60 @@ +--- wrapper_3.1.1_src/src/c/wrapper_unix.c Fri Jul 16 10:29:10 2004 ++++ wrapper_3.1.1_src_modified/src/c/wrapper_unix.c Fri Sep 16 14:45:48 2005 +@@ -309,7 +309,13 @@ + #include <limits.h> + #include <pthread.h> + #include <pwd.h> ++ ++#ifdef MACOSX ++#include <sys/time.h> ++#else + #include <sys/timeb.h> ++#endif ++ + #include <sys/types.h> + #include <sys/stat.h> + #include <sys/wait.h> +@@ -1056,7 +1062,11 @@ + ssize_t bytesRead; + char readBuf [1025]; + int readBufPos, childOutputBufferPos; ++#ifdef MACOSX ++ struct timeval timeBuffer; ++#else + struct timeb timeBuffer; ++#endif + long startTime; + int startTimeMillis; + long now; +@@ -1064,9 +1074,15 @@ + long durr; + + if (jvmOut != -1) { ++#ifdef MACOSX ++ gettimeofday(&timeBuffer, NULL); ++ startTime = now = timeBuffer.tv_sec; ++ startTimeMillis = nowMillis = timeBuffer.tv_usec / 1000; ++#else + ftime( &timeBuffer ); + startTime = now = timeBuffer.time; + startTimeMillis = nowMillis = timeBuffer.millitm; ++#endif + + /* + log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "now=%ld, nowMillis=%d", now, nowMillis); +@@ -1159,9 +1175,15 @@ + } + + /* Get the time again */ ++#ifdef MACOSX ++ gettimeofday(&timeBuffer, NULL); ++ now = timeBuffer.tv_sec; ++ nowMillis = timeBuffer.tv_usec / 1000; ++#else + ftime( &timeBuffer ); + now = timeBuffer.time; + nowMillis = timeBuffer.millitm; ++#endif + } + } + diff --git a/installer/resources/postinstall.sh b/installer/resources/postinstall.sh index 606e75c970590af458d2cd782a9eae3c445efd96..998e493487c9ee46913aabc2207b2edf109dad1d 100644 --- a/installer/resources/postinstall.sh +++ b/installer/resources/postinstall.sh @@ -19,7 +19,7 @@ fi chmod 744 ./i2prouter # chmod 744 ./install_i2p_service_unix chmod 744 ./osid -chmod 744 ./startRouter.sh +chmod 744 ./runplain.sh # chmod 744 ./uninstall_i2p_service_unix ERROR_MSG="Cannot determine operating system type. From the subdirectory in lib/wrapper matching your operating system, please move i2psvc to your base I2P directory, and move the remaining two files to the lib directory."