Skip to contentSkip to conversation

New: POSIX now guarantees proper permissions for mkstemp

Bug 51811 bugzilla-daemon-590EEB7GvNiWaY/[email protected] 1 participant 4 messages Dec 19, 2012 – Dec 20, 2012 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=51811

Summary: POSIX now guarantees proper permissions for mkstemp
Product: Documentation
Version: unspecified
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: man-pages
AssignedTo: documentation_man-pages-ztI5WcYan/[email protected]
ReportedBy: [email protected]
Regression: No

POSIX 2008 says this:

| The mkstemp() function shall create the file, and obtain a file descriptor for

| it, as if by a call to:
|
|   open(filename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR)

So the warning about permissions is probably obsolete by now.

Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): bug-51811-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/

#2 lore raw

[Bug 51811] POSIX now guarantees proper permissions for mkstemp

https://bugzilla.kernel.org/show_bug.cgi?id=51811

--- Comment #1 from Florian Weimer <[email protected]> 2012-12-19 09:49:05 --- The reference to glibc 2.0.6 looks obsolete as well. It was released in 1997,
after all.

Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

[Bug 51811] POSIX now guarantees proper permissions for mkstemp

In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=51811

Michael Kerrisk <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|                            |CODE_FIX

--- Comment #2 from Michael Kerrisk <[email protected]> 2012-12-20 15:25:15 --- Thanks for the report, but man-pages tends to have a long memory. Some (few)
people will care about this behavior. The POSIX info dates only from 2008.
POSIX.1-2001 did not specify that detail.

All of that said, the info about old glibc could be deemphasized a little, since it is so old now. So. I've moved it to notes, and added a note about POSIX.1-2008. See the patch below:

man3/mkstemp.3 +0 -0
@@ -89,8 +89,6 @@ must not be a string constant, but should be declared as a

character array.

The file is created with
permissions 0600, that is, read plus write for owner only.
-(In glibc versions 2.06 and earlier, the file is created with permissions 0666,
-that is, read and write for all users.)
The returned file descriptor provides both read and write access to the file. The file is opened with the
.BR open (2)
@@ -187,9 +185,12 @@ and
.BR mkostemps ():
are glibc extensions.
.SH NOTES
-The old behavior of creating a file with mode 0666 may be
+In glibc versions 2.06 and earlier, the file is created with permissions 0666, +that is, read and write for all users.
+This old behavior may be
a security risk, especially since other UNIX flavors use 0600, and somebody might overlook this detail when porting programs.
+POSIX.1-2008 adds a requirement that the file be created with mode 0600.

More generally, the POSIX specification of
.BR mkstemp ()

Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

[Bug 51811] POSIX now guarantees proper permissions for mkstemp

In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=51811

--- Comment #3 from Florian Weimer <[email protected]> 2012-12-20 15:37:04 --- This looks good to me, thanks.

Signature · 7 lines
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html