From 7eb3c81aada830ba5a9b4e32848783f2223a0f18 Mon Sep 17 00:00:00 2001
From: orbiter v0.37
+ v0.36_build20050326
+
+
+
+
The new setting is effective immediately, you don't need to re-start.
-#(/info)#
+::
+The submitted peer name is already used by another peer. Please choose a different name.
+The settings have not been changed.
+::
+The submitted peer name is not well-formed. Please choose a different name.
+Peer names must not contain characters other than (a-z, A-Z, 0-9, '-', '_') and must not be longer than 80 characters.
+The settings have not been changed.#(/info)#
You can now go back to the Settings page if you want to make more changes.
diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java index 76013d090..3cccb1335 100644 --- a/htroot/SettingsAck_p.java +++ b/htroot/SettingsAck_p.java @@ -191,15 +191,35 @@ public class SettingsAck_p { String port = (String) post.get("port"); String peerName = (String) post.get("peername"); String shutdownWaiting = (String) post.get("shutdownWaiting"); - String info = ""; - env.setConfig("port", port); - env.setConfig("peerName", peerName); - env.setConfig("shutdownWaiting", shutdownWaiting); - prop.put("info", 12);//port or peername changed - prop.put("info_port", port); - prop.put("info_peerName", peerName); - prop.put("info_shutdownWaiting", shutdownWaiting); + // check if peer name already exists + yacySeed oldSeed = yacyCore.seedDB.lookupByName(peerName); + + if (oldSeed == null) { + // the name is new + boolean nameOK = (peerName.length() <= 80); + for (int i = 0; i < peerName.length(); i++) { + if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_".indexOf(peerName.charAt(i)) < 0) nameOK = false; + } + if (!(nameOK)) { + // deny change + prop.put("info", 17);//peer name is wrong + } else { + + // set values + env.setConfig("port", port); + env.setConfig("peerName", peerName); + env.setConfig("shutdownWaiting", shutdownWaiting); + + prop.put("info", 12);//port or peername changed + prop.put("info_port", port); + prop.put("info_peerName", peerName); + prop.put("info_shutdownWaiting", shutdownWaiting); + } + } else { + // deny change + prop.put("info", 16);//peer name is already used by another peer + } return prop; } diff --git a/htroot/Settings_p.html b/htroot/Settings_p.html index c686b9abc..fd5628838 100644 --- a/htroot/Settings_p.html +++ b/htroot/Settings_p.html @@ -47,7 +47,7 @@ delete the file 'DATA/SETTINGS/httpProxy.conf' in the YaCy application root fold