From: Serge Hallyn Date: Sat, 25 Jan 2014 22:28:24 +0000 (-0600) Subject: lxcapi_clone: exit early on snapshot clones X-Git-Tag: lxc-1.0.0.beta3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bc8db6b2f1c8ea34d62f29313187cad197daa6b;p=thirdparty%2Flxc.git lxcapi_clone: exit early on snapshot clones If the user explicitly asks for a snapshot clone (in which case maybe_snap is not set), we cannot abide this currently. Rather than exit later with more cryptic error messages, exit out early. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index 2c3388f59..09b7ca73d 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -2101,6 +2101,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, /* check for privilege */ if (am_unpriv()) { + if (snap && !maybe_snap) { + ERROR("Unprivileged users cannot snapshot"); + bdev_put(orig); + return NULL; + } if (bdevtype && strcmp(bdevtype, "dir") != 0) { ERROR("Unprivileged users can only make dir copy-clones"); bdev_put(orig);