Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
01936aa5
提交
01936aa5
authored
10 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Metadata: the password of linked tables is now only visible for admin users.
上级
0aa8ac13
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
54 行增加
和
3 行删除
+54
-3
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+10
-2
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+42
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
01936aa5
...
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
For Windows, database URLs of the form "jdbc:h2:/test" where considered
<ul><li>
Metadata: the password of linked tables is now only visible for admin users.
</li><li>
For Windows, database URLs of the form "jdbc:h2:/test" where considered
relative and did not work unless the system property "h2.implicitRelativePath" was used.
</li><li>
Follow JDBC specification on Procedures MetaData, use P0 as
return type of procedure.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
01936aa5
...
...
@@ -40,6 +40,7 @@ import org.h2.index.Index;
import
org.h2.index.IndexType
;
import
org.h2.index.MetaIndex
;
import
org.h2.index.MultiVersionIndex
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.message.DbException
;
import
org.h2.mvstore.FileStore
;
import
org.h2.mvstore.db.MVTableEngine.Store
;
...
...
@@ -688,6 +689,13 @@ public class MetaTable extends Table {
storageType
=
table
.
isPersistIndexes
()
?
"CACHED"
:
"MEMORY"
;
}
String
sql
=
table
.
getCreateSQL
();
if
(!
admin
)
{
if
(
sql
!=
null
&&
sql
.
indexOf
(
JdbcSQLException
.
HIDE_SQL
)
>=
0
)
{
// hide the password of linked tables
sql
=
"-"
;
}
}
add
(
rows
,
// TABLE_CATALOG
catalog
,
...
...
@@ -700,7 +708,7 @@ public class MetaTable extends Table {
// STORAGE_TYPE
storageType
,
// SQL
table
.
getCreateSQL
()
,
sql
,
// REMARKS
replaceNullWithEmpty
(
table
.
getComment
()),
// LAST_MODIFICATION
...
...
@@ -1236,7 +1244,7 @@ public class MetaTable extends Table {
FunctionAlias
alias
=
(
FunctionAlias
)
aliasAsSchemaObject
;
for
(
FunctionAlias
.
JavaMethod
method
:
alias
.
getJavaMethods
())
{
// Add return column index 0
if
(
method
.
getDataType
()
!=
Value
.
NULL
)
{
if
(
method
.
getDataType
()
!=
Value
.
NULL
)
{
DataType
dt
=
DataType
.
getDataType
(
method
.
getDataType
());
add
(
rows
,
// ALIAS_CATALOG
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
01936aa5
...
...
@@ -35,6 +35,7 @@ public class TestRights extends TestBase {
@Override
public
void
test
()
throws
SQLException
{
testLinkedTableMeta
();
testGrantMore
();
testOpenNonAdminWithMode
();
testDisallowedTables
();
...
...
@@ -47,6 +48,47 @@ public class TestRights extends TestBase {
testSchemaAdminRole
();
deleteDb
(
"rights"
);
}
private
void
testLinkedTableMeta
()
throws
SQLException
{
deleteDb
(
"rights"
);
Connection
conn
=
getConnection
(
"rights"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create user test password 'test'"
);
stat
.
execute
(
"create linked table test"
+
"(null, 'jdbc:h2:mem:', 'sa', 'sa', 'DUAL')"
);
// password is invisible to non-admin
Connection
conn2
=
getConnection
(
"rights"
,
"test"
,
getPassword
(
"test"
));
Statement
stat2
=
conn2
.
createStatement
();
ResultSet
rs
=
stat2
.
executeQuery
(
"select * from information_schema.tables "
+
"where table_name = 'TEST'"
);
assertTrue
(
rs
.
next
());
ResultSetMetaData
meta
=
rs
.
getMetaData
();
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
String
s
=
rs
.
getString
(
i
);
assertFalse
(
s
!=
null
&&
s
.
indexOf
(
"'sa'"
)
>=
0
);
}
conn2
.
close
();
// password is visible to admin
rs
=
stat
.
executeQuery
(
"select * from information_schema.tables "
+
"where table_name = 'TEST'"
);
assertTrue
(
rs
.
next
());
meta
=
rs
.
getMetaData
();
boolean
foundPassword
=
false
;
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
String
s
=
rs
.
getString
(
i
);
if
(
s
!=
null
&&
s
.
indexOf
(
"'sa'"
)
>=
0
)
{
foundPassword
=
true
;
}
}
assertTrue
(
foundPassword
);
conn2
.
close
();
stat
.
execute
(
"drop table test"
);
conn
.
close
();
}
private
void
testGrantMore
()
throws
SQLException
{
deleteDb
(
"rights"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论