]> git.corax.cc Git - toolbox/commitdiff
include/uipc: Adjust permissions to allow inter-user IPC
authorMatthias Kruk <m@m10k.eu>
Mon, 26 Dec 2022 05:10:04 +0000 (14:10 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 26 Dec 2022 05:10:04 +0000 (14:10 +0900)
Because the sgid bit is not set on the uipc directory, endpoints do
not inherit the group ownership from the parent directory. Thus,
endpoints are created with a user's primary group instead of the IPC
group, making inter-user IPC communication impossible.

This commit modifies the uipc module and the post-install script of
the debian package so that the sgid bit is set on the uipc directory
and endpoints are created with the correct permissions for uipc
communication between users.
This commit also modifies the Makefile so that the uipc directory is
created during toolbox installation.

Makefile
debian/postinst
include/uipc.sh

index a148562c1d62de7f34fec4234889180d1dff4e1a..1bff3bbc0ba750177beb352e5b52b45bb8ce1844 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ install:
        mkdir -p $(DESTDIR)/$(PREFIX)/share/toolbox
        mkdir -p $(DESTDIR)/$(PREFIX)/bin
        mkdir -p $(DESTDIR)/var/lib/toolbox/ipc
+       mkdir -p $(DESTDIR)/var/lib/toolbox/uipc
        cp toolbox.sh $(DESTDIR)/$(PREFIX)/share/toolbox/.
        cp -r include $(DESTDIR)/$(PREFIX)/share/toolbox/.
        cp -r utils   $(DESTDIR)/$(PREFIX)/share/toolbox/.
index 28fb0dd5bfe946a50a7e2a8fe50737fc58ff823e..70769582045664f5454e571dd1937f6a85a3af48 100755 (executable)
@@ -22,6 +22,10 @@ main() {
                if ! dpkg-statoverride --list /var/lib/toolbox/ipc >/dev/null 2>&1; then
                        dpkg-statoverride --update --add root toolbox_ipc 2770 /var/lib/toolbox/ipc
                fi
+
+               if ! dpkg-statoverride --list /var/lib/toolbox/uipc >/dev/null 2>&1; then
+                       dpkg-statoverride --update --add root toolbox_ipc 2770 /var/lib/toolbox/uipc
+               fi
        fi
 
        return 0
index 5cae4d45654056e52da646fc27dfd574c5894268..a2f2b75b5bcb8e5ecf892b05461c30f6fc96a968 100644 (file)
@@ -270,7 +270,8 @@ uipc_endpoint_open() {
                fi
 
                if ! queue_init "$endpoint/queue" ||
-                  ! echo "$USER" > "$endpoint/owner"; then
+                  ! echo "$USER" > "$endpoint/owner" ||
+                  ! chmod -R g+rwxs "$endpoint"; then
                        if ! rm -rf "$endpoint"; then
                                log_error "Could not clean up $endpoint"
                        fi