summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhil Pennock <pdp@exim.org>2011-03-22 22:28:33 -0400
committerPhil Pennock <pdp@exim.org>2011-03-22 22:28:33 -0400
commit084c1d8c14da86888bbffc31a54246dc6e2e8147 (patch)
tree591a6edb04afa15883f5e5d1666bfcebaaaacfc5 /src
parentbdff9439baec7646a48684b8ddc0d50dd8fbffb3 (diff)
Avoid segfault on ref:name specified as uid.
If group not also specified, make this a fatal error. If group specified, we'll error out anyway unless the group can be resolved. Approach considered but not followed: fatal config error if built with ref:name where name is a number. fixes bug 1098
Diffstat (limited to 'src')
-rw-r--r--src/src/exim.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/src/exim.c b/src/src/exim.c
index 30974c9c6..528ffc7c8 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1414,7 +1414,19 @@ if (route_finduser(US EXIM_USERNAME, &pw, &exim_uid))
EXIM_USERNAME);
exit(EXIT_FAILURE);
}
- exim_gid = pw->pw_gid;
+ /* If ref:name uses a number as the name, route_finduser() returns
+ TRUE with exim_uid set and pw coerced to NULL. */
+ if (pw)
+ exim_gid = pw->pw_gid;
+#ifndef EXIM_GROUPNAME
+ else
+ {
+ fprintf(stderr,
+ "exim: ref:name should specify a usercode, not a group.\n"
+ "exim: can't let you get away with it unless you also specify a group.\n");
+ exit(EXIT_FAILURE);
+ }
+#endif
}
else
{