security_dac.c 21.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
/*
 * Copyright (C) 2010-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * POSIX DAC security driver
 */

#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include "security_dac.h"
#include "virterror_internal.h"
#include "util.h"
#include "memory.h"
#include "logging.h"
#include "pci.h"
#include "hostusb.h"
#include "storage_file.h"

#define VIR_FROM_THIS VIR_FROM_SECURITY

typedef struct _virSecurityDACData virSecurityDACData;
typedef virSecurityDACData *virSecurityDACDataPtr;

struct _virSecurityDACData {
    uid_t user;
    gid_t group;
    bool dynamicOwnership;
};

void virSecurityDACSetUser(virSecurityManagerPtr mgr,
                           uid_t user)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    priv->user = user;
}

void virSecurityDACSetGroup(virSecurityManagerPtr mgr,
                            gid_t group)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    priv->group = group;
}

void virSecurityDACSetDynamicOwnership(virSecurityManagerPtr mgr,
                                       bool dynamicOwnership)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    priv->dynamicOwnership = dynamicOwnership;
}

static virSecurityDriverStatus
virSecurityDACProbe(void)
{
    return SECURITY_DRIVER_ENABLE;
}

static int
virSecurityDACOpen(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
{
    return 0;
}

static int
virSecurityDACClose(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
{
    return 0;
}


static const char * virSecurityDACGetModel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
{
    return "dac";
}

static const char * virSecurityDACGetDOI(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED)
{
    return "0";
}

static int
virSecurityDACSetOwnership(const char *path, int uid, int gid)
{
    VIR_INFO("Setting DAC user and group on '%s' to '%d:%d'", path, uid, gid);

    if (chown(path, uid, gid) < 0) {
        struct stat sb;
        int chown_errno = errno;

        if (stat(path, &sb) >= 0) {
            if (sb.st_uid == uid &&
                sb.st_gid == gid) {
                /* It's alright, there's nothing to change anyway. */
                return 0;
            }
        }

113
        if (chown_errno == EOPNOTSUPP || chown_errno == EINVAL) {
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
            VIR_INFO("Setting user and group to '%d:%d' on '%s' not supported by filesystem",
                     uid, gid, path);
        } else if (chown_errno == EPERM) {
            VIR_INFO("Setting user and group to '%d:%d' on '%s' not permitted",
                     uid, gid, path);
        } else if (chown_errno == EROFS) {
            VIR_INFO("Setting user and group to '%d:%d' on '%s' not possible on readonly filesystem",
                     uid, gid, path);
        } else {
            virReportSystemError(chown_errno,
                                 _("unable to set user and group to '%d:%d' on '%s'"),
                                 uid, gid, path);
            return -1;
        }
    }
    return 0;
}

static int
virSecurityDACRestoreSecurityFileLabel(const char *path)
{
    struct stat buf;
    int rc = -1;
    char *newpath = NULL;

    VIR_INFO("Restoring DAC user and group on '%s'", path);

    if (virFileResolveLink(path, &newpath) < 0) {
        virReportSystemError(errno,
                             _("cannot resolve symlink %s"), path);
        goto err;
    }

    if (stat(newpath, &buf) != 0)
        goto err;

    /* XXX record previous ownership */
    rc = virSecurityDACSetOwnership(newpath, 0, 0);

err:
    VIR_FREE(newpath);
    return rc;
}


static int
virSecurityDACSetSecurityFileLabel(virDomainDiskDefPtr disk ATTRIBUTE_UNUSED,
                                   const char *path,
                                   size_t depth ATTRIBUTE_UNUSED,
                                   void *opaque)
{
    virSecurityManagerPtr mgr = opaque;
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    return virSecurityDACSetOwnership(path, priv->user, priv->group);
}


static int
virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr,
174
                                    virDomainDefPtr def ATTRIBUTE_UNUSED,
175 176 177 178 179 180 181 182
                                    virDomainDiskDefPtr disk)

{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    if (!priv->dynamicOwnership)
        return 0;

183 184 185
    if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK)
        return 0;

186 187 188
    return virDomainDiskDefForeachPath(disk,
                                       virSecurityManagerGetAllowDiskFormatProbing(mgr),
                                       false,
189
                                       priv->user, priv->group,
190 191 192 193 194 195 196
                                       virSecurityDACSetSecurityFileLabel,
                                       mgr);
}


static int
virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
197
                                           virDomainDefPtr def ATTRIBUTE_UNUSED,
198 199 200 201 202 203 204 205
                                           virDomainDiskDefPtr disk,
                                           int migrated)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    if (!priv->dynamicOwnership)
        return 0;

206 207 208
    if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK)
        return 0;

209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
    /* Don't restore labels on readoly/shared disks, because
     * other VMs may still be accessing these
     * Alternatively we could iterate over all running
     * domains and try to figure out if it is in use, but
     * this would not work for clustered filesystems, since
     * we can't see running VMs using the file on other nodes
     * Safest bet is thus to skip the restore step.
     */
    if (disk->readonly || disk->shared)
        return 0;

    if (!disk->src)
        return 0;

    /* If we have a shared FS & doing migrated, we must not
     * change ownership, because that kills access on the
     * destination host which is sub-optimal for the guest
     * VM's I/O attempts :-)
     */
    if (migrated) {
        int rc = virStorageFileIsSharedFS(disk->src);
        if (rc < 0)
            return -1;
        if (rc == 1) {
            VIR_DEBUG("Skipping image label restore on %s because FS is shared",
                      disk->src);
            return 0;
        }
    }

    return virSecurityDACRestoreSecurityFileLabel(disk->src);
}


static int
virSecurityDACRestoreSecurityImageLabel(virSecurityManagerPtr mgr,
245
                                        virDomainDefPtr def,
246 247
                                        virDomainDiskDefPtr disk)
{
248
    return virSecurityDACRestoreSecurityImageLabelInt(mgr, def, disk, 0);
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
}


static int
virSecurityDACSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
                                  const char *file,
                                  void *opaque)
{
    virSecurityManagerPtr mgr = opaque;
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    return virSecurityDACSetOwnership(file, priv->user, priv->group);
}


static int
virSecurityDACSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
                                  const char *file,
                                  void *opaque)
{
    virSecurityManagerPtr mgr = opaque;
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    return virSecurityDACSetOwnership(file, priv->user, priv->group);
}


static int
virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
278
                                      virDomainDefPtr def ATTRIBUTE_UNUSED,
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
                                      virDomainHostdevDefPtr dev)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    int ret = -1;

    if (!priv->dynamicOwnership)
        return 0;

    if (dev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
        return 0;

    switch (dev->source.subsys.type) {
    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
        usbDevice *usb = usbGetDevice(dev->source.subsys.u.usb.bus,
                                      dev->source.subsys.u.usb.device);

        if (!usb)
            goto done;

        ret = usbDeviceFileIterate(usb, virSecurityDACSetSecurityUSBLabel, mgr);
        usbFreeDevice(usb);
        break;
    }

    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
        pciDevice *pci = pciGetDevice(dev->source.subsys.u.pci.domain,
                                      dev->source.subsys.u.pci.bus,
                                      dev->source.subsys.u.pci.slot,
                                      dev->source.subsys.u.pci.function);

        if (!pci)
            goto done;

        ret = pciDeviceFileIterate(pci, virSecurityDACSetSecurityPCILabel, mgr);
        pciFreeDevice(pci);

        break;
    }

    default:
        ret = 0;
        break;
    }

done:
    return ret;
}


static int
virSecurityDACRestoreSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED,
                                      const char *file,
                                      void *opaque ATTRIBUTE_UNUSED)
{
    return virSecurityDACRestoreSecurityFileLabel(file);
}


static int
virSecurityDACRestoreSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED,
                                       const char *file,
                                       void *opaque ATTRIBUTE_UNUSED)
{
    return virSecurityDACRestoreSecurityFileLabel(file);
}


static int
virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
348
                                           virDomainDefPtr def ATTRIBUTE_UNUSED,
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
                                           virDomainHostdevDefPtr dev)

{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    int ret = -1;

    if (!priv->dynamicOwnership)
        return 0;

    if (dev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
        return 0;

    switch (dev->source.subsys.type) {
    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
        usbDevice *usb = usbGetDevice(dev->source.subsys.u.usb.bus,
                                      dev->source.subsys.u.usb.device);

        if (!usb)
            goto done;

        ret = usbDeviceFileIterate(usb, virSecurityDACRestoreSecurityUSBLabel, mgr);
        usbFreeDevice(usb);

        break;
    }

    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
        pciDevice *pci = pciGetDevice(dev->source.subsys.u.pci.domain,
                                      dev->source.subsys.u.pci.bus,
                                      dev->source.subsys.u.pci.slot,
                                      dev->source.subsys.u.pci.function);

        if (!pci)
            goto done;

        ret = pciDeviceFileIterate(pci, virSecurityDACRestoreSecurityPCILabel, mgr);
        pciFreeDevice(pci);

        break;
    }

    default:
        ret = 0;
        break;
    }

done:
    return ret;
}


static int
virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
402
                              virDomainChrSourceDefPtr dev)
403 404 405 406 407 408 409 410 411 412 413 414 415

{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    char *in = NULL, *out = NULL;
    int ret = -1;

    switch (dev->type) {
    case VIR_DOMAIN_CHR_TYPE_DEV:
    case VIR_DOMAIN_CHR_TYPE_FILE:
        ret = virSecurityDACSetOwnership(dev->data.file.path, priv->user, priv->group);
        break;

    case VIR_DOMAIN_CHR_TYPE_PIPE:
416 417 418 419 420 421
        if ((virAsprintf(&in, "%s.in", dev->data.file.path) < 0) ||
            (virAsprintf(&out, "%s.out", dev->data.file.path) < 0)) {
            virReportOOMError();
            goto done;
        }
        if (virFileExists(in) && virFileExists(out)) {
422
            if ((virSecurityDACSetOwnership(in, priv->user, priv->group) < 0) ||
423
                (virSecurityDACSetOwnership(out, priv->user, priv->group) < 0)) {
424
                goto done;
425 426 427 428
            }
        } else if (virSecurityDACSetOwnership(dev->data.file.path,
                                              priv->user, priv->group) < 0) {
            goto done;
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
        }
        ret = 0;
        break;

    default:
        ret = 0;
        break;
    }

done:
    VIR_FREE(in);
    VIR_FREE(out);
    return ret;
}

static int
virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
446
                                  virDomainChrSourceDefPtr dev)
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
{
    char *in = NULL, *out = NULL;
    int ret = -1;

    switch (dev->type) {
    case VIR_DOMAIN_CHR_TYPE_DEV:
    case VIR_DOMAIN_CHR_TYPE_FILE:
        ret = virSecurityDACRestoreSecurityFileLabel(dev->data.file.path);
        break;

    case VIR_DOMAIN_CHR_TYPE_PIPE:
        if ((virAsprintf(&out, "%s.out", dev->data.file.path) < 0) ||
            (virAsprintf(&in, "%s.in", dev->data.file.path) < 0)) {
            virReportOOMError();
            goto done;
        }
463 464 465
        if (virFileExists(in) && virFileExists(out)) {
            if ((virSecurityDACRestoreSecurityFileLabel(out) < 0) ||
                (virSecurityDACRestoreSecurityFileLabel(in) < 0)) {
466
            goto done;
467 468 469 470
            }
        } else if (virSecurityDACRestoreSecurityFileLabel(dev->data.file.path) < 0) {
            goto done;
        }
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
        ret = 0;
        break;

    default:
        ret = 0;
        break;
    }

done:
    VIR_FREE(in);
    VIR_FREE(out);
    return ret;
}


static int
virSecurityDACRestoreChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
                                     virDomainChrDefPtr dev,
                                     void *opaque)
{
    virSecurityManagerPtr mgr = opaque;

493
    return virSecurityDACRestoreChardevLabel(mgr, &dev->source);
494 495 496 497 498
}


static int
virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
499
                                      virDomainDefPtr def,
500 501 502 503 504 505 506 507 508 509 510
                                      int migrated)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    int i;
    int rc = 0;

    if (!priv->dynamicOwnership)
        return 0;


    VIR_DEBUG("Restoring security label on %s migrated=%d",
511
              def->name, migrated);
512

513
    for (i = 0 ; i < def->nhostdevs ; i++) {
514
        if (virSecurityDACRestoreSecurityHostdevLabel(mgr,
515 516
                                                      def,
                                                      def->hostdevs[i]) < 0)
517 518
            rc = -1;
    }
519
    for (i = 0 ; i < def->ndisks ; i++) {
520
        if (virSecurityDACRestoreSecurityImageLabelInt(mgr,
521 522
                                                       def,
                                                       def->disks[i],
523 524 525 526
                                                       migrated) < 0)
            rc = -1;
    }

527
    if (virDomainChrDefForeach(def,
528 529
                               false,
                               virSecurityDACRestoreChardevCallback,
530
                               mgr) < 0)
531 532
        rc = -1;

533 534
    if (def->os.kernel &&
        virSecurityDACRestoreSecurityFileLabel(def->os.kernel) < 0)
535 536
        rc = -1;

537 538
    if (def->os.initrd &&
        virSecurityDACRestoreSecurityFileLabel(def->os.initrd) < 0)
539 540 541 542 543 544 545 546 547 548 549 550 551
        rc = -1;

    return rc;
}


static int
virSecurityDACSetChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
                                 virDomainChrDefPtr dev,
                                 void *opaque)
{
    virSecurityManagerPtr mgr = opaque;

552
    return virSecurityDACSetChardevLabel(mgr, &dev->source);
553 554 555 556 557
}


static int
virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr,
558
                                  virDomainDefPtr def,
559 560 561 562 563 564 565 566
                                  const char *stdin_path ATTRIBUTE_UNUSED)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
    int i;

    if (!priv->dynamicOwnership)
        return 0;

567
    for (i = 0 ; i < def->ndisks ; i++) {
568
        /* XXX fixme - we need to recursively label the entire tree :-( */
569
        if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_DIR)
570 571
            continue;
        if (virSecurityDACSetSecurityImageLabel(mgr,
572 573
                                                def,
                                                def->disks[i]) < 0)
574 575
            return -1;
    }
576
    for (i = 0 ; i < def->nhostdevs ; i++) {
577
        if (virSecurityDACSetSecurityHostdevLabel(mgr,
578 579
                                                  def,
                                                  def->hostdevs[i]) < 0)
580 581 582
            return -1;
    }

583
    if (virDomainChrDefForeach(def,
584 585
                               true,
                               virSecurityDACSetChardevCallback,
586
                               mgr) < 0)
587 588
        return -1;

589 590
    if (def->os.kernel &&
        virSecurityDACSetOwnership(def->os.kernel,
591 592 593 594
                                    priv->user,
                                    priv->group) < 0)
        return -1;

595 596
    if (def->os.initrd &&
        virSecurityDACSetOwnership(def->os.initrd,
597 598 599 600 601 602 603 604 605 606
                                    priv->user,
                                    priv->group) < 0)
        return -1;

    return 0;
}


static int
virSecurityDACSetSavedStateLabel(virSecurityManagerPtr mgr,
607
                                 virDomainDefPtr def ATTRIBUTE_UNUSED,
608 609 610 611 612 613 614 615 616 617
                                 const char *savefile)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    return virSecurityDACSetOwnership(savefile, priv->user, priv->group);
}


static int
virSecurityDACRestoreSavedStateLabel(virSecurityManagerPtr mgr,
618
                                     virDomainDefPtr def ATTRIBUTE_UNUSED,
619 620 621 622 623 624 625 626 627 628 629 630 631
                                     const char *savefile)
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

    if (!priv->dynamicOwnership)
        return 0;

    return virSecurityDACRestoreSecurityFileLabel(savefile);
}


static int
virSecurityDACSetProcessLabel(virSecurityManagerPtr mgr,
632
                              virDomainDefPtr def ATTRIBUTE_UNUSED)
633 634 635
{
    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

636
    VIR_DEBUG("Dropping privileges of DEF to %u:%u",
637
              (unsigned int) priv->user, (unsigned int) priv->group);
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654

    if (virSetUIDGID(priv->user, priv->group) < 0)
        return -1;

    return 0;
}


static int
virSecurityDACVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
                     virDomainDefPtr def ATTRIBUTE_UNUSED)
{
    return 0;
}

static int
virSecurityDACGenLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
655
                       virDomainDefPtr def ATTRIBUTE_UNUSED)
656 657 658 659 660 661
{
    return 0;
}

static int
virSecurityDACReleaseLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
662
                           virDomainDefPtr def ATTRIBUTE_UNUSED)
663 664 665 666 667 668
{
    return 0;
}

static int
virSecurityDACReserveLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
669 670
                           virDomainDefPtr def ATTRIBUTE_UNUSED,
                           pid_t pid ATTRIBUTE_UNUSED)
671 672 673 674 675 676
{
    return 0;
}

static int
virSecurityDACGetProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
677 678
                              virDomainDefPtr def ATTRIBUTE_UNUSED,
                              pid_t pid ATTRIBUTE_UNUSED,
679 680 681 682 683 684
                              virSecurityLabelPtr seclabel ATTRIBUTE_UNUSED)
{
    return 0;
}

static int
685
virSecurityDACSetDaemonSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
686
                                   virDomainDefPtr vm ATTRIBUTE_UNUSED)
687 688 689 690 691
{
    return 0;
}


692 693
static int
virSecurityDACSetSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
694
                             virDomainDefPtr def ATTRIBUTE_UNUSED)
695 696 697 698 699
{
    return 0;
}


700 701
static int
virSecurityDACClearSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
702
                               virDomainDefPtr def ATTRIBUTE_UNUSED)
703 704 705 706
{
    return 0;
}

707
static int
708
virSecurityDACSetImageFDLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
709
                              virDomainDefPtr def ATTRIBUTE_UNUSED,
710
                              int fd ATTRIBUTE_UNUSED)
711 712 713 714
{
    return 0;
}

715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730
virSecurityDriver virSecurityDriverDAC = {
    sizeof(virSecurityDACData),
    "virDAC",

    virSecurityDACProbe,
    virSecurityDACOpen,
    virSecurityDACClose,

    virSecurityDACGetModel,
    virSecurityDACGetDOI,

    virSecurityDACVerify,

    virSecurityDACSetSecurityImageLabel,
    virSecurityDACRestoreSecurityImageLabel,

731
    virSecurityDACSetDaemonSocketLabel,
732
    virSecurityDACSetSocketLabel,
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
    virSecurityDACClearSocketLabel,

    virSecurityDACGenLabel,
    virSecurityDACReserveLabel,
    virSecurityDACReleaseLabel,

    virSecurityDACGetProcessLabel,
    virSecurityDACSetProcessLabel,

    virSecurityDACSetSecurityAllLabel,
    virSecurityDACRestoreSecurityAllLabel,

    virSecurityDACSetSecurityHostdevLabel,
    virSecurityDACRestoreSecurityHostdevLabel,

    virSecurityDACSetSavedStateLabel,
    virSecurityDACRestoreSavedStateLabel,
750

751
    virSecurityDACSetImageFDLabel,
752
};