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