]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Remove %{uid}, %{gid}
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 23 Jan 2024 06:12:50 +0000 (08:12 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 31 Jan 2024 13:36:03 +0000 (15:36 +0200)
Should use %{process:uid} and %{process:gid}
in future.

src/lib-storage/mail-storage-service.c
src/lib-storage/mail-user.c

index 09bab67f4a04ab201dfdb117e7779f0ec932037c..42a34b2187b6ef9481f8c1405f147c6385b819f6 100644 (file)
@@ -307,15 +307,10 @@ static bool parse_gid(const char *str, gid_t *gid_r, const char **error_r)
 static const struct var_expand_table *
 get_var_expand_table(struct master_service *service,
                     struct mail_storage_service_user *user,
-                    const struct mail_storage_service_input *input,
-                    const struct mail_storage_service_privileges *priv)
+                    const struct mail_storage_service_input *input)
 {
        const char *username = t_strcut(input->username, '@');
        const char *domain = i_strchr_to_next(input->username, '@');
-       const char *uid = priv == NULL ? NULL :
-               dec2str(priv->uid == (uid_t)-1 ? geteuid() : priv->uid);
-       const char *gid = priv == NULL ? NULL :
-               dec2str(priv->gid == (gid_t)-1 ? getegid() : priv->gid);
        const char *local_name = NULL;
 
        const char *auth_user, *auth_username, *auth_domain;
@@ -341,8 +336,6 @@ get_var_expand_table(struct master_service *service,
                { 's', service_name, "service" },
                { 'l', net_ip2addr(&input->local_ip), "lip" },
                { 'r', net_ip2addr(&input->remote_ip), "rip" },
-               { 'i', uid, "uid" },
-               { '\0', gid, "gid" },
                { '\0', input->session_id, "session" },
                { '\0', auth_user, "auth_user" },
                { '\0', auth_username, "auth_username" },
@@ -365,12 +358,7 @@ const struct var_expand_table *
 mail_storage_service_get_var_expand_table(struct mail_storage_service_ctx *ctx,
                                          struct mail_storage_service_input *input)
 {
-       struct mail_storage_service_privileges priv;
-
-       i_zero(&priv);
-       priv.uid = (uid_t)-1;
-       priv.gid = (gid_t)-1;
-       return get_var_expand_table(ctx->service, NULL, input, &priv);
+       return get_var_expand_table(ctx->service, NULL, input);
 }
 
 static int
@@ -744,7 +732,7 @@ mail_storage_service_var_expand_callback(struct event *event,
 
        *tab_r = get_var_expand_table(var_expand_ctx->ctx->service,
                                      var_expand_ctx->user,
-                                     var_expand_ctx->input, NULL);
+                                     var_expand_ctx->input);
        *func_tab_r = mail_storage_service_var_expand_func_table;
 }
 
index 301c46a8890d99aa79c7f4d8feb364dedfa89bf7..47b9f321c70577263d5dc4a84251785e9140a917 100644 (file)
@@ -307,8 +307,6 @@ mail_user_var_expand_table(struct mail_user *user)
                { 's', user->service, "service" },
                { 'l', local_ip, "lip" },
                { 'r', remote_ip, "rip" },
-               { 'i', p_strdup(user->pool, dec2str(user->uid)), "uid" },
-               { '\0', p_strdup(user->pool, dec2str(user->gid)), "gid" },
                { '\0', user->session_id, "session" },
                { '\0', auth_user, "auth_user" },
                { '\0', auth_username, "auth_username" },