Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
97c52abc
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
97c52abc
编写于
4月 02, 1999
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Repair problems with omitted password and VALID UNTIL
parameters in CREATE USER.
上级
f620241d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
21 deletion
+38
-21
src/backend/commands/user.c
src/backend/commands/user.c
+38
-21
未找到文件。
src/backend/commands/user.c
浏览文件 @
97c52abc
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: user.c,v 1.2
6 1999/03/16 04:25:45 momjian
Exp $
* $Id: user.c,v 1.2
7 1999/04/02 06:16:36 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -94,20 +94,24 @@ UpdatePgPwdFile(char *sql, CommandDest dest)
...
@@ -94,20 +94,24 @@ UpdatePgPwdFile(char *sql, CommandDest dest)
void
void
DefineUser
(
CreateUserStmt
*
stmt
,
CommandDest
dest
)
DefineUser
(
CreateUserStmt
*
stmt
,
CommandDest
dest
)
{
{
char
*
pg_shadow
,
char
*
pg_shadow
,
sql
[
SQL_LENGTH
];
sql
[
SQL_LENGTH
];
Relation
pg_shadow_rel
;
Relation
pg_shadow_rel
;
TupleDesc
pg_shadow_dsc
;
TupleDesc
pg_shadow_dsc
;
HeapScanDesc
scan
;
HeapScanDesc
scan
;
HeapTuple
tuple
;
HeapTuple
tuple
;
Datum
datum
;
Datum
datum
;
bool
exists
=
false
,
bool
exists
=
false
,
n
,
n
,
inblock
;
inblock
,
int
max_id
=
-
1
;
havepassword
,
havevaluntil
;
if
(
stmt
->
password
)
int
max_id
=
-
1
;
havepassword
=
stmt
->
password
&&
stmt
->
password
[
0
];
havevaluntil
=
stmt
->
validUntil
&&
stmt
->
validUntil
[
0
];
if
(
havepassword
)
CheckPgUserAclNotNull
();
CheckPgUserAclNotNull
();
if
(
!
(
inblock
=
IsTransactionBlock
()))
if
(
!
(
inblock
=
IsTransactionBlock
()))
BeginTransactionBlock
();
BeginTransactionBlock
();
...
@@ -163,18 +167,31 @@ DefineUser(CreateUserStmt *stmt, CommandDest dest)
...
@@ -163,18 +167,31 @@ DefineUser(CreateUserStmt *stmt, CommandDest dest)
}
}
/*
/*
* Build the insert statment to be executed.
* Build the insert statement to be executed.
*
* XXX Ugly as this code is, it still fails to cope with ' or \
* in any of the provided strings.
*/
*/
snprintf
(
sql
,
SQL_LENGTH
,
snprintf
(
sql
,
SQL_LENGTH
,
"insert into %s(usename,usesysid,usecreatedb,usetrace,usesuper,"
"insert into %s (usename,usesysid,usecreatedb,usetrace,"
"usecatupd,passwd,valuntil) values('%s',%d%s%s,'%s','%s')"
,
"usesuper,usecatupd,passwd,valuntil) "
ShadowRelationName
,
"values('%s',%d,'%c','t','%c','t',%s%s%s,%s%s%s)"
,
stmt
->
user
,
max_id
+
1
,
ShadowRelationName
,
(
stmt
->
createdb
&&
*
stmt
->
createdb
)
?
",'t','t'"
:
",'f','t'"
,
stmt
->
user
,
(
stmt
->
createuser
&&
*
stmt
->
createuser
)
?
",'t','t'"
:
",'f','t'"
,
max_id
+
1
,
stmt
->
password
?
stmt
->
password
:
"''"
,
(
stmt
->
createdb
&&
*
stmt
->
createdb
)
?
't'
:
'f'
,
stmt
->
validUntil
?
stmt
->
validUntil
:
""
);
(
stmt
->
createuser
&&
*
stmt
->
createuser
)
?
't'
:
'f'
,
havepassword
?
"'"
:
""
,
havepassword
?
stmt
->
password
:
"NULL"
,
havepassword
?
"'"
:
""
,
havevaluntil
?
"'"
:
""
,
havevaluntil
?
stmt
->
validUntil
:
"NULL"
,
havevaluntil
?
"'"
:
""
);
/*
* XXX If insert fails, say because a bogus valuntil date is given,
* need to catch the resulting error and undo our transaction.
*/
pg_exec_query_dest
(
sql
,
dest
,
false
);
pg_exec_query_dest
(
sql
,
dest
,
false
);
/*
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录