2 ** Copyright 2000-2008 Double Precision, Inc. See COPYING for
3 ** distribution information.
6 #include "courier_auth_config.h"
18 #include "authpgsql.h"
19 #include "courierauth.h"
20 #include "courierauthstaticlist.h"
21 #include "courierauthdebug.h"
22 #include "libhmac/hmac.h"
24 extern void auth_pgsql_enumerate( void(*cb_func
)(const char *name
,
33 static int auth_pgsql_cram(const char *service
,
34 const char *authtype
, char *authdata
,
35 int (*callback_func
)(struct authinfo
*, void *),
38 struct cram_callback_info cci
;
40 if (auth_get_cram(authtype
, authdata
, &cci
))
43 cci
.callback_func
=callback_func
;
44 cci
.callback_arg
=callback_arg
;
46 return auth_pgsql_pre(cci
.user
, service
, &auth_cram_callback
, &cci
);
49 int auth_pgsql(const char *service
, const char *authtype
, char *authdata
,
50 int (*callback_func
)(struct authinfo
*, void *),
53 if (strcmp(authtype
, AUTHTYPE_LOGIN
) == 0)
54 return (auth_pgsql_login(service
, authdata
,
55 callback_func
, callback_arg
));
57 return (auth_pgsql_cram(service
, authtype
, authdata
,
58 callback_func
, callback_arg
));
61 extern int auth_pgsql_pre(const char *user
, const char *service
,
62 int (*callback
)(struct authinfo
*, void *),
65 static struct authstaticinfo authpgsql_info
={
72 auth_pgsql_enumerate
};
74 struct authstaticinfo
*courier_authpgsql_init()
76 return &authpgsql_info
;