Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1b51018a
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,发现更多精彩内容 >>
提交
1b51018a
编写于
7月 18, 2010
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix up poor handling of unsupported-platform case in requirepeer patch.
上级
25241aee
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
21 deletion
+20
-21
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+20
-21
未找到文件。
src/interfaces/libpq/fe-connect.c
浏览文件 @
1b51018a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.40
1 2010/07/18 16:42:20
tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.40
2 2010/07/18 17:08:11
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1751,15 +1751,15 @@ keep_going: /* We will come back to here until there is
char
*
startpacket
;
int
packetlen
;
#ifdef HAVE_UNIX_SOCKETS
if
(
conn
->
requirepeer
)
if
(
conn
->
requirepeer
&&
conn
->
requirepeer
[
0
])
{
#if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED)
char
pwdbuf
[
BUFSIZ
];
struct
passwd
pass_buf
;
struct
passwd
*
pass
;
uid_t
uid
;
#
if defined(HAVE_GETPEEREID)
#if defined(HAVE_GETPEEREID)
gid_t
gid
;
errno
=
0
;
...
...
@@ -1770,12 +1770,13 @@ keep_going: /* We will come back to here until there is
pqStrerror
(
errno
,
sebuf
,
sizeof
(
sebuf
)));
goto
error_return
;
}
#
elif defined(SO_PEERCRED)
#elif defined(SO_PEERCRED)
struct
ucred
peercred
;
ACCEPT_TYPE_ARG3
so_len
=
sizeof
(
peercred
);
errno
=
0
;
if
(
getsockopt
(
conn
->
sock
,
SOL_SOCKET
,
SO_PEERCRED
,
&
peercred
,
&
so_len
)
!=
0
||
if
(
getsockopt
(
conn
->
sock
,
SOL_SOCKET
,
SO_PEERCRED
,
&
peercred
,
&
so_len
)
!=
0
||
so_len
!=
sizeof
(
peercred
))
{
appendPQExpBuffer
(
&
conn
->
errorMessage
,
...
...
@@ -1784,10 +1785,10 @@ keep_going: /* We will come back to here until there is
goto
error_return
;
}
uid
=
peercred
.
uid
;
#
elif defined(HAVE_GETPEERUCRED)
#elif defined(HAVE_GETPEERUCRED)
ucred_t
*
ucred
;
ucred
=
NULL
;
/* must be initialized to NULL */
ucred
=
NULL
;
/* must be initialized to NULL */
if
(
getpeerucred
(
sock
,
&
ucred
)
==
-
1
)
{
appendPQExpBuffer
(
&
conn
->
errorMessage
,
...
...
@@ -1805,35 +1806,33 @@ keep_going: /* We will come back to here until there is
goto
error_return
;
}
ucred_free
(
ucred
);
# else
appendPQExpBuffer
(
&
conn
->
errorMessage
,
libpq_gettext
(
"requirepeer parameter is not supported on this platform
\n
"
));
goto
error_return
;
# endif
#else
#error missing implementation method for requirepeer
#endif
pqGetpwuid
(
uid
,
&
pass_buf
,
pwdbuf
,
sizeof
(
pwdbuf
),
&
pass
);
if
(
pass
==
NULL
)
{
appendPQExpBuffer
(
&
conn
->
errorMessage
,
# if defined(SO_PEERCRED)
libpq_gettext
(
"local user with ID %d does not exist
\n
"
),
(
int
)
peercred
.
uid
);
#else
libpq_gettext
(
"matching local user does not exist
\n
"
));
#endif
(
int
)
uid
);
goto
error_return
;
}
if
(
strcmp
(
pass
->
pw_name
,
conn
->
requirepeer
)
!=
0
)
{
appendPQExpBuffer
(
&
conn
->
errorMessage
,
libpq_gettext
(
"requirepeer
failed (actual: %s != required: %s)
\n
"
),
pass
->
pw_name
,
conn
->
requirepeer
);
libpq_gettext
(
"requirepeer
specifies
\"
%s
\"
, but actual peer user name is
\"
%s
\"
\n
"
),
conn
->
requirepeer
,
pass
->
pw_name
);
goto
error_return
;
}
#else
/* can't support requirepeer */
appendPQExpBuffer
(
&
conn
->
errorMessage
,
libpq_gettext
(
"requirepeer parameter is not supported on this platform
\n
"
));
goto
error_return
;
#endif
}
#endif
/* HAVE_UNIX_SOCKETS */
#ifdef USE_SSL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录