Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e332ccdf
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看板
提交
e332ccdf
编写于
12月 05, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wire up SASL interaction callbacks to libvirt callbacks. Provide default callback impl
上级
7fa9ceb7
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
484 addition
and
95 deletion
+484
-95
ChangeLog
ChangeLog
+12
-0
include/libvirt/libvirt.h
include/libvirt/libvirt.h
+2
-0
include/libvirt/libvirt.h.in
include/libvirt/libvirt.h.in
+2
-0
src/internal.h
src/internal.h
+2
-0
src/libvirt.c
src/libvirt.c
+81
-0
src/libvirt_sym.version
src/libvirt_sym.version
+3
-0
src/remote_internal.c
src/remote_internal.c
+378
-91
src/virsh.c
src/virsh.c
+4
-4
未找到文件。
ChangeLog
浏览文件 @
e332ccdf
Wed Dec 5 13:51:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* include/libvirt/libvirt.h.in: Add virConnectAuthPtrDefault
as default CLI auth callback
* src/libvirt_sym.version: Export virConnectAuthPtrDefault
* src/libvirt.c: Default auth callback for command line based
apps
* src/virsh.c: Use default auth callback
* src/internal.h: Add STRCASEEQLEN, STRCASENEQLEN
* src/remote_internal.c: Wire up callback API to SASL interaction
types / callbacks.
Wed Dec 5 13:27:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* Makefile.am: Put include/ before src/ in SUBDIRS
...
...
include/libvirt/libvirt.h
浏览文件 @
e332ccdf
...
...
@@ -343,6 +343,8 @@ struct _virConnectAuth {
typedef
struct
_virConnectAuth
virConnectAuth
;
typedef
virConnectAuth
*
virConnectAuthPtr
;
extern
virConnectAuthPtr
virConnectAuthPtrDefault
;
/**
* VIR_UUID_BUFLEN:
*
...
...
include/libvirt/libvirt.h.in
浏览文件 @
e332ccdf
...
...
@@ -343,6 +343,8 @@ struct _virConnectAuth {
typedef
struct
_virConnectAuth
virConnectAuth
;
typedef
virConnectAuth
*
virConnectAuthPtr
;
extern
virConnectAuthPtr
virConnectAuthPtrDefault
;
/**
* VIR_UUID_BUFLEN:
*
...
...
src/internal.h
浏览文件 @
e332ccdf
...
...
@@ -46,7 +46,9 @@ extern "C" {
#define STRNEQ(a,b) (strcmp((a),(b)) != 0)
#define STRCASENEQ(a,b) (strcasecmp((a),(b)) != 0)
#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
#define STRCASEEQLEN(a,b,n) (strncasecmp((a),(b),(n)) == 0)
#define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0)
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
/* C99 uses __func__. __FUNCTION__ is legacy. */
#ifndef __GNUC__
...
...
src/libvirt.c
浏览文件 @
e332ccdf
...
...
@@ -63,6 +63,87 @@ static int initialized = 0;
#define DEBUG(fs,...)
#endif
/* !ENABLE_DEBUG */
static
int
virConnectAuthCallbackDefault
(
virConnectCredentialPtr
cred
,
unsigned
int
ncred
,
void
*
cbdata
ATTRIBUTE_UNUSED
)
{
int
i
;
for
(
i
=
0
;
i
<
ncred
;
i
++
)
{
char
buf
[
1024
];
char
*
bufptr
=
buf
;
if
(
printf
(
"%s:"
,
cred
[
i
].
prompt
)
<
0
)
return
-
1
;
if
(
fflush
(
stdout
)
!=
0
)
return
-
1
;
switch
(
cred
[
i
].
type
)
{
case
VIR_CRED_USERNAME
:
case
VIR_CRED_AUTHNAME
:
case
VIR_CRED_ECHOPROMPT
:
case
VIR_CRED_REALM
:
if
(
!
fgets
(
buf
,
sizeof
(
buf
),
stdin
))
{
if
(
feof
(
stdin
))
{
/* Treat EOF as "" */
buf
[
0
]
=
'\0'
;
break
;
}
return
-
1
;
}
if
(
buf
[
strlen
(
buf
)
-
1
]
==
'\n'
)
buf
[
strlen
(
buf
)
-
1
]
=
'\0'
;
break
;
case
VIR_CRED_PASSPHRASE
:
case
VIR_CRED_NOECHOPROMPT
:
bufptr
=
getpass
(
""
);
if
(
!
bufptr
)
return
-
1
;
break
;
}
if
(
STREQ
(
bufptr
,
""
)
&&
cred
[
i
].
defresult
)
cred
[
i
].
result
=
strdup
(
cred
[
i
].
defresult
);
else
cred
[
i
].
result
=
strdup
(
bufptr
);
if
(
!
cred
[
i
].
result
)
return
-
1
;
cred
[
i
].
resultlen
=
strlen
(
cred
[
i
].
result
);
}
return
0
;
}
/* Don't typically want VIR_CRED_USERNAME. It enables you to authenticate
* as one user, and act as another. It just results in annoying
* prompts for the username twice & is very rarely what you want
*/
static
int
virConnectCredTypeDefault
[]
=
{
VIR_CRED_AUTHNAME
,
VIR_CRED_ECHOPROMPT
,
VIR_CRED_REALM
,
VIR_CRED_PASSPHRASE
,
VIR_CRED_NOECHOPROMPT
,
};
static
virConnectAuth
virConnectAuthDefault
=
{
virConnectCredTypeDefault
,
sizeof
(
virConnectCredTypeDefault
)
/
sizeof
(
int
),
virConnectAuthCallbackDefault
,
NULL
,
};
/*
* virConnectAuthPtrDefault
*
* A default implementation of the authentication callbacks. This
* implementation is suitable for command line based tools. It will
* prompt for username, passwords, realm and one time keys as needed.
* It will print on STDOUT, and read from STDIN. If this is not
* suitable for the application's needs an alternative implementation
* should be provided.
*/
virConnectAuthPtr
virConnectAuthPtrDefault
=
&
virConnectAuthDefault
;
/**
* virInitialize:
*
...
...
src/libvirt_sym.version
浏览文件 @
e332ccdf
...
...
@@ -3,6 +3,9 @@
virInitialize;
virConnectOpen;
virConnectOpenReadOnly;
virConnectOpenAuth;
virConnectAuthPtrDefault;
virConnectClose;
virConnectGetType;
virConnectGetVersion;
...
...
src/remote_internal.c
浏览文件 @
e332ccdf
此差异已折叠。
点击以展开。
src/virsh.c
浏览文件 @
e332ccdf
...
...
@@ -4520,10 +4520,10 @@ vshInit(vshControl * ctl)
!
strcasecmp
(
ctl
->
name
,
"xen"
))
&&
ctl
->
uid
!=
0
)
ctl
->
readonly
=
1
;
if
(
!
ctl
->
readonly
)
ctl
->
conn
=
virConnectOpen
(
ctl
->
name
);
else
ctl
->
conn
=
virConnectOpenReadOnly
(
ctl
->
name
);
ctl
->
conn
=
virConnectOpenAuth
(
ctl
->
name
,
virConnectAuthPtrDefault
,
ctl
->
readonly
?
VIR_CONNECT_RO
:
0
);
/* This is not necessarily fatal. All the individual commands check
* vshConnectionUsability, except ones which don't need a connection
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录