]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: sasl-server - Add sasl_server_find_available_mech().
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 9 Aug 2019 21:22:01 +0000 (23:22 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 13 Aug 2019 22:46:26 +0000 (00:46 +0200)
This is a wrapper for auth_client_find_mech(). This will be extended with
filtering in next commits.

src/login-common/sasl-server.c
src/login-common/sasl-server.h

index 57cba086cd7b501849a4c6194cb981904ca1d2ef..a84cbea759f7e3f7c98f4b42bb8d597a2d0d1f01 100644 (file)
@@ -60,6 +60,19 @@ sasl_server_get_advertised_mechs(struct client *client, unsigned int *count_r)
        return ret_mech;
 }
 
+const struct auth_mech_desc *
+sasl_server_find_available_mech(struct client *client ATTR_UNUSED,
+                               const char *name)
+{
+       const struct auth_mech_desc *mech;
+
+       mech = auth_client_find_mech(auth_client, name);
+       if (mech == NULL)
+               return NULL;
+
+       return mech;
+}
+
 static enum auth_request_flags
 client_get_auth_flags(struct client *client)
 {
@@ -397,7 +410,7 @@ void sasl_server_auth_begin(struct client *client,
        client->auth_anonymous = FALSE;
        client->sasl_callback = callback;
 
-       mech = auth_client_find_mech(auth_client, mech_name);
+       mech = sasl_server_find_available_mech(client, mech_name);
        if (mech == NULL) {
                sasl_server_auth_failed(client,
                        "Unsupported authentication mechanism.",
index bd5103ac00f0b9560443c1e10fdc5d3044fda9b3..c0acc11e71fc3ae26050c516ac8d28cbfe242abe 100644 (file)
@@ -17,6 +17,8 @@ typedef void sasl_server_callback_t(struct client *client,
 
 const struct auth_mech_desc *
 sasl_server_get_advertised_mechs(struct client *client, unsigned int *count_r);
+const struct auth_mech_desc *
+sasl_server_find_available_mech(struct client *client, const char *name);
 
 void sasl_server_auth_begin(struct client *client,
                            const char *service, const char *mech_name,