search for: ssh_options_set

Displaying 9 results from an estimated 9 matches for "ssh_options_set".

2019 Sep 23
0
Re: [PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...at least 32 bits. Ergo, (uint32_t) timeout > LONG_MAX is always false. You could assert() rather than trying to use nbdkit_error(). > return -1; > } > } > @@ -403,9 +407,10 @@ ssh_open (int readonly) > } > } > if (timeout > 0) { > - r = ssh_options_set (h->session, SSH_OPTIONS_TIMEOUT, &timeout); > + long arg = timeout; > + r = ssh_options_set (h->session, SSH_OPTIONS_TIMEOUT, &arg); This conversion is correct. > +++ b/server/test-public.c > @@ -33,8 +33,11 @@ > #include <config.h> > > #include...
2019 Mar 06
0
[PATCH nbdkit] Add ssh plugin using libssh.
...calloc (1, sizeof *h); + if (h == NULL) { + nbdkit_error ("calloc: %m"); + return NULL; + } + + /* Set up the SSH session. */ + h->session = ssh_new (); + if (!h->session) { + nbdkit_error ("failed to initialize libssh session"); + goto err; + } + + r = ssh_options_set (h->session, SSH_OPTIONS_HOST, host); + if (r != SSH_OK) { + nbdkit_error ("failed to set host in libssh session: %s: %s", + host, ssh_get_error (h->session)); + goto err; + } + if (port != NULL) { + r = ssh_options_set (h->session, SSH_OPTIONS_PORT_S...
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
...solute_path */ - identity[nr_identities] = value; - nr_identities++; } else if (strcmp (key, "verify-remote-host") == 0) { @@ -410,11 +407,12 @@ ssh_open (int readonly) * as this file is rarely present. */ } - for (i = 0; i < nr_identities; ++i) { - r = ssh_options_set (h->session, SSH_OPTIONS_ADD_IDENTITY, identity[i]); + for (i = 0; i < identities.size; ++i) { + r = ssh_options_set (h->session, + SSH_OPTIONS_ADD_IDENTITY, identities.ptr[i]); if (r != SSH_OK) { nbdkit_error ("failed to add identity in libssh...
2019 Mar 06
2
[PATCH nbdkit] Add ssh plugin using libssh.
This adds a simple plugin using libssh (not libssh2). The intended use for this is with virt-v2v when sourcing guests from VMware over SSH. We've had several years of problems getting our libssh-based driver into qemu. By putting it into nbdkit instead we can bypass that. However this also lets us combine ssh access with filters, in particular the recently written ‘rate’ filter. Rich.
2019 Sep 23
2
[PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...return -1; + /* Because we have to cast it to long before calling the libssh API. */ + if (timeout > LONG_MAX) { + nbdkit_error ("timeout too large"); return -1; } } @@ -403,9 +407,10 @@ ssh_open (int readonly) } } if (timeout > 0) { - r = ssh_options_set (h->session, SSH_OPTIONS_TIMEOUT, &timeout); + long arg = timeout; + r = ssh_options_set (h->session, SSH_OPTIONS_TIMEOUT, &arg); if (r != SSH_OK) { - nbdkit_error ("failed to set timeout in libssh session: %ld: %s", + nbdkit_error ("failed to set t...
2019 Sep 23
2
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...etween 32- and 64-bit platforms, at > which point, it's often better to explicitly call out the intended size. So I'll say why I added these. It may not be a good reason, but here goes :-) There are two external APIs we use which need long types, libcurl (curl_easy_setopt) and libssh (ssh_options_set). The existing parameters had type long (I don't think unsigned long is actually used) which we passed directly to one of these APIs. To use another type would involve a slightly awkward check + cast, with the danger that the code would break on the rarely tested 32 bit platform. ... > &g...
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...tegers are indeed passed as 'long' and there may be ABIs where passing 'int' causes wrong behavior. Still, we could parse into an 'int' or 'unsigned', then assign that to yet another variable of type 'long', before passing the long to cur.. > and libssh (ssh_options_set). That one takes a void* which will be interpreted as 'long*', so again, we have to have the correct type in place. But again, we could parse into 'int' or 'unsigned', then copy to a 'long' prior to calling the API. > The existing > parameters had type long...
2019 Sep 21
2
[PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
sscanf is sadly not safe (because it doesn't handle integer overflow correctly), and strto*l functions are a pain to use correctly. Therefore add some functions to hide the pain of parsing integers from the command line. The simpler uses of sscanf and strto*l are replaced. There are still a few where we are using advanced features of sscanf. --- docs/nbdkit-plugin.pod | 48
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated! The basic purpose of the patch series is to set $nbdkit_stdio_safe to "0" or "1" in sh and eval plugin scripts. To do that, I ended up adding a nicer way to manipulate environ lists, and to do that, I ended up adding a whole generic vector implementation which is applicable in a lot of different places.