summaryrefslogtreecommitdiffstats
path: root/bus/config-parser.c
diff options
context:
space:
mode:
authorMatt McCutchen <matt@mattmccutchen.net>2008-11-10 08:55:27 -0500
committerColin Walters <walters@verbum.org>2008-11-10 08:55:27 -0500
commit0314e701c812565bd7bdac548cadfea5d310d66c (patch)
tree4fb55231397367d68cfbfe8f30a238c56cfcfff6 /bus/config-parser.c
parent14afa0564e9eea01d28d4b2fd1e6ac0bfec626e7 (diff)
Bug 18446: Keep umask for session bus
Signed-off-by: Colin Walters <walters@verbum.org>
Diffstat (limited to 'bus/config-parser.c')
-rw-r--r--bus/config-parser.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/bus/config-parser.c b/bus/config-parser.c
index f9e0b7d7..5bb34f17 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -111,6 +111,8 @@ struct BusConfigParser
unsigned int fork : 1; /**< TRUE to fork into daemon mode */
+ unsigned int keep_umask : 1; /**< TRUE to keep original umask when forking */
+
unsigned int is_toplevel : 1; /**< FALSE if we are a sub-config-file inside another one */
};
@@ -306,6 +308,9 @@ merge_included (BusConfigParser *parser,
if (included->fork)
parser->fork = TRUE;
+ if (included->keep_umask)
+ parser->keep_umask = TRUE;
+
if (included->pidfile != NULL)
{
dbus_free (parser->pidfile);
@@ -698,6 +703,21 @@ start_busconfig_child (BusConfigParser *parser,
return TRUE;
}
+ else if (element_type == ELEMENT_KEEP_UMASK)
+ {
+ if (!check_no_attributes (parser, "keep_umask", attribute_names, attribute_values, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_KEEP_UMASK) == NULL)
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ parser->keep_umask = TRUE;
+
+ return TRUE;
+ }
else if (element_type == ELEMENT_PIDFILE)
{
if (!check_no_attributes (parser, "pidfile", attribute_names, attribute_values, error))
@@ -1947,6 +1967,7 @@ bus_config_parser_end_element (BusConfigParser *parser,
case ELEMENT_ALLOW:
case ELEMENT_DENY:
case ELEMENT_FORK:
+ case ELEMENT_KEEP_UMASK:
case ELEMENT_SELINUX:
case ELEMENT_ASSOCIATE:
case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
@@ -2232,6 +2253,7 @@ bus_config_parser_content (BusConfigParser *parser,
case ELEMENT_ALLOW:
case ELEMENT_DENY:
case ELEMENT_FORK:
+ case ELEMENT_KEEP_UMASK:
case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
case ELEMENT_SELINUX:
@@ -2554,6 +2576,12 @@ bus_config_parser_get_fork (BusConfigParser *parser)
return parser->fork;
}
+dbus_bool_t
+bus_config_parser_get_keep_umask (BusConfigParser *parser)
+{
+ return parser->keep_umask;
+}
+
const char *
bus_config_parser_get_pidfile (BusConfigParser *parser)
{
@@ -2947,6 +2975,9 @@ config_parsers_equal (const BusConfigParser *a,
if (! bools_equal (a->fork, b->fork))
return FALSE;
+ if (! bools_equal (a->keep_umask, b->keep_umask))
+ return FALSE;
+
if (! bools_equal (a->is_toplevel, b->is_toplevel))
return FALSE;