1 /*
2 $Id: courierpasswd.h,v 1.3 2014/11/30 17:32:48 astjean Exp $
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2, or (at
7 your option) any later version.
8 
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 General Public License for more details.
13 
14 Copyright (c) Andrew St. Jean <andrew@arda.homeunix.net> 2002-2005
15 */
16 
17 #ifndef COURIERPASSWD_H
18 #define COURIERPASSWD_H 1
19 
20 #if HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23 
24 #include "logging.h"
25 #include "getopt.h"
26 #include "courierauth.h"
27 #include "courierauthdebug.h"
28 #include <syslog.h>
29 #include <stdio.h>
30 #include <ctype.h>
31 #include <pwd.h>
32 #include <stdlib.h>
33 #include <string.h>
34 
35 #ifdef HAVE_UNISTD_H
36 #include <unistd.h>
37 #endif
38 
39 #if HAVE_ERRNO_H
40 #include <errno.h>
41 #endif
42 #ifndef errno
43 extern int errno;
44 #endif
45 
46 enum { OPT_STDIN = 1, OPT_STDOUT = 2, OPT_STDERR = 3 };
47 
48 /* define what we consider safe characters in strings */
49 #define SAFE_CHARS      "abcdefghijklmnopqrstuvwxyz \
50                          ABCDEFGHIJKLMNOPQRSTUVWXYZ \
51 		         1234567890+_-.:@"
52 
53 #define XMALLOC(type, num)                              	\
54 	         ((type *)xmalloc ((num) * sizeof(type)))
55 #define XCALLOC(type, num)                              	\
56 	        ((type *)xcalloc ((num), sizeof(type)))
57 #define XREALLOC(type, p, num)                          	\
58 	        ((type *)xrealloc ((p), (num) * sizeof(type)))
59 #define XFREE(stale)                                    	\
60 	        do{                                     	\
61 			if (stale){ free (stale); stale = 0; }  \
62 		} while (0)
63 
64 extern void *xmalloc(size_t num);
65 extern void *xcalloc(size_t num, size_t size);
66 extern void *xrealloc(void *p, size_t num);
67 
68 /* prototypes for replacement functions */
69 #ifndef HAVE_STRLCPY
70 size_t strlcpy(char *dst, const char *src, size_t siz);
71 #endif
72 
73 #endif /* COURIERPASSWD_H */
74