2 ** Copyright 1998 - 2008 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
17 #include "courierauthstaticlist.h"
18 #include "courierauthdebug.h"
21 extern void auth_ldap_enumerate( void(*cb_func
)(const char *name
,
30 static int auth_ldap_login(const char *service
, char *authdata
,
31 int (*callback_func
)(struct authinfo
*, void *),
34 const char *user
, *pass
;
36 if ((user
=strtok(authdata
, "\n")) == 0 ||
37 (pass
=strtok(0, "\n")) == 0)
39 DPRINTF("incomplete authentication data");
44 return authldapcommon(service
, user
, pass
, callback_func
,
48 #include "libhmac/hmac.h"
51 static int auth_ldap_cram(const char *service
,
52 const char *authtype
, char *authdata
,
53 int (*callback_func
)(struct authinfo
*, void *),
56 struct cram_callback_info cci
;
58 if (auth_get_cram(authtype
, authdata
, &cci
))
61 cci
.callback_func
=callback_func
;
62 cci
.callback_arg
=callback_arg
;
64 return authldapcommon(service
, cci
.user
, 0, &auth_cram_callback
, &cci
);
67 int auth_ldap(const char *service
, const char *authtype
, char *authdata
,
68 int (*callback_func
)(struct authinfo
*, void *),
71 if (strcmp(authtype
, AUTHTYPE_LOGIN
) == 0)
72 return (auth_ldap_login(service
, authdata
,
73 callback_func
, callback_arg
));
75 return (auth_ldap_cram(service
, authtype
, authdata
,
76 callback_func
, callback_arg
));
80 extern int auth_ldap_pre(const char *userid
, const char *service
,
81 int (*callback
)(struct authinfo
*, void *),
84 extern int auth_ldap_changepw(const char *, const char *, const char *,
87 static struct authstaticinfo authldap_info
={
97 struct authstaticinfo
*courier_authldap_init()
99 return &authldap_info
;