This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch nm-vpn-username-capture
in repository enlightenment.
View the commit online.
commit 98dd01665596b6571d6c7d0e285d95124a36cade
Author: [email protected] <[email protected]>
AuthorDate: Sun Jun 21 22:10:40 2026 -0600
networkmanager: key VPN username ops on UUID, add diagnostics
Connection names are not unique (repeated import/delete leaves duplicates),
making 'nmcli ... <name>' ambiguous for both the probe and the writer -- an
ambiguous query returns empty/garbled output so the post-import prompt never
fires. Parse the connection UUID from the import output and use it for the
probe and the +vpn.data write; query connection.id only for the dialog label.
Add INF logging across import -> probe -> dialog -> write to pinpoint where
the chain stops at runtime.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
---
.../networkmanager/e_networkmanager_import.c | 17 ++++---
.../networkmanager/e_networkmanager_vpn_username.c | 57 ++++++++++++++--------
2 files changed, 48 insertions(+), 26 deletions(-)
diff --git a/src/modules/networkmanager/e_networkmanager_import.c b/src/modules/networkmanager/e_networkmanager_import.c
index b17060edb..1fe67fa0b 100644
--- a/src/modules/networkmanager/e_networkmanager_import.c
+++ b/src/modules/networkmanager/e_networkmanager_import.c
@@ -141,16 +141,18 @@ _on_stdout(void *data, int type EINA_UNUSED, void *event)
return ECORE_CALLBACK_DONE;
}
-/* Parse `Connection 'NAME' (uuid) successfully added.` -> malloc'd NAME. */
+/* Parse `Connection 'NAME' (UUID) successfully added.` -> malloc'd UUID.
+ * The UUID (not the name) is returned because connection names are not
+ * unique, which makes later `nmcli ... <name>` operations ambiguous. */
static char *
-_import_parse_conn_name(const char *out)
+_import_parse_conn_uuid(const char *out)
{
const char *a, *b;
if (!out) return NULL;
- a = strchr(out, '\'');
+ a = strchr(out, '(');
if (!a) return NULL;
a++;
- b = strchr(a, '\'');
+ b = strchr(a, ')');
if (!b) return NULL;
return strndup(a, (size_t)(b - a));
}
@@ -174,11 +176,12 @@ _on_del(void *data, int type EINA_UNUSED, void *event)
Eina_Bool ok = (ev->exited && ev->exit_code == 0);
const char *stderr_text = eina_strbuf_string_get(ctx->stderr_buf);
- char *conn_name = ok ? _import_parse_conn_name(
+ char *conn_uuid = ok ? _import_parse_conn_uuid(
eina_strbuf_string_get(ctx->stdout_buf)) : NULL;
- ctx->done_cb(ctx->data, ok, stderr_text, conn_name);
- free(conn_name);
+ INF("VPN import done: ok=%d uuid=%s", ok, conn_uuid ?: "(none)");
+ ctx->done_cb(ctx->data, ok, stderr_text, conn_uuid);
+ free(conn_uuid);
_import_ctx_free(ctx);
return ECORE_CALLBACK_DONE;
diff --git a/src/modules/networkmanager/e_networkmanager_vpn_username.c b/src/modules/networkmanager/e_networkmanager_vpn_username.c
index 91611b70d..4aa8c3bbc 100644
--- a/src/modules/networkmanager/e_networkmanager_vpn_username.c
+++ b/src/modules/networkmanager/e_networkmanager_vpn_username.c
@@ -116,6 +116,7 @@ enm_vpn_username_set(const char *conn_name, const char *username,
"'%s' connection modify '%s' +vpn.data 'username=%s'",
esc_nmcli, esc_name, esc_user);
free(esc_nmcli); free(esc_name); free(esc_user);
+ INF("VPN username write: %s", cmd);
ctx = calloc(1, sizeof(*ctx));
if (!ctx) { if (cb) cb(data, EINA_FALSE); return; }
@@ -205,6 +206,7 @@ enm_vpn_username_dialog(const char *conn_name, const char *type_label,
Evas_Object *frame, *table, *label, *entry;
char header[160];
+ INF("VPN username dialog for '%s' (%s)", conn_name ?: "?", type_label ?: "?");
dialog = e_dialog_new(NULL, "E", "nm_vpn_username");
if (!dialog) { if (cb) cb(data, NULL); return; }
@@ -332,8 +334,10 @@ _probe_on_del(void *data, int type EINA_UNUSED, void *event)
{
Username_Probe_Ctx *ctx = data;
Ecore_Exe_Event_Del *ev = event;
- char *svc, *short_name, *conn_type, *username;
+ char *id = NULL, *svc = NULL, *conn_type = NULL, *username = NULL;
+ const char *short_name = NULL;
const char *blob;
+ Eina_Bool needed;
if (!ev || ev->exe != ctx->exe) return ECORE_CALLBACK_PASS_ON;
@@ -341,33 +345,44 @@ _probe_on_del(void *data, int type EINA_UNUSED, void *event)
if (ctx->h_del) ecore_event_handler_del(ctx->h_del);
blob = eina_strbuf_string_get(ctx->out);
- /* nmcli -g vpn.service-type,vpn.data prints service-type on line 1 and the
- * data list on line 2. */
- svc = NULL; conn_type = NULL; username = NULL;
+ /* Three lines: connection.id, vpn.service-type, then the vpn.data list. */
{
- const char *nl = strchr(blob, '\n');
- if (nl)
+ const char *l1 = blob;
+ const char *nl1 = strchr(l1, '\n');
+ if (nl1)
{
- svc = strndup(blob, (size_t)(nl - blob));
- conn_type = _nmcli_kv_find(nl + 1, "connection-type");
- username = _nmcli_kv_find(nl + 1, "username");
+ const char *l2 = nl1 + 1;
+ const char *nl2 = strchr(l2, '\n');
+ id = strndup(l1, (size_t)(nl1 - l1));
+ if (nl2)
+ {
+ const char *l3 = nl2 + 1;
+ svc = strndup(l2, (size_t)(nl2 - l2));
+ conn_type = _nmcli_kv_find(l3, "connection-type");
+ username = _nmcli_kv_find(l3, "username");
+ }
}
}
- short_name = NULL;
if (svc) { char *d = strrchr(svc, '.'); short_name = d ? d + 1 : svc; }
- if (enm_vpn_username_needed(short_name, conn_type, username))
+ needed = enm_vpn_username_needed(short_name, conn_type, username);
+ INF("VPN username probe result: id=%s svc=%s conn_type=%s username=%s "
+ "needed=%d (blob_len=%zu)",
+ id ?: "(null)", short_name ?: "(null)", conn_type ?: "(null)",
+ username ?: "(null)", (int)needed, strlen(blob));
+
+ if (needed)
{
- char *name_copy = strdup(ctx->conn_name);
- if (name_copy)
- enm_vpn_username_dialog(ctx->conn_name,
- short_name, /* type label: short name */
+ char *uuid_copy = strdup(ctx->conn_name); /* ctx->conn_name is the UUID */
+ if (uuid_copy)
+ enm_vpn_username_dialog(id ?: ctx->conn_name, /* display name */
+ short_name, /* type label */
username,
_probe_username_entered,
- name_copy);
+ uuid_copy);
}
- free(svc); free(conn_type); free(username);
+ free(id); free(svc); free(conn_type); free(username);
free(ctx->conn_name);
eina_strbuf_free(ctx->out);
free(ctx);
@@ -389,11 +404,15 @@ enm_vpn_username_maybe_prompt(const char *conn_name)
esc_name = _username_shell_escape(conn_name);
if (!esc_nmcli || !esc_name) { free(esc_nmcli); free(esc_name); return; }
- /* LC_ALL=C for stable, non-localized -g field output we parse below. */
+ /* Query by UUID (conn_name here is the connection UUID — unique, unlike the
+ * display name). LC_ALL=C for stable, non-localized -g output. Fields:
+ * line1 connection.id (display name), line2 service-type, line3 vpn.data. */
snprintf(cmd, sizeof(cmd),
- "LC_ALL=C '%s' -g vpn.service-type,vpn.data connection show '%s'",
+ "LC_ALL=C '%s' -g connection.id,vpn.service-type,vpn.data "
+ "connection show '%s'",
esc_nmcli, esc_name);
free(esc_nmcli); free(esc_name);
+ INF("VPN username probe: %s", cmd);
ctx = calloc(1, sizeof(*ctx));
if (!ctx) return;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.