Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 30054)
+++ /main/trunk/greenstone3/build.xml	(revision 30055)
@@ -1832,5 +1832,5 @@
     But you can do: echo mypassword | ant config-admin -->
   <target name="config-admin" description="Reset admin password">
-    <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-8 characters):&gt;">
+    <input addproperty="admin.password" defaultvalue="admin" message="New admin password (3-20 characters):&gt;">
       <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
     </input>
@@ -1850,5 +1850,5 @@
   <target name="get-user-data" description="Get user details">
     <input addproperty="user.username" message="Username:&gt;"/>
-    <input addproperty="user.password" defaultvalue="" message="Password (3-8 characters):&gt;">
+    <input addproperty="user.password" defaultvalue="" message="Password (3-20 characters):&gt;">
       <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
     </input>
@@ -1859,8 +1859,8 @@
   </target>
 
-<!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it. 
-    See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant 
-    But you can do: echo mypassword | ant config-admin -->
-  <target name="update-userdb" description="Add or modify users" depends="check-tomcat-running">
+  <!-- This target won't work with Eclipse because the SecureInputHandler used below conflicts with it. 
+       See http://www.dcepler.net/post.cfm/hiding-password-input-in-ant 
+       But you can do: echo mypassword | ant config-admin -->
+  <target name="update-userdb" description="Add or modify users" depends="start-derby">
 
     <!-- 
@@ -1870,12 +1870,17 @@
 	 See http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
 	 The ${tomcat.isrunning} property is set by the depends-target "check-tomcat-running" -->
-    <!--
-    <if>
-      <bool>
-	<istrue value="${tomcat.isrunning}"/>
-      </bool>
-      <antcall target="stop-tomcat"/>
-    </if>
-    -->
+   
+    <!-- Need the derby networked server to be running in order to modify the usersDB.
+	 The start-derby task will check if derby is already running (if not, ${derby.isstarted} will 
+	 be false) and will only start up networked derby if it is not already running. 
+	 The ${derby.isstarted} property is set by the depends-target "start-derby", since it won't
+	 set the property if called with antcall (like launching in a subshell). Have to use 'depends'.
+	 We'll check ${derby.isstarted} at the end to stop derby again if we had to start it up now.-->
+    <!--<antcall target="start-derby"/>-->
+
+    <!-- wait a max of 5 seconds for the derbyserver to have started up -->
+    <waitfor maxwait="5" maxwaitunit="second">
+      <socket server="${derby.server}" port="${derby.server.port}"/>
+    </waitfor>
 
     <!--<echo>${admin.password}</echo>--> <!-- for testing -->
@@ -1890,14 +1895,15 @@
       <arg value="email=${user.email}"/>
     </java>
-    
-    <!-- run tomcat again if it used to be running -->
-    <!--
+
+    <!-- Need to stop networked derby again if we ran it for this target with the depends=start-derby call. 
+	 The test here is for <not>derby.isstarted</not>, as the property would be the same as before 
+	 derby was started, since properties are immutable within a single ant command. -->
     <if>
       <bool>
-	<istrue value="${tomcat.isrunning}"/>
-	</bool>
-      <antcall target="force-start-tomcat"/>
-    </if>
-    -->
+	<not><istrue value="${derby.isstarted}"/></not>
+      </bool>
+      <antcall target="force-stop-derby"/>
+    </if>
+
   </target>
 
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/sql/derby/DerbySQLServer.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/sql/derby/DerbySQLServer.java	(revision 30054)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/sql/derby/DerbySQLServer.java	(revision 30055)
@@ -12,6 +12,6 @@
 public class DerbySQLServer implements SQLServer{
    
-    static final String PORT = GlobalProperties.getProperty("derby.server.port");//, "1527");
-    static final String DERBYSERVER = GlobalProperties.getProperty("derby.server");//, "localhost");
+    static final String PORT = GlobalProperties.getProperty("derby.server.port", "1527");
+    static final String DERBYSERVER = GlobalProperties.getProperty("derby.server", "localhost");
     static final String PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527";
     static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 30054)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 30055)
@@ -35,6 +35,6 @@
 public class DerbyWrapper
 {
-    static final String PORT = GlobalProperties.getProperty("derby.server.port");//, "1527");
-    static final String DERBYSERVER = GlobalProperties.getProperty("derby.server");//, "localhost");
+    static final String PORT = GlobalProperties.getProperty("derby.server.port", "1527");
+    static final String DERBYSERVER = GlobalProperties.getProperty("derby.server", "localhost");
     static final String PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527";
     static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 30054)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 30055)
@@ -27,4 +27,6 @@
 public class ModifyUsersDB
 {
+    public static int PWD_MIN_LENGTH = 3;
+    public static int PWD_MAX_LENGTH = 20;
 
 	public static void main(String[] args) throws SQLException
@@ -49,5 +51,5 @@
 
 		// If the user specifically sets any of the fields on the cmdline, they'll be overwritten in the db, 
-		// even if the user had set them to empty. Except the password which must be between 3 and 8 characters.
+		// even if the user had set them to empty. Except the password which must be between PWD_MIN_LENGTH and PWD_MAX_LENGTH characters.
 		for (int i = 2; i < args.length; i++)
 		{
@@ -56,9 +58,9 @@
 				password = args[i].substring("password=".length());
 
-				if (password.length() < 3 || password.length() > 8)
+				if (password.length() < PWD_MIN_LENGTH || password.length() > PWD_MAX_LENGTH)
 				{
 					if (!password.equals(""))
 					{
-						System.out.println("Password not updated. It should be between 3 and 8 characters (inclusive).");
+						System.out.println("Password not updated. It should be between " + PWD_MIN_LENGTH + " and " + PWD_MAX_LENGTH + " characters (inclusive).");
 					}
 				}
