Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
8d2d44ad
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8d2d44ad
编写于
3月 11, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove use of polkit-grant. Keep stdio open when running polkit-auth
上级
c3501d47
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
18 deletion
+46
-18
ChangeLog
ChangeLog
+6
-0
configure.in
configure.in
+0
-4
src/libvirt.c
src/libvirt.c
+40
-14
未找到文件。
ChangeLog
浏览文件 @
8d2d44ad
Tue Mar 11 10:45:53 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
* src/libvirt.c, configure.in: Remove use of polkit-grant since
it is fundamentally broken. Only use polkit-auth instead. Keep
stdin/out/err open when running polkit-auth.
Tue Mar 11 10:21:53 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
Tue Mar 11 10:21:53 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
* src/virsh.c: Don't force connection to readonly as non-root
* src/virsh.c: Don't force connection to readonly as non-root
...
...
configure.in
浏览文件 @
8d2d44ad
...
@@ -450,10 +450,6 @@ if test "x$with_polkit" = "xyes" -o "x$with_polkit" = "xcheck"; then
...
@@ -450,10 +450,6 @@ if test "x$with_polkit" = "xyes" -o "x$with_polkit" = "xcheck"; then
CFLAGS="$old_CFLAGS"
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
LDFLAGS="$old_LDFLAGS"
AC_PATH_PROG(POLKIT_GRANT, polkit-grant)
if test "x$POLKIT_GRANT" != "x"; then
AC_DEFINE_UNQUOTED([POLKIT_GRANT],["$POLKIT_GRANT"],[Location of polkit-grant program])
fi
AC_PATH_PROG(POLKIT_AUTH, polkit-auth)
AC_PATH_PROG(POLKIT_AUTH, polkit-auth)
if test "x$POLKIT_AUTH" != "x"; then
if test "x$POLKIT_AUTH" != "x"; then
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
...
...
src/libvirt.c
浏览文件 @
8d2d44ad
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#include <sys/stat.h>
#include <sys/stat.h>
#include <unistd.h>
#include <unistd.h>
#include <assert.h>
#include <assert.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <libxml/parser.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpath.h>
...
@@ -66,6 +69,39 @@ static int initialized = 0;
...
@@ -66,6 +69,39 @@ static int initialized = 0;
int
debugFlag
=
0
;
int
debugFlag
=
0
;
#endif
#endif
#if defined(POLKIT_AUTH)
static
int
virConnectAuthGainPolkit
(
const
char
*
privilege
)
{
const
char
*
const
args
[]
=
{
POLKIT_AUTH
,
"--obtain"
,
privilege
,
NULL
};
int
childpid
,
status
,
ret
;
/* Root has all rights */
if
(
getuid
()
==
0
)
return
0
;
if
((
childpid
=
fork
())
<
0
)
return
-
1
;
if
(
!
childpid
)
{
execvp
(
args
[
0
],
(
char
**
)
args
);
_exit
(
-
1
);
}
while
((
ret
=
waitpid
(
childpid
,
&
status
,
0
)
==
-
1
)
&&
errno
==
EINTR
);
if
(
ret
==
-
1
)
{
return
-
1
;
}
if
(
!
WIFEXITED
(
status
)
||
(
WEXITSTATUS
(
status
)
!=
0
&&
WEXITSTATUS
(
status
)
!=
1
))
{
return
-
1
;
}
return
0
;
}
#endif
static
int
virConnectAuthCallbackDefault
(
virConnectCredentialPtr
cred
,
static
int
virConnectAuthCallbackDefault
(
virConnectCredentialPtr
cred
,
unsigned
int
ncred
,
unsigned
int
ncred
,
void
*
cbdata
ATTRIBUTE_UNUSED
)
{
void
*
cbdata
ATTRIBUTE_UNUSED
)
{
...
@@ -77,25 +113,15 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
...
@@ -77,25 +113,15 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
size_t
len
;
size_t
len
;
switch
(
cred
[
i
].
type
)
{
switch
(
cred
[
i
].
type
)
{
#if defined(POLKIT_
GRANT) || defined(POLKIT_
AUTH)
#if defined(POLKIT_AUTH)
case
VIR_CRED_EXTERNAL
:
{
case
VIR_CRED_EXTERNAL
:
{
int
ret
;
int
ret
;
const
char
*
const
args
[]
=
{
#if defined(POLKIT_GRANT)
POLKIT_GRANT
,
"--gain"
,
cred
[
i
].
prompt
,
NULL
#else
POLKIT_AUTH
,
"--obtain"
,
cred
[
i
].
prompt
,
NULL
#endif
};
if
(
STRNEQ
(
cred
[
i
].
challenge
,
"PolicyKit"
))
if
(
STRNEQ
(
cred
[
i
].
challenge
,
"PolicyKit"
))
return
-
1
;
return
-
1
;
if
(
virRun
(
NULL
,
(
char
**
)
args
,
&
ret
)
<
0
)
return
-
1
;
if
(
!
WIFEXITED
(
ret
)
||
if
(
virConnectAuthGainPolkit
(
cred
[
i
].
prompt
)
<
0
)
(
WEXITSTATUS
(
ret
)
!=
0
&&
WEXITSTATUS
(
ret
)
!=
1
))
return
-
1
;
return
-
1
;
break
;
break
;
}
}
#endif
#endif
...
@@ -158,7 +184,7 @@ static int virConnectCredTypeDefault[] = {
...
@@ -158,7 +184,7 @@ static int virConnectCredTypeDefault[] = {
VIR_CRED_REALM
,
VIR_CRED_REALM
,
VIR_CRED_PASSPHRASE
,
VIR_CRED_PASSPHRASE
,
VIR_CRED_NOECHOPROMPT
,
VIR_CRED_NOECHOPROMPT
,
#if defined(POLKIT_AUTH)
|| defined(POLKIT_GRANT)
#if defined(POLKIT_AUTH)
VIR_CRED_EXTERNAL
,
VIR_CRED_EXTERNAL
,
#endif
#endif
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录