/* Automatically generated from /build/libvirt/src/libvirt/src/remote/lxc_protocol.x by gendispatch.pl.
 * Do not edit this file.  Any changes you make will be lost.
 */
#include <config.h>
#include "viraccessapichecklxc.h"
#include "access/viraccessmanager.h"
#include "datatypes.h"
#include "virerror.h"

#define VIR_FROM_THIS VIR_FROM_ACCESS

/* Returns: -1 on error/denied, 0 on allowed */
int virDomainLxcOpenNamespaceEnsureACL(virConnectPtr conn, virDomainDef * domain)
{
    g_autoptr(virAccessManager) mgr = NULL;
    int rv;

    if (!(mgr = virAccessManagerGetDefault())) {
        return -1;
    }

    if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_OPEN_NAMESPACE)) <= 0) {
        if (rv == 0)
            virReportError(VIR_ERR_ACCESS_DENIED,
                            _("'%1$s' denied access"), conn->driver->name);
        return -1;
    }

    return 0;
}

