]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Set error when field not found in auth_request_fields_var_expand_lookup()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 30 Jan 2025 12:37:46 +0000 (14:37 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:16 +0000 (12:34 +0200)
src/auth/auth-request.c

index e9adb5bee8756abfb0fe8a437096327aa96ad1fa..7ac368114e46dd6218a7d280302b9977e141d96c 100644 (file)
@@ -810,13 +810,13 @@ auth_request_fields_var_expand_lookup(const char *field_name, const char **value
 {
        struct auth_fields *fields = context;
 
-       if (fields != NULL) {
+       if (fields != NULL)
                *value_r = auth_fields_find(fields, field_name);
-               return 0;
-       } else {
+       if (fields == NULL || *value_r == NULL) {
                *error_r = t_strdup_printf("No such field '%s'", field_name);
                return -1;
        }
+       return 0;
 }
 
 int auth_request_set_passdb_fields(struct auth_request *request,