On 12/10/2011 05:09 PM Pascal Volk wrote:
> … For now I've reverted changeset 499e4916bed5.

OK, I found the problem. You forgot to append the GID to the
var_expand_table before returning it. The attached patch works fine for me.

It also adds the short variable %g. I hope that's OK.


Regards,
Pascal
-- 
The trapper recommends today: [email protected]
# HG changeset patch
# User Pascal Volk <[email protected]>
# Date 1323535335 0
# Node ID 89f107e0121a9a53a5fdeb59c7536d1db12cab09
# Parent  51d87deb5c26b386287ced6dc76cb2260659e029
lib-storage: Added %g expansion to mail_user.
Also append the GID to the var_expand_table before returning it.

diff -r 51d87deb5c26 -r 89f107e0121a src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Sat Dec 10 10:59:30 2011 +0200
+++ b/src/lib-storage/mail-storage-service.c	Sat Dec 10 16:42:15 2011 +0000
@@ -541,6 +541,7 @@
 		{ 'r', NULL, "rip" },
 		{ 'p', NULL, "pid" },
 		{ 'i', NULL, "uid" },
+		{ 'g', NULL, "gid" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -557,6 +558,7 @@
 	tab[5].value = net_ip2addr(&input->remote_ip);
 	tab[6].value = my_pid;
 	tab[7].value = dec2str(geteuid());
+	tab[8].value = dec2str(getegid());
 	return tab;
 }
 
diff -r 51d87deb5c26 -r 89f107e0121a src/lib-storage/mail-user.c
--- a/src/lib-storage/mail-user.c	Sat Dec 10 10:59:30 2011 +0200
+++ b/src/lib-storage/mail-user.c	Sat Dec 10 16:42:15 2011 +0000
@@ -189,7 +189,7 @@
 		{ 'r', NULL, "rip" },
 		{ 'p', NULL, "pid" },
 		{ 'i', NULL, "uid" },
-		{ '\0', NULL, "gid" },
+		{ 'g', NULL, "gid" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -212,6 +212,7 @@
 		p_strdup(user->pool, net_ip2addr(user->remote_ip));
 	tab[7].value = my_pid;
 	tab[8].value = p_strdup(user->pool, dec2str(user->uid));
+	tab[9].value = p_strdup(user->pool, dec2str(user->gid));
 
 	user->var_expand_table = tab;
 	return user->var_expand_table;

Reply via email to