search for: sockpath

Displaying 20 results from an estimated 48 matches for "sockpath".

2016 Feb 03
3
Re: [PATCH 1/3] launch: add internal helper for socket paths creation
...> > #endif > > } > > > > +/* Create the path for a socket with the selected filename in the > > + * tmpdir. > > + */ > > +int > > +guestfs_int_create_socketname (guestfs_h *g, const char *filename, > > + char (*sockpath)[UNIX_PATH_MAX]) > > +{ > > + char *path = g->tmpdir; > > + > > + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); > > + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; > > What's wrong with: > > snprintf (*sockpath, UNIX...
2010 Jul 05
5
[PATCH 0/3] RFC: Allow use of external QEMU process with libguestfs
...i=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_vmchannel=tcp:169.254.2.4:6666 TERM=xterm' -kernel /tmp/libguestfsqJB1iN/kernel -initrd /tmp/libguestfsqJB1iN/initrd 3. Tell guestfish to connect to this instance ><fs> launch-method attach ><fs> sockpath /tmp/guest/sock ><fs> launch The temporary kernel/initrd from 'find-appliance' will be automatically deleted when the guestfs handle is closed. Instead of using 'find-appliance' an app can manually invoke the febootstrap-supermin-helper to build the initrd/kernel but...
2023 Mar 23
1
[libnbd PATCH v3 07/19] socket activation: replace execvp() call with fork-safe variant
...or/states-connect-socket-activation.c +++ b/generator/states-connect-socket-activation.c @@ -94,22 +94,23 @@ prepare_socket_activation_environment (string_vector *env) string_vector_empty (env); return -1; } STATE_MACHINE { CONNECT_SA.START: enum state next; char *tmpdir; char *sockpath; int s; struct sockaddr_un addr; + struct execvpe execvpe_ctx; string_vector env; pid_t pid; assert (!h->sock); assert (h->argv.ptr); assert (h->argv.ptr[0]); next = %.DEAD; /* Use /tmp instead of TMPDIR because we must ensure the path is * short enoug...
2016 Feb 02
6
[PATCH 1/3] launch: add internal helper for socket paths creation
...a/src/launch.c +++ b/src/launch.c @@ -418,6 +418,21 @@ guestfs_int_get_cpu_model (int kvm) #endif } +/* Create the path for a socket with the selected filename in the + * tmpdir. + */ +int +guestfs_int_create_socketname (guestfs_h *g, const char *filename, + char (*sockpath)[UNIX_PATH_MAX]) +{ + char *path = g->tmpdir; + + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; + + return 0; +} + /* glibc documents, but does not actually implement, a 'getumask(3)' * call. This implemen...
2017 Nov 20
3
[nbdkit PATCH 0/2] Add nbd forwarder test coverage
To avoid bitrot, any new feature needs testsuite coverage ;) Still to come: once I get my work on parallel nbd finished, I will add a test-parallel-nbd.sh that closely mirrors what my other series added in test-parallel-file.sh. If desired, it might be a fun exercise to tweak test-nbd into using a for-loop of user-controlled depth for how deep you want to nest the forwarding tree, to see where
2016 Feb 03
0
Re: [PATCH 1/3] launch: add internal helper for socket paths creation
...; > > > > > +/* Create the path for a socket with the selected filename in the > > > + * tmpdir. > > > + */ > > > +int > > > +guestfs_int_create_socketname (guestfs_h *g, const char *filename, > > > + char (*sockpath)[UNIX_PATH_MAX]) > > > +{ > > > + char *path = g->tmpdir; > > > + > > > + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); > > > + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; > > > > What's wrong with: &gt...
2019 Oct 04
4
[PATCH libnbd 1/4] generator: Allow long ‘name - shortdesc’ in man pages.
For commands with long names and/or short descriptors, you can end up going over 72 characters in the first line of the man page (causing podwrapper to complain). Wrap these lines. --- generator/generator | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generator/generator b/generator/generator index 7d3f656..ad1cb6b 100755 --- a/generator/generator +++ b/generator/generator
2016 Feb 02
0
Re: [PATCH 1/3] launch: add internal helper for socket paths creation
...418,21 @@ guestfs_int_get_cpu_model (int kvm) > #endif > } > > +/* Create the path for a socket with the selected filename in the > + * tmpdir. > + */ > +int > +guestfs_int_create_socketname (guestfs_h *g, const char *filename, > + char (*sockpath)[UNIX_PATH_MAX]) > +{ > + char *path = g->tmpdir; > + > + snprintf (*sockpath, UNIX_PATH_MAX-1, "%s/%s", path, filename); > + (*sockpath)[UNIX_PATH_MAX-1] = '\0'; What's wrong with: snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", path, filename)...
2016 Jan 29
7
[PATCH 1/6] launch: unix: check for length of sockets
...l not be able to connect to it. --- src/launch-unix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/launch-unix.c b/src/launch-unix.c index 740c554..973e14b 100644 --- a/src/launch-unix.c +++ b/src/launch-unix.c @@ -47,6 +47,12 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath) return -1; } + if (strlen (sockpath) > UNIX_PATH_MAX-1) { + error (g, _("socket filename too long (more than %d characters): %s"), + UNIX_PATH_MAX-1, sockpath); + return -1; + } + if (g->verbose) guestfs_int_print_timestamped_message (g, "co...
2017 Jan 31
0
[PATCH nbdkit] Add support for socket activation.
...gin.so" + +/* Declare program_name. */ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 +#include <errno.h> +#define program_name program_invocation_short_name +#else +#define program_name "nbdkit" +#endif + +static char tmpdir[] = "/tmp/nbdkitXXXXXX"; +static char sockpath[] = "/tmp/nbdkitXXXXXX/sock"; +static char pidpath[] = "/tmp/nbdkitXXXXXX/pid"; + +static pid_t pid = 0; + +static void +cleanup (void) +{ + if (pid > 0) + kill (pid, SIGTERM); + + unlink (pidpath); + unlink (sockpath); + rmdir (tmpdir); +} + +int +main (int argc, cha...
2023 Mar 28
1
[libnbd PATCH v5 3/4] generator: Add APIs to get/set the socket activation socket name
...496-4-rjones at redhat.com>). > > - I've renamed "sa_name" to "sact_name", due to <signal.h> reserving > symbols with the "sa_" prefix. This corresponds to earlier patches in > this series, such as 'socket activation: rename sa_(tmpdir|sockpath) to > sact_(tmpdir|sockpath)' and 'ocaml: rename "sa_u" to "saddr_u"'. > > - Restricted "set_socket_activation_name" to the "Created" state, per > Eric's recommendation > <http://mid.mail-archive.com/n6lzl7ii5m4hu77n7r...
2023 Mar 28
1
[libnbd PATCH v5 3/4] generator: Add APIs to get/set the socket activation socket name
...redhat.com>). >> >> - I've renamed "sa_name" to "sact_name", due to <signal.h> reserving >> symbols with the "sa_" prefix. This corresponds to earlier patches in >> this series, such as 'socket activation: rename sa_(tmpdir|sockpath) to >> sact_(tmpdir|sockpath)' and 'ocaml: rename "sa_u" to "saddr_u"'. >> >> - Restricted "set_socket_activation_name" to the "Created" state, per >> Eric's recommendation >> <http://mid.mail-archive.com...
2016 Feb 03
4
[PATCH v2 1/2] launch: add internal helper for socket paths creation
...a/src/launch.c +++ b/src/launch.c @@ -418,6 +418,23 @@ guestfs_int_get_cpu_model (int kvm) #endif } +/* Create the path for a socket with the selected filename in the + * tmpdir. + */ +int +guestfs_int_create_socketname (guestfs_h *g, const char *filename, + char (*sockpath)[UNIX_PATH_MAX]) +{ + if (strlen (g->tmpdir) + 1 + strlen (filename) > UNIX_PATH_MAX-1) { + error (g, _("socket path too long: %s/%s"), g->tmpdir, filename); + return -1; + } + + snprintf (*sockpath, UNIX_PATH_MAX, "%s/%s", g->tmpdir, filename); + + return...
2023 Mar 23
20
[libnbd PATCH v3 00/19] pass LISTEN_FDNAMES with systemd socket activation
V3 was here: <http://mid.mail-archive.com/20230215141158.2426855-1-lersek at redhat.com>. See the Notes section on each patch for the v4 updates. The series is nearly ready for merging: every patch has at least one R-b tag, except "socket activation: avoid manipulating the sign bit". The series builds, and passes "make check" and "make check-valgrind", at
2016 Feb 02
0
[PATCH 3/3] New API: get-sockdir
...free (g->int_cachedir); free (g->last_error); diff --git a/src/launch.c b/src/launch.c index ec061e3..e6972d1 100644 --- a/src/launch.c +++ b/src/launch.c @@ -425,9 +425,15 @@ int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockpath)[UNIX_PATH_MAX]) { - char *path = g->tmpdir; + if (guestfs_int_lazy_make_sockdir (g) == -1) + return -1; + + if (strlen (g->sockdir) + 1 + strlen (filename) > UNIX_PATH_MAX-1) { + error (g, _("socket path too long: %s/%s"), g->sockdir, filename); + return -1; + }...
2016 Mar 22
0
[PATCH v3 09/11] launch: Remove guestfs_int_print_timestamped_message function.
...y strange situations, such as * guestfsd starts up OK but then vmlinux immediately exits. Check diff --git a/src/launch-unix.c b/src/launch-unix.c index 973e14b..212de69 100644 --- a/src/launch-unix.c +++ b/src/launch-unix.c @@ -53,8 +53,7 @@ launch_unix (guestfs_h *g, void *datav, const char *sockpath) return -1; } - if (g->verbose) - guestfs_int_print_timestamped_message (g, "connecting to %s", sockpath); + debug (g, "connecting to %s", sockpath); daemon_sock = socket (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); if (daemon_sock == -1) { @@ -90,8 +89,7 @@...
2023 Mar 23
1
[libnbd PATCH v3 18/19] generator: Add APIs to get/set the socket activation socket name
...edhat.com/archives/libguestfs/2023-January/030557.html>. I've renamed "sa_name" to "sact_name", due to <signal.h> reserving symbols with the "sa_" prefix. This corresponds to earlier patches in this series, such as 'socket activation: rename sa_(tmpdir|sockpath) to sact_(tmpdir|sockpath)' and 'ocaml: rename "sa_u" to "saddr_u"'.] Message-Id: <20230130225521.1771496-4-rjones at redhat.com> Signed-off-by: Laszlo Ersek <lersek at redhat.com> Reviewed-by: Richard W.M. Jones <rjones at redhat.com> --- Notes:...
2023 Mar 25
1
[libnbd PATCH v5 3/4] generator: Add APIs to get/set the socket activation socket name
...;20230130225521.1771496-4-rjones at redhat.com>). - I've renamed "sa_name" to "sact_name", due to <signal.h> reserving symbols with the "sa_" prefix. This corresponds to earlier patches in this series, such as 'socket activation: rename sa_(tmpdir|sockpath) to sact_(tmpdir|sockpath)' and 'ocaml: rename "sa_u" to "saddr_u"'. - Restricted "set_socket_activation_name" to the "Created" state, per Eric's recommendation <http://mid.mail-archive.com/n6lzl7ii5m4hu77n7rrzm3uih3tnx457e4y67rghki3...
2009 Sep 11
1
[PATCH] guestfish: Redirect stdout when executing remote commands
.../rc.c b/fish/rc.c index 5423c22..5d64c70 100644 --- a/fish/rc.c +++ b/fish/rc.c @@ -27,6 +27,7 @@ #include <sys/types.h> #include <sys/un.h> #include <signal.h> +#include <sys/socket.h> #include <rpc/types.h> #include <rpc/xdr.h> @@ -49,6 +50,124 @@ create_sockpath (pid_t pid, char *sockpath, int len, struct sockaddr_un *addr) strcpy (addr->sun_path, sockpath); } +static const socklen_t controllen = CMSG_LEN (sizeof (int)); + +static void +receive_stdout (int s) +{ + static struct cmsghdr *cmptr = NULL, *h; + struct msghdr msg; + struct io...
2016 Jan 29
0
[PATCH 6/6] launch: avoid too long paths for sockets
...et_cpu_model (int kvm) #endif } +/* Create the path for a socket with the selected filename in the tmpdir, + * falling back to creating a separate sockdir and using that as base. + */ +int +guestfs_int_create_socketname (guestfs_h *g, const char *filename, + char (*sockpath)[UNIX_PATH_MAX]) +{ + char *path = g->tmpdir; + + /* Check whether the new socket can fit into tmpdir. */ + if (strlen (path) + 1 + strlen (filename) > UNIX_PATH_MAX-1) { + if (guestfs_int_lazy_make_sockdir (g) == -1) + return -1; + + path = g->sockdir; + + /* Safety check...