search for: unix_path_max

Displaying 20 results from an estimated 64 matches for "unix_path_max".

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_PATH_MAX, &quo...
2016 Jan 29
7
[PATCH 1/6] launch: unix: check for length of sockets
...++ 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, "connecting to %s", sockpath); -- 2.5.0
2016 Feb 02
6
[PATCH 1/3] launch: add internal helper for socket paths creation
..., int perdozen); extern char *guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev, int flags); #define APPLIANCE_COMMAND_LINE_IS_TCG 1 const char *guestfs_int_get_cpu_model (int kvm); +int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockname)[UNIX_PATH_MAX]); extern void guestfs_int_register_backend (const char *name, const struct backend_ops *); extern int guestfs_int_set_backend (guestfs_h *g, const char *method); diff --git a/src/launch-direct.c b/src/launch-direct.c index b8e453d..a81d4b3 100644 --- a/src/launch-direct.c +++ b/src/launch-dire...
2016 Feb 03
4
[PATCH v2 1/2] launch: add internal helper for socket paths creation
..., int perdozen); extern char *guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev, int flags); #define APPLIANCE_COMMAND_LINE_IS_TCG 1 const char *guestfs_int_get_cpu_model (int kvm); +int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockname)[UNIX_PATH_MAX]); extern void guestfs_int_register_backend (const char *name, const struct backend_ops *); extern int guestfs_int_set_backend (guestfs_h *g, const char *method); diff --git a/src/launch-direct.c b/src/launch-direct.c index b8e453d..a81d4b3 100644 --- a/src/launch-direct.c +++ b/src/launch-dire...
2016 Jan 29
1
Re: [PATCH 6/6] launch: avoid too long paths for sockets
On Fri, Jan 29, 2016 at 07:25:30PM +0100, Pino Toscano wrote: > The API for UNIX sockets limits the path to a static size (usually 104 > or 108 characters, NULL included), which is internally represented as > UNIX_PATH_MAX. If the temporary directory set is long enough (e.g. > when running tools as uninstalled, using "run") then these socket paths > get trucated, if not even cause failures when binding the sockets. > > Introduce a new internal API to create paths for sockets, and a new > he...
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: > > > &g...
2016 Jan 29
0
[PATCH 6/6] launch: avoid too long paths for sockets
The API for UNIX sockets limits the path to a static size (usually 104 or 108 characters, NULL included), which is internally represented as UNIX_PATH_MAX. If the temporary directory set is long enough (e.g. when running tools as uninstalled, using "run") then these socket paths get trucated, if not even cause failures when binding the sockets. Introduce a new internal API to create paths for sockets, and a new helper path where store the...
2016 Feb 02
0
Re: [PATCH 1/3] launch: add internal helper for socket paths creation
...; extern char *guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev, int flags); > #define APPLIANCE_COMMAND_LINE_IS_TCG 1 > const char *guestfs_int_get_cpu_model (int kvm); > +int guestfs_int_create_socketname (guestfs_h *g, const char *filename, char (*sockname)[UNIX_PATH_MAX]); I'm sure I read a rant from Linus about how this doesn't actually enforce the array length. However I have tested it, and gcc warns if I pass the wrong array length, so this looks OK. > extern void guestfs_int_register_backend (const char *name, const struct backend_ops *); >...
2019 Nov 27
5
[v2v PATCH v2 0/5] Various build cleanups
Brought to you by the "I haven't rebuilt the libguestfs universe in a while" saga -- now with working test suite. Pino Toscano (5): build: remove extra gnulib submodule build: remove extra checks and submodules build: stop using gnulib in test-harness build: remove unused gnulib modules Remove extra entries from podfiles .gitmodules | 3 -- Makefile.am
2019 Nov 27
6
[v2v PATCH 0/5] Various build cleanups
Brought to you by the "I haven't rebuilt the libguestfs universe in a while" saga. Pino Toscano (5): build: remove extra gnulib submodule build: remove extra checks and submodules build: stop using gnulib in test-harness build: remove unused gnulib modules Remove extra entries from podfiles .gitmodules | 3 -- Makefile.am | 2 - bootstrap
2016 Feb 02
0
[PATCH 3/3] New API: get-sockdir
...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; + } - snprintf...
2016 Feb 03
0
[PATCH v2 2/2] New API: get-sockdir
...->int_cachedir); free (g->last_error); diff --git a/src/launch.c b/src/launch.c index 60f02a7..9273c58 100644 --- a/src/launch.c +++ b/src/launch.c @@ -425,12 +425,15 @@ 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); + if (guestfs_int_lazy_make_sockdir (g) == -1) + return -1; + + if (strlen (g->sockdir) + 1 + strlen (filename) > UNIX_PAT...
2014 Nov 04
13
[PATCH 0/9] Small bits of non-Linux porting - #2
...making it easier to build and run libguestfs (in fixed appliance mode) on OSes different than Linux. The provided changes should cause no functional changes on Linux. [1] https://www.redhat.com/archives/libguestfs/2014-October/msg00176.html Thanks, -- Pino Pino Toscano (9): build: check for UNIX_PATH_MAX, and properly define it if not src: launch: cast the sockaddr args to sockaddr* build: check for libintl, and use it builder: fix inclusion of <config.h> in lex-generated source build: isolate the libdb tools search in an own autoconf macro test-charset-fidelity: use and link agains...
2012 Sep 16
3
Remaining syntax-check errors in libguestfs
...; daemon/inotify.c:310: char buf[PATH_MAX]; > daemon/link.c:38: char link[PATH_MAX]; > daemon/link.c:63: char link[PATH_MAX]; > daemon/realpath.c:86: char ret[PATH_MAX+1] = "/"; > daemon/xattr.c:272: char pathname[PATH_MAX]; > src/launch-appliance.c:179: addr.sun_path[UNIX_PATH_MAX-1] = '\0'; > src/launch-libvirt.c:200: addr.sun_path[UNIX_PATH_MAX-1] = '\0'; > src/launch-libvirt.c:224: addr.sun_path[UNIX_PATH_MAX-1] = '\0'; > src/launch-unix.c:64: addr.sun_path[UNIX_PATH_MAX-1] = '\0'; > maint.mk: Avoid stack allocations of size...
2014 Nov 11
1
[PATCH] use pkg-config to look up ncurses
...\ -pthread -lpthread \ - -ltinfo -lcrypt + $(LIBCURSES_LIBS) -lcrypt if HAVE_OCAMLOPT virt-builder: $(OBJECTS) diff --git a/configure.ac b/configure.ac index a571de5..1c38084 100644 --- a/configure.ac +++ b/configure.ac @@ -352,19 +352,13 @@ struct sockaddr_un myaddr; AC_DEFINE_UNQUOTED([UNIX_PATH_MAX], $unix_path_max, [Custom value for UNIX_PATH_MAX]) ]) -dnl tgetent, tputs and UP [sic] are all required. They come from libtinfo -dnl which is pulled in as a dependency of libncurses. -old_LIBS="$LIBS" -AC_CHECK_LIB([tinfo], [tgetent], [], [ - AC_MSG_ERROR(['libtinfo' li...
2014 Mar 06
2
[RFC] Add hash token to ControlPath
Hi. Last night on an irc openssh channel, a user brought up a use case involving cluster trees and very descriptive (i.e. long) hierarchical hostnames. To make a long story short, his ControlPath (~/.ssh/control-master /%r@%h:%p) was bumping up against UNIX_PATH_MAX. Attached patch adds a new percent-token (%H) that expands to the sha1 digest of the concatenation of host (%h) + port (%p) + remote user (%r). The token's expanded length is a fixed 40 characters and, barring digest collision, provides uniqueness. The patch was built against 6.5p1 but applie...
2015 Jun 25
0
[PATCH v2 4/9] daemon: Add -l / --listen flag.
...(channel); + exit (EXIT_FAILURE); + } + } + else { + struct sockaddr_un addr; + + sock = socket (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); + if (sock == -1) + error (EXIT_FAILURE, errno, "socket"); + addr.sun_family = AF_UNIX; + strncpy (addr.sun_path, channel, UNIX_PATH_MAX); + addr.sun_path[UNIX_PATH_MAX-1] = '\0'; + + if (bind (sock, (struct sockaddr *) &addr, sizeof addr) == -1) + error (EXIT_FAILURE, errno, "bind: %s", channel); + + if (listen (sock, 4) == -1) + error (EXIT_FAILURE, errno, "listen"); + + sock =...
2020 Jan 16
7
[PATCH 0/4] Use libvirt firmware autoselection
Starting with 5.2.0, libvirt has a way to select the firmware by specifying its type, provided configuration files for the firmware are shipped. Currently we start the appliance as UEFI if any of the firmware are found, so instead we can try to just set the firmware type iff: - the libvirt autoselection works - the 'efi' firmware is available The only behaviour change is that the default
2017 Mar 01
2
[PATCH libguestfs] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
...-git a/m4/guestfs_libraries.m4 b/m4/guestfs_libraries.m4 index 0882d27..c265b29 100644 --- a/m4/guestfs_libraries.m4 +++ b/m4/guestfs_libraries.m4 @@ -82,6 +82,9 @@ AC_CHECK_FUNCS([\ statvfs \ sync]) +dnl Which header file defines major, minor, makedev. +AC_HEADER_MAJOR + dnl Check for UNIX_PATH_MAX, creating a custom one if not available. AC_MSG_CHECKING([for UNIX_PATH_MAX]) AC_COMPILE_IFELSE([ diff --git a/mllib/unix_utils-c.c b/mllib/unix_utils-c.c index 1a4c3d7..f5aaaf6 100644 --- a/mllib/unix_utils-c.c +++ b/mllib/unix_utils-c.c @@ -27,9 +27,15 @@ #include <fnmatch.h> #include &...
2019 May 24
3
[PATCH 0/2] libvirt: fix check of custom QEMU
In case you configure libguestfs with a custom QEMU, e.g.: $ ./configure [...] QEMU=/path/to/qemu then the libvirt backend did not use to override it, launching the appliance with the default QEMU for libvirt. This does not change the manual emulator overriding using set-hv. Pino Toscano (2): launch: libvirt: get default QEMU from domcapabilities launch: libvirt: fix custom hypervisor