Index: ossp-pkg/mm/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/mm/ChangeLog,v rcsdiff -q -kk '-r1.33' '-r1.34' -u '/v/ossp/cvs/ossp-pkg/mm/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/07/26 13:40:41 1.33 +++ ChangeLog 2002/07/26 13:48:38 1.34 @@ -16,6 +16,9 @@ Changes between 1.1.3 and 1.2.0 (01-Jul-2000 to 26-Jul-2002) + *) Fixed race condition in temporary file creation. + [Sebastian Krahmer, SuSE Security] + *) Make sure that under MM_SEMT_IPCSEM (mutex implementation method is SysV IPC semget) the {mm,MM}_permission() also changes the owner of the semaphore. @@ -25,9 +28,6 @@ MAXPATHLEN in [Joe Orton ] - *) Fixed race condition in temporary file creation. - [Sebastian Krahmer, SuSE Security] - *) Removed the old fbtool stuff for reporting the success/failure because after 3 years of existence we really know that OSSP mm works on every reasonable Unix flavor on this earth. Index: ossp-pkg/mm/mm_core.c RCS File: /v/ossp/cvs/ossp-pkg/mm/mm_core.c,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/mm/mm_core.c,v' 2>/dev/null --- mm_core.c 2002/07/26 13:34:53 1.15 +++ mm_core.c 2002/07/26 13:48:38 1.16 @@ -249,7 +249,7 @@ #if defined(MM_SHMT_MMPOSX) shm_unlink(fnmem); /* Ok when it fails */ - if ((fdmem = shm_open(fnmem, O_RDWR|O_CREAT, MM_CORE_FILEMODE)) == -1) + if ((fdmem = shm_open(fnmem, O_RDWR|O_CREAT|O_EXCL, MM_CORE_FILEMODE)) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to open tempfile"); if (ftruncate(fdmem, mm_core_mapoffset+size) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to truncate tempfile"); @@ -275,7 +275,7 @@ #if defined(MM_SHMT_MMFILE) unlink(fnmem); - if ((fdmem = open(fnmem, O_RDWR|O_CREAT, MM_CORE_FILEMODE)) == -1) + if ((fdmem = open(fnmem, O_RDWR|O_CREAT|O_EXCL, MM_CORE_FILEMODE)) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to open memory file"); if (ftruncate(fdmem, mm_core_mapoffset+size) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to truncate memory file"); @@ -303,13 +303,13 @@ #if defined(MM_SEMT_FLOCK) unlink(fnsem); - if ((fdsem = open(fnsem, O_RDWR|O_CREAT, MM_CORE_FILEMODE)) == -1) + if ((fdsem = open(fnsem, O_RDWR|O_CREAT|O_EXCL, MM_CORE_FILEMODE)) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to open semaphore file"); #endif /* MM_SEMT_FLOCK */ #if defined(MM_SEMT_FCNTL) unlink(fnsem); - if ((fdsem = open(fnsem, O_RDWR|O_CREAT, MM_CORE_FILEMODE)) == -1) + if ((fdsem = open(fnsem, O_RDWR|O_CREAT|O_EXCL, MM_CORE_FILEMODE)) == -1) FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to open semaphore file"); #endif /* MM_SEMT_FCNTL */