jail: actually apply filesystem-specific mount options
authorDaniel Golle <daniel@makrotopia.org>
Sun, 19 Jul 2020 23:30:06 +0000 (00:30 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 20 Jul 2020 03:20:21 +0000 (04:20 +0100)
OCI supplied filesystems-specific mount options have not been stored
in the add_mount() function. strdup() them there and free the original
string in the OCI function.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/fs.c

index abe12d4e9810a0e8df7ab7de6645b5e90aeb9200..e510c8b0eccfad530e1ca821657607e3839f338b 100644 (file)
--- a/jail/fs.c
+++ b/jail/fs.c
@@ -170,6 +170,10 @@ int add_mount(const char *source, const char *target, const char *filesystemtype
        }
        if (filesystemtype)
                m->filesystemtype = strdup(filesystemtype);
+
+       if (optstr)
+               m->optstr = strdup(optstr);
+
        m->mountflags = mountflags;
        m->error = error;
 
@@ -350,10 +354,15 @@ int parseOCImount(struct blob_attr *msg)
                        return ret;
        }
 
-       return add_mount(tb[OCI_MOUNT_SOURCE] ? blobmsg_get_string(tb[OCI_MOUNT_SOURCE]) : NULL,
+       ret = add_mount(tb[OCI_MOUNT_SOURCE] ? blobmsg_get_string(tb[OCI_MOUNT_SOURCE]) : NULL,
                  blobmsg_get_string(tb[OCI_MOUNT_DESTINATION]),
                  tb[OCI_MOUNT_TYPE] ? blobmsg_get_string(tb[OCI_MOUNT_TYPE]) : NULL,
                  mount_flags, mount_data, err);
+
+       if (mount_data)
+               free(mount_data);
+
+       return ret;
 }
 
 static void build_noafile(void) {