1 /*******************************************************************************
2 * *****************************************************************************
6 * * Description: Header file for utils.c
9 * * Copyright (c) 1997-2000 Messaging Direct Ltd.
10 * * All rights reserved.
12 * * Portions Copyright (c) 2003 Jeremy Rumpf
13 * * jrumpf@heavyload.net
15 * * Redistribution and use in source and binary forms, with or without
16 * * modification, are permitted provided that the following conditions
19 * * 1. Redistributions of source code must retain the above copyright
20 * * notice, this list of conditions and the following disclaimer.
22 * * 2. Redistributions in binary form must reproduce the above copyright
23 * * notice, this list of conditions and the following disclaimer in the
24 * * documentation and/or other materials provided with the distribution.
26 * * THIS SOFTWARE IS PROVIDED ``AS IS''. ANY EXPRESS OR IMPLIED WARRANTIES,
27 * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 * * IN NO EVENT SHALL JEREMY RUMPF OR ANY CONTRIBUTER TO THIS SOFTWARE BE
29 * * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
35 * * THE POSSIBILITY OF SUCH DAMAGE
40 * * This source file created using 8 space tabs.
42 * ******************************************************************************
43 ********************************************************************************/
50 #include <sys/types.h>
52 #include "saslauthd.h"
57 #define L_INFO LOG_INFO
58 #define L_DEBUG LOG_DEBUG
61 /* some magic to grab function names */
63 # define L_FUNC __func__
64 # define HAVE_L_FUNC 1
65 #elif defined(HAVE_PRETTY_FUNCTION)
66 # define L_FUNC __PRETTY_FUNCTION__
67 # define HAVE_L_FUNC 1
68 #elif defined(HAVE_FUNCTION)
69 # define L_FUNC __FUNCTION__
70 # define HAVE_L_FUNC 1
77 # define L_STDERR_FORMAT "saslauthd[%d] :%-16s: %s\n"
79 # define L_STDERR_FORMAT "saslauthd[%d] :%s%s\n"
84 extern void logger(int, const char *, const char *, ...);
85 extern ssize_t tx_rec(int filefd, void *, size_t);
86 extern ssize_t rx_rec(int , void *, size_t);
87 extern int retry_writev(int, struct iovec *, int);