Thread (4 messages) 4 messages, 3 authors, 2003-12-16

Re: [RFC] SO_PEERSEC - security credentials for Unix stream sockets

From: Stephen Smalley <hidden>
Date: 2003-12-16 13:47:31

Possibly related (same subject, not in this thread)

On Tue, 2003-12-16 at 08:19, James Morris wrote:
It's not reliable: the required buffer size could change between calls.  
Do you know of any examples of syscalls which do this?
getxattr(2).  From the man page:

       An empty buffer of size zero can be passed into these calls  to  return
       the  current size of the named extended attribute, which can be used to
       estimate the size of a buffer which is sufficiently large to  hold  the
       value associated with the extended attribute.
                                                                                
       The  interface  is  designed to allow guessing of initial buffer sizes,
       and to enlarge buffers when the return value indicates that the  buffer
       provided was too small.

The SELinux getfilecon(3) function (libselinux/src/getfilecon.c) uses
getxattr(2) in this manner.

-- 
Stephen Smalley [off-list ref]
National Security Agency
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help