summaryrefslogtreecommitdiffstats
path: root/src/util/unix_pass_fd_fix.c
blob: d59f0898202ba6ea52d37b6ac152451ebb72175c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*++
/* NAME
/*	unix_pass_fd_fix 3
/* SUMMARY
/*	file descriptor passing bug workarounds
/* SYNOPSIS
/*	#include <iostuff.h>
/*
/*	void	set_unix_pass_fd_fix(workarounds)
/*	const char *workarounds;
/* DESCRIPTION
/*	This module supports programmatic control over workarounds
/*	for sending or receiving file descriptors over UNIX-domain
/*	sockets.
/*
/*	set_unix_pass_fd_fix() takes a list of workarouds in external
/*	form, and stores their internal representation. The result
/*	is used by unix_send_fd() and unix_recv_fd().
/*
/*	Arguments:
/* .IP workarounds
/*	List of zero or more of the following, separated by comma
/*	or whitespace.
/* .RS
/* .IP cmsg_len
/*	Send the CMSG_LEN of the file descriptor, instead of
/*	the total message buffer length.
/* .RE
/* SEE ALSO
/*	unix_send_fd(3) send file descriptor
/*	unix_recv_fd(3) receive file descriptor
/* DIAGNOSTICS
/*	Fatal errors: non-existent workaround.
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

/* System library. */

#include <sys_defs.h>

/* Utility library. */

#include <iostuff.h>
#include <name_mask.h>

int     unix_pass_fd_fix = 0;

/* set_unix_pass_fd_fix - set workaround programmatically */

void    set_unix_pass_fd_fix(const char *workarounds)
{
    const static NAME_MASK table[] = {
	"cmsg_len", UNIX_PASS_FD_FIX_CMSG_LEN,
	0,
    };

    unix_pass_fd_fix = name_mask("descriptor passing workarounds",
				 table, workarounds);
}