changeset 1673:1b9f9fdb3b41

remove backup password
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 28 May 2022 21:00:30 -0600
parents 8dd8c556c449
children af18eacf187c
files src/goodjava/lucene/backup/Backup.java src/goodjava/lucene/backup/BackupIndexWriter.java src/goodjava/lucene/backup/BackupServer.java src/luan/modules/lucene/LuceneIndex.java
diffstat 4 files changed, 4 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/goodjava/lucene/backup/Backup.java	Thu May 26 21:10:02 2022 -0600
+++ b/src/goodjava/lucene/backup/Backup.java	Sat May 28 21:00:30 2022 -0600
@@ -30,6 +30,7 @@
 	Backup(File dir) {
 		this.dir = dir;
 		this.index = new File(dir,"index");
+		dir.setLastModified(System.currentTimeMillis());
 	}
 
 	void handle(RpcServer rpc,RpcCall call) {
--- a/src/goodjava/lucene/backup/BackupIndexWriter.java	Thu May 26 21:10:02 2022 -0600
+++ b/src/goodjava/lucene/backup/BackupIndexWriter.java	Sat May 28 21:00:30 2022 -0600
@@ -30,19 +30,17 @@
 	private static final Logger logger = LoggerFactory.getLogger(BackupIndexWriter.class);
 	public static String[] backupDomains;
 	private final String name;
-	private final String password;
 	private final File dir;
 	private boolean isSyncPending = false;
 	private final ExecutorService exec = Executors.newSingleThreadExecutor();
 
-	public BackupIndexWriter(LuceneIndexWriter indexWriter,File logDir,long logTime,String name,String password)
+	public BackupIndexWriter(LuceneIndexWriter indexWriter,File logDir,long logTime,String name)
 		throws IOException
 	{
 		super(indexWriter,logDir,logTime);
 		if( backupDomains == null )
 			throw new RuntimeException("must set backupDomains");
 		this.name = name;
-		this.password = password;
 		File f = new File(System.getProperty("java.io.tmpdir"));
 		dir = new File(f,"goodjava.lucene/"+name);
 		IoUtils.mkdirs(dir);
@@ -139,7 +137,7 @@
 		for( String backupDomain : backupDomains ) {
 			RpcClient rpc = BackupServer.rpcClient(backupDomain);
 			try {
-				RpcCall call = new RpcCall("login",name,password);
+				RpcCall call = new RpcCall("login",name);
 				rpc.write(call);
 				rpc.read();
 				call = new RpcCall("check",logInfo);
--- a/src/goodjava/lucene/backup/BackupServer.java	Thu May 26 21:10:02 2022 -0600
+++ b/src/goodjava/lucene/backup/BackupServer.java	Sat May 28 21:00:30 2022 -0600
@@ -89,7 +89,6 @@
 				return;
 			}
 			String name = (String)call.args[0];
-			String password = (String)call.args[1];
 			synchronized(backups) {
 				backup = backups.get(name);
 				if( backup == null ) {
@@ -97,23 +96,6 @@
 					backups.put(name,backup);
 				}
 			}
-			File pwd = new File(backupDir,name+".pwd");
-			try {
-				if( !pwd.exists() ) {
-					Writer out = new FileWriter(pwd);
-					out.write(password);
-					out.close();
-				} else {
-					Reader in = new FileReader(pwd);
-					if( !IoUtils.readAll(in).equals(password) ) {
-						rpc.write( new RpcException("wrong password") );
-						rpc.close();
-						return;
-					}
-				}
-			} catch(IOException e) {
-				throw new RuntimeException(e);
-			}
 			rpc.write(Rpc.OK);
 		}
 		while( !rpc.isClosed() ) {
--- a/src/luan/modules/lucene/LuceneIndex.java	Thu May 26 21:10:02 2022 -0600
+++ b/src/luan/modules/lucene/LuceneIndex.java	Sat May 28 21:00:30 2022 -0600
@@ -149,7 +149,6 @@
 	private final long logTime;
 	private final String name;
 	private final String domain;
-	private final String password;
 
 	private LuceneIndex(Luan luan,File indexDir,LuanTable options)
 		throws LuanException, IOException, ClassNotFoundException, SQLException
@@ -173,13 +172,6 @@
 				domain = "localhost";
 			this.domain = domain;
 		}
-		{
-			LuanTable module = (LuanTable)luan.require("luan:Io.luan");
-			String password = (String)module.get(luan,"password");
-			if( password == null )
-				password = "password";
-			this.password = password;
-		}
 
 		mfp = defaultFieldParser==null ? new MultiFieldParser() : new MultiFieldParser(defaultFieldParser,defaultFields);
 		mfp.fields.put( "type", STRING_FIELD_PARSER );
@@ -220,7 +212,7 @@
 				String name = this.domain;
 				if( this.name != null )
 					name += "~" + this.name;
-				writer = new BackupIndexWriter((LuceneIndexWriter)writer,logDir,logTime,name,password);
+				writer = new BackupIndexWriter((LuceneIndexWriter)writer,logDir,logTime,name);
 //qqq
 			}
 		}