]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sasl: mech-oauthbearer - Use container_of()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 21 Feb 2025 16:54:48 +0000 (17:54 +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 cf2725ce16402de85ba44fa8ce8ab5e04e841184..db756debf4650ccd5c61390fe3fd4e27d9f5b83d 100644 (file)
@@ -21,7 +21,7 @@ mech_oauthbearer_input(struct dsasl_client *_client,
                       const char **error_r)
 {
        struct oauthbearer_dsasl_client *client =
-               (struct oauthbearer_dsasl_client *)_client;
+               container_of(_client, struct oauthbearer_dsasl_client, client);
 
        if (!client->output_sent) {
                if (input_len > 0) {
@@ -93,7 +93,7 @@ mech_oauthbearer_output(struct dsasl_client *_client,
                        const char **error_r)
 {
        struct oauthbearer_dsasl_client *client =
-               (struct oauthbearer_dsasl_client *)_client;
+               container_of(_client, struct oauthbearer_dsasl_client, client);
        string_t *str;
 
        if (_client->set.authid == NULL) {
@@ -156,7 +156,7 @@ mech_oauthbearer_set_parameter(struct dsasl_client *_client, const char *key,
                               const char *value, const char **error_r)
 {
        struct oauthbearer_dsasl_client *client =
-               (struct oauthbearer_dsasl_client *)_client;
+               container_of(_client, struct oauthbearer_dsasl_client, client);
 
        if (strcmp(key, "host") == 0) {
                if (value != NULL)
@@ -182,7 +182,7 @@ mech_oauthbearer_get_result(struct dsasl_client *_client, const char *key,
                            const char **error_r ATTR_UNUSED)
 {
        struct oauthbearer_dsasl_client *client =
-               (struct oauthbearer_dsasl_client *)_client;
+               container_of(_client, struct oauthbearer_dsasl_client, client);
 
        if (strcmp(key, "status") == 0) {
                /* this is set to value after login attempt */