2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2003 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
19 #include <ldap_cdefs.h>
20 #include <lber_types.h>
23 * Include file for LDAP utility routine
28 /* n octets encode into ceiling(n/3) * 4 bytes */
29 /* Avoid floating point math through extra padding */
31 #define LUTIL_BASE64_ENCODE_LEN(n) (((n)+2)/3 * 4)
32 #define LUTIL_BASE64_DECODE_LEN(n) (((n)+3)/4 * 3)
34 /* ISC Base64 Routines */
38 lutil_b64_ntop LDAP_P((
39 unsigned char const *,
45 lutil_b64_pton LDAP_P((
58 lutil_entropy LDAP_P((
63 struct berval; /* avoid pulling in lber.h */
66 lutil_get_filed_password LDAP_P((
71 struct lutil_pw_scheme;
73 typedef int (LUTIL_PASSWD_CHK_FUNC)(
74 const struct berval *scheme,
75 const struct berval *passwd,
76 const struct berval *cred,
79 typedef struct berval * (LUTIL_PASSWD_HASH_FUNC) (
80 const struct berval *scheme,
81 const struct berval *passwd,
85 lutil_passwd_add LDAP_P((
86 struct berval *scheme,
87 LUTIL_PASSWD_CHK_FUNC *chk_fn,
88 LUTIL_PASSWD_HASH_FUNC *hash_fn ));
91 lutil_passwd_init LDAP_P(( void ));
94 lutil_passwd_destroy LDAP_P(( void ));
97 lutil_authpasswd LDAP_P((
98 const struct berval *passwd, /* stored password */
99 const struct berval *cred, /* user supplied value */
100 const char **methods ));
103 lutil_authpasswd_hash LDAP_P((
104 const struct berval *cred,
105 struct berval **passwd, /* password to store */
106 struct berval **salt, /* salt to store */
107 const char *method ));
109 #if defined( SLAPD_SPASSWD ) && defined( HAVE_CYRUS_SASL )
110 /* cheat to avoid pulling in <sasl.h> */
111 LDAP_LUTIL_V( struct sasl_conn * ) lutil_passwd_sasl_conn;
115 lutil_passwd LDAP_P((
116 const struct berval *passwd, /* stored password */
117 const struct berval *cred, /* user supplied value */
118 const char **methods,
119 const char **text )); /* error message */
121 LDAP_LUTIL_F( struct berval * )
122 lutil_passwd_generate LDAP_P(( ber_len_t ));
124 LDAP_LUTIL_F( struct berval * )
125 lutil_passwd_hash LDAP_P((
126 const struct berval *passwd,
128 const char **text ));
131 lutil_passwd_scheme LDAP_P((
132 const char *scheme ));
135 lutil_salt_format LDAP_P((
136 const char *format ));
139 LDAP_LUTIL_F( char* )
140 lutil_progname LDAP_P((
145 LDAP_LUTIL_F( char* )
146 lutil_strcopy LDAP_P(( char *dst, const char *src ));
148 LDAP_LUTIL_F( char* )
149 lutil_strncopy LDAP_P(( char *dst, const char *src, size_t n ));
153 /* use this macro to statically allocate buffer for lutil_gentime */
154 #define LDAP_LUTIL_GENTIME_BUFSIZE 22
155 #define lutil_gentime(s,m,t) lutil_localtime((s),(m),(t),0)
156 LDAP_LUTIL_F( size_t )
157 lutil_localtime LDAP_P(( char *s, size_t smax, const struct tm *tm,
162 mkstemp LDAP_P (( char * template ));
167 lutil_pair( ber_socket_t sd[2] );
170 /* use this macro to allocate buffer for lutil_uuidstr */
171 #define LDAP_LUTIL_UUIDSTR_BUFSIZE 40
172 LDAP_LUTIL_F( size_t )
173 lutil_uuidstr( char *buf, size_t len );
176 /* use this macro to allocate buffer for lutil_csnstr */
177 #define LDAP_LUTIL_CSNSTR_BUFSIZE 64
178 LDAP_LUTIL_F( size_t )
179 lutil_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod );
182 * Sometimes not all declarations in a header file are needed.
183 * An indicator to this is whether or not the symbol's type has
184 * been defined. Thus, we don't need to include a symbol if
185 * its type has not been defined through another header file.
188 #ifdef HAVE_NT_SERVICE_MANAGER
189 LDAP_LUTIL_V (int) is_NT_Service;
191 #ifdef _LDAP_PVT_THREAD_H
192 LDAP_LUTIL_V (ldap_pvt_thread_cond_t) started_event;
193 #endif /* _LDAP_PVT_THREAD_H */
195 /* macros are different between Windows and Mingw */
196 #if defined(_WINSVC_H) || defined(_WINSVC_)
197 LDAP_LUTIL_V (SERVICE_STATUS) lutil_ServiceStatus;
198 LDAP_LUTIL_V (SERVICE_STATUS_HANDLE) hlutil_ServiceStatus;
199 #endif /* _WINSVC_H */
202 lutil_CommenceStartupProcessing( char *serverName, void (*stopper)(int)) ;
205 lutil_ReportShutdownComplete( void );
207 LDAP_LUTIL_F (void *)
208 lutil_getRegParam( char *svc, char *value );
211 lutil_srv_install( char* service, char * displayName, char* filename,
214 lutil_srv_remove ( char* service, char* filename );
216 #endif /* HAVE_NT_SERVICE_MANAGER */
218 #ifdef HAVE_NT_EVENT_LOG
220 lutil_LogStartedEvent( char *svc, int slap_debug, char *configfile, char *urls );
223 lutil_LogStoppedEvent( char *svc );
227 /* Generally this has only been used to put '\n' to stdout. We need to
228 * make sure it is output in EBCDIC.
232 #define putchar(c) putc((c), stdout)
233 #define putc(c,fp) do { char x=(c); __atoe_l(&x,1); putc(x,fp); } while(0)
238 #endif /* _LUTIL_H */