use upstream suggested fix

Change-Id: Ibe61144ea45211aa1b68e51d267ce5b7e1764839
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147026
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2023-02-14 20:08:52 +00:00
parent b4c8775526
commit ddf4f82443

View file

@ -1,36 +1,14 @@
--- a/hsqldb/src/org/hsqldb/DatabaseCommandInterpreter.java 2023-02-13 11:08:11.297243034 +0000
+++ b/hsqldb/src/org/hsqldb/DatabaseCommandInterpreter.java 2023-02-13 13:49:17.973089433 +0000
@@ -392,31 +392,19 @@
*/
private Result processScript() throws IOException, HsqlException {
@@ -403,6 +403,11 @@
throw Trace.error(Trace.INVALID_IDENTIFIER);
}
- String token = tokenizer.getString();
- ScriptWriterText dsw = null;
+ tokenizer.getString();
session.checkAdmin();
try {
if (tokenizer.wasValue()) {
- if (tokenizer.getType() != Types.VARCHAR) {
- throw Trace.error(Trace.INVALID_IDENTIFIER);
- }
-
- dsw = new ScriptWriterText(database, token, true, true, true);
-
- dsw.writeAll();
-
- return new Result(ResultConstants.UPDATECOUNT);
+ throw Trace.error(Trace.ACCESS_IS_DENIED);
} else {
tokenizer.back();
return DatabaseScript.getScript(database, false);
}
} finally {
- if (dsw != null) {
- dsw.close();
- }
}
}
+ // added condition to avoid execution of spurious command in .script or .log file
+ if (session.isProcessingScript() || session.isProcessingLog()) {
+ return new Result(ResultConstants.UPDATECOUNT);
+ }
+
dsw = new ScriptWriterText(database, token, true, true, true);
dsw.writeAll();