]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client: auth-client-interface - Rename and move mechanism security flags
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 4 Mar 2023 21:38:01 +0000 (22:38 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 9 Oct 2025 08:41:22 +0000 (08:41 +0000)
Move to lib-sasl.

28 files changed:
src/auth/Makefile.am
src/auth/auth-request.c
src/auth/auth-sasl-mech-apop.c
src/auth/auth-sasl-mech-dovecot-token.c
src/auth/mech.c
src/auth/sasl-server-mech-anonymous.c
src/auth/sasl-server-mech-cram-md5.c
src/auth/sasl-server-mech-digest-md5.c
src/auth/sasl-server-mech-gssapi.c
src/auth/sasl-server-mech-login.c
src/auth/sasl-server-mech-oauth2.c
src/auth/sasl-server-mech-otp.c
src/auth/sasl-server-mech-plain.c
src/auth/sasl-server-mech-scram.c
src/auth/sasl-server-mech-winbind.c
src/auth/sasl-server-protected.h
src/auth/sasl-server.h
src/imap-urlauth-login/Makefile.am
src/imap-urlauth/Makefile.am
src/lib-auth-client/Makefile.am
src/lib-auth-client/auth-client-connection.c
src/lib-auth-client/auth-client-interface.h
src/lib-auth-client/auth-client.h
src/lib-login/Makefile.am
src/lib-sasl/Makefile.am
src/lib-sasl/sasl-common.h [new file with mode: 0644]
src/login-common/Makefile.am
src/login-common/sasl-server.c

index 43c522bf237d9ceef000e0ae551ce2e9f04769a9..23e111a6e3755987ce970932d4332f2e91b67c85 100644 (file)
@@ -39,6 +39,7 @@ pkglibexec_PROGRAMS = auth
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-auth \
+       -I$(top_srcdir)/src/lib-sasl \
        -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-test \
        -I$(top_srcdir)/src/lib-json \
index d7dbd259263a5fd1cf96cbf23a6563e4f2bf0e7e..68926c6285da13827415ee5e0173ba1c08b0fba9 100644 (file)
@@ -423,7 +423,7 @@ static bool
 auth_request_fail_on_nuls(struct auth_request *request,
                          const unsigned char *data, size_t data_size)
 {
-       if ((request->mech->flags & MECH_SEC_ALLOW_NULS) != 0)
+       if ((request->mech->flags & SASL_MECH_SEC_ALLOW_NULS) != 0)
                return FALSE;
        if (memchr(data, '\0', data_size) != NULL) {
                e_debug(request->mech_event, "Unexpected NUL in auth data");
index 1acf6df276c3cc03ffe6ee3e79f26b2367b27f86..894a18463f66ab03aefc5f2f4925d9f52365135c 100644 (file)
@@ -161,8 +161,8 @@ static struct auth_request *mech_apop_auth_new(void)
 const struct mech_module mech_apop = {
        .mech_name = "APOP",
 
-       .flags = MECH_SEC_PRIVATE | MECH_SEC_DICTIONARY | MECH_SEC_ACTIVE |
-                MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_PRIVATE | SASL_MECH_SEC_DICTIONARY |
+                SASL_MECH_SEC_ACTIVE | SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_VERIFY_RESPONSE,
 
        .auth_new = mech_apop_auth_new,
index 08815ac1062204781b1b189aa07954ed1905b77a..9b189e64c1bf15a8f9a4201fdecb7724a4cff8bf 100644 (file)
@@ -82,7 +82,7 @@ static struct auth_request *mech_dovecot_token_auth_new(void)
 const struct mech_module mech_dovecot_token = {
        .mech_name = "DOVECOT-TOKEN",
 
-       .flags = MECH_SEC_PRIVATE | MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_PRIVATE | SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_dovecot_token_auth_new,
index ba048ab14f75f56d698e1fda351a5be684c7c9d2..b2699d6f87519683e39c5b536afa1189a1a5cee3 100644 (file)
@@ -82,27 +82,27 @@ static void mech_register_add(struct mechanisms_register *reg,
        list = p_new(reg->pool, struct mech_module_list, 1);
        list->module = *mech;
 
-       if ((mech->flags & MECH_SEC_CHANNEL_BINDING) != 0)
+       if ((mech->flags & SASL_MECH_SEC_CHANNEL_BINDING) != 0)
                handshake = reg->handshake_cbind;
        else
                handshake = reg->handshake;
 
        str_printfa(handshake, "MECH\t%s", mech->mech_name);
-       if ((mech->flags & MECH_SEC_PRIVATE) != 0)
+       if ((mech->flags & SASL_MECH_SEC_PRIVATE) != 0)
                str_append(handshake, "\tprivate");
-       if ((mech->flags & MECH_SEC_ANONYMOUS) != 0)
+       if ((mech->flags & SASL_MECH_SEC_ANONYMOUS) != 0)
                str_append(handshake, "\tanonymous");
-       if ((mech->flags & MECH_SEC_PLAINTEXT) != 0)
+       if ((mech->flags & SASL_MECH_SEC_PLAINTEXT) != 0)
                str_append(handshake, "\tplaintext");
-       if ((mech->flags & MECH_SEC_DICTIONARY) != 0)
+       if ((mech->flags & SASL_MECH_SEC_DICTIONARY) != 0)
                str_append(handshake, "\tdictionary");
-       if ((mech->flags & MECH_SEC_ACTIVE) != 0)
+       if ((mech->flags & SASL_MECH_SEC_ACTIVE) != 0)
                str_append(handshake, "\tactive");
-       if ((mech->flags & MECH_SEC_FORWARD_SECRECY) != 0)
+       if ((mech->flags & SASL_MECH_SEC_FORWARD_SECRECY) != 0)
                str_append(handshake, "\tforward-secrecy");
-       if ((mech->flags & MECH_SEC_MUTUAL_AUTH) != 0)
+       if ((mech->flags & SASL_MECH_SEC_MUTUAL_AUTH) != 0)
                str_append(handshake, "\tmutual-auth");
-       if ((mech->flags & MECH_SEC_CHANNEL_BINDING) != 0)
+       if ((mech->flags & SASL_MECH_SEC_CHANNEL_BINDING) != 0)
                str_append(handshake, "\tchannel-binding");
        str_append_c(handshake, '\n');
 
index 87ee07e3f7dfc58776523e634dc42fc62d98ae7b..c83823242e4675d781efbe71ec1b9a7ccf5bbb97 100644 (file)
@@ -35,7 +35,7 @@ static struct auth_request *mech_anonymous_auth_new(void)
 const struct mech_module mech_anonymous = {
        .mech_name = "ANONYMOUS",
 
-       .flags = MECH_SEC_ANONYMOUS | MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_ANONYMOUS | SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_anonymous_auth_new,
index e98a8e08059a00eb13168a59dcbdeed4b51cd625..a5f0558965f92ef8961503f8229296beec36f455 100644 (file)
@@ -180,7 +180,7 @@ static struct auth_request *mech_cram_md5_auth_new(void)
 const struct mech_module mech_cram_md5 = {
        .mech_name = "CRAM-MD5",
 
-       .flags = MECH_SEC_DICTIONARY | MECH_SEC_ACTIVE,
+       .flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE,
        .passdb_need = MECH_PASSDB_NEED_VERIFY_RESPONSE,
 
        .auth_new = mech_cram_md5_auth_new,
index 2058e7fa54bd7b98c73824e744a7b700d3214d50..710f6994ab756d715b17e40143f1cec74841a201 100644 (file)
@@ -620,8 +620,8 @@ static struct auth_request *mech_digest_md5_auth_new(void)
 const struct mech_module mech_digest_md5 = {
        .mech_name = "DIGEST-MD5",
 
-       .flags = MECH_SEC_DICTIONARY | MECH_SEC_ACTIVE |
-               MECH_SEC_MUTUAL_AUTH,
+       .flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
+                SASL_MECH_SEC_MUTUAL_AUTH,
        .passdb_need = MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
 
        .auth_new = mech_digest_md5_auth_new,
index f6e2daccd11e78553db487f513fd41072a830682..20067559cb2adc490d1275f1cb09b6817718952e 100644 (file)
@@ -692,7 +692,7 @@ mech_gssapi_auth_free(struct auth_request *auth_request)
 const struct mech_module mech_gssapi = {
        .mech_name = "GSSAPI",
 
-       .flags = MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_gssapi_auth_new,
@@ -707,7 +707,7 @@ const struct mech_module mech_gssapi = {
 const struct mech_module mech_gssapi_spnego = {
        .mech_name = "GSS-SPNEGO",
 
-       .flags = MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_gssapi_auth_new,
index bfb095e3b8ee6d4e57d380851e7cf934b038937d..140a5e47f3180bf6f22f01435bc7834f91bff3b2 100644 (file)
@@ -64,7 +64,7 @@ static struct auth_request *mech_login_auth_new(void)
 const struct mech_module mech_login = {
        .mech_name = "LOGIN",
 
-       .flags = MECH_SEC_PLAINTEXT,
+       .flags = SASL_MECH_SEC_PLAINTEXT,
        .passdb_need = MECH_PASSDB_NEED_VERIFY_PLAIN,
 
        .auth_new = mech_login_auth_new,
index 8fad0aef6ea59c21df0a7e4fa44ccd9227b31fa5..3ccfc3a207ea6c271468c48085bf08a02fd6b38e 100644 (file)
@@ -310,7 +310,7 @@ const struct mech_module mech_oauthbearer = {
 
        /* while this does not transfer plaintext password,
           the token is still considered as password */
-       .flags = MECH_SEC_PLAINTEXT,
+       .flags = SASL_MECH_SEC_PLAINTEXT,
        .passdb_need = 0,
 
        .auth_new = mech_oauth2_auth_new,
@@ -322,7 +322,7 @@ const struct mech_module mech_oauthbearer = {
 const struct mech_module mech_xoauth2 = {
        .mech_name = "XOAUTH2",
 
-       .flags = MECH_SEC_PLAINTEXT,
+       .flags = SASL_MECH_SEC_PLAINTEXT,
        .passdb_need = 0,
 
        .auth_new = mech_oauth2_auth_new,
index 2e179c3c28733abeff951c2d3ed9fd82179a5166..6206300ac8fd63bc23ee2ca6cb6943a7a75461b5 100644 (file)
@@ -319,7 +319,8 @@ static void mech_otp_auth_free(struct auth_request *auth_request)
 const struct mech_module mech_otp = {
        .mech_name = "OTP",
 
-       .flags = MECH_SEC_DICTIONARY | MECH_SEC_ACTIVE | MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
+                SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_SET_CREDENTIALS,
 
        .auth_new = mech_otp_auth_new,
index 53c1a8299b293681471e65d891c98802e1f510e0..9b5740b3fc873eb184e10a2ec75ba106700a653a 100644 (file)
@@ -78,7 +78,7 @@ static struct auth_request *mech_plain_auth_new(void)
 const struct mech_module mech_plain = {
        .mech_name = "PLAIN",
 
-       .flags = MECH_SEC_PLAINTEXT | MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_PLAINTEXT | SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_VERIFY_PLAIN,
 
        .auth_new = mech_plain_auth_new,
index 15236e89fd1d18b104f0834c90b6479cc328080d..4baf20643f4047ad7f9fbc2d530f3838df9fe2ef 100644 (file)
@@ -227,7 +227,7 @@ static void mech_scram_auth_free(struct auth_request *auth_request)
 const struct mech_module mech_scram_sha1 = {
        .mech_name = "SCRAM-SHA-1",
 
-       .flags = MECH_SEC_MUTUAL_AUTH,
+       .flags = SASL_MECH_SEC_MUTUAL_AUTH,
        .passdb_need = MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
 
        .auth_new = mech_scram_sha1_auth_new,
@@ -239,7 +239,7 @@ const struct mech_module mech_scram_sha1 = {
 const struct mech_module mech_scram_sha1_plus = {
        .mech_name = "SCRAM-SHA-1-PLUS",
 
-       .flags = MECH_SEC_MUTUAL_AUTH | MECH_SEC_CHANNEL_BINDING,
+       .flags = SASL_MECH_SEC_MUTUAL_AUTH | SASL_MECH_SEC_CHANNEL_BINDING,
        .passdb_need = MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
 
        .auth_new = mech_scram_sha1_auth_new,
@@ -251,7 +251,7 @@ const struct mech_module mech_scram_sha1_plus = {
 const struct mech_module mech_scram_sha256 = {
        .mech_name = "SCRAM-SHA-256",
 
-       .flags = MECH_SEC_MUTUAL_AUTH,
+       .flags = SASL_MECH_SEC_MUTUAL_AUTH,
        .passdb_need = MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
 
        .auth_new = mech_scram_sha256_auth_new,
@@ -263,7 +263,7 @@ const struct mech_module mech_scram_sha256 = {
 const struct mech_module mech_scram_sha256_plus = {
        .mech_name = "SCRAM-SHA-256-PLUS",
 
-       .flags = MECH_SEC_MUTUAL_AUTH | MECH_SEC_CHANNEL_BINDING,
+       .flags = SASL_MECH_SEC_MUTUAL_AUTH | SASL_MECH_SEC_CHANNEL_BINDING,
        .passdb_need = MECH_PASSDB_NEED_LOOKUP_CREDENTIALS,
 
        .auth_new = mech_scram_sha256_auth_new,
index ed508a618418210f333c7488b4ff0b0b991de38a..86e96c101dc5779eb31f54773e3c2f1b16722ca8 100644 (file)
@@ -341,8 +341,8 @@ static struct auth_request *mech_winbind_spnego_auth_new(void)
 const struct mech_module mech_winbind_ntlm = {
        .mech_name = "NTLM",
 
-       .flags = MECH_SEC_DICTIONARY | MECH_SEC_ACTIVE |
-                MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_DICTIONARY | SASL_MECH_SEC_ACTIVE |
+                SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_winbind_ntlm_auth_new,
@@ -354,7 +354,7 @@ const struct mech_module mech_winbind_ntlm = {
 const struct mech_module mech_winbind_spnego = {
        .mech_name = "GSS-SPNEGO",
 
-       .flags = MECH_SEC_ALLOW_NULS,
+       .flags = SASL_MECH_SEC_ALLOW_NULS,
        .passdb_need = MECH_PASSDB_NEED_NOTHING,
 
        .auth_new = mech_winbind_spnego_auth_new,
index 0ea486de33b6ff81d2bfd26b4c1ae40900a52735..b7d8f741055fd1eb99aa961869451f2f27f5b53a 100644 (file)
@@ -11,7 +11,7 @@ struct auth_request;
 struct mech_module {
        const char *mech_name;
 
-       enum mech_security_flags flags;
+       enum sasl_mech_security_flags flags;
        enum mech_passdb_need passdb_need;
 
        struct auth_request *(*auth_new)(void);
index 0c153fe4a485e9549504fe661703fe6ab7ccd8f8..e45266310fc5a5b6b7750dddc8be84c1468bafe4 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "auth-client-interface.h"
 
+#include "sasl-common.h"
+
 enum mech_passdb_need {
        /* Mechanism doesn't need a passdb at all */
        MECH_PASSDB_NEED_NOTHING = 0,
index d44e24c488ba57e72c36f48044349becac06fa93..528dc50d6eb1d94bcfe5311a1e60d092c1c5a3f4 100644 (file)
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib-settings \
        -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-master \
+       -I$(top_srcdir)/src/lib-sasl \
        -I$(top_srcdir)/src/lib-login \
        -I$(top_srcdir)/src/lib-var-expand \
        $(BINARY_CFLAGS)
index 0b38db2ea97ae5ee0e764f3deb2790971a17cf63..72006656f932203b6afc520d2d1524f2f7d691e0 100644 (file)
@@ -6,6 +6,7 @@ pkglibexec_PROGRAMS = imap-urlauth imap-urlauth-worker
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-settings \
+       -I$(top_srcdir)/src/lib-sasl \
        -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-master \
        -I$(top_srcdir)/src/lib-login \
index 402b037294d52cebdbd32dbad9ab8f56dc3e525c..afb77b8cbe05e701ba6096d69be3425831e07bc6 100644 (file)
@@ -4,6 +4,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-master \
        -I$(top_srcdir)/src/lib-settings \
+       -I$(top_srcdir)/src/lib-sasl \
        -I$(top_srcdir)/src/lib-test \
        -I$(top_srcdir)/src/lib-var-expand
 
index 886dd3df91a60c6098e510f6cd8f4d99f76e1908..8e6bb8ab18350b88bc6c3a6c0ee398c39cc6ede6 100644 (file)
@@ -78,21 +78,21 @@ auth_server_input_mech(struct auth_client_connection *conn,
 
        for (args++; *args != NULL; args++) {
                if (strcmp(*args, "private") == 0)
-                       mech_desc.flags |= MECH_SEC_PRIVATE;
+                       mech_desc.flags |= SASL_MECH_SEC_PRIVATE;
                else if (strcmp(*args, "anonymous") == 0)
-                       mech_desc.flags |= MECH_SEC_ANONYMOUS;
+                       mech_desc.flags |= SASL_MECH_SEC_ANONYMOUS;
                else if (strcmp(*args, "plaintext") == 0)
-                       mech_desc.flags |= MECH_SEC_PLAINTEXT;
+                       mech_desc.flags |= SASL_MECH_SEC_PLAINTEXT;
                else if (strcmp(*args, "dictionary") == 0)
-                       mech_desc.flags |= MECH_SEC_DICTIONARY;
+                       mech_desc.flags |= SASL_MECH_SEC_DICTIONARY;
                else if (strcmp(*args, "active") == 0)
-                       mech_desc.flags |= MECH_SEC_ACTIVE;
+                       mech_desc.flags |= SASL_MECH_SEC_ACTIVE;
                else if (strcmp(*args, "forward-secrecy") == 0)
-                       mech_desc.flags |= MECH_SEC_FORWARD_SECRECY;
+                       mech_desc.flags |= SASL_MECH_SEC_FORWARD_SECRECY;
                else if (strcmp(*args, "mutual-auth") == 0)
-                       mech_desc.flags |= MECH_SEC_MUTUAL_AUTH;
+                       mech_desc.flags |= SASL_MECH_SEC_MUTUAL_AUTH;
                else if (strcmp(*args, "channel-binding") == 0)
-                       mech_desc.flags |= MECH_SEC_CHANNEL_BINDING;
+                       mech_desc.flags |= SASL_MECH_SEC_CHANNEL_BINDING;
        }
        array_push_back(&conn->available_auth_mechs, &mech_desc);
        return 0;
index 5e22e0805f6d0aa82be6cf05843ebefea24d5f59..1554409c4a7156162942549153f810d9feea35d1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef AUTH_CLIENT_INTERFACE_H
 #define AUTH_CLIENT_INTERFACE_H
 
+#include "sasl-common.h"
+
 /* Major version changes are not backwards compatible,
    minor version numbers can be ignored. */
 #define AUTH_CLIENT_PROTOCOL_MAJOR_VERSION 1
@@ -9,27 +11,6 @@
 /* GSSAPI can use quite large packets */
 #define AUTH_CLIENT_MAX_LINE_LENGTH 16384
 
-enum mech_security_flags {
-       /* Don't advertise this as available SASL mechanism (eg. APOP) */
-       MECH_SEC_PRIVATE                = 0x0001,
-       /* Anonymous authentication */
-       MECH_SEC_ANONYMOUS              = 0x0002,
-       /* Transfers plaintext passwords */
-       MECH_SEC_PLAINTEXT              = 0x0004,
-       /* Subject to passive (dictionary) attack */
-       MECH_SEC_DICTIONARY             = 0x0008,
-       /* Subject to active (non-dictionary) attack */
-       MECH_SEC_ACTIVE                 = 0x0010,
-       /* Provides forward secrecy between sessions */
-       MECH_SEC_FORWARD_SECRECY        = 0x0020,
-       /* Provides mutual authentication */
-       MECH_SEC_MUTUAL_AUTH            = 0x0040,
-       /* Allow NULs in input data */
-       MECH_SEC_ALLOW_NULS             = 0x0080,
-       /* Requires channel binding */
-       MECH_SEC_CHANNEL_BINDING        = 0x0100,
-};
-
 /* auth failure codes */
 #define AUTH_CLIENT_FAIL_CODE_AUTHZFAILED       "authz_fail"
 #define AUTH_CLIENT_FAIL_CODE_TEMPFAIL          "temp_fail"
index 00334a00775ed22a0ff58fc22d60f80faae2d0e6..b9ba31fc7931431cbc52a246bab4bccfdfda5c1d 100644 (file)
@@ -35,7 +35,7 @@ enum auth_request_status {
 
 struct auth_mech_desc {
        char *name;
-        enum mech_security_flags flags;
+        enum sasl_mech_security_flags flags;
 };
 
 struct auth_connect_id {
index c12e47d1ead5323911912fb3d76a98b0ac408d76..a92f6578686ff52b6bc9d6b825e933d510fab5f7 100644 (file)
@@ -5,6 +5,7 @@ noinst_LTLIBRARIES = liblogin.la
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-test \
+       -I$(top_srcdir)/src/lib-sasl \
        -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-master
 
index 295b8384ef2ba57038f209cb7963a28b312a2fdf..c6f69fc662a166a14e56a4791be9af6031ee6a4e 100644 (file)
@@ -21,6 +21,7 @@ libsasl_la_DEPENDENCIES = \
        ../lib-json/libjson.la
 
 headers = \
+       sasl-common.h \
        dsasl-client.h \
        dsasl-client-private.h
 
diff --git a/src/lib-sasl/sasl-common.h b/src/lib-sasl/sasl-common.h
new file mode 100644 (file)
index 0000000..210dfc5
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SASL_COMMON_H
+#define SASL_COMMON_H
+
+enum sasl_mech_security_flags {
+       /* Don't advertise this as available SASL mechanism (eg. APOP) */
+       SASL_MECH_SEC_PRIVATE           = 0x0001,
+       /* Anonymous authentication */
+       SASL_MECH_SEC_ANONYMOUS         = 0x0002,
+       /* Transfers plaintext passwords */
+       SASL_MECH_SEC_PLAINTEXT         = 0x0004,
+       /* Subject to passive (dictionary) attack */
+       SASL_MECH_SEC_DICTIONARY        = 0x0008,
+       /* Subject to active (non-dictionary) attack */
+       SASL_MECH_SEC_ACTIVE            = 0x0010,
+       /* Provides forward secrecy between sessions */
+       SASL_MECH_SEC_FORWARD_SECRECY   = 0x0020,
+       /* Provides mutual authentication */
+       SASL_MECH_SEC_MUTUAL_AUTH       = 0x0040,
+       /* Allow NULs in input data */
+       SASL_MECH_SEC_ALLOW_NULS        = 0x0080,
+       /* Requires channel binding */
+       SASL_MECH_SEC_CHANNEL_BINDING   = 0x0100,
+};
+
+#endif
index cd196ed59c92419b8417a8d09efe9738d3768c27..2999fa94a7892f7ccca7e73663a4f3c7c59faef4 100644 (file)
@@ -3,8 +3,8 @@ noinst_LTLIBRARIES = liblogin.la
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/lib \
        -I$(top_srcdir)/src/lib-settings \
-       -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-sasl \
+       -I$(top_srcdir)/src/lib-auth-client \
        -I$(top_srcdir)/src/lib-master \
        -I$(top_srcdir)/src/lib-login \
        -I$(top_srcdir)/src/lib-ssl-iostream \
index c1cfebf70cbbacb39cc981b828de473910ca7d7c..15cbdd6165868d579aa42eff0e285c4beeb32702 100644 (file)
@@ -41,11 +41,11 @@ sasl_server_filter_mech(struct client *client, struct auth_mech_desc *mech,
                return FALSE;
        /* Disable anonymous mechanisms unless the protocol explicitly
           allows anonymous login when configured. */
-       if ((mech->flags & MECH_SEC_ANONYMOUS) != 0 &&
+       if ((mech->flags & SASL_MECH_SEC_ANONYMOUS) != 0 &&
            !login_binary->anonymous_login_acceptable)
                return FALSE;
        /* Don't advertize private mechanisms. */
-       if (advertize && (mech->flags & MECH_SEC_PRIVATE) != 0)
+       if (advertize && (mech->flags & SASL_MECH_SEC_PRIVATE) != 0)
                return FALSE;
        /* Only advertize this mechanism if either:
           a) transport is secured
@@ -58,12 +58,12 @@ sasl_server_filter_mech(struct client *client, struct auth_mech_desc *mech,
        */
        if (advertize && !client->connection_secured &&
            !client->set->auth_allow_cleartext &&
-           (mech->flags & MECH_SEC_PLAINTEXT) != 0)
+           (mech->flags & SASL_MECH_SEC_PLAINTEXT) != 0)
                return FALSE;
        /* Disable mechanisms that require channel binding when there is no TLS
           layer (yet). */
        if (client->ssl_iostream == NULL &&
-           (mech->flags & MECH_SEC_CHANNEL_BINDING) != 0)
+           (mech->flags & SASL_MECH_SEC_CHANNEL_BINDING) != 0)
                return FALSE;
 
        return TRUE;
@@ -591,17 +591,17 @@ void sasl_server_auth_begin(struct client *client, const char *mech_name,
 
        mech = sasl_server_find_available_mech(client, mech_name);
        if (mech == NULL ||
-           ((mech->flags & MECH_SEC_PRIVATE) != 0 && !private)) {
+           ((mech->flags & SASL_MECH_SEC_PRIVATE) != 0 && !private)) {
                sasl_server_auth_failed(client,
                        "Unsupported authentication mechanism.",
                        AUTH_CLIENT_FAIL_CODE_MECH_INVALID);
                return;
        }
 
-       i_assert(!private || (mech->flags & MECH_SEC_PRIVATE) != 0);
+       i_assert(!private || (mech->flags & SASL_MECH_SEC_PRIVATE) != 0);
 
        if (!client->connection_secured && !client->set->auth_allow_cleartext &&
-           (mech->flags & MECH_SEC_PLAINTEXT) != 0) {
+           (mech->flags & SASL_MECH_SEC_PLAINTEXT) != 0) {
                client_notify_status(client, TRUE,
                         "cleartext authentication not allowed "
                         "without SSL/TLS, but your client did it anyway. "