diff options
| author | Michael Biebl <biebl@debian.org> | 2022-02-14 19:24:33 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-02-14 19:24:33 +0100 |
| commit | 95864d59ac5530f59fe277580cc13f44b6de5b64 (patch) | |
| tree | 617239c0147c38efedf639d325cd56e8c7fb8be9 /src/nm-dispatcher | |
| parent | 1628eda029ba4dede8d4d45572c6b60367882436 (diff) | |
| parent | 2f94dba7385fd0e0ef19a06eb4a2fcf6c43d7946 (diff) | |
Update upstream source from tag 'upstream/1.35.91'
Update to upstream version '1.35.91' with Debian dir d8c1bf4c615814324dba64d19fe27402339c67f5
Diffstat (limited to 'src/nm-dispatcher')
| -rw-r--r-- | src/nm-dispatcher/nm-dispatcher-utils.c | 68 | ||||
| -rw-r--r-- | src/nm-dispatcher/nm-dispatcher-utils.h | 30 | ||||
| -rw-r--r-- | src/nm-dispatcher/nm-dispatcher.c | 82 | ||||
| -rw-r--r-- | src/nm-dispatcher/tests/test-dispatcher-envp.c | 146 |
4 files changed, 163 insertions, 163 deletions
diff --git a/src/nm-dispatcher/nm-dispatcher-utils.c b/src/nm-dispatcher/nm-dispatcher-utils.c index f754a3fa..74ea4e40 100644 --- a/src/nm-dispatcher/nm-dispatcher-utils.c +++ b/src/nm-dispatcher/nm-dispatcher-utils.c @@ -131,7 +131,7 @@ static void _items_add_printf(GPtrArray *items, const char *fmt, ...) { va_list ap; - char * line; + char *line; nm_assert(items); nm_assert(fmt); @@ -225,8 +225,8 @@ construct_ip_items(GPtrArray *items, int addr_family, GVariant *ip_config, const : G_VARIANT_TYPE("a(ayuay)")); if (val) { gs_unref_ptrarray GPtrArray *addresses = NULL; - gs_free char * gateway_free = NULL; - const char * gateway; + gs_free char *gateway_free = NULL; + const char *gateway; if (addr_family == AF_INET) addresses = nm_utils_ip4_addresses_from_variant(val, &gateway_free); @@ -346,12 +346,12 @@ construct_ip_items(GPtrArray *items, int addr_family, GVariant *ip_config, const static void construct_device_dhcp_items(GPtrArray *items, int addr_family, GVariant *dhcp_config) { - GVariantIter iter; - const char * key; - GVariant * val; - char four_or_six; - gboolean found_unknown_245 = FALSE; - gs_unref_variant GVariant *private_245_val = NULL; + GVariantIter iter; + const char *key; + GVariant *val; + char four_or_six; + gboolean found_unknown_245 = FALSE; + gs_unref_variant GVariant *private_245_val = NULL; if (!dhcp_config) return; @@ -415,34 +415,34 @@ construct_device_dhcp_items(GPtrArray *items, int addr_family, GVariant *dhcp_co /*****************************************************************************/ char ** -nm_dispatcher_utils_construct_envp(const char * action, - GVariant * connection_dict, - GVariant * connection_props, - GVariant * device_props, - GVariant * device_proxy_props, - GVariant * device_ip4_props, - GVariant * device_ip6_props, - GVariant * device_dhcp4_props, - GVariant * device_dhcp6_props, - const char * connectivity_state, - const char * vpn_ip_iface, - GVariant * vpn_proxy_props, - GVariant * vpn_ip4_props, - GVariant * vpn_ip6_props, - char ** out_iface, +nm_dispatcher_utils_construct_envp(const char *action, + GVariant *connection_dict, + GVariant *connection_props, + GVariant *device_props, + GVariant *device_proxy_props, + GVariant *device_ip4_props, + GVariant *device_ip6_props, + GVariant *device_dhcp4_props, + GVariant *device_dhcp6_props, + const char *connectivity_state, + const char *vpn_ip_iface, + GVariant *vpn_proxy_props, + GVariant *vpn_ip4_props, + GVariant *vpn_ip6_props, + char **out_iface, const char **out_error_message) { - const char * iface = NULL; - const char * ip_iface = NULL; - const char * uuid = NULL; - const char * id = NULL; - const char * path = NULL; - const char * filename = NULL; - gboolean external; - NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; - GVariant * variant; + const char *iface = NULL; + const char *ip_iface = NULL; + const char *uuid = NULL; + const char *id = NULL; + const char *path = NULL; + const char *filename = NULL; + gboolean external; + NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; + GVariant *variant; gs_unref_ptrarray GPtrArray *items = NULL; - const char * error_message_backup; + const char *error_message_backup; if (!out_error_message) out_error_message = &error_message_backup; diff --git a/src/nm-dispatcher/nm-dispatcher-utils.h b/src/nm-dispatcher/nm-dispatcher-utils.h index cb40d146..b9e9b2c1 100644 --- a/src/nm-dispatcher/nm-dispatcher-utils.h +++ b/src/nm-dispatcher/nm-dispatcher-utils.h @@ -6,21 +6,21 @@ #ifndef __NETWORKMANAGER_DISPATCHER_UTILS_H__ #define __NETWORKMANAGER_DISPATCHER_UTILS_H__ -char **nm_dispatcher_utils_construct_envp(const char * action, - GVariant * connection_dict, - GVariant * connection_props, - GVariant * device_props, - GVariant * device_proxy_props, - GVariant * device_ip4_props, - GVariant * device_ip6_props, - GVariant * device_dhcp4_props, - GVariant * device_dhcp6_props, - const char * connectivity_state, - const char * vpn_ip_iface, - GVariant * vpn_proxy_props, - GVariant * vpn_ip4_props, - GVariant * vpn_ip6_props, - char ** out_iface, +char **nm_dispatcher_utils_construct_envp(const char *action, + GVariant *connection_dict, + GVariant *connection_props, + GVariant *device_props, + GVariant *device_proxy_props, + GVariant *device_ip4_props, + GVariant *device_ip6_props, + GVariant *device_dhcp4_props, + GVariant *device_dhcp6_props, + const char *connectivity_state, + const char *vpn_ip_iface, + GVariant *vpn_proxy_props, + GVariant *vpn_ip4_props, + GVariant *vpn_ip6_props, + char **out_iface, const char **out_error_message); #endif /* __NETWORKMANAGER_DISPATCHER_UTILS_H__ */ diff --git a/src/nm-dispatcher/nm-dispatcher.c b/src/nm-dispatcher/nm-dispatcher.c index b29f5aca..aeecaa9b 100644 --- a/src/nm-dispatcher/nm-dispatcher.c +++ b/src/nm-dispatcher/nm-dispatcher.c @@ -35,7 +35,7 @@ typedef struct Request Request; typedef struct { GDBusConnection *dbus_connection; - GCancellable * quit_cancellable; + GCancellable *quit_cancellable; bool log_verbose; bool log_stdout; @@ -50,7 +50,7 @@ typedef struct { gboolean persist; Request *current_request; - GQueue * requests_waiting; + GQueue *requests_waiting; int num_requests_pending; bool exit_with_failure; @@ -67,23 +67,23 @@ GlobalData gl; typedef struct { Request *request; - char * script; + char *script; GPid pid; DispatchResult result; - char * error; + char *error; gboolean wait; gboolean dispatched; - GSource * watch_source; - GSource * timeout_source; + GSource *watch_source; + GSource *timeout_source; } ScriptInfo; struct Request { guint request_id; GDBusMethodInvocation *context; - char * action; - char * iface; - char ** envp; + char *action; + char *iface; + char **envp; gboolean debug; GPtrArray *scripts; /* list of ScriptInfo */ @@ -293,7 +293,7 @@ static void complete_request(Request *request) { GVariantBuilder results; - GVariant * ret; + GVariant *ret; guint i; nm_assert(request); @@ -397,7 +397,7 @@ complete_script(ScriptInfo *script) static void script_watch_cb(GPid pid, int status, gpointer user_data) { - ScriptInfo * script = user_data; + ScriptInfo *script = user_data; gs_free char *status_desc = NULL; g_assert(pid == script->pid); @@ -518,8 +518,8 @@ static gboolean script_dispatch(ScriptInfo *script) { gs_free_error GError *error = NULL; - char * argv[4]; - Request * request = script->request; + char *argv[4]; + Request *request = script->request; if (script->dispatched) return FALSE; @@ -596,10 +596,10 @@ _compare_basenames(gconstpointer a, gconstpointer b) static void _find_scripts(Request *request, GHashTable *scripts, const char *base, const char *subdir) { - const char * filename; + const char *filename; gs_free char *dirname = NULL; - GError * error = NULL; - GDir * dir; + GError *error = NULL; + GDir *dir; dirname = g_build_filename(base, "dispatcher.d", subdir, NULL); @@ -628,11 +628,11 @@ static GSList * find_scripts(Request *request) { gs_unref_hashtable GHashTable *scripts = NULL; - GSList * script_list = NULL; + GSList *script_list = NULL; GHashTableIter iter; - const char * subdir; - char * path; - char * filename; + const char *subdir; + char *path; + char *filename; if (NM_IN_STRSET(request->action, NMD_ACTION_PRE_UP, NMD_ACTION_VPN_PRE_UP)) subdir = "pre-up.d"; @@ -649,7 +649,7 @@ find_scripts(Request *request) g_hash_table_iter_init(&iter, scripts); while (g_hash_table_iter_next(&iter, (gpointer *) &filename, (gpointer *) &path)) { gs_free char *link_target = NULL; - const char * err_msg = NULL; + const char *err_msg = NULL; struct stat st; int err; @@ -681,7 +681,7 @@ script_must_wait(const char *path) link = g_file_read_link(path, NULL); if (link) { - gs_free char * dir = NULL; + gs_free char *dir = NULL; nm_auto_free char *real = NULL; if (!g_path_is_absolute(link)) { @@ -706,7 +706,7 @@ script_must_wait(const char *path) static void _handle_action(GDBusMethodInvocation *invocation, GVariant *parameters) { - const char * action; + const char *action; gs_unref_variant GVariant *connection = NULL; gs_unref_variant GVariant *connection_properties = NULL; gs_unref_variant GVariant *device_properties = NULL; @@ -715,18 +715,18 @@ _handle_action(GDBusMethodInvocation *invocation, GVariant *parameters) gs_unref_variant GVariant *device_ip6_config = NULL; gs_unref_variant GVariant *device_dhcp4_config = NULL; gs_unref_variant GVariant *device_dhcp6_config = NULL; - const char * connectivity_state; - const char * vpn_ip_iface; + const char *connectivity_state; + const char *vpn_ip_iface; gs_unref_variant GVariant *vpn_proxy_properties = NULL; gs_unref_variant GVariant *vpn_ip4_config = NULL; gs_unref_variant GVariant *vpn_ip6_config = NULL; gboolean debug; - GSList * sorted_scripts = NULL; - GSList * iter; - Request * request; - char ** p; + GSList *sorted_scripts = NULL; + GSList *iter; + Request *request; + char **p; guint i, num_nowait = 0; - const char * error_message = NULL; + const char *error_message = NULL; g_variant_get(parameters, "(" @@ -872,7 +872,7 @@ _handle_ping(GDBusMethodInvocation *invocation, GVariant *parameters) { gs_free char *msg = NULL; gint64 running_msec; - const char * arg_s; + const char *arg_s; g_variant_get(parameters, "(&s)", &arg_s); @@ -888,12 +888,12 @@ _handle_ping(GDBusMethodInvocation *invocation, GVariant *parameters) } static void -_bus_method_call(GDBusConnection * connection, - const char * sender, - const char * object_path, - const char * interface_name, - const char * method_name, - GVariant * parameters, +_bus_method_call(GDBusConnection *connection, + const char *sender, + const char *object_path, + const char *interface_name, + const char *method_name, + GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { @@ -955,9 +955,9 @@ _bus_register_service(void) static const GDBusInterfaceVTable interface_vtable = { .method_call = _bus_method_call, }; - gs_free_error GError * error = NULL; + gs_free_error GError *error = NULL; NMDBusConnectionCallBlockingData data = { - .result = NULL, + .result = NULL, }; gs_unref_variant GVariant *ret = NULL; guint32 ret_val; @@ -1185,8 +1185,8 @@ int main(int argc, char **argv) { gs_free_error GError *error = NULL; - GSource * source_term = NULL; - GSource * source_int = NULL; + GSource *source_term = NULL; + GSource *source_int = NULL; signal(SIGPIPE, SIG_IGN); source_term = diff --git a/src/nm-dispatcher/tests/test-dispatcher-envp.c b/src/nm-dispatcher/tests/test-dispatcher-envp.c index 8a24c426..f53bb1c1 100644 --- a/src/nm-dispatcher/tests/test-dispatcher-envp.c +++ b/src/nm-dispatcher/tests/test-dispatcher-envp.c @@ -24,7 +24,7 @@ _print_env(const char *const *denv, GHashTable *expected_env) { const char *const *iter; GHashTableIter k; - const char * key; + const char *key; g_print("\n******* Generated environment:\n"); for (iter = denv; iter && *iter; iter++) @@ -37,22 +37,22 @@ _print_env(const char *const *denv, GHashTable *expected_env) } static gboolean -parse_main(GKeyFile * kf, +parse_main(GKeyFile *kf, const char *filename, - GVariant ** out_con_dict, - GVariant ** out_con_props, - char ** out_expected_iface, - char ** out_action, - char ** out_connectivity_state, - char ** out_vpn_ip_iface, - GError ** error) + GVariant **out_con_dict, + GVariant **out_con_props, + char **out_expected_iface, + char **out_action, + char **out_connectivity_state, + char **out_vpn_ip_iface, + GError **error) { - nm_auto_clear_variant_builder GVariantBuilder props = {}; - gs_free char * uuid = NULL; - gs_free char * id = NULL; - gs_unref_object NMConnection *connection = NULL; - NMSettingConnection * s_con; - const char * s; + nm_auto_clear_variant_builder GVariantBuilder props = {}; + gs_free char *uuid = NULL; + gs_free char *id = NULL; + gs_unref_object NMConnection *connection = NULL; + NMSettingConnection *s_con; + const char *s; *out_expected_iface = g_key_file_get_string(kf, "main", "expected-iface", NULL); @@ -108,7 +108,7 @@ static gboolean parse_device(GKeyFile *kf, GVariant **out_device_props, GError **error) { nm_auto_clear_variant_builder GVariantBuilder props = {}; - gs_free char * tmp = NULL; + gs_free char *tmp = NULL; int i; g_variant_builder_init(&props, G_VARIANT_TYPE("a{sv}")); @@ -145,13 +145,13 @@ parse_device(GKeyFile *kf, GVariant **out_device_props, GError **error) } static gboolean -add_uint_array(GKeyFile * kf, +add_uint_array(GKeyFile *kf, GVariantBuilder *props, - const char * section, - const char * key, - GError ** error) + const char *section, + const char *key, + GError **error) { - gs_free char * tmp = NULL; + gs_free char *tmp = NULL; gs_free const char **split = NULL; gsize i; @@ -193,7 +193,7 @@ static gboolean parse_proxy(GKeyFile *kf, GVariant **out_props, const char *section, GError **error) { nm_auto_clear_variant_builder GVariantBuilder props = {}; - gs_free char * tmp = NULL; + gs_free char *tmp = NULL; g_variant_builder_init(&props, G_VARIANT_TYPE("a{sv}")); @@ -216,9 +216,9 @@ static gboolean parse_ip4(GKeyFile *kf, GVariant **out_props, const char *section, GError **error) { nm_auto_clear_variant_builder GVariantBuilder props = {}; - gs_free char * tmp = NULL; - gs_free const char ** split = NULL; - const char ** iter; + gs_free char *tmp = NULL; + gs_free const char **split = NULL; + const char **iter; g_variant_builder_init(&props, G_VARIANT_TYPE("a{sv}")); @@ -250,14 +250,14 @@ parse_ip4(GKeyFile *kf, GVariant **out_props, const char *section, GError **erro split = nm_strsplit_set_with_empty(tmp, ","); if (split) { gs_unref_ptrarray GPtrArray *addresses = NULL; - const char * gateway = NULL; + const char *gateway = NULL; addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref); for (iter = split; *iter; iter++) { - const char * s = *iter; + const char *s = *iter; NMIPAddress *addr; - const char * ip; - const char * prefix; + const char *ip; + const char *prefix; g_strstrip((char *) s); if (s[0] == '\0') @@ -298,7 +298,7 @@ parse_ip4(GKeyFile *kf, GVariant **out_props, const char *section, GError **erro routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref); for (iter = split; *iter; iter++) { const char *s = *iter; - NMIPRoute * route; + NMIPRoute *route; const char *dest; const char *prefix; const char *next_hop; @@ -344,8 +344,8 @@ static gboolean parse_dhcp(GKeyFile *kf, const char *group_name, GVariant **out_props, GError **error) { nm_auto_clear_variant_builder GVariantBuilder props = {}; - gs_strfreev char ** keys = NULL; - char ** iter; + gs_strfreev char **keys = NULL; + char **iter; keys = g_key_file_get_keys(kf, group_name, NULL, error); if (!keys) @@ -366,28 +366,28 @@ parse_dhcp(GKeyFile *kf, const char *group_name, GVariant **out_props, GError ** } static gboolean -get_dispatcher_file(const char * file, - GVariant ** out_con_dict, - GVariant ** out_con_props, - GVariant ** out_device_props, - GVariant ** out_device_proxy_props, - GVariant ** out_device_ip4_props, - GVariant ** out_device_ip6_props, - GVariant ** out_device_dhcp4_props, - GVariant ** out_device_dhcp6_props, - char ** out_connectivity_state, - char ** out_vpn_ip_iface, - GVariant ** out_vpn_proxy_props, - GVariant ** out_vpn_ip4_props, - GVariant ** out_vpn_ip6_props, - char ** out_expected_iface, - char ** out_action, +get_dispatcher_file(const char *file, + GVariant **out_con_dict, + GVariant **out_con_props, + GVariant **out_device_props, + GVariant **out_device_proxy_props, + GVariant **out_device_ip4_props, + GVariant **out_device_ip6_props, + GVariant **out_device_dhcp4_props, + GVariant **out_device_dhcp6_props, + char **out_connectivity_state, + char **out_vpn_ip_iface, + GVariant **out_vpn_proxy_props, + GVariant **out_vpn_ip4_props, + GVariant **out_vpn_ip6_props, + char **out_expected_iface, + char **out_action, GHashTable **out_env, - GError ** error) + GError **error) { nm_auto_unref_keyfile GKeyFile *kf = NULL; - gs_strfreev char ** keys = NULL; - char ** iter; + gs_strfreev char **keys = NULL; + char **iter; g_assert(!error || !*error); g_assert(out_con_dict && !*out_con_dict); @@ -465,29 +465,29 @@ get_dispatcher_file(const char * file, static void test_generic(const char *file, const char *override_vpn_ip_iface) { - gs_unref_variant GVariant *con_dict = NULL; - gs_unref_variant GVariant *con_props = NULL; - gs_unref_variant GVariant *device_props = NULL; - gs_unref_variant GVariant *device_proxy_props = NULL; - gs_unref_variant GVariant *device_ip4_props = NULL; - gs_unref_variant GVariant *device_ip6_props = NULL; - gs_unref_variant GVariant *device_dhcp4_props = NULL; - gs_unref_variant GVariant *device_dhcp6_props = NULL; - gs_free char * connectivity_change = NULL; - gs_free char * vpn_ip_iface = NULL; - gs_unref_variant GVariant *vpn_proxy_props = NULL; - gs_unref_variant GVariant *vpn_ip4_props = NULL; - gs_unref_variant GVariant *vpn_ip6_props = NULL; - gs_free char * expected_iface = NULL; - gs_free char * action = NULL; - gs_free char * out_iface = NULL; - const char * error_message = NULL; - gs_unref_hashtable GHashTable *expected_env = NULL; - GError * error = NULL; + gs_unref_variant GVariant *con_dict = NULL; + gs_unref_variant GVariant *con_props = NULL; + gs_unref_variant GVariant *device_props = NULL; + gs_unref_variant GVariant *device_proxy_props = NULL; + gs_unref_variant GVariant *device_ip4_props = NULL; + gs_unref_variant GVariant *device_ip6_props = NULL; + gs_unref_variant GVariant *device_dhcp4_props = NULL; + gs_unref_variant GVariant *device_dhcp6_props = NULL; + gs_free char *connectivity_change = NULL; + gs_free char *vpn_ip_iface = NULL; + gs_unref_variant GVariant *vpn_proxy_props = NULL; + gs_unref_variant GVariant *vpn_ip4_props = NULL; + gs_unref_variant GVariant *vpn_ip6_props = NULL; + gs_free char *expected_iface = NULL; + gs_free char *action = NULL; + gs_free char *out_iface = NULL; + const char *error_message = NULL; + gs_unref_hashtable GHashTable *expected_env = NULL; + GError *error = NULL; gboolean success; - gs_free char * filename = NULL; - gs_strfreev char ** denv = NULL; - char ** iter; + gs_free char *filename = NULL; + gs_strfreev char **denv = NULL; + char **iter; filename = g_build_filename(TEST_DIR, file, NULL); success = get_dispatcher_file(filename, |