Displaying 3 results from an estimated 3 matches for "ssh_options_timeout".
2019 Sep 23
0
Re: [PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...2_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 <stdio.h>
> -#include <...
2019 Sep 23
2
[PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...e 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 timeout in libssh session: %" PR...
2019 Sep 23
2
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
On Mon, Sep 23, 2019 at 12:05:11PM -0500, Eric Blake wrote:
> > + int nbdkit_parse_long (const char *what, const char *str, long *r);
> > + int nbdkit_parse_unsigned_long (const char *what,
> > + const char *str, unsigned long *r);
>
> Do we really want to encourage the use of parse_long and
> parse_unsigned_long? Those differ between