1 /****************************************************************************
2  *
3  * saslauthd-main.h
4  *
5  * Description:  Header file for saslauthd-main.c
6  *
7  *
8  * Copyright (c) 1997-2000 Messaging Direct Ltd.
9  * All rights reserved.
10  *
11  * Portions Copyright (c) 2003 Jeremy Rumpf
12  * jrumpf@heavyload.net
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  *
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  *
25  * THIS SOFTWARE IS PROVIDED ``AS IS''. ANY EXPRESS OR IMPLIED WARRANTIES,
26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL JEREMY RUMPF OR ANY CONTRIBUTER TO THIS SOFTWARE BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34  * THE POSSIBILITY OF SUCH DAMAGE
35  *
36  * HISTORY
37  *
38  * Feb 2004: Partial rewrite and cleanup  by Jeremy Rumpf jrumpf@heavyload.net
39  * - Merge the doors and unix IPC methods under a common framework.
40  *
41  * This source file created using 8 space tabs.
42  *
43  ****************************************************************************/
44 
45 #ifndef _SASLAUTHDMAIN_H
46 #define _SASLAUTHDMAIN_H
47 
48 #include <config.h>
49 
50 #include <sys/types.h>
51 
52 /****************************************************************
53  * Plug in some autoconf magic to determine what IPC method
54  * to use.
55  ****************************************************************/
56 #ifdef USE_DOORS
57 # define USE_DOORS_IPC
58 #else
59 # define USE_UNIX_IPC
60 #endif
61 
62 /* AIX uses a slight variant of this */
63 #ifdef _AIX
64 # define SALEN_TYPE size_t
65 #else
66 # define SALEN_TYPE int
67 #endif
68 
69 /* Define some macros. These help keep the ifdefs out of the
70  * mainline code. */
71 #ifdef AUTH_SIA
72 #define SET_AUTH_PARAMETERS(argc, argv) set_auth_parameters(argc, argv)
73 #else
74 #define SET_AUTH_PARAMETERS(argc, argv)
75 #endif
76 
77 /* file name defines - don't forget the '/' in these! */
78 #define PID_FILE		"/saslauthd.pid"
79 #define PID_FILE_LOCK		"/saslauthd.pid.lock"
80 #define ACCEPT_LOCK_FILE	"/mux.accept"
81 #define SOCKET_FILE		"/mux"
82 #define DOOR_FILE		"/mux"
83 
84 /* login, pw, service, realm buffer size */
85 #define MAX_REQ_LEN		256
86 
87 /* socket backlog when supported */
88 #define SOCKET_BACKLOG  	32
89 
90 /* saslauthd-main.c */
91 extern char	*do_auth(const char *, const char *,
92 			 const char *, const char *);
93 extern void	set_auth_mech(const char *);
94 extern void	set_max_procs(const char *);
95 extern void	set_mech_option(const char *);
96 extern void	set_run_path(const char *);
97 extern void	signal_setup();
98 extern void	detach_tty();
99 extern void	handle_sigchld();
100 extern void	server_exit();
101 extern pid_t	have_baby();
102 
103 /* ipc api delcarations */
104 extern void	ipc_init();
105 extern void	ipc_loop();
106 extern void	ipc_cleanup();
107 
108 #endif  /* _SASLAUTHDMAIN_H */
109