[PATCH 1/3] cert: Try TLS format in l_cert_load_container_file
by Andrew Zaborowski
---
ell/cert.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/ell/cert.c b/ell/cert.c
index 14631b2..141ea1c 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -35,6 +35,8 @@
#include "pem-private.h"
#include "cert.h"
#include "cert-private.h"
+#include "tls.h"
+#include "tls-private.h"
#include "missing.h"
#define X509_CERTIFICATE_POS 0
@@ -1635,14 +1637,34 @@ LIB_EXPORT bool l_cert_load_container_file(const char *filename,
if (err != -ENOMSG)
goto close;
- /* Try PEM */
+ /* Try other formats */
+ }
+
+ /*
+ * For backwards compatibility try the TLS internal struct Certificate
+ * format as may be captured by PCAP (no future support guaranteed).
+ */
+ if (out_certchain && !password && file.st.st_size &&
+ tls_parse_certificate_list(file.data, file.st.st_size,
+ out_certchain) == 0) {
+ error = false;
+
+ if (out_privkey)
+ *out_privkey = NULL;
+
+ if (out_encrypted)
+ *out_encrypted = false;
+
+ goto close;
}
/*
* RFC 7486 allows whitespace and possibly other data before the
* PEM "encapsulation boundary" so rather than check if the start
* of the data looks like PEM, we fall back to this format if the
- * data didn't look like anything else we knew about.
+ * data didn't look like anything else we knew about. Note this
+ * succeeds for empty files and files without any PEM markers,
+ * returning NULL chain and privkey.
*/
if (cert_try_load_pem_format((const char *) file.data, file.st.st_size,
password, out_certchain, out_privkey,
--
2.27.0
1 year
[PATCH 1/2] settings: Add l_settings_add_group
by Andrew Zaborowski
l_settings_add_group creates a group in the l_settings object without
adding any key/value pairs to it.
---
ell/ell.sym | 1 +
ell/settings.c | 28 ++++++++++++++++++++++++++++
ell/settings.h | 2 ++
3 files changed, 31 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 229a2a6..5568ac2 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -443,6 +443,7 @@ global:
l_settings_set_debug;
l_settings_get_groups;
l_settings_has_group;
+ l_settings_add_group;
l_settings_get_keys;
l_settings_has_key;
l_settings_get_value;
diff --git a/ell/settings.c b/ell/settings.c
index 8db0942..3d3728c 100644
--- a/ell/settings.c
+++ b/ell/settings.c
@@ -866,6 +866,34 @@ static bool validate_group_name(const char *group_name)
return true;
}
+LIB_EXPORT bool l_settings_add_group(struct l_settings *settings,
+ const char *group_name)
+{
+ struct group_data *group;
+
+ if (unlikely(!settings || !group_name))
+ return false;
+
+ if (!validate_group_name(group_name)) {
+ l_util_debug(settings->debug_handler, settings->debug_data,
+ "Invalid group name %s", group_name);
+ return false;
+ }
+
+ group = l_queue_find(settings->groups, group_match, group_name);
+ if (group) {
+ l_util_debug(settings->debug_handler, settings->debug_data,
+ "Group %s exists", group_name);
+ return true;
+ }
+
+ group = l_new(struct group_data, 1);
+ group->name = l_strdup(group_name);
+ group->settings = l_queue_new();
+ l_queue_push_tail(settings->groups, group);
+ return true;
+}
+
static bool validate_key(const char *key)
{
int i;
diff --git a/ell/settings.h b/ell/settings.h
index f95ed9b..be92d29 100644
--- a/ell/settings.h
+++ b/ell/settings.h
@@ -54,6 +54,8 @@ char **l_settings_get_groups(const struct l_settings *settings);
char **l_settings_get_keys(const struct l_settings *settings,
const char *group_name);
+bool l_settings_add_group(struct l_settings *settings, const char *group_name);
+
bool l_settings_has_group(const struct l_settings *settings,
const char *group_name);
bool l_settings_has_key(const struct l_settings *settings,
--
2.27.0
1 year
[PATCH] tester: Remove timeout if pre-setup failed
by Inga Stotland
If test pre setup stage fails, remove test run timeout.
Also, fix a stray call to free(): should be l_free().
---
ell/tester.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ell/tester.c b/ell/tester.c
index 54fbb4b..7625b93 100644
--- a/ell/tester.c
+++ b/ell/tester.c
@@ -279,6 +279,9 @@ LIB_EXPORT void l_tester_pre_setup_failed(struct l_tester *tester)
print_progress(test->name, COLOR_RED, "pre setup failed");
+ l_timeout_remove(test->run_timer);
+ test->run_timer = NULL;
+
l_idle_oneshot(done_callback, tester, NULL);
}
@@ -501,7 +504,7 @@ static void wait_callback(struct l_timeout *timer, void *user_data)
wait->func(wait->user_data);
- free(wait);
+ l_free(wait);
l_timeout_remove(timer);
}
--
2.26.3
1 year
[PATCH] dbus: emit DBus.Introspectable for real objects only
by Arseny Maslennikov
From: Arseny Maslennikov <arseny(a)altlinux.org>
In a similar vein to GDBus, we now explicitly declare
org.freedesktop.DBus.Introspectable in the introspection output for
registered objects only, not for every node. This removes clutter from
introspection trees.
For example, if a service exports the following object paths on the bus:
* /org/freedesktop/LogControl1
* /org/bluez
* /org/bluez/hci0
then /org is now described in the introspection output as a node
containing two subnodes "bluez" and "freedesktop" and no interface
elements.
Inspection tools like d-feet only list the objects themselves, while
before this change they would uselessly list:
* /
* /org
* /org/bluez
* /org/bluez/hci0
* /org/freedesktop
* /org/freedesktop/LogControl1
We still conform to the spec by responding to
org.freedesktop.DBus.Introspectable.Introspect calls on every node — we
just don't advertise the interface in the xml response.
---
ell/dbus-service.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/ell/dbus-service.c b/ell/dbus-service.c
index 84fca3a..94afc14 100644
--- a/ell/dbus-service.c
+++ b/ell/dbus-service.c
@@ -1709,16 +1709,28 @@ void _dbus_object_tree_introspect(struct _dbus_object_tree *tree,
{
struct object_node *node;
struct child_node *child;
+ bool path_is_object = true;
node = l_hashmap_lookup(tree->objects, path);
- if (!node)
+ if (!node) {
+ path_is_object = false;
node = _dbus_object_tree_lookup(tree, path);
+ }
l_string_append(buf, XML_HEAD);
l_string_append(buf, "<node>\n");
if (node) {
- l_string_append(buf, static_introspectable);
+ /* We emit org.freedesktop.DBus.Introspectable only in case the
+ * object node corresponds to a registered object, i. e.
+ * exposes anything other than:
+ * - org.freedesktop.DBus.Introspectable
+ * - org.freedesktop.DBus.Peer
+ * - org.freedesktop.DBus.Properties
+ */
+ if (path_is_object)
+ l_string_append(buf, static_introspectable);
+
l_queue_foreach(node->instances,
generate_interface_instance, buf);
--
2.31.0
1 year
[PATCH] tester: Fix test timeout data
by Inga Stotland
When advancing to a next test case, create test timeout with the tester
instance as user data.
Also, remove stray debug printfs.
---
ell/tester.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/ell/tester.c b/ell/tester.c
index eedd66b..54fbb4b 100644
--- a/ell/tester.c
+++ b/ell/tester.c
@@ -131,18 +131,11 @@ static void teardown_callback(void *user_data)
struct l_tester *tester = user_data;
struct test_case *test;
- printf("teardown %p\n", tester->test_entry);
-
test = tester->test_entry->data;
- printf("teardown data %p\n", tester->test_entry->data);
test->stage = L_TESTER_STAGE_TEARDOWN;
test->teardown = false;
- printf("Test name %p\n", test->name);
- printf("Test name %s\n", test->name);
print_progress(test->name, COLOR_MAGENTA, "teardown");
- printf("teardown\n");
-
if (test->teardown_func)
test->teardown_func(test->test_data);
@@ -189,7 +182,7 @@ static void next_test_case(struct l_tester *tester)
if (test->timeout > 0)
test->run_timer = l_timeout_create(test->timeout, test_timeout,
- test, NULL);
+ tester, NULL);
test->stage = L_TESTER_STAGE_PRE_SETUP;
--
2.26.3
1 year, 1 month
[PATCH] build: Fix exported symbols (tester)
by Inga Stotland
---
ell/ell.sym | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ell/ell.sym b/ell/ell.sym
index 606513c..229a2a6 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -670,9 +670,9 @@ global:
l_tester_destroy;
l_tester_start;
l_tester_summarize;
- l_tester_test_add;
- l_tester_test_add_full;
- l_tester_test_get_stage;
+ l_tester_add;
+ l_tester_add_full;
+ l_tester_get_stage;
l_tester_get_data;
l_tester_pre_setup_complete;
l_tester_pre_setup_failed;
--
2.26.3
1 year, 1 month