diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-02-16 08:45:06 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2005-02-16 08:45:06 +0000 |
commit | 3b4437ceabc197bc77be0da604d67494f4bd4ead (patch) | |
tree | d79d9b8059fd97a0bfb9bcb603b897e9eb8a5fa6 /imap4d | |
parent | c372551834214d37ab7e8de5a4aafb35bb2927a2 (diff) | |
download | mailutils-3b4437ceabc197bc77be0da604d67494f4bd4ead.tar.gz mailutils-3b4437ceabc197bc77be0da604d67494f4bd4ead.tar.bz2 |
(cb_validate): Provide normal authentication for PLAIN and LOGIN mechanisms.
Diffstat (limited to 'imap4d')
-rw-r--r-- | imap4d/auth_gsasl.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/imap4d/auth_gsasl.c b/imap4d/auth_gsasl.c index 61fe116ab..b012f49f7 100644 --- a/imap4d/auth_gsasl.c +++ b/imap4d/auth_gsasl.c @@ -1,5 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -192,10 +192,22 @@ cb_validate (Gsasl_session_ctx *ctx, const char *authentication_id, const char *password) { + int rc; + struct mu_auth_data *auth; char **username = gsasl_server_application_data_get (ctx); + *username = strdup (authentication_id ? authentication_id : authorization_id); - return GSASL_OK; + + auth_data = mu_get_auth_by_name (*username); + + if (auth_data == NULL) + return GSASL_AUTHENTICATION_ERROR; + + rc = mu_authenticate (auth, password); + mu_auth_data_free (auth); + + return rc == 0 ? GSASL_OK : GSASL_AUTHENTICATION_ERROR; } #define GSSAPI_SERVICE "imap" @@ -252,7 +264,7 @@ cb_retrieve (Gsasl_session_ctx *ctx, if (username && authentication_id) *username = strdup (authentication_id); - + return gsasl_md5pwd_get_password (gsasl_cram_md5_pwd, authentication_id, key, keylen); } |