X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Flxc%2Flxccontainer.c;h=57a7adeced730cd4281a60ca2673a9a2940f53d8;hb=dfce2c76be55cd36c7e629b5d56b9b30c0a4301a;hp=253f07f68316f518e0a8b2381c0aef7627f028d4;hpb=85e02f56000be3bc41859a15ccac7c57c3baf92b;p=mirror_lxc.git diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 253f07f68..57a7adece 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -79,6 +79,10 @@ #include "utils.h" #include "version.h" +#if HAVE_OPENSSL +#include +#endif + /* major()/minor() */ #ifdef MAJOR_IN_MKDEV #include @@ -1300,6 +1304,7 @@ static struct lxc_storage *do_storage_create(struct lxc_container *c, if (!c->set_config_item(c, "lxc.rootfs.path", bdev->src)) { ERROR("Failed to set \"lxc.rootfs.path = %s\"", bdev->src); + storage_put(bdev); return NULL; } @@ -1654,9 +1659,9 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) char *contents; FILE *f; int ret = -1; -#if HAVE_LIBGNUTLS - int i; - unsigned char md_value[SHA_DIGEST_LENGTH]; +#if HAVE_OPENSSL + int i, md_len = 0; + unsigned char md_value[EVP_MAX_MD_SIZE]; char *tpath; #endif @@ -1697,14 +1702,14 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) if (ret < 0) goto out_free_contents; -#if HAVE_LIBGNUTLS +#if HAVE_OPENSSL tpath = get_template_path(t); if (!tpath) { ERROR("Invalid template \"%s\" specified", t); goto out_free_contents; } - ret = sha1sum_file(tpath, md_value); + ret = sha1sum_file(tpath, md_value, &md_len); if (ret < 0) { ERROR("Failed to get sha1sum of %s", tpath); free(tpath); @@ -1730,9 +1735,9 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) fprintf(f, "\n"); } -#if HAVE_LIBGNUTLS +#if HAVE_OPENSSL fprintf(f, "# Template script checksum (SHA-1): "); - for (i=0; ilxc_conf) return minus_one_set_errno(-EINVAL); - switch (cmd) { - case LXC_SECCOMP_NOTIFY_GET_FD: - if (fd) - return minus_one_set_errno(EINVAL); - - return lxc_seccomp_get_notify_fd(&c->lxc_conf->seccomp); - } - - return minus_one_set_errno(EINVAL); + return lxc_seccomp_get_notify_fd(&c->lxc_conf->seccomp); } -WRAP_API_2(int, lxcapi_seccomp_notify, unsigned int, int) +WRAP_API(int, lxcapi_seccomp_notify_fd) struct lxc_container *lxc_container_new(const char *name, const char *configpath) { @@ -5400,7 +5397,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath c->console_log = lxcapi_console_log; c->mount = lxcapi_mount; c->umount = lxcapi_umount; - c->seccomp_notify = lxcapi_seccomp_notify; + c->seccomp_notify_fd = lxcapi_seccomp_notify_fd; return c;