From: Marco Bettini Date: Wed, 1 Feb 2023 11:44:06 +0000 (+0000) Subject: auth: Use t_split_key_value_eq() X-Git-Tag: 2.4.0~3005 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9340a6eecb00d3f9db19051debbd5b0b6c5b4b9;p=thirdparty%2Fdovecot%2Fcore.git auth: Use t_split_key_value_eq() auth_user_fields_parse() use t_split_key_value_eq --- diff --git a/src/lib-auth-client/auth-master.c b/src/lib-auth-client/auth-master.c index 3f56dc3655..4a2f658325 100644 --- a/src/lib-auth-client/auth-master.c +++ b/src/lib-auth-client/auth-master.c @@ -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;