summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-02-29 10:35:26 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-29 10:43:02 -0500
commitfac201c52871b9fa4ec1c75c040243ff2563eb20 (patch)
treea57b3ebe85a9add1f67e1a974ba089d1f4c5b44b /src/bin/e_ipc.c
parentdc337120694b12cc39b2d3fc6dc53968b2ec7ef0 (diff)
simplify ipc socket creation
in trying to be extra secure here, a security hole is created due to time between mkdir and stat calls CID 1039781
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index 1ffb336..6058a3c 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -77,13 +77,7 @@ e_ipc_init(void)
77 { 77 {
78 snprintf(buf, sizeof(buf), "%s/e-%s@%x", 78 snprintf(buf, sizeof(buf), "%s/e-%s@%x",
79 base, user, id1); 79 base, user, id1);
80 if (mkdir(buf, S_IRWXU) < 0) 80 if (!mkdir(buf, S_IRWXU))
81 goto retry;
82 if (stat(buf, &st) < 0)
83 goto retry;
84 if ((st.st_uid == getuid()) &&
85 ((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
86 (S_IRWXU | S_IFDIR)))
87 { 81 {
88#ifdef USE_IPC 82#ifdef USE_IPC
89 snprintf(buf3, sizeof(buf3), "%s/%i", 83 snprintf(buf3, sizeof(buf3), "%s/%i",
@@ -97,7 +91,6 @@ e_ipc_init(void)
97 break; 91 break;
98 } 92 }
99 } 93 }
100retry:
101 id1 = rand(); 94 id1 = rand();
102 } 95 }
103#ifdef USE_IPC 96#ifdef USE_IPC