]> git.corax.cc Git - toolbox/commitdiff
include/uipc: Don't store private endpoints in per-user directories
authorMatthias Kruk <m@m10k.eu>
Tue, 27 Dec 2022 06:09:58 +0000 (15:09 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 27 Dec 2022 06:09:58 +0000 (15:09 +0900)
Private endpoints are stored in per-user directories that are created
when the uipc module is loaded. However, the mode and ownership that
the directory is created with may be incorrect, depending on the mode
of the parent directory.

This commit modifies the uipc module so that endpoints are not created
in per-user directories, and moves the necessary directory creation
code to the Makefile, where it will be executed during installation.

Makefile
include/uipc.sh

index d9b2b0595066f192efcf0fd7214237dc4303d306..92a0aae88dadd851806c57474c35778e9b79f80f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,9 @@ install:
        mkdir -p $(DESTDIR)/$(PREFIX)/share/toolbox
        mkdir -p $(DESTDIR)/$(PREFIX)/bin
        mkdir -p $(DESTDIR)/var/lib/toolbox/ipc/{pub,priv,pubsub}
-       mkdir -p $(DESTDIR)/var/lib/toolbox/uipc
+       mkdir -p $(DESTDIR)/var/lib/toolbox/uipc/{pub,priv,pubsub}
        chmod -R g+rwxs $(DESTDIR)/var/lib/toolbox/ipc
+       chmod -R g+rwxs $(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 ad9eb214d3ef504160205d42de6c3ace80f0903d..6ee8f8d14dc1a0a92b355de3cae5edf58dfd2247 100644 (file)
@@ -22,19 +22,10 @@ __init() {
        fi
 
        declare -gxr  __uipc_root="/var/lib/toolbox/uipc"
-       declare -gxr  __uipc_public="$__uipc_root/pub"
-       declare -gxr  __uipc_private="$__uipc_root/priv/$USER"
-       declare -gxr  __uipc_group="toolbox_ipc"
        declare -gxr  __uipc_pubsub_root="$__uipc_root/pubsub"
 
        declare -gxir __uipc_version=1
 
-       if ! mkdir -p "$__uipc_private" ||
-          ! chgrp "$__uipc_group" "$__uipc_private"; then
-               log_error "Could not initialize private UIPC directory $__uipc_private"
-               return 1
-       fi
-
        return 0
 }
 
@@ -259,7 +250,7 @@ uipc_endpoint_open() {
                local self
 
                self="${0##*/}"
-               name="priv/$USER/$self.$$.$(date +"%s").$RANDOM"
+               name="priv/$USER.$self.$$.$(date +"%s").$RANDOM"
        fi
 
        endpoint="$__uipc_root/$name"