linux/include/asm-m68k
Catherine Zhang 877ce7c1b3 [AF_UNIX]: Datagram getpeersec
This patch implements an API whereby an application can determine the
label of its peer's Unix datagram sockets via the auxiliary data mechanism of
recvmsg.

Patch purpose:

This patch enables a security-aware application to retrieve the
security context of the peer of a Unix datagram socket.  The application
can then use this security context to determine the security context for
processing on behalf of the peer who sent the packet.

Patch design and implementation:

The design and implementation is very similar to the UDP case for INET
sockets.  Basically we build upon the existing Unix domain socket API for
retrieving user credentials.  Linux offers the API for obtaining user
credentials via ancillary messages (i.e., out of band/control messages
that are bundled together with a normal message).  To retrieve the security
context, the application first indicates to the kernel such desire by
setting the SO_PASSSEC option via getsockopt.  Then the application
retrieves the security context using the auxiliary data mechanism.

An example server application for Unix datagram socket should look like this:

toggle = 1;
toggle_len = sizeof(toggle);

setsockopt(sockfd, SOL_SOCKET, SO_PASSSEC, &toggle, &toggle_len);
recvmsg(sockfd, &msg_hdr, 0);
if (msg_hdr.msg_controllen > sizeof(struct cmsghdr)) {
    cmsg_hdr = CMSG_FIRSTHDR(&msg_hdr);
    if (cmsg_hdr->cmsg_len <= CMSG_LEN(sizeof(scontext)) &&
        cmsg_hdr->cmsg_level == SOL_SOCKET &&
        cmsg_hdr->cmsg_type == SCM_SECURITY) {
        memcpy(&scontext, CMSG_DATA(cmsg_hdr), sizeof(scontext));
    }
}

sock_setsockopt is enhanced with a new socket option SOCK_PASSSEC to allow
a server socket to receive security context of the peer.

Testing:

We have tested the patch by setting up Unix datagram client and server
applications.  We verified that the server can retrieve the security context
using the auxiliary data mechanism of recvmsg.

Signed-off-by: Catherine Zhang <cxzhang@watson.ibm.com>
Acked-by: Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-06-29 16:58:06 -07:00
..
a.out.h
adb.h
adb_iop.h
amigahw.h
amigaints.h [PATCH] m68k: convert amiga irq code 2006-06-25 10:00:57 -07:00
amigayle.h
amipcmcia.h
apollodma.h
apollohw.h [PATCH] m68k: convert apollo irq code 2006-06-25 10:00:57 -07:00
atafd.h
atafdreg.h
atari_SLM.h
atari_acsi.h
atari_joystick.h
atari_stdma.h [PATCH] m68k: introduce irq controller 2006-06-25 10:00:57 -07:00
atari_stram.h
atarihw.h
atariints.h [PATCH] m68k: cleanup generic irq names 2006-06-25 10:00:57 -07:00
atarikb.h
atomic.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
auxvec.h
bitops.h [PATCH] m68k: fix undefined reference to generic_find_next_zero_le_bit 2006-03-26 08:57:13 -08:00
blinken.h
bootinfo.h
bug.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
bugs.h
bvme6000hw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
byteorder.h
cache.h
cachectl.h
cacheflush.h [PATCH] m68k: small flush_icache() cleanup 2006-06-25 10:00:56 -07:00
checksum.h
contregs.h
cputime.h
current.h
delay.h
div64.h
dma-mapping.h [PATCH] m68k: dma API addition 2006-06-25 10:00:56 -07:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
dsp56k.h
dvma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
elf.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emergency-restart.h
entry.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
errno.h
fbio.h
fcntl.h
floppy.h
fpu.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
futex.h
hardirq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
hp300hw.h
hw_irq.h
hwtest.h
ide.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
idprom.h
intersil.h
io.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ioctl.h
ioctls.h
ipc.h
ipcbuf.h
irq.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
kmap_types.h
linkage.h
local.h
mac_asc.h
mac_baboon.h
mac_iop.h
mac_mouse.h
mac_oss.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
mac_psc.h
mac_via.h
machdep.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
machines.h
machw.h
macintosh.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
macints.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
math-emu.h
mc146818rtc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
md.h
mman.h
mmu.h
mmu_context.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
module.h
motorola_pgalloc.h
motorola_pgtable.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
movs.h
msgbuf.h
mutex.h
mvme16xhw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
mvme147hw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
namei.h
nubus.h
openprom.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
oplib.h
page.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
page_offset.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
param.h
parport.h
pci.h
percpu.h
pgalloc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h
processor.h [PATCH] m68k: use c99 initializer 2006-06-23 07:43:00 -07:00
ptrace.h
q40_master.h
q40ints.h
raw_io.h [PATCH] iomap_copy fallout (m68k) 2006-02-18 16:30:40 -05:00
resource.h
rtc.h
sbus.h
scatterlist.h [PATCH] m68k: Add the generic dma API functions 2006-06-25 10:00:56 -07:00
sections.h
segment.h
semaphore-helper.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
semaphore.h
sembuf.h
serial.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
setup.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
shm.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] m68k: fix constraints of the signal functions and some cleanup 2006-06-25 10:00:56 -07:00
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
spinlock.h
stat.h [PATCH] 2TB files: st_blocks is invalid when calling stat64 2006-03-26 08:57:00 -08:00
statfs.h
string.h
sun3-head.h
sun3_pgalloc.h
sun3_pgtable.h
sun3ints.h [PATCH] m68k: convert sun3 irq code 2006-06-25 10:00:58 -07:00
sun3mmu.h
sun3x.h
sun3xflop.h
sun3xprom.h
suspend.h
swim_iop.h
system.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
termbits.h
termios.h
thread_info.h
timex.h
tlb.h
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
topology.h
traps.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
types.h
uaccess.h [PATCH] m68k: fix uaccess.h for gcc-3.x 2006-06-25 10:00:56 -07:00
ucontext.h
unaligned.h
unistd.h [PATCH] m68k: cleanup unistd.h 2006-06-23 07:43:00 -07:00
user.h
virtconvert.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
xor.h
zorro.h