diff options
author | Jason King <[email protected]> | 2020-04-28 12:55:18 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-28 10:55:18 -0700 |
commit | c14ca1456e6e7b2fdfd7578207c7f1866c852a77 (patch) | |
tree | 4f27b9c4b81a394405a08665b4745bff9c572880 /include/libzfs_impl.h | |
parent | 89a6610ed053359d2299715e519d06d2ca5c053f (diff) |
Support custom URI schemes for the keylocation property
Every platform has their own preferred methods for implementing URI
schemes beyond the currently supported file scheme (e.g. 'https' on
FreeBSD would likely use libfetch, while Linux distros and illumos
would probably use libcurl, etc). It would be helpful if libzfs can
be extended to support additional schemes in a simple manner.
A table of (scheme, handler_function) pairs is added to libzfs_crypto.c,
and the existing functions in libzfs_crypto.c so that when the key
format is ZFS_KEYFORMAT_URI, the scheme from the URI string is
extracted, and a matching handler it located in the aforementioned
table (returning an error if no matching handler is found). The handler
function is then invoked to retrieve the key material (in the format
specified by the keyformat property) and the key is loaded or the
handler can return an error to abort the key loading process.
Reviewed by: Sean Eric Fagan <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Jason King <[email protected]>
Closes #10218
Diffstat (limited to 'include/libzfs_impl.h')
-rw-r--r-- | include/libzfs_impl.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h index 5cec62913..be11b1fc0 100644 --- a/include/libzfs_impl.h +++ b/include/libzfs_impl.h @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2020 by Delphix. All rights reserved. * Copyright (c) 2018 Datto Inc. + * Copyright 2020 Joyent, Inc. */ #ifndef _LIBZFS_IMPL_H @@ -33,6 +34,7 @@ #include <sys/nvpair.h> #include <sys/dmu.h> #include <sys/zfs_ioctl.h> +#include <regex.h> #include <libuutil.h> #include <libzfs.h> @@ -71,6 +73,7 @@ struct libzfs_handle { int libzfs_pool_iter; char libzfs_chassis_id[256]; boolean_t libzfs_prop_debug; + regex_t libzfs_urire; }; #define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */ @@ -124,6 +127,14 @@ typedef enum { SHARED_SMB = 0x4 } zfs_share_type_t; +typedef int (*zfs_uri_handler_fn_t)(struct libzfs_handle *, const char *, + const char *, zfs_keyformat_t, boolean_t, uint8_t **, size_t *); + +typedef struct zfs_uri_handler { + const char *zuh_scheme; + zfs_uri_handler_fn_t zuh_handler; +} zfs_uri_handler_t; + #define CONFIG_BUF_MINSIZE 262144 int zfs_error(libzfs_handle_t *, int, const char *); |