[lkml]   [2008]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectUser credentials on a unix datagram socket
The socket(7) man page seems to imply that user credentials cannot be
sent on a unix datagram socket, unless socketpair() created it.

> Return the credentials of the foreign process connected to this socket.
> This is only possible for connected AF_UNIX stream sockets and AF_UNIX
> stream and datagram socket pairs created using socketpair(2);

But through trial and error, without reading any kernel source, I
learned that you can send user credentials on a regular unix datagram
socket which was not created with socketpair().

I'm unsure what SO_PEERCRED is intended for; I used SO_PASSCRED in my
server code, and it works. I'm glad it does. Stream sockets would
require a file descriptor for each client. Ugh. What I want to do is
so much simpler with datagram sockets.

I have sample code at

I hope someone will revise the man page and explain that you can pass
user credentials on a unix datagram socket, even one not created with

This is a very useful feature. Please keep it in the kernel!

Webmail for Dialup Users

 \ /
  Last update: 2008-10-06 00:03    [W:0.041 / U:10.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site