[libvirt] [PATCH] network: Fix dnsmasq hostsfile creation logic and related tests
by Matthias Bolte
networkSaveDnsmasqHostsfile was added in 8fa9c2214247 (Apr 2010).
It has a force flag. If the dnsmasq hostsfile already exists force
needs to be true to overwrite it. networkBuildDnsmasqArgv sets force
to false, networkDefine sets it to true. This results in the
hostsfile being written only in networkDefine in the common case.
If no error occurred networkSaveDnsmasqHostsfile returns true and
networkBuildDnsmasqArgv adds the --dhcp-hostsfile to the dnsmasq
command line.
networkSaveDnsmasqHostsfile was changed in 89ae9849f744 (24 Jun 2011)
to return a new dnsmasqContext instead of reusing one. This change broke
the logic of the force flag as now networkSaveDnsmasqHostsfile returns
NULL on error, but the early return -- if force was not set and the
hostsfile exists -- returns 0. This turned the early return in an error
case and networkBuildDnsmasqArgv didn't add the --dhcp-hostsfile option
anymore if the hostsfile already exists. It did because networkDefine
created the hostsfile already.
Then 9d4e2845d498 fixed the return 0 case in networkSaveDnsmasqHostsfile
but didn't apply the force option correctly to the new addnhosts file.
Now force doesn't control an early return anymore, but influences the
handling of the hostsfile context creation and dnsmasqSave is always
called now. This commit also added test cases that reveal several
problems. First, the tests now call functions that try to write the
dnsmasq config files to disk. If someone runs this tests as root this
might overwrite actively used dnsmasq config files, this is a no-go. Also
the tests depend onconfigure --localstatedir, this needs to be fixed as
well, because it makes the tests fail when localstatedir is different
from /var.
This patch does several things to fix this:
1) Move dnsmasqContext creation and saving out of networkBuildDnsmasqArgv
to the caller to separate the command line generation from the config
file writing. This makes the command line generation testable without the
risk of interfering with system files, because the tests just don't call
dnsmasqSave.
2) This refactoring of networkSaveDnsmasqHostsfile makes the force flag
useless as the saving happens somewhere else now. This fixes the wrong
usage of the force flag in combination with then newly added addnhosts
file by removing the force flag.
3) Adapt the wrong test cases to the correct behavior, by adding the
missing --dhcp-hostsfile option. Both affected tests contain DHCP host
elements but missed the necessary --dhcp-hostsfile option.
4) Rename networkSaveDnsmasqHostsfile to networkBuildDnsmasqHostsfile,
because it doesn't save the dnsmasqContext anymore.
5) Move all directory creations in dnsmasq context handling code from
the *New functions to dnsmasqSave to avoid directory creations in system
paths in the test cases.
6) Now that networkBuildDnsmasqArgv doesn't create the dnsmasqContext
anymore the test case can create one with the localstatedir that is
expected by the tests instead of the configure --localstatedir given one.
---
src/network/bridge_driver.c | 71 +++++++++-----------
src/network/bridge_driver.h | 5 +-
src/util/dnsmasq.c | 28 ++++----
src/util/dnsmasq.h | 1 +
.../nat-network-dns-txt-record.argv | 3 +-
tests/networkxml2argvdata/nat-network.argv | 3 +-
tests/networkxml2argvtest.c | 8 ++-
7 files changed, 63 insertions(+), 56 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index aa170d6..f48fdcb 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -436,27 +436,17 @@ networkShutdown(void) {
}
-static dnsmasqContext*
-networkSaveDnsmasqHostsfile(virNetworkIpDefPtr ipdef,
- virNetworkDNSDefPtr dnsdef,
- char *name,
- bool force)
+static int
+networkBuildDnsmasqHostsfile(dnsmasqContext *dctx,
+ virNetworkIpDefPtr ipdef,
+ virNetworkDNSDefPtr dnsdef)
{
unsigned int i, j;
- dnsmasqContext *dctx = dnsmasqContextNew(name,
- DNSMASQ_STATE_DIR);
- if (dctx == NULL) {
- virReportOOMError();
- goto cleanup;
- }
-
- if (!(! force && virFileExists(dctx->hostsfile->path))) {
- for (i = 0; i < ipdef->nhosts; i++) {
- virNetworkDHCPHostDefPtr host = &(ipdef->hosts[i]);
- if ((host->mac) && VIR_SOCKET_HAS_ADDR(&host->ip))
- dnsmasqAddDhcpHost(dctx, host->mac, &host->ip, host->name);
- }
+ for (i = 0; i < ipdef->nhosts; i++) {
+ virNetworkDHCPHostDefPtr host = &(ipdef->hosts[i]);
+ if ((host->mac) && VIR_SOCKET_HAS_ADDR(&host->ip))
+ dnsmasqAddDhcpHost(dctx, host->mac, &host->ip, host->name);
}
if (dnsdef) {
@@ -469,15 +459,7 @@ networkSaveDnsmasqHostsfile(virNetworkIpDefPtr ipdef,
}
}
- if (dnsmasqSave(dctx) < 0)
- goto cleanup;
-
- return dctx;
-
-cleanup:
- dnsmasqContextFree(dctx);
-
- return NULL;
+ return 0;
}
@@ -485,12 +467,13 @@ static int
networkBuildDnsmasqArgv(virNetworkObjPtr network,
virNetworkIpDefPtr ipdef,
const char *pidfile,
- virCommandPtr cmd) {
+ virCommandPtr cmd,
+ dnsmasqContext *dctx)
+{
int r, ret = -1;
int nbleases = 0;
int ii;
virNetworkIpDefPtr tmpipdef;
- dnsmasqContext *dctx = NULL;
/*
* NB, be careful about syntax for dnsmasq options in long format.
@@ -617,14 +600,13 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
if (ipdef->nranges || ipdef->nhosts)
virCommandAddArg(cmd, "--dhcp-no-override");
- if ((dctx = networkSaveDnsmasqHostsfile(ipdef, network->def->dns, network->def->name, false))) {
+ if (networkBuildDnsmasqHostsfile(dctx, ipdef, network->def->dns) >= 0) {
if (dctx->hostsfile->nhosts)
virCommandAddArgPair(cmd, "--dhcp-hostsfile",
dctx->hostsfile->path);
if (dctx->addnhostsfile->nhosts)
virCommandAddArgPair(cmd, "--addn-hosts",
dctx->addnhostsfile->path);
- dnsmasqContextFree(dctx);
}
if (ipdef->tftproot) {
@@ -655,7 +637,7 @@ cleanup:
int
networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdout,
- char *pidfile)
+ char *pidfile, dnsmasqContext *dctx)
{
virCommandPtr cmd = NULL;
int ret = -1, ii;
@@ -684,7 +666,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdou
return 0;
cmd = virCommandNew(DNSMASQ);
- if (networkBuildDnsmasqArgv(network, ipdef, pidfile, cmd) < 0) {
+ if (networkBuildDnsmasqArgv(network, ipdef, pidfile, cmd, dctx) < 0) {
goto cleanup;
}
@@ -704,6 +686,7 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
char *pidfile = NULL;
int ret = -1;
int err;
+ dnsmasqContext *dctx = NULL;
if ((err = virFileMakePath(NETWORK_PID_DIR)) != 0) {
virReportSystemError(err,
@@ -730,8 +713,16 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
goto cleanup;
}
- ret = networkBuildDhcpDaemonCommandLine(network,&cmd, pidfile);
- if (ret< 0)
+ dctx = dnsmasqContextNew(network->def->name, DNSMASQ_STATE_DIR);
+ if (dctx == NULL)
+ goto cleanup;
+
+ ret = networkBuildDhcpDaemonCommandLine(network, &cmd, pidfile, dctx);
+ if (ret < 0)
+ goto cleanup;
+
+ ret = dnsmasqSave(dctx);
+ if (ret < 0)
goto cleanup;
if (virCommandRun(cmd, NULL) < 0)
@@ -753,6 +744,7 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
cleanup:
VIR_FREE(pidfile);
virCommandFree(cmd);
+ dnsmasqContextFree(dctx);
return ret;
}
@@ -2205,6 +2197,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
virNetworkObjPtr network = NULL;
virNetworkPtr ret = NULL;
int ii;
+ dnsmasqContext* dctx = NULL;
networkDriverLock(driver);
@@ -2251,10 +2244,11 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
}
}
if (ipv4def) {
- dnsmasqContext* dctx = networkSaveDnsmasqHostsfile(ipv4def, network->def->dns, network->def->name, true);
- if (dctx == NULL)
+ dctx = dnsmasqContextNew(network->def->name, DNSMASQ_STATE_DIR);
+ if (dctx == NULL ||
+ networkBuildDnsmasqHostsfile(dctx, ipv4def, network->def->dns) < 0 ||
+ dnsmasqSave(dctx) < 0)
goto cleanup;
- dnsmasqContextFree(dctx);
}
VIR_INFO("Defining network '%s'", network->def->name);
@@ -2262,6 +2256,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
cleanup:
virNetworkDefFree(def);
+ dnsmasqContextFree(dctx);
if (network)
virNetworkObjUnlock(network);
networkDriverUnlock(driver);
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index a106e3d..2896c84 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -30,9 +30,12 @@
# include "internal.h"
# include "network_conf.h"
# include "command.h"
+# include "dnsmasq.h"
int networkRegister(void);
-int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdout, char *pidfile);
+int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,
+ virCommandPtr *cmdout, char *pidfile,
+ dnsmasqContext *dctx);
typedef char *(*networkDnsmasqLeaseFileNameFunc)(const char *netname);
diff --git a/src/util/dnsmasq.c b/src/util/dnsmasq.c
index 04a912a..4bdbb44 100644
--- a/src/util/dnsmasq.c
+++ b/src/util/dnsmasq.c
@@ -142,7 +142,6 @@ static dnsmasqAddnHostsfile *
addnhostsNew(const char *name,
const char *config_dir)
{
- int err;
dnsmasqAddnHostsfile *addnhostsfile;
if (VIR_ALLOC(addnhostsfile) < 0) {
@@ -159,12 +158,6 @@ addnhostsNew(const char *name,
goto error;
}
- if ((err = virFileMakePath(config_dir))) {
- virReportSystemError(err, _("cannot create config directory '%s'"),
- config_dir);
- goto error;
- }
-
return addnhostsfile;
error:
@@ -344,7 +337,6 @@ static dnsmasqHostsfile *
hostsfileNew(const char *name,
const char *config_dir)
{
- int err;
dnsmasqHostsfile *hostsfile;
if (VIR_ALLOC(hostsfile) < 0) {
@@ -361,12 +353,6 @@ hostsfileNew(const char *name,
goto error;
}
- if ((err = virFileMakePath(config_dir))) {
- virReportSystemError(err, _("cannot create config directory '%s'"),
- config_dir);
- goto error;
- }
-
return hostsfile;
error:
@@ -468,6 +454,11 @@ dnsmasqContextNew(const char *network_name,
return NULL;
}
+ if (!(ctx->config_dir = strdup(config_dir))) {
+ virReportOOMError();
+ goto error;
+ }
+
if (!(ctx->hostsfile = hostsfileNew(network_name, config_dir)))
goto error;
if (!(ctx->addnhostsfile = addnhostsNew(network_name, config_dir)))
@@ -492,6 +483,8 @@ dnsmasqContextFree(dnsmasqContext *ctx)
if (!ctx)
return;
+ VIR_FREE(ctx->config_dir);
+
if (ctx->hostsfile)
hostsfileFree(ctx->hostsfile);
if (ctx->addnhostsfile)
@@ -546,8 +539,15 @@ dnsmasqAddHost(dnsmasqContext *ctx,
int
dnsmasqSave(const dnsmasqContext *ctx)
{
+ int err;
int ret = 0;
+ if ((err = virFileMakePath(ctx->config_dir))) {
+ virReportSystemError(err, _("cannot create config directory '%s'"),
+ ctx->config_dir);
+ return -1;
+ }
+
if (ctx->hostsfile)
ret = hostsfileSave(ctx->hostsfile);
if (ret == 0) {
diff --git a/src/util/dnsmasq.h b/src/util/dnsmasq.h
index 3f6320a..62f6f38 100644
--- a/src/util/dnsmasq.h
+++ b/src/util/dnsmasq.h
@@ -60,6 +60,7 @@ typedef struct
typedef struct
{
+ char *config_dir;
dnsmasqHostsfile *hostsfile;
dnsmasqAddnHostsfile *addnhostsfile;
} dnsmasqContext;
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
index 9d74543..be6ba4b 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
@@ -5,4 +5,5 @@
--listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 --dhcp-no-override\
+--dhcp-lease-max=253 --dhcp-no-override \
+--dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile\
diff --git a/tests/networkxml2argvdata/nat-network.argv b/tests/networkxml2argvdata/nat-network.argv
index 181623f..d7faee2 100644
--- a/tests/networkxml2argvdata/nat-network.argv
+++ b/tests/networkxml2argvdata/nat-network.argv
@@ -4,4 +4,5 @@
--listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 --dhcp-no-override\
+--dhcp-lease-max=253 --dhcp-no-override \
+--dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile\
diff --git a/tests/networkxml2argvtest.c b/tests/networkxml2argvtest.c
index 62de191..4a11d6f 100644
--- a/tests/networkxml2argvtest.c
+++ b/tests/networkxml2argvtest.c
@@ -24,6 +24,7 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
virNetworkObjPtr obj = NULL;
virCommandPtr cmd = NULL;
char *pidfile = NULL;
+ dnsmasqContext *dctx = NULL;
if (virtTestLoadFile(inxml, &inXmlData) < 0)
goto fail;
@@ -38,8 +39,12 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
goto fail;
obj->def = dev;
+ dctx = dnsmasqContextNew(dev->name, "/var/lib/libvirt/dnsmasq");
- if (networkBuildDhcpDaemonCommandLine(obj, &cmd, pidfile) < 0)
+ if (dctx == NULL)
+ goto fail;
+
+ if (networkBuildDhcpDaemonCommandLine(obj, &cmd, pidfile, dctx) < 0)
goto fail;
if (!(actual = virCommandToString(cmd)))
@@ -59,6 +64,7 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
VIR_FREE(pidfile);
virCommandFree(cmd);
virNetworkObjFree(obj);
+ dnsmasqContextFree(dctx);
return ret;
}
--
1.7.0.4
13 years, 5 months
[libvirt] [PATCH] Fix compliation with systemtap 1.3
by Matthias Bolte
Version 1.3 uses this macro
#define STAP_CAST(t) (size_t)t
that breaks if t is a function. For that to work it should probably
look like this
#define STAP_CAST(t) ((size_t)(t))
In systemtap 1.4 this was completely rewritten.
Anyway, before commit df0b57a95a767c t was always a variable, but now
also a function is used here, namely virNetSASLSessionGetIdentity.
Use an intermediate variable to avoid this problem.
---
daemon/remote.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 9547702..9e6cf77 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1759,13 +1759,13 @@ remoteSASLFinish(virNetServerClientPtr client)
if (virNetServerClientSetIdentity(client, identity) < 0)
goto error;
-
virNetServerClientSetSASLSession(client, priv->sasl);
VIR_DEBUG("Authentication successful %d", virNetServerClientGetFD(client));
+
+ identity = virNetSASLSessionGetIdentity(priv->sasl);
PROBE(CLIENT_AUTH_ALLOW, "fd=%d, auth=%d, username=%s",
- virNetServerClientGetFD(client), REMOTE_AUTH_SASL,
- virNetSASLSessionGetIdentity(priv->sasl));
+ virNetServerClientGetFD(client), REMOTE_AUTH_SASL, identity);
virNetSASLSessionFree(priv->sasl);
priv->sasl = NULL;
@@ -1793,6 +1793,7 @@ remoteDispatchAuthSaslStart(virNetServerPtr server ATTRIBUTE_UNUSED,
int rv = -1;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ const char *identity;
virMutexLock(&priv->lock);
@@ -1856,9 +1857,9 @@ authfail:
goto error;
authdeny:
+ identity = virNetSASLSessionGetIdentity(priv->sasl);
PROBE(CLIENT_AUTH_DENY, "fd=%d, auth=%d, username=%s",
- virNetServerClientGetFD(client), REMOTE_AUTH_SASL,
- virNetSASLSessionGetIdentity(priv->sasl));
+ virNetServerClientGetFD(client), REMOTE_AUTH_SASL, identity);
goto error;
error:
@@ -1888,7 +1889,7 @@ remoteDispatchAuthSaslStep(virNetServerPtr server ATTRIBUTE_UNUSED,
int rv = -1;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
-
+ const char *identity;
virMutexLock(&priv->lock);
@@ -1952,9 +1953,9 @@ authfail:
goto error;
authdeny:
+ identity = virNetSASLSessionGetIdentity(priv->sasl);
PROBE(CLIENT_AUTH_DENY, "fd=%d, auth=%d, username=%s",
- virNetServerClientGetFD(client), REMOTE_AUTH_SASL,
- virNetSASLSessionGetIdentity(priv->sasl));
+ virNetServerClientGetFD(client), REMOTE_AUTH_SASL, identity);
goto error;
error:
--
1.7.0.4
13 years, 5 months
[libvirt] [PATCH] build: fix mingw build
by Eric Blake
./autobuild.sh died on several messages resembling:
../../src/rpc/virnetsocket.c: In function 'virNetSocketNewListenTCP':
../../src/rpc/virnetsocket.c:231:9: error: implicit declaration of function 'bind_used_without_requesting_gnulib_module_bind' [-Wimplicit-function-declaration]
../../src/rpc/virnetsocket.c:231:9: error: nested extern declaration of 'bind_used_without_requesting_gnulib_module_bind' [-Wnested-externs]
Basically, gnulib socket fds are not safe to pass to mingw socket
functions unless we pull in those gnulib modules.
* bootstrap.conf (gnulib_modules): Add modules to handle socket
functions on mingw.
---
Pushing under the build-breaker rule.
bootstrap.conf | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 7b2cd60..581d60b 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -19,8 +19,10 @@
# gnulib modules used by this package.
gnulib_modules='
+accept
areadlink
base64
+bind
byteswap
c-ctype
c-strcase
@@ -40,6 +42,8 @@ getaddrinfo
getcwd-lgpl
gethostname
getpass
+getpeername
+getsockname
gettext-h
gettimeofday
gitlog-to-changelog
@@ -48,6 +52,7 @@ ignore-value
inet_pton
intprops
ioctl
+listen
maintainer-makefile
manywarnings
mkstemp
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] sysinfo: fix parsing regression
by Eric Blake
Detected by gcc -O2, introduced in commit 532ce9c2. If dmidecode
outputs a field unrecognized by the parsers, then the code would
dereference an uninitialized eol variable.
* src/util/sysinfo.c (virSysinfoParseBIOS)
(virSysinfoParseSystem, virSysinfoParseProcessor)
(virSysinfoParseMemory): Avoid uninitialized variable.
---
I'm pushing this under the build-breaker rule.
It introduces a merge conflict with the (unapplied) patch here:
https://www.redhat.com/archives/libvir-list/2011-June/msg01356.html
but that patch needs to be rebased anyways.
src/util/sysinfo.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index bff1cb8..d32f7f0 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -130,7 +130,7 @@ virSysinfoRead(void) {
static char *
virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
{
- char *cur, *eol;
+ char *cur, *eol = NULL;
if ((cur = strstr(base, "Vendor: ")) != NULL) {
cur += 8;
@@ -157,7 +157,7 @@ virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
- return eol + 1;
+ return eol ? eol + 1 : NULL;
no_memory:
return NULL;
@@ -166,7 +166,7 @@ no_memory:
static char *
virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
{
- char *cur, *eol;
+ char *cur, *eol = NULL;
if ((base = strstr(base, "System Information")) == NULL)
return 0;
@@ -215,7 +215,7 @@ virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
- return eol + 1;
+ return eol ? eol + 1 : NULL;
no_memory:
return NULL;
@@ -229,6 +229,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
while((tmp_base = strstr(base, "Processor Information")) != NULL) {
base = tmp_base;
+ eol = NULL;
if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) {
goto no_memory;
@@ -313,6 +314,8 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
goto no_memory;
}
+ if (!eol)
+ break;
base = eol + 1;
}
@@ -330,6 +333,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
while ((tmp_base = strstr(base, "Memory Device")) != NULL) {
base = tmp_base;
+ eol = NULL;
if (VIR_EXPAND_N(ret->memory, ret->nmemory, 1) < 0) {
goto no_memory;
@@ -411,6 +415,8 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
}
next:
+ if (!eol)
+ break;
base = eol + 1;
}
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] build: Don't expect translatable strings in a dead file
by Jiri Denemark
daemon/remote_dispatch_bodies.h is no longer with us and shouldn't be
searched for translatable strings.
---
Pushed under the build-breaker rule.
po/POTFILES.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a81fc55..1f226fd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
daemon/libvirtd.c
daemon/remote.c
-daemon/remote_dispatch_bodies.h
daemon/stream.c
gnulib/lib/gai_strerror.c
src/conf/cpu_conf.c
--
1.7.6
13 years, 5 months
[libvirt] [PATCH] daemon: Fix build without polkit
by Jiri Denemark
---
Pushed under the build-breaker rule.
daemon/libvirtd.c | 10 +++++-----
daemon/remote.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 62f089d..d1f80e4 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -874,7 +874,7 @@ static void
daemonConfigFree(struct daemonConfig *data);
static struct daemonConfig*
-daemonConfigNew(bool privileged)
+daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
{
struct daemonConfig *data;
char *localhost;
@@ -1034,8 +1034,10 @@ daemonConfigLoad(struct daemonConfig *data,
*/
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT) {
VIR_FREE(data->unix_sock_rw_perms);
- if (!(data->unix_sock_rw_perms = strdup("0777")))
- goto no_memory;
+ if (!(data->unix_sock_rw_perms = strdup("0777"))) {
+ virReportOOMError();
+ goto error;
+ }
}
#endif
if (remoteConfigGetAuth(conf, "auth_unix_ro", &data->auth_unix_ro, filename) < 0)
@@ -1091,8 +1093,6 @@ daemonConfigLoad(struct daemonConfig *data,
virConfFree (conf);
return 0;
-no_memory:
- virReportOOMError();
error:
virConfFree (conf);
return -1;
diff --git a/daemon/remote.c b/daemon/remote.c
index 47e47e4..9547702 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -2209,7 +2209,7 @@ authdeny:
static int
remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr,
remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
--
1.7.6
13 years, 5 months
[libvirt] [PATCH] remote: fix uninitialized variable
by Eric Blake
Detected by gcc -O2:
remote/remote_driver.c: In function 'doRemoteOpen':
remote/remote_driver.c:2753:26: error: 'sasl' may be used uninitialized in this function [-Werror=uninitialized]
* src/remote/remote_driver.c (remoteAuthSASL): Initialize sasl.
---
Pushing under the build-breaker rule.
src/remote/remote_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2ac87c8..0e68bc5 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2520,7 +2520,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv,
int ret = -1;
const char *mechlist;
virNetSASLContextPtr saslCtxt;
- virNetSASLSessionPtr sasl;
+ virNetSASLSessionPtr sasl = NULL;
VIR_DEBUG("Client initialize SASL authentication");
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] build: fix 'make check' when pdwtags is available
by Eric Blake
Problem introduced in commit 6818cf86.
* src/remote_protocol-structs: Delete unused struct.
---
Pushing under the build-breaker rule.
Normally, deleting a struct from remote_protocol-structs is a
sign of an over-the-wire API breakage; but in this case, I've
verified that the new RPC code manages to represent the same
over-the-wire layout without needing this header struct.
src/remote_protocol-structs | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index c07ba81..25979b4 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1615,11 +1615,3 @@ struct remote_domain_get_control_info_ret {
u_int details;
uint64_t stateTime;
};
-struct remote_message_header {
- u_int prog;
- u_int vers;
- int proc;
- remote_message_type type;
- u_int serial;
- remote_message_status status;
-};
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH 0/3] Improve flexibility of SELinux labelling
by Daniel P. Berrange
This patch series adds two new features
- The ability to override 'system_u:system_r:svirt_t:s0' from
/etc/selinux/targeted/contexts/virtual_domain_context using
the guest XML
- The ability to use dynamic relabelling of resources, in combo
with static VM label assignment.
The latter is useful for management applications which want to
be in full control of assigning VM labels (so that they can be
unique across an entire cluster of hosts for example), while
still benefiting from automatic relabelling of resources in the
XML.
13 years, 5 months