You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by co...@apache.org on 2024/08/20 21:44:35 UTC

svn commit: r1920081 - /apr/apr/trunk/shmem/unix/shm.c

Author: covener
Date: Tue Aug 20 21:44:35 2024
New Revision: 1920081

URL: http://svn.apache.org/viewvc?rev=1920081&view=rev
Log:
use 0600 perms for named shared mem consistently

Modified:
    apr/apr/trunk/shmem/unix/shm.c

Modified: apr/apr/trunk/shmem/unix/shm.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/shmem/unix/shm.c?rev=1920081&r1=1920080&r2=1920081&view=diff
==============================================================================
--- apr/apr/trunk/shmem/unix/shm.c (original)
+++ apr/apr/trunk/shmem/unix/shm.c Tue Aug 20 21:44:35 2024
@@ -287,10 +287,9 @@ APR_DECLARE(apr_status_t) apr_shm_create
         status = APR_SUCCESS;
 
 #if APR_USE_SHMEM_MMAP_TMP
-        /* FIXME: Is APR_FPROT_OS_DEFAULT sufficient? */
         status = apr_file_open(&file, filename,
                                APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_EXCL,
-                               APR_FPROT_OS_DEFAULT, pool);
+                               APR_FPROT_UREAD | APR_FPROT_UWRITE, pool);
         if (status != APR_SUCCESS) {
             return status;
         }
@@ -319,8 +318,7 @@ APR_DECLARE(apr_status_t) apr_shm_create
         }
 #endif /* APR_USE_SHMEM_MMAP_TMP */
 #if APR_USE_SHMEM_MMAP_SHM
-        /* FIXME: SysV uses 0600... should we? */
-        tmpfd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0644);
+        tmpfd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0600);
         if (tmpfd == -1) {
             return errno;
         }
@@ -358,10 +356,9 @@ APR_DECLARE(apr_status_t) apr_shm_create
 #elif APR_USE_SHMEM_SHMGET
         new_m->realsize = reqsize;
 
-        /* FIXME: APR_FPROT_OS_DEFAULT is too permissive, switch to 600 I think. */
         status = apr_file_open(&file, filename,
                                APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_EXCL,
-                               APR_FPROT_OS_DEFAULT, pool);
+                               APR_FPROT_UREAD | APR_FPROT_UWRITE, pool);
         if (status != APR_SUCCESS) {
             return status;
         }
@@ -552,8 +549,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach
 #if APR_USE_SHMEM_MMAP_SHM
         const char *shm_name = make_shm_open_safe_name(filename, pool);
 
-        /* FIXME: SysV uses 0600... should we? */
-        tmpfd = shm_open(shm_name, O_RDWR, 0644);
+        tmpfd = shm_open(shm_name, O_RDWR, 0600);
         if (tmpfd == -1) {
             return errno;
         }