Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 09:50:18 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240385 - head/lib/libc/sys
Message-ID:  <201209120950.q8C9oIcP039955@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Sep 12 09:50:17 2012
New Revision: 240385
URL: http://svn.freebsd.org/changeset/base/240385

Log:
  Describe in detail required conditions for receiving the SCM_CREDS
  control message and suggest to use LOCAL_CREDS setsockopt() for
  reliability.

Modified:
  head/lib/libc/sys/recv.2

Modified: head/lib/libc/sys/recv.2
==============================================================================
--- head/lib/libc/sys/recv.2	Wed Sep 12 09:29:22 2012	(r240384)
+++ head/lib/libc/sys/recv.2	Wed Sep 12 09:50:17 2012	(r240385)
@@ -28,7 +28,7 @@
 .\"     @(#)recv.2	8.3 (Berkeley) 2/21/94
 .\" $FreeBSD$
 .\"
-.Dd December 28, 2006
+.Dd September 12, 2012
 .Dt RECV 2
 .Os
 .Sh NAME
@@ -252,8 +252,21 @@ struct cmsgcred {
 };
 .Ed
 .Pp
-The kernel will fill in the credential information of the sending process
-and deliver it to the receiver.
+If a sender supplies ancillary data with enough space for the above struct
+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
 The
 .Fa msg_flags
@@ -322,7 +335,8 @@ address space.
 .Xr getsockopt 2 ,
 .Xr read 2 ,
 .Xr select 2 ,
-.Xr socket 2
+.Xr socket 2 ,
+.Xr unix 4
 .Sh HISTORY
 The
 .Fn recv



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209120950.q8C9oIcP039955>