]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
var_expand(): Added %{uid} and %{gid} variables.
authorTimo Sirainen <tss@iki.fi>
Fri, 9 Dec 2011 16:57:53 +0000 (18:57 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 9 Dec 2011 16:57:53 +0000 (18:57 +0200)
src/lib/var-expand.c

index e39638f6f2bb9c8ac73429e0a39a04391607f6bf..1ffeeb215891eec055da6d0cf1148433d06ac9dc 100644 (file)
@@ -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 @@ var_expand_long(const struct var_expand_table *table,
                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)