]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sasl: Add dsasl_client_mech_uses_password()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 21 Feb 2025 08:47:28 +0000 (10:47 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 27 Feb 2025 10:47:44 +0000 (12:47 +0200)
This indicates whether mechanism uses password at all.

src/lib-sasl/dsasl-client-private.h
src/lib-sasl/dsasl-client.c
src/lib-sasl/dsasl-client.h
src/lib-sasl/mech-external.c

index 9cc0ba9b113c8b6a9ab021ae9863b3888e149ca6..d1a617467868e8bf1d5dc9b5dac7f36f549c2488 100644 (file)
@@ -5,6 +5,7 @@
 
 enum dsasl_mech_security_flags {
        DSASL_MECH_SEC_ALLOW_NULS       = BIT(1),
+       DSASL_MECH_SEC_NO_PASSWORD      = BIT(2),
 };
 
 struct dsasl_client {
index 71d6bef957d35bf3729931b58c0657eed6dccccf..d1919505d05ac3cc93b7936da3b61390b83e7eba 100644 (file)
@@ -34,6 +34,11 @@ const char *dsasl_client_mech_get_name(const struct dsasl_client_mech *mech)
        return mech->name;
 }
 
+bool dsasl_client_mech_uses_password(const struct dsasl_client_mech *mech)
+{
+       return (mech->flags & DSASL_MECH_SEC_NO_PASSWORD) == 0;
+}
+
 void dsasl_client_mech_register(const struct dsasl_client_mech *mech)
 {
        unsigned int idx;
index 1b3a7fa8080b93ee21369787e81e4e8915770c9a..1fef8ba93b47d37d7f83de0c77342305a6d69b1d 100644 (file)
@@ -23,6 +23,7 @@ extern const struct dsasl_client_mech dsasl_client_mech_plain;
 
 const struct dsasl_client_mech *dsasl_client_mech_find(const char *name);
 const char *dsasl_client_mech_get_name(const struct dsasl_client_mech *mech);
+bool dsasl_client_mech_uses_password(const struct dsasl_client_mech *mech);
 
 struct dsasl_client *dsasl_client_new(const struct dsasl_client_mech *mech,
                                      const struct dsasl_client_settings *set);
index 7df94b4fd6c190ae5ff225bb4d8f5d219d69660d..2484f2d5146d9c0f20cbae1d0a32c2ed99161642 100644 (file)
@@ -53,6 +53,7 @@ mech_external_output(struct dsasl_client *_client,
 const struct dsasl_client_mech dsasl_client_mech_external = {
        .name = "EXTERNAL",
        .struct_size = sizeof(struct external_dsasl_client),
+       .flags = DSASL_MECH_SEC_NO_PASSWORD,
 
        .input = mech_external_input,
        .output = mech_external_output