dovecot-1.2: auth: Added support for EXTERNAL SASL mechanism.
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 26 03:35:07 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/e3fe9b4a6a2d
changeset: 9079:e3fe9b4a6a2d
user: Timo Sirainen <tss at iki.fi>
date: Mon May 25 20:35:00 2009 -0400
description:
auth: Added support for EXTERNAL SASL mechanism.
diffstat:
2 files changed, 53 insertions(+)
src/auth/Makefile.am | 1
src/auth/mech-external.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
diffs (67 lines):
diff -r 76d455a7f4da -r e3fe9b4a6a2d src/auth/Makefile.am
--- a/src/auth/Makefile.am Mon May 25 20:33:42 2009 -0400
+++ b/src/auth/Makefile.am Mon May 25 20:35:00 2009 -0400
@@ -69,6 +69,7 @@ dovecot_auth_SOURCES = \
mech-login.c \
mech-cram-md5.c \
mech-digest-md5.c \
+ mech-external.c \
mech-gssapi.c \
mech-ntlm.c \
mech-otp.c \
diff -r 76d455a7f4da -r e3fe9b4a6a2d src/auth/mech-external.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/auth/mech-external.c Mon May 25 20:35:00 2009 -0400
@@ -0,0 +1,52 @@
+/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
+
+#include "common.h"
+#include "mech.h"
+#include "passdb.h"
+#include "plain-common.h"
+
+static void
+mech_external_auth_continue(struct auth_request *request,
+ const unsigned char *data, size_t data_size)
+{
+ const char *authzid, *error;
+
+ authzid = t_strndup(data, data_size);
+ if (request->user == NULL) {
+ auth_request_log_info(request, "external",
+ "username not known");
+ auth_request_fail(request);
+ } else if (*authzid != '\0' &&
+ !auth_request_set_login_username(request, authzid, &error)) {
+ /* invalid login username */
+ auth_request_log_info(request, "plain",
+ "login user: %s", error);
+ auth_request_fail(request);
+ } else {
+ auth_request_verify_plain(request, "",
+ plain_verify_callback);
+ }
+}
+
+static struct auth_request *mech_external_auth_new(void)
+{
+ struct auth_request *request;
+ pool_t pool;
+
+ pool = pool_alloconly_create("external_auth_request", 2048);
+ request = p_new(pool, struct auth_request, 1);
+ request->pool = pool;
+ return request;
+}
+
+const struct mech_module mech_external = {
+ "EXTERNAL",
+
+ MEMBER(flags) 0,
+ MEMBER(passdb_need) MECH_PASSDB_NEED_VERIFY_PLAIN,
+
+ mech_external_auth_new,
+ mech_generic_auth_initial,
+ mech_external_auth_continue,
+ mech_generic_auth_free
+};
More information about the dovecot-cvs
mailing list