src: Drop most of #ifdef WITH_GNUTLS

Now that GnuTLS is a requirement, we can drop a lot of
conditionally built code. However, not all ifdef-s can go because
we still want libvirt_setuid to build without gnutls.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2018-06-04 11:12:29 +02:00
parent fe9f235a4c
commit 234ce7d02f
20 changed files with 27 additions and 253 deletions

View File

@ -619,9 +619,7 @@ virLockDaemonSetupNetworkingSystemD(virNetServerPtr lockSrv, virNetServerPtr adm
/* Systemd passes FDs, starting immediately after stderr, /* Systemd passes FDs, starting immediately after stderr,
* so the first FD we'll get is '3'. */ * so the first FD we'll get is '3'. */
if (!(svc = virNetServerServiceNewFD(3 + i, 0, if (!(svc = virNetServerServiceNewFD(3 + i, 0,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, 0, 1))) false, 0, 1)))
return -1; return -1;
@ -642,9 +640,7 @@ virLockDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
VIR_DEBUG("Setting up networking natively"); VIR_DEBUG("Setting up networking natively");
if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0, if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, 0, 1))) false, 0, 1)))
return -1; return -1;

View File

@ -554,9 +554,7 @@ virLogDaemonSetupNetworkingSystemD(virNetServerPtr logSrv, virNetServerPtr admin
/* Systemd passes FDs, starting immediately after stderr, /* Systemd passes FDs, starting immediately after stderr,
* so the first FD we'll get is '3'. */ * so the first FD we'll get is '3'. */
if (!(svc = virNetServerServiceNewFD(3 + i, 0, if (!(svc = virNetServerServiceNewFD(3 + i, 0,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, 0, 1))) false, 0, 1)))
return -1; return -1;
@ -577,9 +575,7 @@ virLogDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
VIR_DEBUG("Setting up networking natively"); VIR_DEBUG("Setting up networking natively");
if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0, if (!(svc = virNetServerServiceNewUNIX(sock_path, 0700, 0, 0,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, 0, 1))) false, 0, 1)))
return -1; return -1;

View File

@ -957,9 +957,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
0700, 0700,
0, 0,
0, 0,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, false,
0, 0,
5))) 5)))

View File

@ -18,10 +18,8 @@
#include <config.h> #include <config.h>
#ifdef WITH_GNUTLS
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
#endif
#include "locking/domain_lock.h" #include "locking/domain_lock.h"
#include "viralloc.h" #include "viralloc.h"
@ -131,7 +129,6 @@ qemuMigrationCookieFree(qemuMigrationCookiePtr mig)
} }
#ifdef WITH_GNUTLS
static char * static char *
qemuDomainExtractTLSSubject(const char *certdir) qemuDomainExtractTLSSubject(const char *certdir)
{ {
@ -188,7 +185,7 @@ qemuDomainExtractTLSSubject(const char *certdir)
VIR_FREE(pemdata); VIR_FREE(pemdata);
return NULL; return NULL;
} }
#endif
static qemuMigrationCookieGraphicsPtr static qemuMigrationCookieGraphicsPtr
qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver, qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
@ -212,11 +209,10 @@ qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
if (!glisten || !(listenAddr = glisten->address)) if (!glisten || !(listenAddr = glisten->address))
listenAddr = cfg->spiceListen; listenAddr = cfg->spiceListen;
#ifdef WITH_GNUTLS
if (cfg->spiceTLS && if (cfg->spiceTLS &&
!(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir))) !(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir)))
goto error; goto error;
#endif
if (VIR_STRDUP(mig->listen, listenAddr) < 0) if (VIR_STRDUP(mig->listen, listenAddr) < 0)
goto error; goto error;

View File

@ -375,9 +375,7 @@ daemonSetupNetworking(virNetServerPtr srv,
virNetServerServicePtr svcAdm = NULL; virNetServerServicePtr svcAdm = NULL;
virNetServerServicePtr svcRO = NULL; virNetServerServicePtr svcRO = NULL;
virNetServerServicePtr svcTCP = NULL; virNetServerServicePtr svcTCP = NULL;
#if WITH_GNUTLS
virNetServerServicePtr svcTLS = NULL; virNetServerServicePtr svcTLS = NULL;
#endif
gid_t unix_sock_gid = 0; gid_t unix_sock_gid = 0;
int unix_sock_ro_mask = 0; int unix_sock_ro_mask = 0;
int unix_sock_rw_mask = 0; int unix_sock_rw_mask = 0;
@ -416,9 +414,7 @@ daemonSetupNetworking(virNetServerPtr srv,
unix_sock_rw_mask, unix_sock_rw_mask,
unix_sock_gid, unix_sock_gid,
config->auth_unix_rw, config->auth_unix_rw,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, false,
config->max_queued_clients, config->max_queued_clients,
config->max_client_requests, config->max_client_requests,
@ -429,9 +425,7 @@ daemonSetupNetworking(virNetServerPtr srv,
unix_sock_ro_mask, unix_sock_ro_mask,
unix_sock_gid, unix_sock_gid,
config->auth_unix_ro, config->auth_unix_ro,
#if WITH_GNUTLS
NULL, NULL,
#endif
true, true,
config->max_queued_clients, config->max_queued_clients,
config->max_client_requests, config->max_client_requests,
@ -455,9 +449,7 @@ daemonSetupNetworking(virNetServerPtr srv,
unix_sock_adm_mask, unix_sock_adm_mask,
unix_sock_gid, unix_sock_gid,
REMOTE_AUTH_NONE, REMOTE_AUTH_NONE,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, false,
config->admin_max_queued_clients, config->admin_max_queued_clients,
config->admin_max_client_requests))) config->admin_max_client_requests)))
@ -475,9 +467,7 @@ daemonSetupNetworking(virNetServerPtr srv,
config->tcp_port, config->tcp_port,
AF_UNSPEC, AF_UNSPEC,
config->auth_tcp, config->auth_tcp,
#if WITH_GNUTLS
NULL, NULL,
#endif
false, false,
config->max_queued_clients, config->max_queued_clients,
config->max_client_requests))) config->max_client_requests)))
@ -488,7 +478,6 @@ daemonSetupNetworking(virNetServerPtr srv,
goto cleanup; goto cleanup;
} }
#if WITH_GNUTLS
if (config->listen_tls) { if (config->listen_tls) {
virNetTLSContextPtr ctxt = NULL; virNetTLSContextPtr ctxt = NULL;
@ -552,22 +541,12 @@ daemonSetupNetworking(virNetServerPtr srv,
virObjectUnref(ctxt); virObjectUnref(ctxt);
} }
#else
(void)privileged;
if (config->listen_tls) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("This libvirtd build does not support TLS"));
goto cleanup;
}
#endif
} }
#if WITH_SASL #if WITH_SASL
if (config->auth_unix_rw == REMOTE_AUTH_SASL || if (config->auth_unix_rw == REMOTE_AUTH_SASL ||
(sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL) || (sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL) ||
# if WITH_GNUTLS
(ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL) || (ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL) ||
# endif
(ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)) { (ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)) {
saslCtxt = virNetSASLContextNewServer( saslCtxt = virNetSASLContextNewServer(
(const char *const*)config->sasl_allowed_username_list); (const char *const*)config->sasl_allowed_username_list);
@ -579,9 +558,7 @@ daemonSetupNetworking(virNetServerPtr srv,
ret = 0; ret = 0;
cleanup: cleanup:
#if WITH_GNUTLS
virObjectUnref(svcTLS); virObjectUnref(svcTLS);
#endif
virObjectUnref(svcTCP); virObjectUnref(svcTCP);
virObjectUnref(svcRO); virObjectUnref(svcRO);
virObjectUnref(svcAdm); virObjectUnref(svcAdm);

View File

@ -3353,7 +3353,6 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
if (!sasl) if (!sasl)
goto authfail; goto authfail;
# if WITH_GNUTLS
/* Inform SASL that we've got an external SSF layer from TLS */ /* Inform SASL that we've got an external SSF layer from TLS */
if (virNetServerClientHasTLSSession(client)) { if (virNetServerClientHasTLSSession(client)) {
int ssf; int ssf;
@ -3367,7 +3366,6 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
if (virNetSASLSessionExtKeySize(sasl, ssf) < 0) if (virNetSASLSessionExtKeySize(sasl, ssf) < 0)
goto authfail; goto authfail;
} }
# endif
if (virNetServerClientIsSecure(client)) if (virNetServerClientIsSecure(client))
/* If we've got TLS or UNIX domain sock, we don't care about SSF */ /* If we've got TLS or UNIX domain sock, we don't care about SSF */

View File

@ -25,9 +25,7 @@
# include <signal.h> # include <signal.h>
# ifdef WITH_GNUTLS
# include "virnettlscontext.h" # include "virnettlscontext.h"
# endif
# include "virobject.h" # include "virobject.h"
# include "virjson.h" # include "virjson.h"
# include "virnetserverprogram.h" # include "virnetserverprogram.h"

View File

@ -73,9 +73,7 @@ struct _virNetServer {
int keepaliveInterval; int keepaliveInterval;
unsigned int keepaliveCount; unsigned int keepaliveCount;
#ifdef WITH_GNUTLS
virNetTLSContextPtr tls; virNetTLSContextPtr tls;
#endif
virNetServerClientPrivNew clientPrivNew; virNetServerClientPrivNew clientPrivNew;
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart; virNetServerClientPrivPreExecRestart clientPrivPreExecRestart;
@ -320,9 +318,7 @@ static int virNetServerDispatchNewClient(virNetServerServicePtr svc,
virNetServerServiceGetAuth(svc), virNetServerServiceGetAuth(svc),
virNetServerServiceIsReadonly(svc), virNetServerServiceIsReadonly(svc),
virNetServerServiceGetMaxRequests(svc), virNetServerServiceGetMaxRequests(svc),
#if WITH_GNUTLS
virNetServerServiceGetTLSContext(svc), virNetServerServiceGetTLSContext(svc),
#endif
srv->clientPrivNew, srv->clientPrivNew,
srv->clientPrivPreExecRestart, srv->clientPrivPreExecRestart,
srv->clientPrivFree, srv->clientPrivFree,
@ -728,14 +724,12 @@ int virNetServerAddProgram(virNetServerPtr srv,
return -1; return -1;
} }
#if WITH_GNUTLS
int virNetServerSetTLSContext(virNetServerPtr srv, int virNetServerSetTLSContext(virNetServerPtr srv,
virNetTLSContextPtr tls) virNetTLSContextPtr tls)
{ {
srv->tls = virObjectRef(tls); srv->tls = virObjectRef(tls);
return 0; return 0;
} }
#endif
/** /**

View File

@ -24,9 +24,7 @@
#ifndef __VIR_NET_SERVER_H__ #ifndef __VIR_NET_SERVER_H__
# define __VIR_NET_SERVER_H__ # define __VIR_NET_SERVER_H__
# ifdef WITH_GNUTLS
# include "virnettlscontext.h" # include "virnettlscontext.h"
# endif
# include "virnetserverprogram.h" # include "virnetserverprogram.h"
# include "virnetserverclient.h" # include "virnetserverclient.h"
# include "virnetserverservice.h" # include "virnetserverservice.h"
@ -71,10 +69,8 @@ int virNetServerAddService(virNetServerPtr srv,
int virNetServerAddProgram(virNetServerPtr srv, int virNetServerAddProgram(virNetServerPtr srv,
virNetServerProgramPtr prog); virNetServerProgramPtr prog);
# if WITH_GNUTLS
int virNetServerSetTLSContext(virNetServerPtr srv, int virNetServerSetTLSContext(virNetServerPtr srv,
virNetTLSContextPtr tls); virNetTLSContextPtr tls);
# endif
int virNetServerAddClient(virNetServerPtr srv, int virNetServerAddClient(virNetServerPtr srv,

View File

@ -73,10 +73,8 @@ struct _virNetServerClient
int auth; int auth;
bool auth_pending; bool auth_pending;
bool readonly; bool readonly;
#if WITH_GNUTLS
virNetTLSContextPtr tlsCtxt; virNetTLSContextPtr tlsCtxt;
virNetTLSSessionPtr tls; virNetTLSSessionPtr tls;
#endif
#if WITH_SASL #if WITH_SASL
virNetSASLSessionPtr sasl; virNetSASLSessionPtr sasl;
#endif #endif
@ -154,18 +152,13 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client)
VIR_DEBUG("tls=%p hs=%d, rx=%p tx=%p", VIR_DEBUG("tls=%p hs=%d, rx=%p tx=%p",
#ifdef WITH_GNUTLS
client->tls, client->tls,
client->tls ? virNetTLSSessionGetHandshakeStatus(client->tls) : -1, client->tls ? virNetTLSSessionGetHandshakeStatus(client->tls) : -1,
#else
NULL, -1,
#endif
client->rx, client->rx,
client->tx); client->tx);
if (!client->sock || client->wantClose) if (!client->sock || client->wantClose)
return 0; return 0;
#if WITH_GNUTLS
if (client->tls) { if (client->tls) {
switch (virNetTLSSessionGetHandshakeStatus(client->tls)) { switch (virNetTLSSessionGetHandshakeStatus(client->tls)) {
case VIR_NET_TLS_HANDSHAKE_RECVING: case VIR_NET_TLS_HANDSHAKE_RECVING:
@ -182,7 +175,6 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client)
mode |= VIR_EVENT_HANDLE_WRITABLE; mode |= VIR_EVENT_HANDLE_WRITABLE;
} }
} else { } else {
#endif
/* If there is a message on the rx queue, and /* If there is a message on the rx queue, and
* we're not in middle of a delayedClose, then * we're not in middle of a delayedClose, then
* we're wanting more input */ * we're wanting more input */
@ -193,9 +185,7 @@ virNetServerClientCalculateHandleMode(virNetServerClientPtr client)
then monitor for writability on socket */ then monitor for writability on socket */
if (client->tx) if (client->tx)
mode |= VIR_EVENT_HANDLE_WRITABLE; mode |= VIR_EVENT_HANDLE_WRITABLE;
#if WITH_GNUTLS
} }
#endif
VIR_DEBUG("mode=0%o", mode); VIR_DEBUG("mode=0%o", mode);
return mode; return mode;
} }
@ -300,7 +290,6 @@ void virNetServerClientRemoveFilter(virNetServerClientPtr client,
} }
#ifdef WITH_GNUTLS
/* Check the client's access. */ /* Check the client's access. */
static int static int
virNetServerClientCheckAccess(virNetServerClientPtr client) virNetServerClientCheckAccess(virNetServerClientPtr client)
@ -335,7 +324,7 @@ virNetServerClientCheckAccess(virNetServerClientPtr client)
return 0; return 0;
} }
#endif
static void virNetServerClientDispatchMessage(virNetServerClientPtr client, static void virNetServerClientDispatchMessage(virNetServerClientPtr client,
virNetMessagePtr msg) virNetMessagePtr msg)
@ -396,9 +385,7 @@ virNetServerClientNewInternal(unsigned long long id,
virNetSocketPtr sock, virNetSocketPtr sock,
int auth, int auth,
bool auth_pending, bool auth_pending,
#ifdef WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
bool readonly, bool readonly,
size_t nrequests_max, size_t nrequests_max,
long long timestamp) long long timestamp)
@ -416,9 +403,7 @@ virNetServerClientNewInternal(unsigned long long id,
client->auth = auth; client->auth = auth;
client->auth_pending = auth_pending; client->auth_pending = auth_pending;
client->readonly = readonly; client->readonly = readonly;
#ifdef WITH_GNUTLS
client->tlsCtxt = virObjectRef(tls); client->tlsCtxt = virObjectRef(tls);
#endif
client->nrequests_max = nrequests_max; client->nrequests_max = nrequests_max;
client->conn_time = timestamp; client->conn_time = timestamp;
@ -452,9 +437,7 @@ virNetServerClientPtr virNetServerClientNew(unsigned long long id,
int auth, int auth,
bool readonly, bool readonly,
size_t nrequests_max, size_t nrequests_max,
#ifdef WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
virNetServerClientPrivNew privNew, virNetServerClientPrivNew privNew,
virNetServerClientPrivPreExecRestart privPreExecRestart, virNetServerClientPrivPreExecRestart privPreExecRestart,
virFreeCallback privFree, virFreeCallback privFree,
@ -464,13 +447,7 @@ virNetServerClientPtr virNetServerClientNew(unsigned long long id,
time_t now; time_t now;
bool auth_pending = !virNetServerClientAuthMethodImpliesAuthenticated(auth); bool auth_pending = !virNetServerClientAuthMethodImpliesAuthenticated(auth);
VIR_DEBUG("sock=%p auth=%d tls=%p", sock, auth, VIR_DEBUG("sock=%p auth=%d tls=%p", sock, auth, tls);
#ifdef WITH_GNUTLS
tls
#else
NULL
#endif
);
if ((now = time(NULL)) == (time_t)-1) { if ((now = time(NULL)) == (time_t)-1) {
virReportSystemError(errno, "%s", _("failed to get current time")); virReportSystemError(errno, "%s", _("failed to get current time"));
@ -478,10 +455,7 @@ virNetServerClientPtr virNetServerClientNew(unsigned long long id,
} }
if (!(client = virNetServerClientNewInternal(id, sock, auth, auth_pending, if (!(client = virNetServerClientNewInternal(id, sock, auth, auth_pending,
#ifdef WITH_GNUTLS tls, readonly, nrequests_max,
tls,
#endif
readonly, nrequests_max,
now))) now)))
return NULL; return NULL;
@ -586,9 +560,7 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virNetServerPtr srv,
sock, sock,
auth, auth,
auth_pending, auth_pending,
#ifdef WITH_GNUTLS
NULL, NULL,
#endif
readonly, readonly,
nrequests_max, nrequests_max,
timestamp))) { timestamp))) {
@ -720,7 +692,6 @@ long long virNetServerClientGetTimestamp(virNetServerClientPtr client)
return client->conn_time; return client->conn_time;
} }
#ifdef WITH_GNUTLS
bool virNetServerClientHasTLSSession(virNetServerClientPtr client) bool virNetServerClientHasTLSSession(virNetServerClientPtr client)
{ {
bool has; bool has;
@ -749,7 +720,6 @@ int virNetServerClientGetTLSKeySize(virNetServerClientPtr client)
virObjectUnlock(client); virObjectUnlock(client);
return size; return size;
} }
#endif
int virNetServerClientGetFD(virNetServerClientPtr client) int virNetServerClientGetFD(virNetServerClientPtr client)
{ {
@ -837,13 +807,11 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
} }
#endif #endif
#if WITH_GNUTLS
if (client->tls) { if (client->tls) {
const char *identity = virNetTLSSessionGetX509DName(client->tls); const char *identity = virNetTLSSessionGetX509DName(client->tls);
if (virIdentitySetX509DName(ret, identity) < 0) if (virIdentitySetX509DName(ret, identity) < 0)
goto error; goto error;
} }
#endif
if (client->sock && if (client->sock &&
virNetSocketGetSELinuxContext(client->sock, &seccontext) < 0) virNetSocketGetSELinuxContext(client->sock, &seccontext) < 0)
@ -895,10 +863,8 @@ bool virNetServerClientIsSecure(virNetServerClientPtr client)
{ {
bool secure = false; bool secure = false;
virObjectLock(client); virObjectLock(client);
#if WITH_GNUTLS
if (client->tls) if (client->tls)
secure = true; secure = true;
#endif
#if WITH_SASL #if WITH_SASL
if (client->sasl) if (client->sasl)
secure = true; secure = true;
@ -1019,10 +985,8 @@ void virNetServerClientDispose(void *obj)
#endif #endif
if (client->sockTimer > 0) if (client->sockTimer > 0)
virEventRemoveTimeout(client->sockTimer); virEventRemoveTimeout(client->sockTimer);
#if WITH_GNUTLS
virObjectUnref(client->tls); virObjectUnref(client->tls);
virObjectUnref(client->tlsCtxt); virObjectUnref(client->tlsCtxt);
#endif
virObjectUnref(client->sock); virObjectUnref(client->sock);
} }
@ -1071,12 +1035,10 @@ virNetServerClientCloseLocked(virNetServerClientPtr client)
if (client->sock) if (client->sock)
virNetSocketRemoveIOCallback(client->sock); virNetSocketRemoveIOCallback(client->sock);
#if WITH_GNUTLS
if (client->tls) { if (client->tls) {
virObjectUnref(client->tls); virObjectUnref(client->tls);
client->tls = NULL; client->tls = NULL;
} }
#endif
client->wantClose = true; client->wantClose = true;
while (client->rx) { while (client->rx) {
@ -1139,13 +1101,10 @@ int virNetServerClientInit(virNetServerClientPtr client)
{ {
virObjectLock(client); virObjectLock(client);
#if WITH_GNUTLS
if (!client->tlsCtxt) { if (!client->tlsCtxt) {
#endif
/* Plain socket, so prepare to read first message */ /* Plain socket, so prepare to read first message */
if (virNetServerClientRegisterEvent(client) < 0) if (virNetServerClientRegisterEvent(client) < 0)
goto error; goto error;
#if WITH_GNUTLS
} else { } else {
int ret; int ret;
@ -1174,7 +1133,6 @@ int virNetServerClientInit(virNetServerClientPtr client)
goto error; goto error;
} }
} }
#endif
virObjectUnlock(client); virObjectUnlock(client);
return 0; return 0;
@ -1475,7 +1433,6 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client)
} }
#if WITH_GNUTLS
static void static void
virNetServerClientDispatchHandshake(virNetServerClientPtr client) virNetServerClientDispatchHandshake(virNetServerClientPtr client)
{ {
@ -1498,7 +1455,7 @@ virNetServerClientDispatchHandshake(virNetServerClientPtr client)
client->wantClose = true; client->wantClose = true;
} }
} }
#endif
static void static void
virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque) virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque)
@ -1516,21 +1473,17 @@ virNetServerClientDispatchEvent(virNetSocketPtr sock, int events, void *opaque)
if (events & (VIR_EVENT_HANDLE_WRITABLE | if (events & (VIR_EVENT_HANDLE_WRITABLE |
VIR_EVENT_HANDLE_READABLE)) { VIR_EVENT_HANDLE_READABLE)) {
#if WITH_GNUTLS
if (client->tls && if (client->tls &&
virNetTLSSessionGetHandshakeStatus(client->tls) != virNetTLSSessionGetHandshakeStatus(client->tls) !=
VIR_NET_TLS_HANDSHAKE_COMPLETE) { VIR_NET_TLS_HANDSHAKE_COMPLETE) {
virNetServerClientDispatchHandshake(client); virNetServerClientDispatchHandshake(client);
} else { } else {
#endif
if (events & VIR_EVENT_HANDLE_WRITABLE) if (events & VIR_EVENT_HANDLE_WRITABLE)
virNetServerClientDispatchWrite(client); virNetServerClientDispatchWrite(client);
if (events & VIR_EVENT_HANDLE_READABLE && if (events & VIR_EVENT_HANDLE_READABLE &&
client->rx) client->rx)
msg = virNetServerClientDispatchRead(client); msg = virNetServerClientDispatchRead(client);
#if WITH_GNUTLS
} }
#endif
} }
/* NB, will get HANGUP + READABLE at same time upon /* NB, will get HANGUP + READABLE at same time upon
@ -1687,10 +1640,8 @@ virNetServerClientGetTransport(virNetServerClientPtr client)
else else
ret = VIR_CLIENT_TRANS_TCP; ret = VIR_CLIENT_TRANS_TCP;
#ifdef WITH_GNUTLS
if (client->tls) if (client->tls)
ret = VIR_CLIENT_TRANS_TLS; ret = VIR_CLIENT_TRANS_TLS;
#endif
virObjectUnlock(client); virObjectUnlock(client);

View File

@ -69,18 +69,12 @@ virNetServerClientPtr virNetServerClientNew(unsigned long long id,
int auth, int auth,
bool readonly, bool readonly,
size_t nrequests_max, size_t nrequests_max,
# ifdef WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
# endif
virNetServerClientPrivNew privNew, virNetServerClientPrivNew privNew,
virNetServerClientPrivPreExecRestart privPreExecRestart, virNetServerClientPrivPreExecRestart privPreExecRestart,
virFreeCallback privFree, virFreeCallback privFree,
void *privOpaque) void *privOpaque)
# ifdef WITH_GNUTLS
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(7) ATTRIBUTE_NONNULL(9); ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(7) ATTRIBUTE_NONNULL(9);
# else
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6) ATTRIBUTE_NONNULL(8);
# endif
virNetServerClientPtr virNetServerClientNewPostExecRestart(virNetServerPtr srv, virNetServerClientPtr virNetServerClientNewPostExecRestart(virNetServerPtr srv,
virJSONValuePtr object, virJSONValuePtr object,
@ -107,11 +101,9 @@ void virNetServerClientSetReadonly(virNetServerClientPtr client, bool readonly);
unsigned long long virNetServerClientGetID(virNetServerClientPtr client); unsigned long long virNetServerClientGetID(virNetServerClientPtr client);
long long virNetServerClientGetTimestamp(virNetServerClientPtr client); long long virNetServerClientGetTimestamp(virNetServerClientPtr client);
# ifdef WITH_GNUTLS
bool virNetServerClientHasTLSSession(virNetServerClientPtr client); bool virNetServerClientHasTLSSession(virNetServerClientPtr client);
virNetTLSSessionPtr virNetServerClientGetTLSSession(virNetServerClientPtr client); virNetTLSSessionPtr virNetServerClientGetTLSSession(virNetServerClientPtr client);
int virNetServerClientGetTLSKeySize(virNetServerClientPtr client); int virNetServerClientGetTLSKeySize(virNetServerClientPtr client);
# endif
# ifdef WITH_SASL # ifdef WITH_SASL
bool virNetServerClientHasSASLSession(virNetServerClientPtr client); bool virNetServerClientHasSASLSession(virNetServerClientPtr client);

View File

@ -43,9 +43,7 @@ struct _virNetServerService {
bool readonly; bool readonly;
size_t nrequests_client_max; size_t nrequests_client_max;
#if WITH_GNUTLS
virNetTLSContextPtr tls; virNetTLSContextPtr tls;
#endif
virNetServerServiceDispatchFunc dispatchFunc; virNetServerServiceDispatchFunc dispatchFunc;
void *dispatchOpaque; void *dispatchOpaque;
@ -94,9 +92,7 @@ virNetServerServiceNewFDOrUNIX(const char *path,
mode_t mask, mode_t mask,
gid_t grp, gid_t grp,
int auth, int auth,
#if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max, size_t nrequests_client_max,
@ -112,9 +108,7 @@ virNetServerServiceNewFDOrUNIX(const char *path,
mask, mask,
grp, grp,
auth, auth,
#if WITH_GNUTLS
tls, tls,
#endif
readonly, readonly,
max_queued_clients, max_queued_clients,
nrequests_client_max); nrequests_client_max);
@ -128,9 +122,7 @@ virNetServerServiceNewFDOrUNIX(const char *path,
*/ */
return virNetServerServiceNewFD((*cur_fd)++, return virNetServerServiceNewFD((*cur_fd)++,
auth, auth,
#if WITH_GNUTLS
tls, tls,
#endif
readonly, readonly,
max_queued_clients, max_queued_clients,
nrequests_client_max); nrequests_client_max);
@ -142,9 +134,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
const char *service, const char *service,
int family, int family,
int auth, int auth,
#if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max) size_t nrequests_client_max)
@ -161,9 +151,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
svc->auth = auth; svc->auth = auth;
svc->readonly = readonly; svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max; svc->nrequests_client_max = nrequests_client_max;
#if WITH_GNUTLS
svc->tls = virObjectRef(tls); svc->tls = virObjectRef(tls);
#endif
if (virNetSocketNewListenTCP(nodename, if (virNetSocketNewListenTCP(nodename,
service, service,
@ -202,9 +190,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
mode_t mask, mode_t mask,
gid_t grp, gid_t grp,
int auth, int auth,
#if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max) size_t nrequests_client_max)
@ -221,9 +207,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
svc->auth = auth; svc->auth = auth;
svc->readonly = readonly; svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max; svc->nrequests_client_max = nrequests_client_max;
#if WITH_GNUTLS
svc->tls = virObjectRef(tls); svc->tls = virObjectRef(tls);
#endif
if (VIR_ALLOC_N(svc->socks, 1) < 0) if (VIR_ALLOC_N(svc->socks, 1) < 0)
goto error; goto error;
@ -263,9 +247,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
virNetServerServicePtr virNetServerServiceNewFD(int fd, virNetServerServicePtr virNetServerServiceNewFD(int fd,
int auth, int auth,
#if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
#endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max) size_t nrequests_client_max)
@ -282,9 +264,7 @@ virNetServerServicePtr virNetServerServiceNewFD(int fd,
svc->auth = auth; svc->auth = auth;
svc->readonly = readonly; svc->readonly = readonly;
svc->nrequests_client_max = nrequests_client_max; svc->nrequests_client_max = nrequests_client_max;
#if WITH_GNUTLS
svc->tls = virObjectRef(tls); svc->tls = virObjectRef(tls);
#endif
if (VIR_ALLOC_N(svc->socks, 1) < 0) if (VIR_ALLOC_N(svc->socks, 1) < 0)
goto error; goto error;
@ -469,12 +449,10 @@ size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc)
return svc->nrequests_client_max; return svc->nrequests_client_max;
} }
#if WITH_GNUTLS
virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc) virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc)
{ {
return svc->tls; return svc->tls;
} }
#endif
void virNetServerServiceSetDispatcher(virNetServerServicePtr svc, void virNetServerServiceSetDispatcher(virNetServerServicePtr svc,
virNetServerServiceDispatchFunc func, virNetServerServiceDispatchFunc func,
@ -494,9 +472,7 @@ void virNetServerServiceDispose(void *obj)
virObjectUnref(svc->socks[i]); virObjectUnref(svc->socks[i]);
VIR_FREE(svc->socks); VIR_FREE(svc->socks);
#if WITH_GNUTLS
virObjectUnref(svc->tls); virObjectUnref(svc->tls);
#endif
} }
void virNetServerServiceToggle(virNetServerServicePtr svc, void virNetServerServiceToggle(virNetServerServicePtr svc,

View File

@ -41,9 +41,7 @@ virNetServerServicePtr virNetServerServiceNewFDOrUNIX(const char *path,
mode_t mask, mode_t mask,
gid_t grp, gid_t grp,
int auth, int auth,
# if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
# endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max, size_t nrequests_client_max,
@ -53,9 +51,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
const char *service, const char *service,
int family, int family,
int auth, int auth,
# if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
# endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max); size_t nrequests_client_max);
@ -63,17 +59,13 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
mode_t mask, mode_t mask,
gid_t grp, gid_t grp,
int auth, int auth,
# if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
# endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max); size_t nrequests_client_max);
virNetServerServicePtr virNetServerServiceNewFD(int fd, virNetServerServicePtr virNetServerServiceNewFD(int fd,
int auth, int auth,
# if WITH_GNUTLS
virNetTLSContextPtr tls, virNetTLSContextPtr tls,
# endif
bool readonly, bool readonly,
size_t max_queued_clients, size_t max_queued_clients,
size_t nrequests_client_max); size_t nrequests_client_max);
@ -87,9 +79,7 @@ int virNetServerServiceGetPort(virNetServerServicePtr svc);
int virNetServerServiceGetAuth(virNetServerServicePtr svc); int virNetServerServiceGetAuth(virNetServerServicePtr svc);
bool virNetServerServiceIsReadonly(virNetServerServicePtr svc); bool virNetServerServiceIsReadonly(virNetServerServicePtr svc);
size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc); size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc);
# ifdef WITH_GNUTLS
virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc); virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc);
# endif
void virNetServerServiceSetDispatcher(virNetServerServicePtr svc, void virNetServerServiceSetDispatcher(virNetServerServicePtr svc,
virNetServerServiceDispatchFunc func, virNetServerServiceDispatchFunc func,

View File

@ -26,10 +26,8 @@
#include "viralloc.h" #include "viralloc.h"
#include "virrandom.h" #include "virrandom.h"
#ifdef WITH_GNUTLS
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/crypto.h> #include <gnutls/crypto.h>
#endif
VIR_LOG_INIT("util.crypto"); VIR_LOG_INIT("util.crypto");
@ -39,7 +37,6 @@ static const char hex[] = "0123456789abcdef";
#define VIR_CRYPTO_LARGEST_DIGEST_SIZE VIR_CRYPTO_HASH_SIZE_SHA256 #define VIR_CRYPTO_LARGEST_DIGEST_SIZE VIR_CRYPTO_HASH_SIZE_SHA256
#if WITH_GNUTLS
struct virHashInfo { struct virHashInfo {
gnutls_digest_algorithm_t algorithm; gnutls_digest_algorithm_t algorithm;
@ -74,17 +71,7 @@ virCryptoHashBuf(virCryptoHash hash,
return hashinfo[hash].hashlen; return hashinfo[hash].hashlen;
} }
#else
ssize_t
virCryptoHashBuf(virCryptoHash hash,
const char *input ATTRIBUTE_UNUSED,
unsigned char *output ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INVALID_ARG,
_("algorithm=%d is not supported"), hash);
return -1;
}
#endif
int int
virCryptoHashString(virCryptoHash hash, virCryptoHashString(virCryptoHash hash,
@ -129,11 +116,7 @@ virCryptoHaveCipher(virCryptoCipher algorithm)
switch (algorithm) { switch (algorithm) {
case VIR_CRYPTO_CIPHER_AES256CBC: case VIR_CRYPTO_CIPHER_AES256CBC:
#ifdef WITH_GNUTLS
return true; return true;
#else
return false;
#endif
case VIR_CRYPTO_CIPHER_NONE: case VIR_CRYPTO_CIPHER_NONE:
case VIR_CRYPTO_CIPHER_LAST: case VIR_CRYPTO_CIPHER_LAST:
@ -144,7 +127,6 @@ virCryptoHaveCipher(virCryptoCipher algorithm)
} }
#ifdef WITH_GNUTLS
/* virCryptoEncryptDataAESgntuls: /* virCryptoEncryptDataAESgntuls:
* *
* Performs the AES gnutls encryption * Performs the AES gnutls encryption
@ -295,22 +277,3 @@ virCryptoEncryptData(virCryptoCipher algorithm,
_("algorithm=%d is not supported"), algorithm); _("algorithm=%d is not supported"), algorithm);
return -1; return -1;
} }
#else
int
virCryptoEncryptData(virCryptoCipher algorithm,
uint8_t *enckey ATTRIBUTE_UNUSED,
size_t enckeylen ATTRIBUTE_UNUSED,
uint8_t *iv ATTRIBUTE_UNUSED,
size_t ivlen ATTRIBUTE_UNUSED,
uint8_t *data ATTRIBUTE_UNUSED,
size_t datalen ATTRIBUTE_UNUSED,
uint8_t **ciphertext ATTRIBUTE_UNUSED,
size_t *ciphertextlen ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INVALID_ARG,
_("algorithm=%d is not supported"), algorithm);
return -1;
}
#endif

View File

@ -1043,10 +1043,8 @@ mymain(void)
DO_TEST("disk-drive-network-sheepdog", NONE); DO_TEST("disk-drive-network-sheepdog", NONE);
DO_TEST("disk-drive-network-rbd-auth", NONE); DO_TEST("disk-drive-network-rbd-auth", NONE);
DO_TEST("disk-drive-network-source-auth", NONE); DO_TEST("disk-drive-network-source-auth", NONE);
# ifdef WITH_GNUTLS
DO_TEST("disk-drive-network-rbd-auth-AES", DO_TEST("disk-drive-network-rbd-auth-AES",
QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_VIRTIO_SCSI); QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_VIRTIO_SCSI);
# endif
DO_TEST("disk-drive-network-rbd-ipv6", NONE); DO_TEST("disk-drive-network-rbd-ipv6", NONE);
DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE); DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE);
DO_TEST("disk-drive-network-vxhs", QEMU_CAPS_VXHS); DO_TEST("disk-drive-network-vxhs", QEMU_CAPS_VXHS);
@ -1339,17 +1337,10 @@ mymain(void)
if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID, if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509secretUUID,
"6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0) "6fd3f62d-9fe7-4a4e-a869-7acd6376d8ea") < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
# ifdef WITH_GNUTLS
DO_TEST("serial-tcp-tlsx509-secret-chardev", DO_TEST("serial-tcp-tlsx509-secret-chardev",
QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_OBJECT_SECRET,
QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_ISA_SERIAL,
QEMU_CAPS_OBJECT_TLS_CREDS_X509); QEMU_CAPS_OBJECT_TLS_CREDS_X509);
# else
DO_TEST_FAILURE("serial-tcp-tlsx509-secret-chardev",
QEMU_CAPS_OBJECT_SECRET,
QEMU_CAPS_DEVICE_ISA_SERIAL,
QEMU_CAPS_OBJECT_TLS_CREDS_X509);
# endif
driver.config->chardevTLS = 0; driver.config->chardevTLS = 0;
VIR_FREE(driver.config->chardevTLSx509certdir); VIR_FREE(driver.config->chardevTLSx509certdir);
DO_TEST("serial-many-chardev", DO_TEST("serial-many-chardev",
@ -1653,14 +1644,10 @@ mymain(void)
DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET); DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET); DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS, QEMU_CAPS_OBJECT_SECRET);
# ifdef WITH_GNUTLS
DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET); DO_TEST("luks-disks", QEMU_CAPS_OBJECT_SECRET);
DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET); DO_TEST("luks-disks-source", QEMU_CAPS_OBJECT_SECRET);
DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET); DO_TEST_PARSE_ERROR("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET);
DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS); DO_TEST("luks-disks-source-qcow2", QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_QCOW2_LUKS);
# else
DO_TEST_FAILURE("luks-disks", QEMU_CAPS_OBJECT_SECRET);
# endif
DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE); DO_TEST_PARSE_ERROR("luks-disk-invalid", NONE);
DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET); DO_TEST_PARSE_ERROR("luks-disks-source-both", QEMU_CAPS_OBJECT_SECRET);
@ -2351,12 +2338,10 @@ mymain(void)
DO_TEST("hostdev-scsi-virtio-iscsi-auth", DO_TEST("hostdev-scsi-virtio-iscsi-auth",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC); QEMU_CAPS_DEVICE_SCSI_GENERIC);
# ifdef WITH_GNUTLS
DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES", DO_TEST("disk-hostdev-scsi-virtio-iscsi-auth-AES",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_OBJECT_SECRET,
QEMU_CAPS_ISCSI_PASSWORD_SECRET); QEMU_CAPS_ISCSI_PASSWORD_SECRET);
# endif
DO_TEST("hostdev-scsi-vhost-scsi-ccw", DO_TEST("hostdev-scsi-vhost-scsi-ccw",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_CCW); QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_CCW);

View File

@ -22,7 +22,6 @@
#include "testutils.h" #include "testutils.h"
#if WITH_GNUTLS
#include "vircrypto.h" #include "vircrypto.h"
#include "virrandom.h" #include "virrandom.h"
@ -181,12 +180,3 @@ mymain(void)
/* Forces usage of not so random virRandomBytes */ /* Forces usage of not so random virRandomBytes */
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so") VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")
#else
static int
mymain(void)
{
return EXIT_AM_SKIP;
}
VIR_TEST_MAIN(mymain);
#endif /* WITH_GNUTLS */

View File

@ -21,7 +21,6 @@
#include "testutils.h" #include "testutils.h"
#if WITH_GNUTLS
#include "virfile.h" #include "virfile.h"
#include "virfilecache.h" #include "virfilecache.h"
@ -235,12 +234,3 @@ mymain(void)
} }
VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virfilecachemock.so") VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virfilecachemock.so")
#else
static int
mymain(void)
{
return EXIT_AM_SKIP;
}
VIR_TEST_MAIN(mymain);
#endif /* WITH_GNUTLS */

View File

@ -117,9 +117,7 @@ testCreateServer(const char *server_name, const char *host, int family)
NULL, NULL,
family, family,
VIR_NET_SERVER_SERVICE_AUTH_NONE, VIR_NET_SERVER_SERVICE_AUTH_NONE,
# ifdef WITH_GNUTLS
NULL, NULL,
# endif
true, true,
5, 5,
2))) 2)))
@ -129,9 +127,7 @@ testCreateServer(const char *server_name, const char *host, int family)
NULL, NULL,
family, family,
VIR_NET_SERVER_SERVICE_AUTH_POLKIT, VIR_NET_SERVER_SERVICE_AUTH_POLKIT,
# ifdef WITH_GNUTLS
NULL, NULL,
# endif
false, false,
25, 25,
5))) 5)))
@ -152,9 +148,7 @@ testCreateServer(const char *server_name, const char *host, int family)
VIR_NET_SERVER_SERVICE_AUTH_SASL, VIR_NET_SERVER_SERVICE_AUTH_SASL,
true, true,
15, 15,
# ifdef WITH_GNUTLS
NULL, NULL,
# endif
testClientNew, testClientNew,
testClientPreExec, testClientPreExec,
testClientFree, testClientFree,
@ -166,9 +160,7 @@ testCreateServer(const char *server_name, const char *host, int family)
VIR_NET_SERVER_SERVICE_AUTH_POLKIT, VIR_NET_SERVER_SERVICE_AUTH_POLKIT,
true, true,
66, 66,
# ifdef WITH_GNUTLS
NULL, NULL,
# endif
testClientNew, testClientNew,
testClientPreExec, testClientPreExec,
testClientFree, testClientFree,

View File

@ -73,9 +73,7 @@ static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
sv[0] = -1; sv[0] = -1;
if (!(client = virNetServerClientNew(1, sock, 0, false, 1, if (!(client = virNetServerClientNew(1, sock, 0, false, 1,
# ifdef WITH_GNUTLS
NULL, NULL,
# endif
testClientNew, testClientNew,
NULL, NULL,
testClientFree, testClientFree,

View File

@ -22,6 +22,9 @@
#ifndef WIN32 #ifndef WIN32
# include <stdio.h>
# include <gnutls/gnutls.h>
# include "internal.h" # include "internal.h"
# include "virstring.h" # include "virstring.h"
# include "virrandom.h" # include "virrandom.h"
@ -50,10 +53,6 @@ int virRandomGenerateWWN(char **wwn,
} }
# ifdef WITH_GNUTLS
# include <stdio.h>
# include <gnutls/gnutls.h>
static int (*real_gnutls_dh_params_generate2)(gnutls_dh_params_t dparams, static int (*real_gnutls_dh_params_generate2)(gnutls_dh_params_t dparams,
unsigned int bits); unsigned int bits);
@ -87,7 +86,6 @@ gnutls_dh_params_generate2(gnutls_dh_params_t dparams,
return gnutls_dh_params_cpy(dparams, params_cache); return gnutls_dh_params_cpy(dparams, params_cache);
} }
# endif
#else /* WIN32 */ #else /* WIN32 */
/* Can't mock on WIN32 */ /* Can't mock on WIN32 */
#endif #endif