3 * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
8 * Public License. A copy of this license is available at
9 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10 * top-level directory of the distribution.
16 #include <ldap_cdefs.h>
17 #include <lber_types.h>
20 * Include file for LDAP utility routine
25 /* n octets encode into ceiling(n/3) * 4 bytes */
26 /* Avoid floating point math through extra padding */
28 #define LUTIL_BASE64_ENCODE_LEN(n) (((n)+2)/3 * 4)
29 #define LUTIL_BASE64_DECODE_LEN(n) (((n)+3)/4 * 3)
31 /* ISC Base64 Routines */
35 lutil_b64_ntop LDAP_P((
36 unsigned char const *,
42 lutil_b64_pton LDAP_P((
55 lutil_entropy LDAP_P((
60 struct berval; /* avoid pulling in lber.h */
63 lutil_get_filed_password LDAP_P((
69 lutil_authpasswd LDAP_P((
70 const struct berval *passwd, /* stored password */
71 const struct berval *cred, /* user supplied value */
72 const char **methods ));
75 lutil_authpasswd_hash LDAP_P((
76 const struct berval *cred,
77 struct berval **passwd, /* password to store */
78 struct berval **salt, /* salt to store */
79 const char *method ));
81 #if defined( SLAPD_SPASSWD ) && defined( HAVE_CYRUS_SASL )
82 /* cheat to avoid pulling in <sasl.h> */
83 LDAP_LUTIL_V( struct sasl_conn * ) lutil_passwd_sasl_conn;
88 const struct berval *passwd, /* stored password */
89 const struct berval *cred, /* user supplied value */
90 const char **methods ));
92 LDAP_LUTIL_F( struct berval * )
93 lutil_passwd_generate LDAP_P(( ber_len_t ));
95 LDAP_LUTIL_F( struct berval * )
96 lutil_passwd_hash LDAP_P((
97 const struct berval *passwd,
98 const char *method ));
101 lutil_passwd_scheme LDAP_P((
102 const char *scheme ));
105 lutil_salt_format LDAP_P((
106 const char *format ));
109 LDAP_LUTIL_F( char* )
110 lutil_progname LDAP_P((
115 LDAP_LUTIL_F( char* )
116 lutil_strcopy LDAP_P(( char *dst, const char *src ));
118 LDAP_LUTIL_F( char* )
119 lutil_strncopy LDAP_P(( char *dst, const char *src, size_t n ));
123 /* use this macro to statically allocate buffer for lutil_gentime */
124 #define LDAP_LUTIL_GENTIME_BUFSIZE 22
125 LDAP_LUTIL_F( size_t )
126 lutil_gentime LDAP_P(( char *s, size_t max, const struct tm *tm ));
130 mkstemp LDAP_P (( char * template ));
135 lutil_pair( ber_socket_t sd[2] );
138 /* use this macro to allocate buffer for lutil_uuidstr */
139 #define LDAP_LUTIL_UUIDSTR_BUFSIZE 40
140 LDAP_LUTIL_F( size_t )
141 lutil_uuidstr( char *buf, size_t len );
144 /* use this macro to allocate buffer for lutil_csnstr */
145 #define LDAP_LUTIL_CSNSTR_BUFSIZE 64
146 LDAP_LUTIL_F( size_t )
147 lutil_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod );
150 * Sometimes not all declarations in a header file are needed.
151 * An indicator to this is whether or not the symbol's type has
152 * been defined. Thus, we don't need to include a symbol if
153 * its type has not been defined through another header file.
156 #ifdef HAVE_NT_SERVICE_MANAGER
157 LDAP_LUTIL_V (int) is_NT_Service;
159 #ifdef _LDAP_PVT_THREAD_H
160 LDAP_LUTIL_V (ldap_pvt_thread_cond_t) started_event;
161 #endif /* _LDAP_PVT_THREAD_H */
163 /* macros are different between Windows and Mingw */
164 #if defined(_WINSVC_H) || defined(_WINSVC_)
165 LDAP_LUTIL_V (SERVICE_STATUS) SLAPDServiceStatus;
166 LDAP_LUTIL_V (SERVICE_STATUS_HANDLE) hSLAPDServiceStatus;
167 #endif /* _WINSVC_H */
169 #endif /* HAVE_NT_SERVICE_MANAGER */
172 /* Generally this has only been used to put '\n' to stdout. We need to
173 * make sure it is output in EBCDIC.
177 #define putchar(c) putc((c), stdout)
178 #define putc(c,fp) do { char x=(c); __atoe_l(&x,1); putc(x,fp); } while(0)
183 #endif /* _LUTIL_H */