Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package seatd for openSUSE:Factory checked in at 2022-02-25 21:25:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/seatd (Old) and /work/SRC/openSUSE:Factory/.seatd.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "seatd" Fri Feb 25 21:25:20 2022 rev:8 rq:957630 version:0.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/seatd/seatd.changes 2021-12-07 00:01:01.900214395 +0100 +++ /work/SRC/openSUSE:Factory/.seatd.new.1958/seatd.changes 2022-02-25 21:25:56.203647571 +0100 @@ -1,0 +2,8 @@ +Fri Feb 25 16:15:51 UTC 2022 - Michael Vetter <[email protected]> + +- Update to 0.6.4 + * seatd-launch: Use snprintf for socket path + * seatd-launch: Remove socket path command line arg +- This updates fixes bsc#1196493 (CVE-2022-25643) + +------------------------------------------------------------------- Old: ---- seatd-0.6.2.obscpio seatd-0.6.3.obscpio New: ---- seatd-0.6.4.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ seatd.spec ++++++ --- /var/tmp/diff_new_pack.AUNhge/_old 2022-02-25 21:25:56.839647684 +0100 +++ /var/tmp/diff_new_pack.AUNhge/_new 2022-02-25 21:25:56.847647686 +0100 @@ -1,7 +1,7 @@ # # spec file for package seatd # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: seatd -Version: 0.6.3 +Version: 0.6.4 Release: 0 Summary: Seat management daemon License: MIT Group: System/Base URL: https://git.sr.ht/~kennylevinsen/seatd Source0: %{name}-%{version}.tar.gz -BuildRequires: meson +BuildRequires: meson >= 0.56.0 BuildRequires: ninja BuildRequires: pkgconfig BuildRequires: scdoc ++++++ _service ++++++ --- /var/tmp/diff_new_pack.AUNhge/_old 2022-02-25 21:25:56.871647690 +0100 +++ /var/tmp/diff_new_pack.AUNhge/_new 2022-02-25 21:25:56.875647690 +0100 @@ -3,7 +3,7 @@ <service name="obs_scm" mode="disabled"> <param name="url">https://git.sr.ht/~kennylevinsen/seatd</param> <param name="scm">git</param> - <param name="revision">0.6.3</param> + <param name="revision">0.6.4</param> <param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param> <param name="versionrewrite-pattern">(.*)\+0</param> <param name="versionrewrite-replacement">\1</param> ++++++ seatd-0.6.2.obscpio -> seatd-0.6.4.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.builds/alpine.yml new/seatd-0.6.4/.builds/alpine.yml --- old/seatd-0.6.2/.builds/alpine.yml 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.builds/alpine.yml 2022-02-21 22:52:04.000000000 +0100 @@ -20,9 +20,9 @@ ninja -C build scan-build [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ] - smoketest: | - timeout -s KILL 30s ./seatd/.builds/smoketest-seatd.sh + timeout -s KILL 30s sudo SEATD_LOGLEVEL=debug ./build/seatd-launch ./build/simpletest /dev/dri/card0 - smoketest-builtin: | - timeout -s KILL 30s ./seatd/.builds/smoketest-builtin.sh + timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/dri/card0 - check-format: | ninja -C build clang-format git -C seatd diff --exit-code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.builds/archlinux.yml new/seatd-0.6.4/.builds/archlinux.yml --- old/seatd-0.6.2/.builds/archlinux.yml 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.builds/archlinux.yml 2022-02-21 22:52:04.000000000 +0100 @@ -19,6 +19,12 @@ ninja -C build scan-build [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ] - smoketest: | - timeout -s KILL 30s ./seatd/.builds/smoketest-seatd.sh + timeout -s KILL 30s sudo SEATD_LOGLEVEL=debug ./build/seatd-launch ./build/simpletest /dev/input/event0 - smoketest-builtin: | - timeout -s KILL 30s ./seatd/.builds/smoketest-builtin.sh + timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/input/event0 + - smoketest-logind: | + # Turn off systemd-logind and patch our session to be tied to seat0 on VT 6 + sudo systemctl stop systemd-logind + echo -e "ACTIVE=$XDG_SESSION_ID\nACTIVE_UID=$UID\nSESSIONS=$XDG_SESSION_ID\nUIDS=$UID\n" | sudo tee -a /run/systemd/seats/seat0 > /dev/null + echo -e "SEAT=seat0\nVTNR=6\n" | sudo tee -a /run/systemd/sessions/$XDG_SESSION_ID > /dev/null + timeout -s KILL 30s sudo LIBSEAT_BACKEND=logind ./build/simpletest /dev/input/event0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.builds/freebsd.yml new/seatd-0.6.4/.builds/freebsd.yml --- old/seatd-0.6.2/.builds/freebsd.yml 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.builds/freebsd.yml 2022-02-21 22:52:04.000000000 +0100 @@ -15,6 +15,6 @@ meson -Db_lundef=false -Db_sanitize=address -Dlibseat-seatd=enabled -Dlibseat-builtin=enabled -Dexamples=enabled -Dlibseat-logind=disabled build seatd ninja -C build sudo ninja -C build install - timeout -s KILL 30s ./seatd/.builds/smoketest-seatd.sh + timeout -s KILL 30s sudo SEATD_LOGLEVEL=debug ./build/seatd-launch ./build/simpletest /dev/input/event0 - smoketest-builtin: | - timeout -s KILL 30s ./seatd/.builds/smoketest-builtin.sh + timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/input/event0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.builds/smoketest-builtin.sh new/seatd-0.6.4/.builds/smoketest-builtin.sh --- old/seatd-0.6.2/.builds/smoketest-builtin.sh 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.builds/smoketest-builtin.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -#!/bin/sh - -# Devices that exist on sr.ht -if [ -e "/dev/input/event0" ] -then - file="/dev/input/event0" -elif [ -e "/dev/dri/card0" ] -then - file="/dev/dri/card0" -else - echo "No useful device file found" - exit 1 -fi - -# -# Run simpletest a few times -# -cnt=0 -while [ "$cnt" -lt 2 ] -do - echo "Simpletest run $((cnt+1))" - if ! sudo LIBSEAT_BACKEND=builtin ./build/simpletest $file - then - echo "Simpletest failed" - exit $res - fi - cnt=$((cnt+1)) -done - -echo "smoketest-builtin completed" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.builds/smoketest-seatd.sh new/seatd-0.6.4/.builds/smoketest-seatd.sh --- old/seatd-0.6.2/.builds/smoketest-seatd.sh 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.builds/smoketest-seatd.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -#!/bin/sh - -# Devices that exist on sr.ht -if [ -e "/dev/input/event0" ] -then - file="/dev/input/event0" -elif [ -e "/dev/dri/card0" ] -then - file="/dev/dri/card0" -else - echo "No useful device file found" - exit 1 -fi - -export SEATD_LOGLEVEL=debug -# -# Run simpletest a few times -# -cnt=0 -while [ "$cnt" -lt 2 ] -do - echo "Simpletest run $((cnt+1))" - if ! sudo -E ./build/seatd-launch ./build/simpletest $file - then - echo "Simpletest failed" - exit 1 - fi - cnt=$((cnt+1)) -done - -echo "smoketest-seatd completed" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/.clang-format new/seatd-0.6.4/.clang-format --- old/seatd-0.6.2/.clang-format 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/.clang-format 2022-02-21 22:52:04.000000000 +0100 @@ -2,7 +2,7 @@ IndentWidth: 8 TabWidth: 8 ContinuationIndentWidth: 8 -UseTab: Always +UseTab: ForContinuationAndIndentation ColumnLimit: 100 AlignConsecutiveMacros: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/common/drm.c new/seatd-0.6.4/common/drm.c --- old/seatd-0.6.2/common/drm.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/common/drm.c 2022-02-21 22:52:04.000000000 +0100 @@ -9,8 +9,8 @@ #include "drm.h" // From libdrm -#define DRM_IOCTL_BASE 'd' -#define DRM_IO(nr) _IO(DRM_IOCTL_BASE, nr) +#define DRM_IOCTL_BASE 'd' +#define DRM_IO(nr) _IO(DRM_IOCTL_BASE, nr) #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/common/terminal.c new/seatd-0.6.4/common/terminal.c --- old/seatd-0.6.2/common/terminal.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/common/terminal.c 2022-02-21 22:52:04.000000000 +0100 @@ -13,14 +13,14 @@ #include <linux/vt.h> #define K_ENABLE K_UNICODE #define K_DISABLE K_OFF -#define FRSIG 0 +#define FRSIG 0 #elif defined(__FreeBSD__) #include <sys/consio.h> #include <sys/kbio.h> #include <termios.h> #define K_ENABLE K_XLATE #define K_DISABLE K_RAW -#define FRSIG SIGIO +#define FRSIG SIGIO #else #error Unsupported platform #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/examples/simpletest/main.c new/seatd-0.6.4/examples/simpletest/main.c --- old/seatd-0.6.2/examples/simpletest/main.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/examples/simpletest/main.c 2022-02-21 22:52:04.000000000 +0100 @@ -43,7 +43,11 @@ while (active == 0) { fprintf(stderr, "waiting for activation...\n"); - libseat_dispatch(backend, -1); + if (libseat_dispatch(backend, -1) == -1) { + libseat_close_seat(backend); + fprintf(stderr, "libseat_dispatch() failed: %s\n", strerror(errno)); + return -1; + } } fprintf(stderr, "active!\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/include/protocol.h new/seatd-0.6.4/include/protocol.h --- old/seatd-0.6.2/include/protocol.h 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/include/protocol.h 2022-02-21 22:52:04.000000000 +0100 @@ -1,10 +1,10 @@ #ifndef _SEATD_CONSTANTS_H #define _SEATD_CONSTANTS_H -#define MAX_PATH_LEN 256 -#define MAX_SEAT_LEN 64 +#define MAX_PATH_LEN 256 +#define MAX_SEAT_LEN 64 #define MAX_SEAT_DEVICES 128 -#define MAX_SESSION_LEN 64 +#define MAX_SESSION_LEN 64 #define CLIENT_EVENT(opcode) (opcode) #define SERVER_EVENT(opcode) ((opcode) + (1 << 15)) @@ -15,6 +15,7 @@ #define CLIENT_CLOSE_DEVICE CLIENT_EVENT(4) #define CLIENT_DISABLE_SEAT CLIENT_EVENT(5) #define CLIENT_SWITCH_SESSION CLIENT_EVENT(6) +#define CLIENT_PING CLIENT_EVENT(7) #define SERVER_SEAT_OPENED SERVER_EVENT(1) #define SERVER_SEAT_CLOSED SERVER_EVENT(2) @@ -22,7 +23,8 @@ #define SERVER_DEVICE_CLOSED SERVER_EVENT(4) #define SERVER_DISABLE_SEAT SERVER_EVENT(5) #define SERVER_ENABLE_SEAT SERVER_EVENT(6) -#define SERVER_ERROR SERVER_EVENT(0x7FFF) +#define SERVER_PONG SERVER_EVENT(7) +#define SERVER_ERROR SERVER_EVENT(0x7FFF) #include <stdint.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/libseat/backend/logind.c new/seatd-0.6.4/libseat/backend/logind.c --- old/seatd-0.6.2/libseat/backend/logind.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/libseat/backend/logind.c 2022-02-21 22:52:04.000000000 +0100 @@ -41,6 +41,7 @@ bool active; bool initial_setup; + bool awaiting_pong; int has_drm; }; @@ -67,6 +68,48 @@ return 0; } +static int ping_handler(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { + (void)ret_error; + struct backend_logind *session = userdata; + if (sd_bus_message_is_method_error(m, NULL)) { + const sd_bus_error *error = sd_bus_message_get_error(m); + log_errorf("Ping failed: %s: %s", error->name, error->message); + return -1; + } + session->awaiting_pong = false; + return 0; +} + +static int send_ping(struct backend_logind *backend) { + int ret = sd_bus_call_method_async(backend->bus, NULL, "org.freedesktop.login1", + "/org/freedesktop/login1", "org.freedesktop.DBus.Peer", + "Ping", ping_handler, backend, ""); + if (ret < 0) { + return ret; + } + return 0; +} + +static void check_pending_events(struct backend_logind *backend) { + if (sd_bus_get_events(backend->bus) <= 0) { + return; + } + if (backend->awaiting_pong) { + return; + } + + // We have events pending execution, so a dispatch is required. + // However, we likely already drained our socket, so there will not be + // anything to read. Instead, send a ping request to logind so that the + // user will be woken up by its response. + int ret = send_ping(backend); + if (ret < 0) { + log_errorf("Could not send ping message: %s", strerror(-ret)); + return; + } + backend->awaiting_pong = true; +} + static int open_device(struct libseat *base, const char *path, int *fd) { struct backend_logind *session = backend_logind_from_libseat_backend(base); @@ -113,9 +156,11 @@ } *fd = tmpfd; + out: sd_bus_error_free(&error); sd_bus_message_unref(msg); + check_pending_events(session); return tmpfd; } @@ -150,7 +195,7 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); - + check_pending_events(session); return ret < 0 ? -1 : 0; } @@ -173,6 +218,7 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); + check_pending_events(session); return ret < 0 ? -1 : 0; } @@ -253,10 +299,11 @@ return (struct backend_logind *)base; } -static bool session_activate(struct backend_logind *session) { +static int session_activate(struct backend_logind *session) { sd_bus_message *msg = NULL; sd_bus_error error = SD_BUS_ERROR_NULL; + // Note: the Activate call might not make the session active immediately int ret = sd_bus_call_method(session->bus, "org.freedesktop.login1", session->path, "org.freedesktop.login1.Session", "Activate", &error, &msg, ""); if (ret < 0) { @@ -265,10 +312,26 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); - return ret >= 0; + return ret; } -static bool take_control(struct backend_logind *session) { +static int session_check_active(struct backend_logind *session) { + sd_bus_error error = SD_BUS_ERROR_NULL; + int active = 0; + int ret = sd_bus_get_property_trivial(session->bus, "org.freedesktop.login1", session->path, + "org.freedesktop.login1.Session", "Active", &error, + 'b', &active); + if (ret < 0) { + log_errorf("Could not check if session is active: %s", error.message); + } else { + session->active = (bool)active; + } + + sd_bus_error_free(&error); + return ret; +} + +static int take_control(struct backend_logind *session) { sd_bus_message *msg = NULL; sd_bus_error error = SD_BUS_ERROR_NULL; @@ -281,7 +344,7 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); - return ret >= 0; + return ret; } static void release_control(struct backend_logind *session) { @@ -467,7 +530,7 @@ return 0; } -static bool add_signal_matches(struct backend_logind *backend) { +static int add_signal_matches(struct backend_logind *backend) { static const char *logind = "org.freedesktop.login1"; static const char *session_interface = "org.freedesktop.login1.Session"; static const char *property_interface = "org.freedesktop.DBus.Properties"; @@ -477,34 +540,34 @@ "PauseDevice", pause_device, backend); if (ret < 0) { log_errorf("Could not add D-Bus match: %s", strerror(-ret)); - return false; + return ret; } ret = sd_bus_match_signal(backend->bus, NULL, logind, backend->path, session_interface, "ResumeDevice", resume_device, backend); if (ret < 0) { log_errorf("Could not add D-Bus match: %s", strerror(-ret)); - return false; + return ret; } ret = sd_bus_match_signal(backend->bus, NULL, logind, backend->path, property_interface, "PropertiesChanged", properties_changed, backend); if (ret < 0) { log_errorf("Could not add D-Bus match: %s", strerror(-ret)); - return false; + return ret; } ret = sd_bus_match_signal(backend->bus, NULL, logind, backend->seat_path, property_interface, "PropertiesChanged", properties_changed, backend); if (ret < 0) { log_errorf("Could not add D-Bus match: %s", strerror(-ret)); - return false; + return ret; } - return true; + return 0; } -static bool find_session_path(struct backend_logind *session) { +static int find_session_path(struct backend_logind *session) { int ret; sd_bus_message *msg = NULL; sd_bus_error error = SD_BUS_ERROR_NULL; @@ -529,10 +592,10 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); - return ret >= 0; + return ret; } -static bool find_seat_path(struct backend_logind *session) { +static int find_seat_path(struct backend_logind *session) { int ret; sd_bus_message *msg = NULL; sd_bus_error error = SD_BUS_ERROR_NULL; @@ -557,10 +620,10 @@ sd_bus_error_free(&error); sd_bus_message_unref(msg); - return ret >= 0; + return ret; } -static bool get_display_session(char **session_id) { +static int get_display_session(char **session_id) { assert(session_id != NULL); char *xdg_session_id = getenv("XDG_SESSION_ID"); int ret; @@ -593,12 +656,12 @@ success: assert(*session_id != NULL); - return true; + return 0; error: free(*session_id); *session_id = NULL; - return false; + return ret; } static int set_type(struct backend_logind *backend, const char *type) { @@ -623,11 +686,13 @@ return NULL; } - if (!get_display_session(&backend->id)) { + int ret; + ret = get_display_session(&backend->id); + if (ret < 0) { goto error; } - int ret = sd_session_get_seat(backend->id, &backend->seat); + ret = sd_session_get_seat(backend->id, &backend->seat); if (ret < 0) { goto error; } @@ -637,23 +702,33 @@ goto error; } - if (!find_session_path(backend)) { + ret = find_session_path(backend); + if (ret < 0) { + goto error; + } + + ret = find_seat_path(backend); + if (ret < 0) { goto error; } - if (!find_seat_path(backend)) { + ret = add_signal_matches(backend); + if (ret < 0) { goto error; } - if (!add_signal_matches(backend)) { + ret = session_activate(backend); + if (ret < 0) { goto error; } - if (!session_activate(backend)) { + ret = session_check_active(backend); + if (ret < 0) { goto error; } - if (!take_control(backend)) { + ret = take_control(backend); + if (ret < 0) { goto error; } @@ -663,7 +738,6 @@ } backend->initial_setup = true; - backend->active = true; backend->seat_listener = listener; backend->seat_listener_data = data; backend->base.impl = &logind_impl; @@ -672,6 +746,7 @@ error: destroy(backend); + errno = -ret; return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/libseat/backend/seatd.c new/seatd-0.6.4/libseat/backend/seatd.c --- old/seatd-0.6.2/libseat/backend/seatd.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/libseat/backend/seatd.c 2022-02-21 22:52:04.000000000 +0100 @@ -36,6 +36,7 @@ const struct libseat_seat_listener *seat_listener; void *seat_listener_data; struct linked_list pending_events; + bool awaiting_pong; bool error; char seat_name[MAX_SEAT_LEN]; @@ -243,6 +244,12 @@ while (connection_get(&backend->connection, &header, sizeof header) != -1) { packets++; switch (header.opcode) { + case SERVER_PONG: + // We care about whether or not the answer has been + // read from the connection, so handle it here instead + // of pushing it to the pending event list. + backend->awaiting_pong = false; + break; case SERVER_DISABLE_SEAT: case SERVER_ENABLE_SEAT: if (queue_event(backend, header.opcode) == -1) { @@ -450,6 +457,36 @@ return backend->seat_name; } +static int send_ping(struct backend_seatd *backend) { + struct proto_header header = { + .opcode = CLIENT_PING, + .size = 0, + }; + if (conn_put(backend, &header, sizeof header) == -1 || conn_flush(backend) == -1) { + return -1; + } + return 0; +} + +static void check_pending_events(struct backend_seatd *backend) { + if (linked_list_empty(&backend->pending_events)) { + return; + } + if (backend->awaiting_pong) { + return; + } + + // We have events pending execution, so a dispatch is required. + // However, we likely already drained our socket, so there will not be + // anything to read. Instead, send a ping request to seatd, so that the + // user will be woken up by its response. + if (send_ping(backend) == -1) { + log_errorf("Could not send ping request: %s", strerror(errno)); + return; + } + backend->awaiting_pong = true; +} + static int open_device(struct libseat *base, const char *path, int *fd) { struct backend_seatd *backend = backend_seatd_from_libseat_backend(base); if (backend->error) { @@ -481,11 +518,11 @@ goto error; } - execute_events(backend); + check_pending_events(backend); return rmsg.device_id; error: - execute_events(backend); + check_pending_events(backend); return -1; } @@ -516,11 +553,11 @@ goto error; } - execute_events(backend); + check_pending_events(backend); return 0; error: - execute_events(backend); + check_pending_events(backend); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/meson.build new/seatd-0.6.4/meson.build --- old/seatd-0.6.2/meson.build 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/meson.build 2022-02-21 22:52:04.000000000 +0100 @@ -1,7 +1,7 @@ project( 'seatd', 'c', - version: '0.6.2', + version: '0.6.4', license: 'MIT', meson_version: '>=0.56.0', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/seatd/client.c new/seatd-0.6.4/seatd/client.c --- old/seatd-0.6.2/seatd/client.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/seatd/client.c 2022-02-21 22:52:04.000000000 +0100 @@ -309,6 +309,20 @@ return client_send_error(client, errno); } +static int handle_ping(struct client *client) { + struct proto_header header = { + .opcode = SERVER_PONG, + .size = 0, + }; + + if (connection_put(&client->connection, &header, sizeof header) == -1) { + log_errorf("Could not write response: %s", strerror(errno)); + return -1; + } + + return 0; +} + static int client_handle_opcode(struct client *client, uint16_t opcode, size_t size) { int res = 0; switch (opcode) { @@ -372,6 +386,14 @@ res = handle_disable_seat(client); break; } + case CLIENT_PING: { + if (size != 0) { + log_error("Protocol error: invalid ping message"); + return -1; + } + res = handle_ping(client); + break; + } default: log_errorf("Protocol error: unknown opcode: %d", opcode); res = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seatd-0.6.2/seatd-launch/seatd-launch.c new/seatd-0.6.4/seatd-launch/seatd-launch.c --- old/seatd-0.6.2/seatd-launch/seatd-launch.c 2021-09-16 01:07:42.000000000 +0200 +++ new/seatd-0.6.4/seatd-launch/seatd-launch.c 2022-02-21 22:52:04.000000000 +0100 @@ -15,18 +15,13 @@ const char *usage = "Usage: seatd-launch [options] [--] command\n" "\n" - " -h Show this help message\n" - " -s <path> Where to create the seatd socket\n" - " -v Show the version number\n" + " -h Show this help message\n" + " -v Show the version number\n" "\n"; int c; - char *sockpath = NULL; - while ((c = getopt(argc, argv, "vhs:")) != -1) { + while ((c = getopt(argc, argv, "vh")) != -1) { switch (c) { - case 's': - sockpath = optarg; - break; case 'v': printf("seatd-launch version %s\n", SEATD_VERSION); return 0; @@ -47,11 +42,8 @@ } char **command = &argv[optind]; - char sockbuf[256]; - if (sockpath == NULL) { - sprintf(sockbuf, "/tmp/seatd.%d.sock", getpid()); - sockpath = sockbuf; - } + char sockpath[32]; + snprintf(sockpath, sizeof sockpath, "/tmp/seatd.%d.sock", getpid()); unlink(sockpath); ++++++ seatd.obsinfo ++++++ --- /var/tmp/diff_new_pack.AUNhge/_old 2022-02-25 21:25:56.987647710 +0100 +++ /var/tmp/diff_new_pack.AUNhge/_new 2022-02-25 21:25:56.991647712 +0100 @@ -1,5 +1,6 @@ name: seatd -version: 0.6.3 -mtime: 1634672357 -commit: 88db55f6068c1c01d85b61aa6adff0a6b2a8dce8 +version: 0.6.4 +mtime: 1645480324 +commit: df13d03f9cfd0dc0c2b3298cd0e5eb4e4a10835e +
