dovecot-2.1: var_expand(): Added %{uid} and %{gid} variables.

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 9 18:58:04 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/8a63f621bd2e
changeset: 13833:8a63f621bd2e
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 09 18:57:53 2011 +0200
description:
var_expand(): Added %{uid} and %{gid} variables.

diffstat:

 src/lib/var-expand.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 5c2ef2374848 -r 8a63f621bd2e src/lib/var-expand.c
--- a/src/lib/var-expand.c	Fri Dec 09 17:49:13 2011 +0200
+++ b/src/lib/var-expand.c	Fri Dec 09 18:57:53 2011 +0200
@@ -11,6 +11,7 @@
 #include "var-expand.h"
 
 #include <stdlib.h>
+#include <unistd.h>
 #include <ctype.h>
 
 #define TABLE_LAST(t) \
@@ -160,6 +161,10 @@
 		case 3:
 			if (strcmp(key, "pid") == 0)
 				value = my_pid;
+			else if (strcmp(key, "uid") == 0)
+				value = dec2str(geteuid());
+			else if (strcmp(key, "gid") == 0)
+				value = dec2str(getegid());
 			break;
 		case 8:
 			if (strcmp(key, "hostname") == 0)


More information about the dovecot-cvs mailing list