search for: is_config_key

Displaying 20 results from an estimated 21 matches for "is_config_key".

2018 Sep 08
0
[PATCH nbdkit v2 2/6] main: Tighten up characters permitted in config keys.
...--git a/src/main.c b/src/main.c index 9c18d6f..c523854 100644 --- a/src/main.c +++ b/src/main.c @@ -72,6 +72,7 @@ static void fork_into_background (void); static uid_t parseuser (const char *); static gid_t parsegroup (const char *); static unsigned int get_socket_activation (void); +static int is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ int exit_with_parent; /* --exit-with-parent */ @@ -694,7 +695,7 @@ main (int argc, char *argv[]) magic_config_key = backend->magic_config_key (backend); for (i = 0; optind < argc; ++i, ++optind) {...
2018 Sep 10
0
[PATCH nbdkit v3 2/6] main: Tighten up characters permitted in config keys.
...--git a/src/main.c b/src/main.c index 9c18d6f..f4a800f 100644 --- a/src/main.c +++ b/src/main.c @@ -72,6 +72,7 @@ static void fork_into_background (void); static uid_t parseuser (const char *); static gid_t parsegroup (const char *); static unsigned int get_socket_activation (void); +static int is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ int exit_with_parent; /* --exit-with-parent */ @@ -694,7 +695,7 @@ main (int argc, char *argv[]) magic_config_key = backend->magic_config_key (backend); for (i = 0; optind < argc; ++i, ++optind) {...
2020 Feb 18
4
[PATCH nbdkit 2/2] server: Avoid modifying argv by saving keys in a list and freeing on exit.
Unfortunately you cannot restore argv by setting *p = '=' :-( The reason is we advertize that plugins are allowed to save they ‘const char *key’ pointer passed to them in .config, but assigning *p = '=' changes the key string from "key" back to "key=value". Surprisingly only test-eval.sh actually broke, but other plugins are undoubtedly affected. My alternate
2018 Sep 08
1
Re: [PATCH nbdkit v2 2/6] main: Tighten up characters permitted in config keys.
...ct things to start with a letter or underscore (and not a dot, digit, or dash)? > --- > docs/nbdkit-plugin.pod | 18 ++++++++++-------- > src/main.c | 32 +++++++++++++++++++++++++++++++- > 2 files changed, 41 insertions(+), 9 deletions(-) > > +static int > +is_config_key (const char *key, size_t len) > +{ > + const char allowed[] = > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > + "0123456789" > + "._-"; > + size_t i; > + > + if (key[0] == '\0') > + r...
2019 Aug 27
1
[PATCH nbdkit] server: Try hard to maintain invariant that fds 0, 1 and 2 are always open.
...ULL; diff --git a/server/main.c b/server/main.c index 65025a6..65bef30 100644 --- a/server/main.c +++ b/server/main.c @@ -60,6 +60,7 @@ static struct backend *open_filter_so (struct backend *next, size_t i, const cha static void start_serving (void); static void write_pidfile (void); static bool is_config_key (const char *key, size_t len); +static void open_std_file_descriptors (void); struct debug_flag *debug_flags; /* -D */ bool exit_with_parent; /* --exit-with-parent */ @@ -149,6 +150,13 @@ main (int argc, char *argv[]) size_t i; const char *magic_config_key; + /* Ensures that f...
2018 Sep 10
1
Re: [PATCH nbdkit v3 2/6] main: Tighten up characters permitted in config keys.
...at the key is a simple alphanumeric with period, > + * underscore or dash. > + * > + * Note this doesn't return an error. If the key is not valid then we > + * return false and the parsing code will assume that this is a bare > + * value instead. > + */ > +static int > +is_config_key (const char *key, size_t len) > +{ > + static const char allowed_first[] = > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; > + static const char allowed[] = > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNO...
2018 Sep 10
7
[PATCH nbdkit v3 0/6] plugins: Implement magic config key.
v1: https://www.redhat.com/archives/libguestfs/2018-September/msg00024.html v2: https://www.redhat.com/archives/libguestfs/2018-September/msg00034.html v3: - Fixed is_config_key zero length test. - Fixed is_config_key so it uses strspn and is not O(n^2). - Changed >= 1.7 to >= 1.8 in the documentation. Rich.
2018 Sep 08
8
[PATCH nbdkit v2 0/6] plugins: Implement magic config key.
v1 was here: https://www.redhat.com/archives/libguestfs/2018-September/msg00024.html v2: - As discussed in the patch review, tighten up the characters permitted in keys. - Update documentation to note that relative paths can be made safe by prefixing with ./ and absolute paths do not need any extra steps. - I pushed patch 1/6 from the v1 series since it was just a trivial
2019 Mar 26
3
nbdkit design: varying the rate limit parameter
Hi Eric, We may have our first user (Tomas, CC'd) of the rate filter to limit NBD connections. As you recall it lets you do commands like: nbdkit --filter=rate memory size=64G rate=10M to limit network bandwidth to 10 Mbps. However a twist is that he needs to vary the parameter while nbdkit is running in response to a UI, and we haven't really thought about that before. In the
2020 Jul 22
2
[nbdkit PATCH] server: Reinstate limited use of -e/-exportname.
...', fp); /* Construct older $nbd "URL". Unfortunately guestfish and qemu take * different syntax, so try to guess which one we need. diff --git a/server/main.c b/server/main.c index d815fe12..2f0aaf07 100644 --- a/server/main.c +++ b/server/main.c @@ -79,6 +79,7 @@ static bool is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ bool exit_with_parent; /* --exit-with-parent */ +const char *export_name; /* -e */ bool foreground; /* -f */ const char *ipaddr; /* -i */ enum log_to log_to = LOG_TO_DEFAULT; /*...
2020 Aug 25
0
[nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...; - exit (EXIT_FAILURE); - } - magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { size_t n; @@ -647,12 +641,11 @@ main (int argc, char *argv[]) p = strchr (argv[optind], '='); n = p - argv[optind]; if (p && is_config_key (argv[optind], n)) { /* Is it key=value? */ - keys[optind] = strndup (argv[optind], n); - if (keys[optind] == NULL) { - perror ("strndup"); + CLEANUP_FREE char *key = strndup (argv[optind], n); + const char *safekey = nbdkit_string_intern (key); + if (safek...
2020 Aug 27
0
[nbdkit PATCH v2 4/8] api: Add nbdkit_str[n]dup_intern helper
...; - exit (EXIT_FAILURE); - } - magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { size_t n; @@ -647,12 +641,10 @@ main (int argc, char *argv[]) p = strchr (argv[optind], '='); n = p - argv[optind]; if (p && is_config_key (argv[optind], n)) { /* Is it key=value? */ - keys[optind] = strndup (argv[optind], n); - if (keys[optind] == NULL) { - perror ("strndup"); + const char *key = nbdkit_strndup_intern (argv[optind], n); + if (key == NULL) exit (EXIT_FAILURE); - } -...
2019 Jan 01
2
[PATCH nbdkit] server: Use bool for types which are really booleans.
...a/server/main.c +++ b/server/main.c @@ -35,6 +35,7 @@ #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <string.h> #include <fcntl.h> #include <unistd.h> @@ -75,26 +76,26 @@ static unsigned int get_socket_activation (void); static int is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ -int exit_with_parent; /* --exit-with-parent */ +bool exit_with_parent; /* --exit-with-parent */ const char *exportname; /* -e */ -int foreground; /* -f */ +bool foreground;...
2020 Jul 21
3
[PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
...p); - /* Construct older $nbd "URL". Unfortunately guestfish and qemu take * different syntax, so try to guess which one we need. */ diff --git a/server/main.c b/server/main.c index c432f5bd..d815fe12 100644 --- a/server/main.c +++ b/server/main.c @@ -79,7 +79,6 @@ static bool is_config_key (const char *key, size_t len); struct debug_flag *debug_flags; /* -D */ bool exit_with_parent; /* --exit-with-parent */ -const char *exportname; /* -e */ bool foreground; /* -f */ const char *ipaddr; /* -i */ enum log_to log_to = LOG_TO_DEFAULT; /*...
2020 Aug 15
3
[PATCH EXPERIMENTAL nbdkit 0/2] Port to Windows using mingw.
The patches following do indeed allow you to compile nbdkit.exe, but it does not actually work yet. I'm posting this experimental series more as a work in progress and to get feedback. Note this does not require Windows itself to build or test. You can cross-compile it using mingw64-* packages on Fedora or Debian, and test it [spoiler alert: it fails] using Wine. Rich.
2020 Feb 12
5
[PATCH nbdkit 1/3] server: Rename global backend pointer to "top".
...ript", and * any other bare parameters are errors. */ - magic_config_key = backend->magic_config_key (backend); + magic_config_key = top->magic_config_key (top); for (i = 0; optind < argc; ++i, ++optind) { p = strchr (argv[optind], '='); if (p && is_config_key (argv[optind], p - argv[optind])) { /* key=value */ *p = '\0'; - backend->config (backend, argv[optind], p+1); + top->config (top, argv[optind], p+1); } else if (magic_config_key == NULL) { if (i == 0) /* magic script parameter */ -...
2020 Aug 25
9
[nbdkit PATCH 0/5] Implement .default_export, nbdkit_string_intern
More patches on the way for improving .list_exports signature and adding .export_description, but this is the promised code showing why nbdkit_string_intern is useful. Patch 4 is somewhat RFC: we could either add new API to take the boilerplate from: foo_config(const char *key, const char *value) { if (strcmp (key, "file") == 0) { CLEANUP_FREE char *tmp = nbdkit_realpath (value);
2020 Aug 18
15
[PATCH nbdkit 0/9] Port to Windows.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw This is the port to Windows using native Windows APIs (not MSYS or Cygwin). This patch series is at the point where it basically now works. I can run the server with the memory plugin, and access it remotely using guestfish, creating filesystems and so on without any apparent problems. Nevertheless there are many
2019 Jan 14
6
[PATCH nbdkit incomplete 0/5] Port to Windows.
This is an incomplete port to Windows. Currently the server compiles and starts up successfully, but goes into an infinite loop when you connect to it. Nevertheless I think the approach is ready for feedback. This being Windows the changes go quite deep. Rich.
2020 Aug 20
15
[PATCH nbdkit 0/13] Port to Windows without using a separate library.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw-nolib After a lot of work I have made the port to Windows work without using a separate library. Instead, on Windows only, we build an "import library" (library of stubs) which resolves references to nbdkit_* functions in the main program and fixes up the plugin, basically the first technique outlined in