diff -u authvchkpw.c.orig authvchkpw.c --- authvchkpw.c.orig Sun Feb 20 13:41:20 2005 +++ authvchkpw.c Mon Apr 18 12:28:01 2005 @@ -54,8 +54,10 @@ return (*i->callback_func)(a, i->callback_arg); } -int auth_vchkpw(const char *service, const char *authtype, char *authdata, - int (*callback_func)(struct authinfo *, void *), void *callback_arg) +static int auth_vchkpw_login(const char *service, const char *authtype, + char *authdata, + int (*callback_func)(struct authinfo *, void *), + void *callback_arg) { char *user, *pass; struct callback_info ci; @@ -119,6 +121,46 @@ #endif return 0; +} + +#if HAVE_HMACLIB + +#include "libhmac/hmac.h" +#include "cramlib.h" + + +static int auth_vchkpw_cram(const char *service, + const char *authtype, char *authdata, + int (*callback_func)(struct authinfo *, void *), + void *callback_arg) +{ + struct cram_callback_info cci; + + if (auth_get_cram(authtype, authdata, &cci)) + return (-1); + + cci.callback_func=callback_func; + cci.callback_arg=callback_arg; + + return auth_vchkpw_pre(cci.user, service, &auth_cram_callback, &cci); +} +#endif + +int auth_vchkpw(const char *service, const char *authtype, char *authdata, + int (*callback_func)(struct authinfo *, void *), + void *callback_arg) +{ + if (strcmp(authtype, AUTHTYPE_LOGIN) == 0) + return (auth_vchkpw_login(service, authtype, authdata, + callback_func, callback_arg)); + +#if HAVE_HMACLIB + return (auth_vchkpw_cram(service, authtype, authdata, + callback_func, callback_arg)); +#else + errno=EPERM; + return (-1); +#endif } static void authvchkpwclose() diff -u preauthvchkpw.c.orig preauthvchkpw.c --- preauthvchkpw.c.orig Sun Feb 20 13:41:20 2005 +++ preauthvchkpw.c Mon Apr 18 12:22:35 2005 @@ -152,6 +152,8 @@ auth.fullname = vpw->pw_gecos; auth.passwd = vpw->pw_passwd; auth.options = options; + auth.quota = vpw->pw_shell; + auth.clearpasswd = vpw->pw_clear_passwd; courier_authdebug_authinfo("DEBUG: authvchkpw: ", &auth, 0, vpw->pw_passwd); return ((*callback)(&auth, arg));