From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 24 10:32:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED0B346A; Wed, 24 Oct 2012 10:32:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5A0E8FC0A; Wed, 24 Oct 2012 10:32:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9OAWd4a095462; Wed, 24 Oct 2012 10:32:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9OAWdCD095460; Wed, 24 Oct 2012 10:32:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210241032.q9OAWdCD095460@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 24 Oct 2012 10:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r241996 - stable/9/lib/libc/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2012 10:32:40 -0000 Author: glebius Date: Wed Oct 24 10:32:39 2012 New Revision: 241996 URL: http://svn.freebsd.org/changeset/base/241996 Log: Merge r240385 from head: Describe in detail required conditions for receiving the SCM_CREDS control message and suggest to use LOCAL_CREDS setsockopt() for reliability. Modified: stable/9/lib/libc/sys/recv.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/recv.2 ============================================================================== --- stable/9/lib/libc/sys/recv.2 Wed Oct 24 10:30:40 2012 (r241995) +++ stable/9/lib/libc/sys/recv.2 Wed Oct 24 10:32:39 2012 (r241996) @@ -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