837eb41ba273c92ec769b0845058ce8cd543b763
[hcoop/debian/courier-authlib.git] / auth.h
1 #ifndef authlib_auth_h
2 #define authlib_auth_h
3
4 /*
5 ** Copyright 1998 - 2004 Double Precision, Inc. See COPYING for
6 ** distribution information.
7 */
8
9 #if HAVE_CONFIG_H
10 #include "courier_auth_config.h"
11 #endif
12 #include <sys/types.h>
13 #include "courierauth.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19
20
21 /* authcheckpassword is the general password validation routine.
22 ** It returns 0 if the password matches the encrypted password.
23 */
24
25 int authcheckpassword(const char *, /* password */
26 const char *); /* encrypted password */
27
28 /*
29 ** authcryptpasswd is a password hashing function, used to create
30 ** new password. password is the cleartext password.
31 ** encryption_hint is a hint to the type of hashing to be used
32 ** (NULL means use a default hash function).
33 */
34
35 char *authcryptpasswd(const char *password,
36 const char *encryption_hint);
37
38
39 int auth_sys_common( int (*auth_pre_func)(const char *,
40 const char *,
41 int (*)(struct authinfo *,
42 void *),
43 void *),
44 const char *user,
45 const char *pass,
46 const char *service,
47 int (*callback_func)(struct authinfo *, void *),
48 void *callback_arg);
49
50 const char *authgetconfig(const char *filename, const char *env);
51
52 char *auth_parse_select_clause (char *(*escape_func)(const char *, size_t),
53 const char *clause, const char *username,
54 const char *defdomain,
55 const char *service);
56
57 char *auth_parse_chpass_clause (char *(*escape_func)(const char *, size_t),
58 const char *clause, const char *username,
59 const char *defdomain, const char *newpass,
60 const char *newpass_crypt);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif