diff options
Diffstat (limited to 'src/libnmc-base')
| -rw-r--r-- | src/libnmc-base/nm-client-utils.c | 38 | ||||
| -rw-r--r-- | src/libnmc-base/nm-client-utils.h | 12 | ||||
| -rw-r--r-- | src/libnmc-base/nm-polkit-listener.c | 104 | ||||
| -rw-r--r-- | src/libnmc-base/nm-secret-agent-simple.c | 206 | ||||
| -rw-r--r-- | src/libnmc-base/nm-secret-agent-simple.h | 12 | ||||
| -rw-r--r-- | src/libnmc-base/nm-vpn-helpers.c | 94 | ||||
| -rw-r--r-- | src/libnmc-base/nm-vpn-helpers.h | 10 | ||||
| -rw-r--r-- | src/libnmc-base/qrcodegen.c | 2 | ||||
| -rw-r--r-- | src/libnmc-base/qrcodegen.h | 2 |
9 files changed, 240 insertions, 240 deletions
diff --git a/src/libnmc-base/nm-client-utils.c b/src/libnmc-base/nm-client-utils.c index 49234d97..01b3df32 100644 --- a/src/libnmc-base/nm-client-utils.c +++ b/src/libnmc-base/nm-client-utils.c @@ -55,14 +55,14 @@ nmc_objects_sort_by_path(const NMObject *const *objs, gssize len) * If required, the resulting number is checked to be in the <min,max> range. */ static gboolean -nmc_string_to_uint_base(const char * str, +nmc_string_to_uint_base(const char *str, int base, gboolean range_check, unsigned long int min, unsigned long int max, unsigned long int *value) { - char * end; + char *end; unsigned long int tmp; if (!str || !str[0]) @@ -79,7 +79,7 @@ nmc_string_to_uint_base(const char * str, } gboolean -nmc_string_to_uint(const char * str, +nmc_string_to_uint(const char *str, gboolean range_check, unsigned long int min, unsigned long int max, @@ -130,10 +130,10 @@ nmc_string_to_bool(const char *str, gboolean *val_bool, GError **error) } gboolean -nmc_string_to_ternary_full(const char * str, +nmc_string_to_ternary_full(const char *str, NMCStringToTernaryFlags flags, - NMTernary * val, - GError ** error) + NMTernary *val, + GError **error) { gs_free char *str_to_free = NULL; int i; @@ -194,7 +194,7 @@ _nmc_string_is_valid(const char *input, const char *const *allowed, GError **err { const char *const *p; size_t input_ln, p_len; - const char * partial_match = NULL; + const char *partial_match = NULL; gboolean ambiguous = FALSE; g_return_val_if_fail(!error || !*error, NULL); @@ -324,7 +324,7 @@ nmc_device_state_to_string_with_external(NMDevice *device) { NMActiveConnection *ac; NMDeviceState state; - const char * s; + const char *s; state = nm_device_get_state(device); @@ -501,8 +501,8 @@ NM_UTILS_LOOKUP_STR_DEFINE( NMActiveConnectionState nmc_activation_get_effective_state(NMActiveConnection *active, - NMDevice * device, - const char ** reason) + NMDevice *device, + const char **reason) { NMActiveConnectionState ac_state; NMActiveConnectionStateReason ac_reason; @@ -569,7 +569,7 @@ can_show_utf8(void) { static gboolean can_show_utf8_set = FALSE; static gboolean can_show_utf8 = TRUE; - char * locale_str; + char *locale_str; if (G_LIKELY(can_show_utf8_set)) return can_show_utf8; @@ -763,12 +763,12 @@ nmc_utils_read_passwd_file(const char *passwd_file, gssize *out_error_line, GErr } GHashTable * -nmc_utils_parse_passwd_file(char * contents /* will be modified */, - gssize * out_error_line, +nmc_utils_parse_passwd_file(char *contents /* will be modified */, + gssize *out_error_line, GError **error) { gs_unref_hashtable GHashTable *pwds_hash = NULL; - const char * contents_str; + const char *contents_str; gsize contents_line; pwds_hash = @@ -781,11 +781,11 @@ nmc_utils_parse_passwd_file(char * contents /* will be modified */, while (contents_str[0]) { nm_auto_free_secret char *l_hash_key = NULL; nm_auto_free_secret char *l_hash_val = NULL; - const char * l_content_line; - const char * l_setting; - const char * l_prop; - const char * l_val; - const char * s; + const char *l_content_line; + const char *l_setting; + const char *l_prop; + const char *l_val; + const char *s; gsize l_hash_val_len; /* consume first line. As line delimiters we accept "\r\n", "\n", and "\r". */ diff --git a/src/libnmc-base/nm-client-utils.h b/src/libnmc-base/nm-client-utils.h index 1fc18aca..7d6ec707 100644 --- a/src/libnmc-base/nm-client-utils.h +++ b/src/libnmc-base/nm-client-utils.h @@ -17,7 +17,7 @@ const char *_nmc_string_is_valid(const char *input, const char *const *allowed, #define nmc_string_is_valid(input, allowed, error) \ _nmc_string_is_valid((input), NM_CAST_STRV_CC(allowed), (error)) -gboolean nmc_string_to_uint(const char * str, +gboolean nmc_string_to_uint(const char *str, gboolean range_check, unsigned long int min, unsigned long int max, @@ -29,10 +29,10 @@ typedef enum { NMC_STRING_TO_TERNARY_FLAGS_IGNORE_FOR_DEFAULT = (1LL << 0), } NMCStringToTernaryFlags; -gboolean nmc_string_to_ternary_full(const char * str, +gboolean nmc_string_to_ternary_full(const char *str, NMCStringToTernaryFlags flags, - NMTernary * val, - GError ** error); + NMTernary *val, + GError **error); static inline gboolean nmc_string_to_ternary(const char *str, NMTernary *val, GError **error) @@ -53,8 +53,8 @@ const char *nmc_device_reason_to_string(NMDeviceStateReason reason); const char *nmc_device_metered_to_string(NMMetered value); NMActiveConnectionState nmc_activation_get_effective_state(NMActiveConnection *active, - NMDevice * device, - const char ** reason); + NMDevice *device, + const char **reason); const char *nmc_wifi_strength_bars(guint8 strength); diff --git a/src/libnmc-base/nm-polkit-listener.c b/src/libnmc-base/nm-polkit-listener.c index 29c25b4e..39a06bc6 100644 --- a/src/libnmc-base/nm-polkit-listener.c +++ b/src/libnmc-base/nm-polkit-listener.c @@ -59,9 +59,9 @@ static guint signals[LAST_SIGNAL] = {0}; struct _NMPolkitListener { GObject parent; GDBusConnection *dbus_connection; - char * name_owner; - GCancellable * cancellable; - GMainContext * main_context; + char *name_owner; + GCancellable *cancellable; + GMainContext *main_context; CList request_lst_head; guint pk_auth_agent_reg_id; guint name_owner_changed_id; @@ -79,14 +79,14 @@ G_DEFINE_TYPE(NMPolkitListener, nm_polkit_listener, G_TYPE_OBJECT); typedef struct { CList request_lst; - NMPolkitListener * listener; - GSource * child_stdout_watch_source; - GSource * child_stdin_watch_source; + NMPolkitListener *listener; + GSource *child_stdout_watch_source; + GSource *child_stdin_watch_source; GDBusMethodInvocation *dbus_invocation; - char * action_id; - char * message; - char * username; - char * cookie; + char *action_id; + char *message; + char *username; + char *cookie; NMStrBuf in_buffer; NMStrBuf out_buffer; gsize out_buffer_offset; @@ -163,11 +163,11 @@ static char * choose_identity(GVariant *identities) { GVariantIter identity_iter; - GVariant * details_tmp; - const char * kind; + GVariant *details_tmp; + const char *kind; gs_free char *username_first = NULL; gs_free char *username_root = NULL; - const char * user; + const char *user; /* Choose identity. First try current user, then root, and else * take the first one we find. */ @@ -221,10 +221,10 @@ choose_identity(GVariant *identities) static void agent_register_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - NMPolkitListener *listener = NM_POLKIT_LISTENER(user_data); - GDBusConnection * dbus_connection = G_DBUS_CONNECTION(source_object); - gs_free_error GError *error = NULL; - gs_unref_variant GVariant *ret = NULL; + NMPolkitListener *listener = NM_POLKIT_LISTENER(user_data); + GDBusConnection *dbus_connection = G_DBUS_CONNECTION(source_object); + gs_free_error GError *error = NULL; + gs_unref_variant GVariant *ret = NULL; ret = g_dbus_connection_call_finish(dbus_connection, res, &error); @@ -242,9 +242,9 @@ agent_register_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) static void agent_register(NMPolkitListener *self, const char *session_id) { - const char * locale = NULL; + const char *locale = NULL; gs_unref_object NMAuthSubject *subject = NULL; - GVariant * subject_variant = NULL; + GVariant *subject_variant = NULL; locale = g_getenv("LANG"); if (locale == NULL) { @@ -277,7 +277,7 @@ static void agent_unregister(NMPolkitListener *self) { gs_unref_object NMAuthSubject *subject = NULL; - GVariant * subject_variant = NULL; + GVariant *subject_variant = NULL; subject = nm_auth_subject_new_unix_process_self(); subject_variant = nm_auth_subject_unix_to_polkit_gvariant(subject); @@ -299,14 +299,14 @@ agent_unregister(NMPolkitListener *self) static void retrieve_session_id_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { - NMPolkitListener * listener = NM_POLKIT_LISTENER(user_data); - char * session_id; - guint32 session_uid; - nm_auto_free_variant_iter GVariantIter *iter = NULL; - gs_unref_variant GVariant *ret = NULL; - gs_free_error GError *error = NULL; - gs_free char * err_str = NULL; - uid_t uid = getuid(); + NMPolkitListener *listener = NM_POLKIT_LISTENER(user_data); + char *session_id; + guint32 session_uid; + nm_auto_free_variant_iter GVariantIter *iter = NULL; + gs_unref_variant GVariant *ret = NULL; + gs_free_error GError *error = NULL; + gs_free char *err_str = NULL; + uid_t uid = getuid(); ret = g_dbus_connection_call_finish(listener->dbus_connection, res, &error); @@ -437,7 +437,7 @@ io_watch_have_data(int fd, GIOCondition condition, gpointer user_data) } while (TRUE) { - char * line_terminator; + char *line_terminator; const char *line; line = nm_str_buf_get_str(&request->in_buffer); @@ -568,12 +568,12 @@ get_request(NMPolkitListener *listener, const char *cookie) } static AuthRequest * -create_request(NMPolkitListener * listener, +create_request(NMPolkitListener *listener, GDBusMethodInvocation *invocation, - const char * action_id, - const char * message, - char * username_take, - const char * cookie) + const char *action_id, + const char *message, + char *username_take, + const char *cookie) { AuthRequest *request; @@ -596,20 +596,20 @@ create_request(NMPolkitListener * listener, } static void -dbus_method_call_cb(GDBusConnection * connection, - const char * sender, - const char * object_path, - const char * interface_name, - const char * method_name, - GVariant * parameters, +dbus_method_call_cb(GDBusConnection *connection, + const char *sender, + const char *object_path, + const char *interface_name, + const char *method_name, + GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { - NMPolkitListener *listener = NM_POLKIT_LISTENER(user_data); - const char * action_id; - const char * message; - const char * cookie; - AuthRequest * request; + NMPolkitListener *listener = NM_POLKIT_LISTENER(user_data); + const char *action_id; + const char *message; + const char *cookie; + AuthRequest *request; gs_unref_variant GVariant *identities_gvariant = NULL; if (nm_streq(method_name, "BeginAuthentication")) { @@ -724,15 +724,15 @@ name_owner_changed(NMPolkitListener *self, const char *name_owner) static void name_owner_changed_cb(GDBusConnection *connection, - const char * sender_name, - const char * object_path, - const char * interface_name, - const char * signal_name, - GVariant * parameters, + const char *sender_name, + const char *object_path, + const char *interface_name, + const char *signal_name, + GVariant *parameters, gpointer user_data) { NMPolkitListener *self = user_data; - const char * new_owner; + const char *new_owner; if (!g_variant_is_of_type(parameters, G_VARIANT_TYPE("(sss)"))) { return; @@ -829,7 +829,7 @@ static void dispose(GObject *object) { NMPolkitListener *self = NM_POLKIT_LISTENER(object); - AuthRequest * request; + AuthRequest *request; nm_clear_g_cancellable(&self->cancellable); diff --git a/src/libnmc-base/nm-secret-agent-simple.c b/src/libnmc-base/nm-secret-agent-simple.c index a3d5062d..5651a15b 100644 --- a/src/libnmc-base/nm-secret-agent-simple.c +++ b/src/libnmc-base/nm-secret-agent-simple.c @@ -34,12 +34,12 @@ typedef struct { NMSecretAgentSimple *self; - NMConnection * connection; - const char * setting_name; - char ** hints; + NMConnection *connection; + const char *setting_name; + char **hints; NMSecretAgentOldGetSecretsFunc callback; gpointer callback_data; - GCancellable * cancellable; + GCancellable *cancellable; NMSecretAgentGetSecretsFlags flags; } RequestData; @@ -54,7 +54,7 @@ static guint signals[LAST_SIGNAL] = {0}; typedef struct { GHashTable *requests; - char * path; + char *path; gboolean enabled; } NMSecretAgentSimplePrivate; @@ -88,12 +88,12 @@ _request_data_free(gpointer data) } static void -_request_data_complete(RequestData * request, - GVariant * secrets, - GError * error, +_request_data_complete(RequestData *request, + GVariant *secrets, + GError *error, GHashTableIter *iter_to_remove) { - NMSecretAgentSimple * self = request->self; + NMSecretAgentSimple *self = request->self; NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); nm_assert((secrets != NULL) != (error != NULL)); @@ -124,8 +124,8 @@ _request_data_complete(RequestData * request, typedef struct { NMSecretAgentSimpleSecret base; - NMSetting * setting; - char * property; + NMSetting *setting; + char *property; } SecretReal; static void @@ -145,11 +145,11 @@ _secret_real_free(NMSecretAgentSimpleSecret *secret) static NMSecretAgentSimpleSecret * _secret_real_new_plain(NMSecretAgentSecretType secret_type, - const char * pretty_name, - NMSetting * setting, - const char * property) + const char *pretty_name, + NMSetting *setting, + const char *property) { - SecretReal * real; + SecretReal *real; gs_free char *value = NULL; nm_assert(property); @@ -178,7 +178,7 @@ _secret_real_new_plain(NMSecretAgentSecretType secret_type, static NMSecretAgentSimpleSecret * _secret_real_new_vpn_secret(const char *pretty_name, - NMSetting * setting, + NMSetting *setting, const char *property, const char *vpn_type) { @@ -208,8 +208,8 @@ _secret_real_new_vpn_secret(const char *pretty_name, static NMSecretAgentSimpleSecret * _secret_real_new_wireguard_peer_psk(NMSettingWireGuard *s_wg, - const char * public_key, - const char * preshared_key) + const char *public_key, + const char *preshared_key) { SecretReal *real; @@ -238,8 +238,8 @@ _secret_real_new_wireguard_peer_psk(NMSettingWireGuard *s_wg, static gboolean add_8021x_secrets(RequestData *request, GPtrArray *secrets) { - NMSetting8021x * s_8021x = nm_connection_get_setting_802_1x(request->connection); - const char * eap_method; + NMSetting8021x *s_8021x = nm_connection_get_setting_802_1x(request->connection); + const char *eap_method; NMSecretAgentSimpleSecret *secret; /* If hints are given, then always ask for what the hints require */ @@ -301,7 +301,7 @@ add_wireless_secrets(RequestData *request, GPtrArray *secrets) { NMSettingWirelessSecurity *s_wsec = nm_connection_get_setting_wireless_security(request->connection); - const char * key_mgmt = nm_setting_wireless_security_get_key_mgmt(s_wsec); + const char *key_mgmt = nm_setting_wireless_security_get_key_mgmt(s_wsec); NMSecretAgentSimpleSecret *secret; if (!key_mgmt || nm_streq(key_mgmt, "owe")) @@ -350,7 +350,7 @@ add_wireless_secrets(RequestData *request, GPtrArray *secrets) static gboolean add_pppoe_secrets(RequestData *request, GPtrArray *secrets) { - NMSettingPppoe * s_pppoe = nm_connection_get_setting_pppoe(request->connection); + NMSettingPppoe *s_pppoe = nm_connection_get_setting_pppoe(request->connection); NMSecretAgentSimpleSecret *secret; secret = _secret_real_new_plain(NM_SECRET_AGENT_SECRET_TYPE_PROPERTY, @@ -375,7 +375,7 @@ static NMSettingSecretFlags get_vpn_secret_flags(NMSettingVpn *s_vpn, const char *secret_name) { NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; - GHashTable * vpn_data; + GHashTable *vpn_data; g_object_get(s_vpn, NM_SETTING_VPN_DATA, &vpn_data, NULL); nm_vpn_service_plugin_get_secret_flags(vpn_data, secret_name, &flags); @@ -385,10 +385,10 @@ get_vpn_secret_flags(NMSettingVpn *s_vpn, const char *secret_name) } static void -add_vpn_secret_helper(GPtrArray * secrets, +add_vpn_secret_helper(GPtrArray *secrets, NMSettingVpn *s_vpn, - const char * name, - const char * ui_name) + const char *name, + const char *ui_name) { NMSecretAgentSimpleSecret *secret; NMSettingSecretFlags flags; @@ -421,10 +421,10 @@ add_vpn_secret_helper(GPtrArray * secrets, static gboolean add_vpn_secrets(RequestData *request, GPtrArray *secrets, char **msg) { - NMSettingVpn * s_vpn = nm_connection_get_setting_vpn(request->connection); + NMSettingVpn *s_vpn = nm_connection_get_setting_vpn(request->connection); const NmcVpnPasswordName *p; - const char * vpn_msg = NULL; - char ** iter; + const char *vpn_msg = NULL; + char **iter; /* If hints are given, then always ask for what the hints require */ if (request->hints) { @@ -451,7 +451,7 @@ add_vpn_secrets(RequestData *request, GPtrArray *secrets, char **msg) static gboolean add_wireguard_secrets(RequestData *request, GPtrArray *secrets, char **msg, GError **error) { - NMSettingWireGuard * s_wg; + NMSettingWireGuard *s_wg; NMSecretAgentSimpleSecret *secret; guint i; @@ -479,8 +479,8 @@ add_wireguard_secrets(RequestData *request, GPtrArray *secrets, char **msg, GErr if (request->hints) { for (i = 0; request->hints[i]; i++) { NMWireGuardPeer *peer; - const char * name = request->hints[i]; - gs_free char * public_key = NULL; + const char *name = request->hints[i]; + gs_free char *public_key = NULL; if (nm_streq(name, NM_SETTING_WIREGUARD_PRIVATE_KEY)) continue; @@ -516,13 +516,13 @@ add_wireguard_secrets(RequestData *request, GPtrArray *secrets, char **msg, GErr typedef struct { GPid auth_dialog_pid; - GString * auth_dialog_response; - RequestData * request; - GPtrArray * secrets; - GCancellable * cancellable; + GString *auth_dialog_response; + RequestData *request; + GPtrArray *secrets; + GCancellable *cancellable; gulong cancellable_id; guint child_watch_id; - GInputStream * input_stream; + GInputStream *input_stream; GOutputStream *output_stream; char read_buf[5]; } AuthDialogData; @@ -544,16 +544,16 @@ _auth_dialog_data_free(AuthDialogData *data) static void _auth_dialog_exited(GPid pid, int status, gpointer user_data) { - AuthDialogData * data = user_data; - RequestData * request = data->request; - GPtrArray * secrets = data->secrets; - NMSettingVpn * s_vpn = nm_connection_get_setting_vpn(request->connection); + AuthDialogData *data = user_data; + RequestData *request = data->request; + GPtrArray *secrets = data->secrets; + NMSettingVpn *s_vpn = nm_connection_get_setting_vpn(request->connection); nm_auto_unref_keyfile GKeyFile *keyfile = NULL; - gs_strfreev char ** groups = NULL; - gs_free char * title = NULL; - gs_free char * message = NULL; + gs_strfreev char **groups = NULL; + gs_free char *title = NULL; + gs_free char *message = NULL; int i; - gs_free_error GError *error = NULL; + gs_free_error GError *error = NULL; data->child_watch_id = 0; @@ -646,9 +646,9 @@ _request_cancelled(GObject *object, gpointer user_data) static void _auth_dialog_read_done(GObject *source_object, GAsyncResult *res, gpointer user_data) { - GInputStream * auth_dialog_out = G_INPUT_STREAM(source_object); - AuthDialogData *data = user_data; - gssize read_size; + GInputStream *auth_dialog_out = G_INPUT_STREAM(source_object); + AuthDialogData *data = user_data; + gssize read_size; gs_free_error GError *error = NULL; read_size = g_input_stream_read_finish(auth_dialog_out, res, &error); @@ -684,7 +684,7 @@ _auth_dialog_read_done(GObject *source_object, GAsyncResult *res, gpointer user_ static void _auth_dialog_write_done(GObject *source_object, GAsyncResult *res, gpointer user_data) { - GOutputStream *auth_dialog_out = G_OUTPUT_STREAM(source_object); + GOutputStream *auth_dialog_out = G_OUTPUT_STREAM(source_object); _nm_unused gs_free char *auth_dialog_request_free = user_data; /* We don't care about write errors. If there are any problems, the @@ -732,20 +732,20 @@ _add_secret_to_string(const char *key, const char *value, gpointer user_data) static gboolean try_spawn_vpn_auth_helper(RequestData *request, GPtrArray *secrets) { - NMSettingVpn * s_vpn = nm_connection_get_setting_vpn(request->connection); + NMSettingVpn *s_vpn = nm_connection_get_setting_vpn(request->connection); gs_unref_ptrarray GPtrArray *auth_dialog_argv = NULL; - NMVpnPluginInfo * plugin_info; - const char * s; + NMVpnPluginInfo *plugin_info; + const char *s; GPid auth_dialog_pid; int auth_dialog_in_fd; int auth_dialog_out_fd; - GOutputStream * auth_dialog_in; - GInputStream * auth_dialog_out; - GError * error = NULL; - GString * auth_dialog_request; - gs_free char * auth_dialog_request_str = NULL; + GOutputStream *auth_dialog_in; + GInputStream *auth_dialog_out; + GError *error = NULL; + GString *auth_dialog_request; + gs_free char *auth_dialog_request_str = NULL; gsize auth_dialog_request_len; - AuthDialogData * data; + AuthDialogData *data; int i; plugin_info = nm_vpn_plugin_info_list_find_by_service(nm_vpn_get_plugin_infos(), @@ -845,11 +845,11 @@ static void request_secrets_from_ui(RequestData *request) { gs_unref_ptrarray GPtrArray *secrets = NULL; - gs_free_error GError * error = NULL; - NMSecretAgentSimplePrivate *priv; - NMSecretAgentSimpleSecret * secret; - const char * title; - gs_free char * msg = NULL; + gs_free_error GError *error = NULL; + NMSecretAgentSimplePrivate *priv; + NMSecretAgentSimpleSecret *secret; + const char *title; + gs_free char *msg = NULL; priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(request->self); g_return_if_fail(priv->enabled); @@ -869,8 +869,8 @@ request_secrets_from_ui(RequestData *request) if (nm_connection_is_type(request->connection, NM_SETTING_WIRELESS_SETTING_NAME)) { NMSettingWireless *s_wireless; - GBytes * ssid; - gs_free char * ssid_utf8 = NULL; + GBytes *ssid; + gs_free char *ssid_utf8 = NULL; s_wireless = nm_connection_get_setting_wireless(request->connection); ssid = nm_setting_wireless_get_ssid(s_wireless); @@ -1022,21 +1022,21 @@ out_fail_error: } static void -get_secrets(NMSecretAgentOld * agent, - NMConnection * connection, - const char * connection_path, - const char * setting_name, - const char ** hints, +get_secrets(NMSecretAgentOld *agent, + NMConnection *connection, + const char *connection_path, + const char *setting_name, + const char **hints, NMSecretAgentGetSecretsFlags flags, NMSecretAgentOldGetSecretsFunc callback, gpointer callback_data) { - NMSecretAgentSimple * self = NM_SECRET_AGENT_SIMPLE(agent); + NMSecretAgentSimple *self = NM_SECRET_AGENT_SIMPLE(agent); NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); - RequestData * request; - gs_free_error GError *error = NULL; - gs_free char * request_id = NULL; - const char * request_id_setting_name; + RequestData *request; + gs_free_error GError *error = NULL; + gs_free char *request_id = NULL; + const char *request_id_setting_name; request_id = g_strdup_printf("%s/%s", connection_path, setting_name); @@ -1097,14 +1097,14 @@ get_secrets(NMSecretAgentOld * agent, */ void nm_secret_agent_simple_response(NMSecretAgentSimple *self, - const char * request_id, - GPtrArray * secrets) + const char *request_id, + GPtrArray *secrets) { NMSecretAgentSimplePrivate *priv; - RequestData * request; - gs_unref_variant GVariant *secrets_dict = NULL; - gs_free_error GError *error = NULL; - int i; + RequestData *request; + gs_unref_variant GVariant *secrets_dict = NULL; + gs_free_error GError *error = NULL; + int i; g_return_if_fail(NM_IS_SECRET_AGENT_SIMPLE(self)); @@ -1117,9 +1117,9 @@ nm_secret_agent_simple_response(NMSecretAgentSimple *self, GVariantBuilder vpn_secrets_builder; GVariantBuilder wg_secrets_builder; GVariantBuilder wg_peer_builder; - GHashTable * settings; + GHashTable *settings; GHashTableIter iter; - const char * name; + const char *name; gboolean has_vpn = FALSE; gboolean has_wg = FALSE; @@ -1207,11 +1207,11 @@ nm_secret_agent_simple_response(NMSecretAgentSimple *self, static void cancel_get_secrets(NMSecretAgentOld *agent, const char *connection_path, const char *setting_name) { - NMSecretAgentSimple * self = NM_SECRET_AGENT_SIMPLE(agent); - NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); - gs_free_error GError *error = NULL; - gs_free char * request_id = NULL; - RequestData * request; + NMSecretAgentSimple *self = NM_SECRET_AGENT_SIMPLE(agent); + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); + gs_free_error GError *error = NULL; + gs_free char *request_id = NULL; + RequestData *request; request_id = g_strdup_printf("%s/%s", connection_path, setting_name); request = g_hash_table_lookup(priv->requests, &request_id); @@ -1229,9 +1229,9 @@ cancel_get_secrets(NMSecretAgentOld *agent, const char *connection_path, const c } static void -save_secrets(NMSecretAgentOld * agent, - NMConnection * connection, - const char * connection_path, +save_secrets(NMSecretAgentOld *agent, + NMConnection *connection, + const char *connection_path, NMSecretAgentOldSaveSecretsFunc callback, gpointer callback_data) { @@ -1240,9 +1240,9 @@ save_secrets(NMSecretAgentOld * agent, } static void -delete_secrets(NMSecretAgentOld * agent, - NMConnection * connection, - const char * connection_path, +delete_secrets(NMSecretAgentOld *agent, + NMConnection *connection, + const char *connection_path, NMSecretAgentOldDeleteSecretsFunc callback, gpointer callback_data) { @@ -1263,10 +1263,10 @@ delete_secrets(NMSecretAgentOld * agent, void nm_secret_agent_simple_enable(NMSecretAgentSimple *self, const char *path) { - NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); - gs_free RequestData **requests = NULL; - gsize i; - gs_free char * path_full = NULL; + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(self); + gs_free RequestData **requests = NULL; + gsize i; + gs_free char *path_full = NULL; /* The path is only used to match a request_id with the current * connection. Since the request_id is "${CONNECTION_PATH}/${SETTING}", @@ -1326,10 +1326,10 @@ nm_secret_agent_simple_new(const char *name) static void dispose(GObject *object) { - NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(object); - gs_free_error GError *error = NULL; - GHashTableIter iter; - RequestData * request; + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE(object); + gs_free_error GError *error = NULL; + GHashTableIter iter; + RequestData *request; g_hash_table_iter_init(&iter, priv->requests); while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &request)) { @@ -1356,7 +1356,7 @@ finalize(GObject *object) void nm_secret_agent_simple_class_init(NMSecretAgentSimpleClass *klass) { - GObjectClass * object_class = G_OBJECT_CLASS(klass); + GObjectClass *object_class = G_OBJECT_CLASS(klass); NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS(klass); object_class->dispose = dispose; diff --git a/src/libnmc-base/nm-secret-agent-simple.h b/src/libnmc-base/nm-secret-agent-simple.h index 878f9c75..7193f7e5 100644 --- a/src/libnmc-base/nm-secret-agent-simple.h +++ b/src/libnmc-base/nm-secret-agent-simple.h @@ -17,10 +17,10 @@ typedef enum { typedef struct { NMSecretAgentSecretType secret_type; - const char * pretty_name; - const char * entry_id; - char * value; - const char * vpn_type; + const char *pretty_name; + const char *entry_id; + char *value; + const char *vpn_type; bool is_secret : 1; bool no_prompt_entry_id : 1; } NMSecretAgentSimpleSecret; @@ -53,8 +53,8 @@ GType nm_secret_agent_simple_get_type(void); NMSecretAgentSimple *nm_secret_agent_simple_new(const char *name); void nm_secret_agent_simple_response(NMSecretAgentSimple *self, - const char * request_id, - GPtrArray * secrets); + const char *request_id, + GPtrArray *secrets); void nm_secret_agent_simple_enable(NMSecretAgentSimple *self, const char *path); diff --git a/src/libnmc-base/nm-vpn-helpers.c b/src/libnmc-base/nm-vpn-helpers.c index 99a69276..e2c0c394 100644 --- a/src/libnmc-base/nm-vpn-helpers.c +++ b/src/libnmc-base/nm-vpn-helpers.c @@ -25,8 +25,8 @@ NMVpnEditorPlugin * nm_vpn_get_editor_plugin(const char *service_type, GError **error) { - NMVpnEditorPlugin *plugin = NULL; - NMVpnPluginInfo * plugin_info; + NMVpnEditorPlugin *plugin = NULL; + NMVpnPluginInfo *plugin_info; gs_free_error GError *local = NULL; g_return_val_if_fail(service_type, NULL); @@ -95,8 +95,8 @@ nm_vpn_get_plugin_infos(void) gboolean nm_vpn_supports_ipv6(NMConnection *connection) { - NMSettingVpn * s_vpn; - const char * service_type; + NMSettingVpn *s_vpn; + const char *service_type; NMVpnEditorPlugin *plugin; guint32 capabilities; @@ -188,16 +188,16 @@ _extract_variable_value(char *line, const char *tag, char **value) gboolean nm_vpn_openconnect_authenticate_helper(const char *host, - char ** cookie, - char ** gateway, - char ** gwcert, - int * status, - GError ** error) + char **cookie, + char **gateway, + char **gwcert, + int *status, + GError **error) { - gs_free char * output = NULL; + gs_free char *output = NULL; gs_free const char **output_v = NULL; - const char *const * iter; - const char * path; + const char *const *iter; + const char *path; const char *const DEFAULT_PATHS[] = { "/sbin/", "/usr/sbin/", @@ -249,14 +249,14 @@ nm_vpn_openconnect_authenticate_helper(const char *host, } static gboolean -_wg_complete_peer(GPtrArray ** p_peers, +_wg_complete_peer(GPtrArray **p_peers, NMWireGuardPeer *peer_take, gsize peer_start_line_nr, - const char * filename, - GError ** error) + const char *filename, + GError **error) { - nm_auto_unref_wgpeer NMWireGuardPeer *peer = peer_take; - gs_free_error GError *local = NULL; + nm_auto_unref_wgpeer NMWireGuardPeer *peer = peer_take; + gs_free_error GError *local = NULL; if (!peer) return TRUE; @@ -330,37 +330,37 @@ nm_vpn_wireguard_import(const char *filename, GError **error) { nm_auto_clear_secret_ptr NMSecretPtr file_content = NM_SECRET_PTR_INIT(); char ifname[IFNAMSIZ]; - gs_free char * uuid = NULL; + gs_free char *uuid = NULL; gboolean ifname_valid = FALSE; - const char * cstr; - char * line_remainder; - gs_unref_object NMConnection *connection = NULL; - NMSettingConnection * s_con; - NMSettingIPConfig * s_ip4; - NMSettingIPConfig * s_ip6; - NMSettingWireGuard * s_wg; - gs_free_error GError *local = NULL; + const char *cstr; + char *line_remainder; + gs_unref_object NMConnection *connection = NULL; + NMSettingConnection *s_con; + NMSettingIPConfig *s_ip4; + NMSettingIPConfig *s_ip6; + NMSettingWireGuard *s_wg; + gs_free_error GError *local = NULL; enum { LINE_CONTEXT_INIT, LINE_CONTEXT_INTERFACE, LINE_CONTEXT_PEER, } line_context; - gsize line_nr; - gsize current_peer_start_line_nr = 0; - nm_auto_unref_wgpeer NMWireGuardPeer *current_peer = NULL; - gs_unref_ptrarray GPtrArray *data_dns_search = NULL; - gs_unref_ptrarray GPtrArray *data_dns_v4 = NULL; - gs_unref_ptrarray GPtrArray *data_dns_v6 = NULL; - gs_unref_ptrarray GPtrArray *data_addr_v4 = NULL; - gs_unref_ptrarray GPtrArray *data_addr_v6 = NULL; - gs_unref_ptrarray GPtrArray *data_peers = NULL; - const char * data_private_key = NULL; - gint64 data_table; - guint data_listen_port = 0; - guint data_fwmark = 0; - guint data_mtu = 0; - int is_v4; - guint i; + gsize line_nr; + gsize current_peer_start_line_nr = 0; + nm_auto_unref_wgpeer NMWireGuardPeer *current_peer = NULL; + gs_unref_ptrarray GPtrArray *data_dns_search = NULL; + gs_unref_ptrarray GPtrArray *data_dns_v4 = NULL; + gs_unref_ptrarray GPtrArray *data_dns_v6 = NULL; + gs_unref_ptrarray GPtrArray *data_addr_v4 = NULL; + gs_unref_ptrarray GPtrArray *data_addr_v6 = NULL; + gs_unref_ptrarray GPtrArray *data_peers = NULL; + const char *data_private_key = NULL; + gint64 data_table; + guint data_listen_port = 0; + guint data_fwmark = 0; + guint data_mtu = 0; + int is_v4; + guint i; g_return_val_if_fail(filename, NULL); g_return_val_if_fail(!error || !*error, NULL); @@ -420,8 +420,8 @@ nm_vpn_wireguard_import(const char *filename, GError **error) line_nr = 0; while (line_remainder[0] != '\0') { const char *matched_key = NULL; - char * value = NULL; - char * line; + char *value = NULL; + char *line; char ch; gint64 i64; @@ -742,9 +742,9 @@ fail_invalid_secret: const char *method_manual = is_v4 ? NM_SETTING_IP4_CONFIG_METHOD_MANUAL : NM_SETTING_IP6_CONFIG_METHOD_MANUAL; NMSettingIPConfig *s_ip = is_v4 ? s_ip4 : s_ip6; - GPtrArray * data_dns = is_v4 ? data_dns_v4 : data_dns_v6; - GPtrArray * data_addr = is_v4 ? data_addr_v4 : data_addr_v6; - GPtrArray * data_dns_search2 = data_dns_search; + GPtrArray *data_dns = is_v4 ? data_dns_v4 : data_dns_v6; + GPtrArray *data_addr = is_v4 ? data_addr_v4 : data_addr_v6; + GPtrArray *data_dns_search2 = data_dns_search; if (!data_addr) { /* When specifying "DNS", we also require an "Address" for the same address diff --git a/src/libnmc-base/nm-vpn-helpers.h b/src/libnmc-base/nm-vpn-helpers.h index 1cf06743..678ce1e2 100644 --- a/src/libnmc-base/nm-vpn-helpers.h +++ b/src/libnmc-base/nm-vpn-helpers.h @@ -20,11 +20,11 @@ gboolean nm_vpn_supports_ipv6(NMConnection *connection); const NmcVpnPasswordName *nm_vpn_get_secret_names(const char *service_type); gboolean nm_vpn_openconnect_authenticate_helper(const char *host, - char ** cookie, - char ** gateway, - char ** gwcert, - int * status, - GError ** error); + char **cookie, + char **gateway, + char **gwcert, + int *status, + GError **error); NMConnection *nm_vpn_wireguard_import(const char *filename, GError **error); diff --git a/src/libnmc-base/qrcodegen.c b/src/libnmc-base/qrcodegen.c index 0aacdb01..b86ca587 100644 --- a/src/libnmc-base/qrcodegen.c +++ b/src/libnmc-base/qrcodegen.c @@ -133,7 +133,7 @@ static const int PENALTY_N4 = 10; // Public function - see documentation comment in header file. bool -qrcodegen_encodeText(const char * text, +qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[], enum qrcodegen_Ecc ecl, diff --git a/src/libnmc-base/qrcodegen.h b/src/libnmc-base/qrcodegen.h index b91ae49a..46d986a3 100644 --- a/src/libnmc-base/qrcodegen.h +++ b/src/libnmc-base/qrcodegen.h @@ -158,7 +158,7 @@ struct qrcodegen_Segment { * - Please consult the QR Code specification for information on * data capacities per version, ECC level, and text encoding mode. */ -bool qrcodegen_encodeText(const char * text, +bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[], enum qrcodegen_Ecc ecl, |