#include "virdbus.h"
#include "virfile.h"
#include "virstring.h"
+#include "viraccessapicheck.h"
#define VIR_FROM_THIS VIR_FROM_NETWORK
goto cleanup;
}
+ if (virNetworkLookupByUUIDEnsureACL(conn, network->def) < 0)
+ goto cleanup;
+
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
goto cleanup;
}
+ if (virNetworkLookupByNameEnsureACL(conn, network->def) < 0)
+ goto cleanup;
+
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
int nactive = 0, i;
struct network_driver *driver = conn->networkPrivateData;
+ if (virConnectNumOfNetworksEnsureACL(conn) < 0)
+ return -1;
+
networkDriverLock(driver);
for (i = 0; i < driver->networks.count; i++) {
virNetworkObjLock(driver->networks.objs[i]);
struct network_driver *driver = conn->networkPrivateData;
int got = 0, i;
+ if (virConnectListNetworksEnsureACL(conn) < 0)
+ return -1;
+
networkDriverLock(driver);
for (i = 0; i < driver->networks.count && got < nnames; i++) {
virNetworkObjLock(driver->networks.objs[i]);
int ninactive = 0, i;
struct network_driver *driver = conn->networkPrivateData;
+ if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
+ return -1;
+
networkDriverLock(driver);
for (i = 0; i < driver->networks.count; i++) {
virNetworkObjLock(driver->networks.objs[i]);
struct network_driver *driver = conn->networkPrivateData;
int got = 0, i;
+ if (virConnectListDefinedNetworksEnsureACL(conn) < 0)
+ return -1;
+
networkDriverLock(driver);
for (i = 0; i < driver->networks.count && got < nnames; i++) {
virNetworkObjLock(driver->networks.objs[i]);
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
+ if (virConnectListAllNetworksEnsureACL(conn) < 0)
+ goto cleanup;
+
networkDriverLock(driver);
ret = virNetworkList(conn, driver->networks, nets, flags);
networkDriverUnlock(driver);
+cleanup:
return ret;
}
virReportError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}
+
+ if (virNetworkIsActiveEnsureACL(net->conn, obj->def) < 0)
+ goto cleanup;
+
ret = virNetworkObjIsActive(obj);
cleanup:
virReportError(VIR_ERR_NO_NETWORK, NULL);
goto cleanup;
}
+
+ if (virNetworkIsPersistentEnsureACL(net->conn, obj->def) < 0)
+ goto cleanup;
+
ret = obj->persistent;
cleanup:
if (!(def = virNetworkDefParseString(xml)))
goto cleanup;
+ if (virNetworkCreateXMLEnsureACL(conn, def) < 0)
+ goto cleanup;
+
if (networkValidate(driver, def, true) < 0)
goto cleanup;
if (!(def = virNetworkDefParseString(xml)))
goto cleanup;
+ if (virNetworkDefineXMLEnsureACL(conn, def) < 0)
+ goto cleanup;
+
if (networkValidate(driver, def, false) < 0)
goto cleanup;
goto cleanup;
}
+ if (virNetworkUndefineEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
if (virNetworkObjIsActive(network))
active = true;
goto cleanup;
}
+ if (virNetworkUpdateEnsureACL(net->conn, network->def, flags) < 0)
+ goto cleanup;
+
/* see if we are listening for dhcp pre-modification */
for (ii = 0;
(ipdef = virNetworkDefGetIpByIndex(network->def, AF_INET, ii));
goto cleanup;
}
+ if (virNetworkCreateEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
ret = networkStartNetwork(driver, network);
cleanup:
goto cleanup;
}
+ if (virNetworkDestroyEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
if (!virNetworkObjIsActive(network)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("network is not active"));
goto cleanup;
}
+ if (virNetworkGetXMLDescEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
if ((flags & VIR_NETWORK_XML_INACTIVE) && network->newDef)
def = network->newDef;
else
goto cleanup;
}
+ if (virNetworkGetBridgeNameEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
if (!(network->def->bridge)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' does not have a bridge name."),
goto cleanup;
}
+ if (virNetworkGetAutostartEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
*autostart = network->autostart;
ret = 0;
goto cleanup;
}
+ if (virNetworkSetAutostartEnsureACL(net->conn, network->def) < 0)
+ goto cleanup;
+
if (!network->persistent) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot set autostart for transient network"));