Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
bccd4a8c
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看板
提交
bccd4a8c
编写于
1月 08, 2013
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename HAVE_GNUTLS to WITH_GNUTLS
上级
19e285f1
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
89 addition
and
89 deletion
+89
-89
configure.ac
configure.ac
+2
-2
daemon/libvirtd.c
daemon/libvirtd.c
+7
-7
daemon/remote.c
daemon/remote.c
+1
-1
src/Makefile.am
src/Makefile.am
+1
-1
src/libvirt.c
src/libvirt.c
+4
-4
src/locking/lock_daemon.c
src/locking/lock_daemon.c
+2
-2
src/lxc/lxc_controller.c
src/lxc/lxc_controller.c
+1
-1
src/qemu/qemu_migration.c
src/qemu/qemu_migration.c
+5
-5
src/remote/remote_driver.c
src/remote/remote_driver.c
+5
-5
src/rpc/virnetclient.c
src/rpc/virnetclient.c
+6
-6
src/rpc/virnetclient.h
src/rpc/virnetclient.h
+3
-3
src/rpc/virnetserver.c
src/rpc/virnetserver.c
+3
-3
src/rpc/virnetserver.h
src/rpc/virnetserver.h
+2
-2
src/rpc/virnetserverclient.c
src/rpc/virnetserverclient.c
+20
-20
src/rpc/virnetserverclient.h
src/rpc/virnetserverclient.h
+2
-2
src/rpc/virnetserverservice.c
src/rpc/virnetserverservice.c
+9
-9
src/rpc/virnetserverservice.h
src/rpc/virnetserverservice.h
+4
-4
src/rpc/virnetsocket.c
src/rpc/virnetsocket.c
+8
-8
src/rpc/virnetsocket.h
src/rpc/virnetsocket.h
+2
-2
tests/Makefile.am
tests/Makefile.am
+2
-2
未找到文件。
configure.ac
浏览文件 @
bccd4a8c
...
...
@@ -1086,10 +1086,10 @@ if test "x$with_gnutls" != "xno"; then
fi
if test "x$with_gnutls" = "xyes" ; then
AC_DEFINE_UNQUOTED([
HAVE
_GNUTLS], 1,
AC_DEFINE_UNQUOTED([
WITH
_GNUTLS], 1,
[whether GNUTLS is available for encryption])
fi
AM_CONDITIONAL([
HAVE
_GNUTLS], [test "x$with_gnutls" = "xyes"])
AM_CONDITIONAL([
WITH
_GNUTLS], [test "x$with_gnutls" = "xyes"])
AC_SUBST([GNUTLS_CFLAGS])
AC_SUBST([GNUTLS_LIBS])
...
...
daemon/libvirtd.c
浏览文件 @
bccd4a8c
...
...
@@ -449,7 +449,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
virNetServerServicePtr
svc
=
NULL
;
virNetServerServicePtr
svcRO
=
NULL
;
virNetServerServicePtr
svcTCP
=
NULL
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetServerServicePtr
svcTLS
=
NULL
;
#endif
gid_t
unix_sock_gid
=
0
;
...
...
@@ -476,7 +476,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
unix_sock_rw_mask
,
unix_sock_gid
,
config
->
auth_unix_rw
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
false
,
...
...
@@ -488,7 +488,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
unix_sock_ro_mask
,
unix_sock_gid
,
config
->
auth_unix_ro
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
true
,
...
...
@@ -513,7 +513,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
if
(
!
(
svcTCP
=
virNetServerServiceNewTCP
(
config
->
listen_addr
,
config
->
tcp_port
,
config
->
auth_tcp
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
false
,
...
...
@@ -525,7 +525,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
goto
error
;
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
config
->
listen_tls
)
{
virNetTLSContextPtr
ctxt
=
NULL
;
...
...
@@ -581,7 +581,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
#if WITH_SASL
if
(
config
->
auth_unix_rw
==
REMOTE_AUTH_SASL
||
config
->
auth_unix_ro
==
REMOTE_AUTH_SASL
||
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
config
->
auth_tls
==
REMOTE_AUTH_SASL
||
# endif
config
->
auth_tcp
==
REMOTE_AUTH_SASL
)
{
...
...
@@ -595,7 +595,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
return
0
;
error:
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virObjectUnref
(
svcTLS
);
#endif
virObjectUnref
(
svcTCP
);
...
...
daemon/remote.c
浏览文件 @
bccd4a8c
...
...
@@ -2464,7 +2464,7 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
if
(
!
sasl
)
goto
authfail
;
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
/* Inform SASL that we've got an external SSF layer from TLS */
if
(
virNetServerClientHasTLSSession
(
client
))
{
int
ssf
;
...
...
src/Makefile.am
浏览文件 @
bccd4a8c
...
...
@@ -1779,7 +1779,7 @@ else
EXTRA_DIST
+=
\
rpc/virnetsshsession.h rpc/virnetsshsession.c
endif
if
HAVE
_GNUTLS
if
WITH
_GNUTLS
libvirt_net_rpc_la_SOURCES
+=
\
rpc/virnettlscontext.h rpc/virnettlscontext.c
else
...
...
src/libvirt.c
浏览文件 @
bccd4a8c
...
...
@@ -55,7 +55,7 @@
#include "configmake.h"
#include "intprops.h"
#include "virconf.h"
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
# include "rpc/virnettlscontext.h"
#endif
#include "vircommand.h"
...
...
@@ -271,7 +271,7 @@ winsock_init(void)
#endif
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
static int virTLSMutexInit(void **priv)
{
virMutexPtr lock = NULL;
...
...
@@ -408,14 +408,14 @@ virGlobalInit(void)
virErrorInitialize() < 0)
goto error;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
gcry_control(GCRYCTL_SET_THREAD_CBS, &virTLSThreadImpl);
gcry_check_version(NULL);
#endif
virLogSetFromEnv();
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virNetTLSInit();
#endif
...
...
src/locking/lock_daemon.c
浏览文件 @
bccd4a8c
...
...
@@ -655,7 +655,7 @@ virLockDaemonSetupNetworkingSystemD(virNetServerPtr srv)
/* Systemd passes FDs, starting immediately after stderr,
* so the first FD we'll get is '3'. */
if
(
!
(
svc
=
virNetServerServiceNewFD
(
3
,
0
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
false
,
1
)))
...
...
@@ -677,7 +677,7 @@ virLockDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
VIR_DEBUG
(
"Setting up networking natively"
);
if
(
!
(
svc
=
virNetServerServiceNewUNIX
(
sock_path
,
0700
,
0
,
0
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
false
,
1
)))
...
...
src/lxc/lxc_controller.c
浏览文件 @
bccd4a8c
...
...
@@ -631,7 +631,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
0700
,
0
,
0
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
NULL
,
#endif
false
,
...
...
src/qemu/qemu_migration.c
浏览文件 @
bccd4a8c
...
...
@@ -23,7 +23,7 @@
#include <config.h>
#include <sys/time.h>
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
#endif
...
...
@@ -198,7 +198,7 @@ static void qemuMigrationCookieFree(qemuMigrationCookiePtr mig)
}
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
static
char
*
qemuDomainExtractTLSSubject
(
const
char
*
certdir
)
{
...
...
@@ -276,7 +276,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
if
(
!
listenAddr
)
listenAddr
=
driver
->
vncListen
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
if
(
driver
->
vncTLS
&&
!
(
mig
->
tlsSubject
=
qemuDomainExtractTLSSubject
(
driver
->
vncTLSx509certdir
)))
goto
error
;
...
...
@@ -291,7 +291,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
if
(
!
listenAddr
)
listenAddr
=
driver
->
spiceListen
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
if
(
driver
->
spiceTLS
&&
!
(
mig
->
tlsSubject
=
qemuDomainExtractTLSSubject
(
driver
->
spiceTLSx509certdir
)))
goto
error
;
...
...
@@ -304,7 +304,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
no_memory:
virReportOOMError
();
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
error:
#endif
qemuMigrationCookieGraphicsFree
(
mig
);
...
...
src/remote/remote_driver.c
浏览文件 @
bccd4a8c
...
...
@@ -80,7 +80,7 @@ struct private_data {
int
counter
;
/* Serial number for RPC */
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virNetTLSContextPtr
tls
;
#endif
...
...
@@ -598,7 +598,7 @@ doRemoteOpen(virConnectPtr conn,
/* Connect to the remote service. */
switch
(
transport
)
{
case
trans_tls
:
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
priv
->
tls
=
virNetTLSContextNewClientPath
(
pkipath
,
geteuid
()
!=
0
?
true
:
false
,
sanity
,
verify
);
...
...
@@ -618,7 +618,7 @@ doRemoteOpen(virConnectPtr conn,
if
(
!
priv
->
client
)
goto
failed
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
if
(
priv
->
tls
)
{
VIR_DEBUG
(
"Starting TLS session"
);
if
(
virNetClientSetTLSSession
(
priv
->
client
,
priv
->
tls
)
<
0
)
...
...
@@ -1012,7 +1012,7 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv)
(
xdrproc_t
)
xdr_void
,
(
char
*
)
NULL
)
==
-
1
)
ret
=
-
1
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virObjectUnref
(
priv
->
tls
);
priv
->
tls
=
NULL
;
#endif
...
...
@@ -3893,7 +3893,7 @@ remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
saslcb
)))
goto
cleanup
;
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
/* Initialize some connection props we care about */
if
(
priv
->
tls
)
{
if
((
ssf
=
virNetClientGetTLSKeySize
(
priv
->
client
))
<
0
)
...
...
src/rpc/virnetclient.c
浏览文件 @
bccd4a8c
...
...
@@ -70,7 +70,7 @@ struct _virNetClient {
virNetSocketPtr
sock
;
bool
asyncIO
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSSessionPtr
tls
;
#endif
char
*
hostname
;
...
...
@@ -629,7 +629,7 @@ void virNetClientDispose(void *obj)
if
(
client
->
sock
)
virNetSocketRemoveIOCallback
(
client
->
sock
);
virObjectUnref
(
client
->
sock
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virObjectUnref
(
client
->
tls
);
#endif
#if WITH_SASL
...
...
@@ -667,7 +667,7 @@ virNetClientCloseLocked(virNetClientPtr client)
virObjectUnref
(
client
->
sock
);
client
->
sock
=
NULL
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virObjectUnref
(
client
->
tls
);
client
->
tls
=
NULL
;
#endif
...
...
@@ -751,7 +751,7 @@ void virNetClientSetSASLSession(virNetClientPtr client,
#endif
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
int
virNetClientSetTLSSession
(
virNetClientPtr
client
,
virNetTLSContextPtr
tls
)
{
...
...
@@ -860,7 +860,7 @@ bool virNetClientIsEncrypted(virNetClientPtr client)
{
bool
ret
=
false
;
virNetClientLock
(
client
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
client
->
tls
)
ret
=
true
;
#endif
...
...
@@ -966,7 +966,7 @@ const char *virNetClientRemoteAddrString(virNetClientPtr client)
return
virNetSocketRemoteAddrString
(
client
->
sock
);
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
int
virNetClientGetTLSKeySize
(
virNetClientPtr
client
)
{
int
ret
=
0
;
...
...
src/rpc/virnetclient.h
浏览文件 @
bccd4a8c
...
...
@@ -23,7 +23,7 @@
#ifndef __VIR_NET_CLIENT_H__
# define __VIR_NET_CLIENT_H__
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
# include "virnettlscontext.h"
# endif
# include "virnetmessage.h"
...
...
@@ -109,7 +109,7 @@ void virNetClientSetSASLSession(virNetClientPtr client,
virNetSASLSessionPtr
sasl
);
# endif
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
int
virNetClientSetTLSSession
(
virNetClientPtr
client
,
virNetTLSContextPtr
tls
);
# endif
...
...
@@ -120,7 +120,7 @@ bool virNetClientIsOpen(virNetClientPtr client);
const
char
*
virNetClientLocalAddrString
(
virNetClientPtr
client
);
const
char
*
virNetClientRemoteAddrString
(
virNetClientPtr
client
);
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
int
virNetClientGetTLSKeySize
(
virNetClientPtr
client
);
# endif
...
...
src/rpc/virnetserver.c
浏览文件 @
bccd4a8c
...
...
@@ -98,7 +98,7 @@ struct _virNetServer {
unsigned
int
quit
:
1
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virNetTLSContextPtr
tls
;
#endif
...
...
@@ -311,7 +311,7 @@ static int virNetServerDispatchNewClient(virNetServerServicePtr svc,
virNetServerServiceGetAuth
(
svc
),
virNetServerServiceIsReadonly
(
svc
),
virNetServerServiceGetMaxRequests
(
svc
),
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetServerServiceGetTLSContext
(
svc
),
#endif
srv
->
clientPrivNew
,
...
...
@@ -1038,7 +1038,7 @@ no_memory:
return
-
1
;
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
int
virNetServerSetTLSContext
(
virNetServerPtr
srv
,
virNetTLSContextPtr
tls
)
{
...
...
src/rpc/virnetserver.h
浏览文件 @
bccd4a8c
...
...
@@ -26,7 +26,7 @@
# include <signal.h>
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
# include "virnettlscontext.h"
# endif
# include "virnetserverprogram.h"
...
...
@@ -81,7 +81,7 @@ int virNetServerAddService(virNetServerPtr srv,
int
virNetServerAddProgram
(
virNetServerPtr
srv
,
virNetServerProgramPtr
prog
);
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
int
virNetServerSetTLSContext
(
virNetServerPtr
srv
,
virNetTLSContextPtr
tls
);
# endif
...
...
src/rpc/virnetserverclient.c
浏览文件 @
bccd4a8c
...
...
@@ -66,7 +66,7 @@ struct _virNetServerClient
int
auth
;
bool
readonly
;
char
*
identity
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
tlsCtxt
;
virNetTLSSessionPtr
tls
;
#endif
...
...
@@ -149,7 +149,7 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client) {
VIR_DEBUG
(
"tls=%p hs=%d, rx=%p tx=%p"
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
client
->
tls
,
client
->
tls
?
virNetTLSSessionGetHandshakeStatus
(
client
->
tls
)
:
-
1
,
#else
...
...
@@ -160,7 +160,7 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client) {
if
(
!
client
->
sock
||
client
->
wantClose
)
return
0
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
client
->
tls
)
{
switch
(
virNetTLSSessionGetHandshakeStatus
(
client
->
tls
))
{
case
VIR_NET_TLS_HANDSHAKE_RECVING
:
...
...
@@ -188,7 +188,7 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client) {
then monitor for writability on socket */
if
(
client
->
tx
)
mode
|=
VIR_EVENT_HANDLE_WRITABLE
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
}
#endif
VIR_DEBUG
(
"mode=%o"
,
mode
);
...
...
@@ -297,7 +297,7 @@ void virNetServerClientRemoveFilter(virNetServerClientPtr client,
}
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
/* Check the client's access. */
static
int
virNetServerClientCheckAccess
(
virNetServerClientPtr
client
)
...
...
@@ -353,7 +353,7 @@ static void virNetServerClientSockTimerFunc(int timer,
static
virNetServerClientPtr
virNetServerClientNewInternal
(
virNetSocketPtr
sock
,
int
auth
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
#endif
bool
readonly
,
...
...
@@ -375,7 +375,7 @@ virNetServerClientNewInternal(virNetSocketPtr sock,
client
->
sock
=
virObjectRef
(
sock
);
client
->
auth
=
auth
;
client
->
readonly
=
readonly
;
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
client
->
tlsCtxt
=
virObjectRef
(
tls
);
#endif
client
->
nrequests_max
=
nrequests_max
;
...
...
@@ -411,7 +411,7 @@ virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
int
auth
,
bool
readonly
,
size_t
nrequests_max
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
#endif
virNetServerClientPrivNew
privNew
,
...
...
@@ -422,7 +422,7 @@ virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
virNetServerClientPtr
client
;
VIR_DEBUG
(
"sock=%p auth=%d tls=%p"
,
sock
,
auth
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
tls
#else
NULL
...
...
@@ -430,7 +430,7 @@ virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
);
if
(
!
(
client
=
virNetServerClientNewInternal
(
sock
,
auth
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
tls
,
#endif
readonly
,
nrequests_max
)))
...
...
@@ -499,7 +499,7 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr objec
if
(
!
(
client
=
virNetServerClientNewInternal
(
sock
,
auth
,
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
NULL
,
#endif
readonly
,
...
...
@@ -602,7 +602,7 @@ bool virNetServerClientGetReadonly(virNetServerClientPtr client)
}
#ifdef
HAVE
_GNUTLS
#ifdef
WITH
_GNUTLS
bool
virNetServerClientHasTLSSession
(
virNetServerClientPtr
client
)
{
bool
has
;
...
...
@@ -648,7 +648,7 @@ bool virNetServerClientIsSecure(virNetServerClientPtr client)
{
bool
secure
=
false
;
virNetServerClientLock
(
client
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
client
->
tls
)
secure
=
true
;
#endif
...
...
@@ -765,7 +765,7 @@ void virNetServerClientDispose(void *obj)
#endif
if
(
client
->
sockTimer
>
0
)
virEventRemoveTimeout
(
client
->
sockTimer
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virObjectUnref
(
client
->
tls
);
virObjectUnref
(
client
->
tlsCtxt
);
#endif
...
...
@@ -821,7 +821,7 @@ void virNetServerClientClose(virNetServerClientPtr client)
if
(
client
->
sock
)
virNetSocketRemoveIOCallback
(
client
->
sock
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
client
->
tls
)
{
virObjectUnref
(
client
->
tls
);
client
->
tls
=
NULL
;
...
...
@@ -886,13 +886,13 @@ int virNetServerClientInit(virNetServerClientPtr client)
{
virNetServerClientLock
(
client
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
!
client
->
tlsCtxt
)
{
#endif
/* Plain socket, so prepare to read first message */
if
(
virNetServerClientRegisterEvent
(
client
)
<
0
)
goto
error
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
}
else
{
int
ret
;
...
...
@@ -1224,7 +1224,7 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client)
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
static
void
virNetServerClientDispatchHandshake
(
virNetServerClientPtr
client
)
{
...
...
@@ -1264,7 +1264,7 @@ virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque)
if
(
events
&
(
VIR_EVENT_HANDLE_WRITABLE
|
VIR_EVENT_HANDLE_READABLE
))
{
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
client
->
tls
&&
virNetTLSSessionGetHandshakeStatus
(
client
->
tls
)
!=
VIR_NET_TLS_HANDSHAKE_COMPLETE
)
{
...
...
@@ -1276,7 +1276,7 @@ virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque)
if
(
events
&
VIR_EVENT_HANDLE_READABLE
&&
client
->
rx
)
virNetServerClientDispatchRead
(
client
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
}
#endif
}
...
...
src/rpc/virnetserverclient.h
浏览文件 @
bccd4a8c
...
...
@@ -52,7 +52,7 @@ virNetServerClientPtr virNetServerClientNew(virNetSocketPtr sock,
int
auth
,
bool
readonly
,
size_t
nrequests_max
,
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
# endif
virNetServerClientPrivNew
privNew
,
...
...
@@ -78,7 +78,7 @@ void virNetServerClientRemoveFilter(virNetServerClientPtr client,
int
virNetServerClientGetAuth
(
virNetServerClientPtr
client
);
bool
virNetServerClientGetReadonly
(
virNetServerClientPtr
client
);
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
bool
virNetServerClientHasTLSSession
(
virNetServerClientPtr
client
);
int
virNetServerClientGetTLSKeySize
(
virNetServerClientPtr
client
);
# endif
...
...
src/rpc/virnetserverservice.c
浏览文件 @
bccd4a8c
...
...
@@ -41,7 +41,7 @@ struct _virNetServerService {
bool
readonly
;
size_t
nrequests_client_max
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
tls
;
#endif
...
...
@@ -92,7 +92,7 @@ cleanup:
virNetServerServicePtr
virNetServerServiceNewTCP
(
const
char
*
nodename
,
const
char
*
service
,
int
auth
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
#endif
bool
readonly
,
...
...
@@ -110,7 +110,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
svc
->
auth
=
auth
;
svc
->
readonly
=
readonly
;
svc
->
nrequests_client_max
=
nrequests_client_max
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
svc
->
tls
=
virObjectRef
(
tls
);
#endif
...
...
@@ -150,7 +150,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
mode_t
mask
,
gid_t
grp
,
int
auth
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
#endif
bool
readonly
,
...
...
@@ -168,7 +168,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
svc
->
auth
=
auth
;
svc
->
readonly
=
readonly
;
svc
->
nrequests_client_max
=
nrequests_client_max
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
svc
->
tls
=
virObjectRef
(
tls
);
#endif
...
...
@@ -212,7 +212,7 @@ error:
virNetServerServicePtr
virNetServerServiceNewFD
(
int
fd
,
int
auth
,
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
#endif
bool
readonly
,
...
...
@@ -230,7 +230,7 @@ virNetServerServicePtr virNetServerServiceNewFD(int fd,
svc
->
auth
=
auth
;
svc
->
readonly
=
readonly
;
svc
->
nrequests_client_max
=
nrequests_client_max
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
svc
->
tls
=
virObjectRef
(
tls
);
#endif
...
...
@@ -415,7 +415,7 @@ size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc)
return
svc
->
nrequests_client_max
;
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSContextPtr
virNetServerServiceGetTLSContext
(
virNetServerServicePtr
svc
)
{
return
svc
->
tls
;
...
...
@@ -440,7 +440,7 @@ void virNetServerServiceDispose(void *obj)
virObjectUnref
(
svc
->
socks
[
i
]);
VIR_FREE
(
svc
->
socks
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virObjectUnref
(
svc
->
tls
);
#endif
}
...
...
src/rpc/virnetserverservice.h
浏览文件 @
bccd4a8c
...
...
@@ -40,7 +40,7 @@ typedef int (*virNetServerServiceDispatchFunc)(virNetServerServicePtr svc,
virNetServerServicePtr
virNetServerServiceNewTCP
(
const
char
*
nodename
,
const
char
*
service
,
int
auth
,
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
# endif
bool
readonly
,
...
...
@@ -49,14 +49,14 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
mode_t
mask
,
gid_t
grp
,
int
auth
,
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
# endif
bool
readonly
,
size_t
nrequests_client_max
);
virNetServerServicePtr
virNetServerServiceNewFD
(
int
fd
,
int
auth
,
# if
HAVE
_GNUTLS
# if
WITH
_GNUTLS
virNetTLSContextPtr
tls
,
# endif
bool
readonly
,
...
...
@@ -71,7 +71,7 @@ int virNetServerServiceGetPort(virNetServerServicePtr svc);
int
virNetServerServiceGetAuth
(
virNetServerServicePtr
svc
);
bool
virNetServerServiceIsReadonly
(
virNetServerServicePtr
svc
);
size_t
virNetServerServiceGetMaxRequests
(
virNetServerServicePtr
svc
);
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
virNetTLSContextPtr
virNetServerServiceGetTLSContext
(
virNetServerServicePtr
svc
);
# endif
...
...
src/rpc/virnetsocket.c
浏览文件 @
bccd4a8c
...
...
@@ -79,7 +79,7 @@ struct _virNetSocket {
char
*
localAddrStr
;
char
*
remoteAddrStr
;
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
virNetTLSSessionPtr
tlsSession
;
#endif
#if WITH_SASL
...
...
@@ -950,7 +950,7 @@ virJSONValuePtr virNetSocketPreExecRestart(virNetSocketPtr sock)
goto
error
;
}
#endif
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
sock
->
tlsSession
)
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"Unable to save socket state when TLS session is active"
));
...
...
@@ -1015,7 +1015,7 @@ void virNetSocketDispose(void *obj)
unlink
(
sock
->
localAddr
.
data
.
un
.
sun_path
);
#endif
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
/* Make sure it can't send any more I/O during shutdown */
if
(
sock
->
tlsSession
)
virNetTLSSessionSetIOCallbacks
(
sock
->
tlsSession
,
NULL
,
NULL
,
NULL
);
...
...
@@ -1184,7 +1184,7 @@ const char *virNetSocketRemoteAddrString(virNetSocketPtr sock)
}
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
static
ssize_t
virNetSocketTLSSessionWrite
(
const
char
*
buf
,
size_t
len
,
void
*
opaque
)
...
...
@@ -1287,7 +1287,7 @@ static ssize_t virNetSocketReadWire(virNetSocketPtr sock, char *buf, size_t len)
#endif
reread:
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
sock
->
tlsSession
&&
virNetTLSSessionGetHandshakeStatus
(
sock
->
tlsSession
)
==
VIR_NET_TLS_HANDSHAKE_COMPLETE
)
{
...
...
@@ -1295,7 +1295,7 @@ reread:
}
else
{
#endif
ret
=
read
(
sock
->
fd
,
buf
,
len
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
}
#endif
...
...
@@ -1346,7 +1346,7 @@ static ssize_t virNetSocketWriteWire(virNetSocketPtr sock, const char *buf, size
#endif
rewrite:
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
if
(
sock
->
tlsSession
&&
virNetTLSSessionGetHandshakeStatus
(
sock
->
tlsSession
)
==
VIR_NET_TLS_HANDSHAKE_COMPLETE
)
{
...
...
@@ -1354,7 +1354,7 @@ rewrite:
}
else
{
#endif
ret
=
write
(
sock
->
fd
,
buf
,
len
);
#if
HAVE
_GNUTLS
#if
WITH
_GNUTLS
}
#endif
...
...
src/rpc/virnetsocket.h
浏览文件 @
bccd4a8c
...
...
@@ -26,7 +26,7 @@
# include "virsocketaddr.h"
# include "vircommand.h"
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
# include "virnettlscontext.h"
# endif
# include "virobject.h"
...
...
@@ -124,7 +124,7 @@ ssize_t virNetSocketWrite(virNetSocketPtr sock, const char *buf, size_t len);
int
virNetSocketSendFD
(
virNetSocketPtr
sock
,
int
fd
);
int
virNetSocketRecvFD
(
virNetSocketPtr
sock
,
int
*
fd
);
# ifdef
HAVE
_GNUTLS
# ifdef
WITH
_GNUTLS
void
virNetSocketSetTLSSession
(
virNetSocketPtr
sock
,
virNetTLSSessionPtr
sess
);
# endif
...
...
tests/Makefile.am
浏览文件 @
bccd4a8c
...
...
@@ -100,7 +100,7 @@ test_programs = virshtest sockettest \
sysinfotest
\
$(NULL)
if
HAVE
_GNUTLS
if
WITH
_GNUTLS
test_programs
+=
virnettlscontexttest
endif
...
...
@@ -530,7 +530,7 @@ virnetsockettest_SOURCES = \
virnetsockettest_CFLAGS
=
-Dabs_builddir
=
"
\"
$(abs_builddir)
\"
"
$(AM_CFLAGS)
virnetsockettest_LDADD
=
$(LDADDS)
if
HAVE
_GNUTLS
if
WITH
_GNUTLS
virnettlscontexttest_SOURCES
=
\
virnettlscontexttest.c testutils.h testutils.c
virnettlscontexttest_CFLAGS
=
-Dabs_builddir
=
"
\"
$(abs_builddir)
\"
"
$(AM_CFLAGS)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录