summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bus/bus.c5
-rw-r--r--bus/config-parser-common.c6
-rw-r--r--bus/config-parser-common.h3
-rw-r--r--bus/config-parser.c24
4 files changed, 37 insertions, 1 deletions
diff --git a/bus/bus.c b/bus/bus.c
index e5733fec..42cc295f 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -55,6 +55,7 @@ struct BusContext
BusLimits limits;
unsigned int fork : 1;
unsigned int keep_umask : 1;
+ unsigned int allow_anonymous : 1;
};
static dbus_int32_t server_data_slot = -1;
@@ -189,6 +190,9 @@ new_connection_callback (DBusServer *server,
dbus_connection_set_max_message_size (new_connection,
context->limits.max_message_size);
+ dbus_connection_set_allow_anonymous (new_connection,
+ context->allow_anonymous);
+
/* on OOM, we won't have ref'd the connection so it will die. */
}
@@ -386,6 +390,7 @@ process_config_first_time_only (BusContext *context,
context->fork = bus_config_parser_get_fork (parser);
context->keep_umask = bus_config_parser_get_keep_umask (parser);
+ context->allow_anonymous = bus_config_parser_get_allow_anonymous (parser);
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
retval = TRUE;
diff --git a/bus/config-parser-common.c b/bus/config-parser-common.c
index 1e0f7f91..a12642c4 100644
--- a/bus/config-parser-common.c
+++ b/bus/config-parser-common.c
@@ -118,6 +118,10 @@ bus_config_parser_element_name_to_type (const char *name)
{
return ELEMENT_KEEP_UMASK;
}
+ else if (strcmp (name, "allow_anonymous") == 0)
+ {
+ return ELEMENT_ALLOW_ANONYMOUS;
+ }
return ELEMENT_NONE;
}
@@ -168,6 +172,8 @@ bus_config_parser_element_type_to_name (ElementType type)
return "associate";
case ELEMENT_KEEP_UMASK:
return "keep_umask";
+ case ELEMENT_ALLOW_ANONYMOUS:
+ return "allow_anonymous";
}
_dbus_assert_not_reached ("bad element type");
diff --git a/bus/config-parser-common.h b/bus/config-parser-common.h
index 01eb118b..ebdc3c95 100644
--- a/bus/config-parser-common.h
+++ b/bus/config-parser-common.h
@@ -48,7 +48,8 @@ typedef enum
ELEMENT_ASSOCIATE,
ELEMENT_STANDARD_SESSION_SERVICEDIRS,
ELEMENT_STANDARD_SYSTEM_SERVICEDIRS,
- ELEMENT_KEEP_UMASK
+ ELEMENT_KEEP_UMASK,
+ ELEMENT_ALLOW_ANONYMOUS
} ElementType;
ElementType bus_config_parser_element_name_to_type (const char *element_name);
diff --git a/bus/config-parser.c b/bus/config-parser.c
index 5bb34f17..64b8f6f1 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -114,6 +114,8 @@ struct BusConfigParser
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 */
+
+ unsigned int allow_anonymous : 1; /**< TRUE to allow anonymous connections */
};
static Element*
@@ -835,6 +837,20 @@ start_busconfig_child (BusConfigParser *parser,
return TRUE;
}
+ else if (element_type == ELEMENT_ALLOW_ANONYMOUS)
+ {
+ if (!check_no_attributes (parser, "allow_anonymous", attribute_names, attribute_values, error))
+ return FALSE;
+
+ if (push_element (parser, ELEMENT_ALLOW_ANONYMOUS) == NULL)
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ parser->allow_anonymous = TRUE;
+ return TRUE;
+ }
else if (element_type == ELEMENT_SERVICEDIR)
{
if (!check_no_attributes (parser, "servicedir", attribute_names, attribute_values, error))
@@ -1972,6 +1988,7 @@ bus_config_parser_end_element (BusConfigParser *parser,
case ELEMENT_ASSOCIATE:
case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
+ case ELEMENT_ALLOW_ANONYMOUS:
break;
}
@@ -2256,6 +2273,7 @@ bus_config_parser_content (BusConfigParser *parser,
case ELEMENT_KEEP_UMASK:
case ELEMENT_STANDARD_SESSION_SERVICEDIRS:
case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS:
+ case ELEMENT_ALLOW_ANONYMOUS:
case ELEMENT_SELINUX:
case ELEMENT_ASSOCIATE:
if (all_whitespace (content))
@@ -2582,6 +2600,12 @@ bus_config_parser_get_keep_umask (BusConfigParser *parser)
return parser->keep_umask;
}
+dbus_bool_t
+bus_config_parser_get_allow_anonymous (BusConfigParser *parser)
+{
+ return parser->allow_anonymous;
+}
+
const char *
bus_config_parser_get_pidfile (BusConfigParser *parser)
{