]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sasl: mech-oauthbearer - Use lib-auth/auth-gs2
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 21 Feb 2025 03:12:54 +0000 (04:12 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 2 Sep 2025 05:25:53 +0000 (05:25 +0000)
src/lib-sasl/mech-oauthbearer.c

index db756debf4650ccd5c61390fe3fd4e27d9f5b83d..9e92487962314460d2a5f3d9cebc65c5cdfbac11 100644 (file)
@@ -5,6 +5,7 @@
 #include "net.h"
 #include "json-istream.h"
 #include "istream.h"
+#include "auth-gs2.h"
 #include "dsasl-client-private.h"
 
 struct oauthbearer_dsasl_client {
@@ -105,9 +106,13 @@ mech_oauthbearer_output(struct dsasl_client *_client,
                return DSASL_CLIENT_RESULT_ERR_INTERNAL;
        }
 
-       str = str_new(_client->pool, 64);
+       struct auth_gs2_header gs2_header = {
+               .authzid = _client->set.authid,
+       };
 
-       str_printfa(str, "n,a=%s,\x01", _client->set.authid);
+       str = str_new(_client->pool, 64);
+       auth_gs2_header_encode(&gs2_header, str);
+       str_append_c(str, '\x01');
        if (client->host != NULL && *client->host != '\0')
                str_printfa(str, "host=%s\x01", client->host);
        if (client->port > 0)