]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Use t_split_key_value_eq()
authorMarco Bettini <marco.bettini@open-xchange.com>
Wed, 1 Feb 2023 11:44:06 +0000 (11:44 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Thu, 2 Feb 2023 14:13:03 +0000 (14:13 +0000)
auth_user_fields_parse() use t_split_key_value_eq

src/lib-auth-client/auth-master.c

index 3f56dc365564969c96cef53cccd95f07a489d064..4a2f65832566ebdd230a6109c8aba9eb817db004 100644 (file)
@@ -720,27 +720,28 @@ int auth_master_user_lookup(struct auth_master_connection *conn,
 int auth_user_fields_parse(const char *const *fields, pool_t pool,
                           struct auth_user_reply *reply_r, const char **error_r)
 {
-       const char *value;
-
        i_zero(reply_r);
        reply_r->uid = (uid_t)-1;
        reply_r->gid = (gid_t)-1;
        p_array_init(&reply_r->extra_fields, pool, 64);
 
        for (; *fields != NULL; fields++) {
-               if (str_begins(*fields, "uid=", &value)) {
+               const char *key, *value;
+               t_split_key_value_eq(*fields, &key, &value);
+
+               if (strcmp(key, "uid") == 0) {
                        if (str_to_uid(value, &reply_r->uid) < 0) {
                                *error_r = "Invalid uid in reply";
                                return -1;
                        }
-               } else if (str_begins(*fields, "gid=", &value)) {
+               } else if (strcmp(key, "gid") == 0) {
                        if (str_to_gid(value, &reply_r->gid) < 0) {
                                *error_r = "Invalid gid in reply";
                                return -1;
                        }
-               } else if (str_begins(*fields, "home=", &value))
+               } else if (strcmp(key, "home") == 0)
                        reply_r->home = p_strdup(pool, value);
-               else if (str_begins(*fields, "chroot=", &value))
+               else if (strcmp(key, "chroot") == 0)
                        reply_r->chroot = p_strdup(pool, value);
                else if (strcmp(*fields, "anonymous") == 0)
                        reply_r->anonymous = TRUE;