]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/portable/portabled-image-bus.h
Merge pull request #18481 from keszybz/rpm-restart-post-trans
[thirdparty/systemd.git] / src / portable / portabled-image-bus.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
f18edd8a 2#pragma once
61d0578b
LP
3
4#include "sd-bus.h"
5
57f1b61b 6#include "discover-image.h"
61d0578b
LP
7#include "portabled.h"
8
9int bus_image_common_get_os_release(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
10int bus_image_common_get_metadata(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
11int bus_image_common_attach(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
12int bus_image_common_remove(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
e26fe5f9 13int bus_image_common_reattach(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
61d0578b
LP
14int bus_image_common_mark_read_only(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
15int bus_image_common_set_limit(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
16
17extern const sd_bus_vtable image_vtable[];
18
19int bus_image_path(Image *image, char **ret);
20
21/* So here's some complexity: some of operations can either take an image name, or a fully qualified file system path
22 * to an image. We need to authenticate differently when processing these two: images referenced via simple image names
23 * mean the images are located in the image search path and thus safe for limited read access for unprivileged
24 * clients. For operations on images located anywhere else we need explicit authentication however, so that
25 * unprivileged clients can't make us open arbitrary files in the file system.
26 *
27 * The "Image" bus objects directly represent images in the image search path, but do not exist for path-referenced
28 * images. Hence, when requesting a bus object we need to refuse references by file system path, but still allow
29 * references by image name. Depending on the operation to execute potentially we need to authenticate in all cases. */
30
31typedef enum ImageAcquireMode {
32 BUS_IMAGE_REFUSE_BY_PATH, /* allow by name + prohibit by path */
33 BUS_IMAGE_AUTHENTICATE_BY_PATH, /* allow by name + polkit by path */
34 BUS_IMAGE_AUTHENTICATE_ALL, /* polkit by name + polkit by path */
35 _BUS_IMAGE_ACQUIRE_MODE_MAX,
2d93c20e 36 _BUS_IMAGE_ACQUIRE_MODE_INVALID = -EINVAL,
61d0578b
LP
37} ImageAcquireMode;
38
39int bus_image_acquire(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, ImageAcquireMode mode, const char *polkit_action, Image **ret, sd_bus_error *error);
40
41int bus_image_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
42int bus_image_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);