[PATCH v1 04/23] security_dac: Introduce remember/recall stubs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These stubs will be worked in later. They merely lay out the
structure of the feature.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/security/security_dac.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 9b079e0..9b53332 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -184,6 +184,51 @@ virSecurityDACGetImageIds(virSecurityLabelDefPtr seclabel,
     return 0;
 }
 
+/**
+ * virSecurityDACRememberLabel:
+ * @priv: driver's private data
+ * @path: path to the file
+ * @uid: user owning the @path
+ * @gid: group owning the @path
+ *
+ * Remember the owner of @path (represented by @uid:@gid).
+ *
+ * Returns: 0 on success, -1 on failure
+ */
+static int
+ATTRIBUTE_UNUSED
+virSecurityDACRememberLabel(virSecurityDACDataPtr priv ATTRIBUTE_UNUSED,
+                            const char *path ATTRIBUTE_UNUSED,
+                            uid_t uid ATTRIBUTE_UNUSED,
+                            gid_t gid ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+
+/**
+ * virSecurityDACRecallLabel:
+ * @priv: driver's private data
+ * @path: path to the file
+ * @uid: user owning the @path
+ * @gid: group owning the @path
+ *
+ * Recall the previously recorded owner for the @path. However, it may happen
+ * that @path is still in use (e.g. by another domain). In that case, 1 is
+ * returned and caller should not relabel the @path.
+ *
+ * Returns: 1 if @path is still in use (@uid and @gid not touched)
+ *          0 if @path should be restored (@uid and @gid set)
+ *         -1 on failure (@uid and @gid not touched)
+ */
+static int
+ATTRIBUTE_UNUSED
+virSecurityDACRecallLabel(virSecurityDACDataPtr priv ATTRIBUTE_UNUSED,
+                          const char *path ATTRIBUTE_UNUSED,
+                          uid_t *uid ATTRIBUTE_UNUSED,
+                          gid_t *gid ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
 
 static virSecurityDriverStatus
 virSecurityDACProbe(const char *virtDriver ATTRIBUTE_UNUSED)
-- 
2.4.9

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]