Describe in detail required conditions for receiving the SCM_CREDS
control message and suggest to use LOCAL_CREDS setsockopt() for reliability.
This commit is contained in:
parent
189d85cc15
commit
be81cc14ab
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240385
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)recv.2 8.3 (Berkeley) 2/21/94
|
.\" @(#)recv.2 8.3 (Berkeley) 2/21/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd December 28, 2006
|
.Dd September 12, 2012
|
||||||
.Dt RECV 2
|
.Dt RECV 2
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -252,8 +252,21 @@ struct cmsgcred {
|
|||||||
};
|
};
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The kernel will fill in the credential information of the sending process
|
If a sender supplies ancillary data with enough space for the above struct
|
||||||
and deliver it to the receiver.
|
tagged as
|
||||||
|
.Dv SCM_CREDS
|
||||||
|
control message type to the
|
||||||
|
.Fn sendmsg
|
||||||
|
system call, then kernel will fill in the credential information of the
|
||||||
|
sending process and deliver it to the receiver.
|
||||||
|
Since receiver usually has no control over a sender, this method of retrieving
|
||||||
|
credential information isn't reliable.
|
||||||
|
For reliable retrieval of remote side credentials it is advised to use the
|
||||||
|
.Dv LOCAL_CREDS
|
||||||
|
socket option on the receiving socket.
|
||||||
|
See
|
||||||
|
.Xr unix 4
|
||||||
|
for details.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fa msg_flags
|
.Fa msg_flags
|
||||||
@ -322,7 +335,8 @@ address space.
|
|||||||
.Xr getsockopt 2 ,
|
.Xr getsockopt 2 ,
|
||||||
.Xr read 2 ,
|
.Xr read 2 ,
|
||||||
.Xr select 2 ,
|
.Xr select 2 ,
|
||||||
.Xr socket 2
|
.Xr socket 2 ,
|
||||||
|
.Xr unix 4
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
The
|
The
|
||||||
.Fn recv
|
.Fn recv
|
||||||
|
Loading…
Reference in New Issue
Block a user