Commit graph

38 commits

Author SHA1 Message Date
282bc830ee agent: document unavoidable passphrase residue in eldbus message
The passphrase is copied into the libdbus-owned outbound message buffer
and freed asynchronously by eldbus after the reply is sent — we cannot
wipe it ourselves. Callers already explicit_bzero their own copies; add
a comment so future readers don't mistake the missing wipe here for an
oversight.
2026-04-29 15:00:13 +07:00
9a40d38ad8 hidden: wipe SSID buffer and entry on dialog close
Mirror the passphrase handling so the heap is consistent: explicit_bzero
the strdup'd SSID before free, and clear the SSID entry widget alongside
the passphrase entry. SSIDs aren't secret per se, but leaving identifiable
network names in freed memory after a hidden-network prompt is avoidable.
2026-04-29 14:59:53 +07:00
862594256a adapter: capture manager (not Iwd_Adapter) in Set(Powered) reply
On _on_name_vanished the adapter hash is freed, so an in-flight
Set(Powered) reply that lands as a local error after disconnect would
deref a freed Iwd_Adapter. Mirror the pattern already used in
iwd_network.c / iwd_device.c: capture the manager pointer plus a
strdup'd path in a small reply context, free in the reply callback.
2026-04-29 14:59:30 +07:00
438fffbacd popup: resolve forget target by netpath at click time
The confirmation popup captured Iwd_Network * raw, so if the network
disappeared from a scan refresh or iwd restart between opening the
dialog and clicking Forget, the click would UAF. Stash the object path
instead and re-resolve through the live network hash on click.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:57:09 +07:00
1d4d125a93 device: capture manager (not Iwd_Device) in reply contexts
A device can be removed (rfkill, hot-unplug, iwd restart) while a
Scan/Disconnect/ConnectHiddenNetwork/GetOrderedNetworks call is in
flight, after which the reply would dereference a freed Iwd_Device.
The manager outlives every sub-object and exposes the network hash
needed by GetOrderedNetworks, so pass it directly instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:56:35 +07:00
11b21c8fd9 network: capture manager (not Iwd_Network) in reply context
If a Connect or Forget reply arrives after the Iwd_Network was freed
(network disappeared from a scan, iwd vanished mid-call), the callback
would dereference ctx->n->manager — use-after-free. The manager outlives
every sub-object, so capture it directly along with a strdup'd SSID;
the network back-ref isn't actually used for anything else.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:55:27 +07:00
4b3598d36e build: pin UTF-8 input/exec charset
The sources contain UTF-8 string literals (signal bars, ✕, ★, ✔, …).
Without an explicit charset, GCC honors LC_ALL/LANG at compile time,
so a build under a non-UTF-8 locale can mangle them. Probe the flags
with cc.get_supported_arguments so older/other compilers stay happy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:52:49 +07:00
e7dd97d713 popup: set access_info on network and forget buttons
The button labels embed Unicode signal bars (▂▄▆█) and ★/✔ markers,
which screen readers announce as raw codepoints. Provide a spoken
label that conveys the same info as words.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:52:25 +07:00
480476f59d ui: remove unused wifi_list/wifi_status stubs
The popup builds its network list inline in e_mod_popup.c and shows
status via labels there; these stubs were never wired up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:51:53 +07:00
c115148f4a gadget: explicitly remove mouse-down callback on shutdown
evas_object_del would clean up the callback as a side effect, but
matching every add with an explicit del avoids relying on that ordering
and keeps the lifetime obvious to readers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:50:24 +07:00
ad3d752b12 iwd: extract shared state/security label helpers
Both popup.c and gadget.c carried near-identical _state_label/_sec_label
helpers, with the gadget version using bare ints instead of the
Iwd_Security enum. Move to iwd/iwd_labels.{c,h} and use the enum
consistently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:50:01 +07:00
b03d10b164 config: use E_FREE/eina_stringshare_replace on stale config
free() on memory returned by e_config_domain_load mixes allocators on
the stringshare member. Use eina_stringshare_replace to drop the
stringshared field and E_FREE for the struct.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:48:29 +07:00
92d4fbc5ff popup: UTF-8-aware SSID truncation
%.*s cuts at byte index, splitting multi-byte sequences and producing
broken glyphs followed by the ellipsis. Walk codepoints instead and
truncate at a codepoint boundary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:48:03 +07:00
4df3b04690 gadget: replace _theme_path static buffer with caller-provided one
Static buffers in identity-like helpers are footguns: they're only safe
when consumed immediately and break when callers ever stash the pointer.
Take a caller-provided buffer instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:46:49 +07:00
853e6ae454 popup: confirmation dialog before Forget
Forget destroys the saved passphrase irreversibly. A stray click on
the ✕ next to a known network would wipe credentials with no recovery
and (until the previous commit) no error feedback either. Add an
elm_popup confirmation that names the SSID before invoking Forget.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:30:33 +07:00
0418e8bab9 manager: surface D-Bus call errors to the user
Connect / Forget / Set(Powered) / Scan / Disconnect / RegisterAgent /
ConnectHidden previously discarded reply errors with NULL callbacks, so
"Connecting…" could hang forever after a refused call (rfkill, busy
adapter, another agent already registered, bad credentials on a known
network). The user had no way to see the failure.

Add iwd_manager_{report,last,clear}_error and wire reply callbacks in
adapter / device / network / agent. The popup status line now appends
the latest error to the state label, and user actions (rescan, toggle,
connect, disconnect) clear it.

Scan errors that mean "already in flight" are filtered out — they're
the normal race when two scan triggers fire close together.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:29:59 +07:00
3fc41eef8f agent: UnregisterAgent on free
Tell iwd to drop our registration during shutdown instead of relying
on NameOwnerChanged GC. Avoids spurious agent calls landing while the
service interface is being torn down. Fire-and-forget — the reply,
if any, is irrelevant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:26:25 +07:00
47d70ab78d gadget: stringshare gadcon id instead of static buffer
A static char[128] returned from _gc_id_new is overwritten on every
call, so multiple gadget instances would alias the same id once gadcon
compares or stores it. eina_stringshare_add gives each instance its
own stable id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:25:56 +07:00
0ab9561d2b security: wipe passphrases, bind hidden stash to SSID, re-register agent
Wipe passphrase memory in the auth and hidden-network dialogs (explicit_bzero
on owned copies plus overwriting the elm_entry buffer before destruction) so
secrets don't linger on the heap. Bind the hidden-network passphrase stash to
its SSID with a 30s timeout, so a typo'd or out-of-range hidden connect can't
leak its passphrase to an unrelated network whose RequestPassphrase happens
to land first. Re-RegisterAgent on iwd NameOwnerChanged so PSK connects
survive systemctl restart iwd instead of silently hanging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:24:45 +07:00
5844e2265e iwd_manager: coalesce notify into ecore_job to avoid UI freeze
In busy areas iwd emits hundreds of PropertiesChanged per second during
scans; each one synchronously rebuilt the popup list and froze the whole
compositor. Schedule a single job per main-loop tick instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 10:42:55 +07:00
7ef9b6d3bd README: comprehensive rewrite
Replaces the Phase 0 placeholder with a full project README covering
features, architecture, build/install, runtime requirements, usage,
configuration, and known gaps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:47:20 +07:00
c8076e830a gadget: signal-tier icon, tooltip, right-click settings menu
When connected, picks the icon from the active network's signal tier
(network-wireless-signal-{none,weak,ok,good,excellent}) instead of
hardcoding the excellent tier. Tooltip shows SSID/security/signal when
connected, or the current state otherwise. Right-click opens the
settings dialog via e_iwd_config_dialog_show.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:47:20 +07:00
dcec367acc config: implement settings dialog (E_Config_Dialog)
Adds the basic settings UI: auto-connect / show-hidden checkboxes,
signal refresh interval slider, preferred-adapter entry. Apply writes
into e_iwd_config and persists via e_iwd_config_save(). Hooked from
the gadget right-click menu in the next change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:47:20 +07:00
1cd214a1f5 popup: disconnect, forget, hidden + signal bars + agent cancel hook
Adds the long-missing user-visible affordances:
  - Disconnect button (visible while connected)
  - Per-row Forget (✕) button on known networks
  - Hidden... button + wifi_hidden_prompt → Station.ConnectHiddenNetwork,
    with one-shot passphrase pre-arming so the agent answers iwd
    automatically without re-prompting.
  - Signal-tier bars in network rows; sort prefers stronger signals
    within the same known/unknown class.
  - iwd Agent.Cancel now tears down any open auth dialog (cancel
    handler installed at module init via the new manager hook).

wifi_auth_prompt now returns the popup widget so the cancel path can
dismiss it externally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:47:20 +07:00
7c2ea76c63 ui/wifi_auth: surface security label in passphrase prompt
wifi_auth_prompt now takes an optional human-readable security string
("WPA", "WEP", ...) shown above the entry, so the user knows what kind
of credential is being asked for. Popup passes the network's security
type when issuing the prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:46:26 +07:00
dcf0fd00a0 ui: add wifi_hidden_prompt dialog
Modal SSID + optional passphrase prompt with the same callback shape as
wifi_auth_prompt. Used by the upcoming popup "Hidden..." button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:54 +07:00
9f2a9373aa iwd_agent: surface Cancel + stub EAP methods, expose cancel hook
iwd's Cancel(reason) now invokes a UI callback (registered via
iwd_manager_set_cancel_handler) so the popup can tear down an open
auth dialog. Stubbed RequestPrivateKeyPassphrase /
RequestUserNameAndPassword / RequestUserPassword to return Canceled
instead of leaving them unimplemented (which would unregister us).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
7a55d1da5a iwd: add iwd_device_connect_hidden via Station.ConnectHiddenNetwork
Async D-Bus call with error logged on failure. Backend support for the
upcoming Hidden Network UI affordance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
29ded04f10 iwd: track per-network signal strength via Station.GetOrderedNetworks
Adds Iwd_Network.signal_dbm/have_signal and a signal_tier helper, and
calls Station.GetOrderedNetworks on station attach and on scan
completion to populate them. Enables signal-aware UI affordances.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
6bc2975f06 strip debugging fprintfs and dead Device.Powered path
Drop the diagnostic logs added during adapter/scan/connect
debugging — the wire flow is now well-understood, so the noise
isn't worth keeping. Also delete iwd_device_set_powered (and the
adapter_obj/adapter_proxy fields it relied on); manager.set_powered
goes through Iwd_Adapter directly, so the device-side fallback is
unreachable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
a4199e15af Phase 5/6: log Connect failures + RPM spec
Network.Connect now uses an async reply callback so polkit /
authentication / iwd-side errors land on stderr instead of being
swallowed. Add a minimal RPM spec for packaging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
1b5dd32c0b manager: track Adapter objects + clear list on disable
Promote Adapter to a first-class manager object (Iwd_Adapter with
PropertiesChanged subscription). iwd_manager_set_powered now drives
the adapter directly, so Enable still works after Disable has torn
down the device hash. State recomputation also looks at any
powered adapter, and the popup hides the network list while
state == IWD_STATE_OFF.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
293a858799 Phase 4: persist module config via E_Config_DD
Versioned descriptor for E_Iwd_Config with auto_connect, show_hidden,
refresh_interval and preferred_adapter; load/save against the
"module.iwd" domain. Stale or missing config falls back to defaults.
The settings dialog UI is still a stub.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
e66a3effa6 Phase 3: popup UI with network list and passphrase dialog
e_gadcon_popup hosts a status label, a scrollable list of networks
(snapshotted from iwd_manager and sorted: connected → known → alpha),
and Rescan/Enable/Disable action buttons. Clicking a network calls
Network.Connect; iwd then asks our Agent for a passphrase, which is
routed to a modal elm_popup via iwd_manager_set_passphrase_handler.

The passphrase handler is installed at module init so iwd-initiated
auth works even when the popup is closed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
fcd4427de1 Phase 2: gadcon provider with state-driven icon
Register an "iwd" gadcon client; each instance carries an elm_icon
that swaps freedesktop standard names based on Iwd_State.
Click toggles the (still stubbed) popup. Listener on iwd_manager
refreshes every active instance on state changes.

E 0.27 only ships the legacy gadcon API (no e_gadget header), so
this targets gadcon for compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
6ea19e2252 Phase 1: register iwd Agent for passphrase prompts
Export net.connman.iwd.Agent at /net/eiwd/agent and register it via
AgentManager. RequestPassphrase replies are deferred so the UI can
prompt asynchronously; the manager exposes
iwd_manager_set_passphrase_handler for the UI layer to plug in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
73d17ff21c Phase 1: implement iwd D-Bus core
iwd_dbus watches net.connman.iwd name ownership, calls
GetManagedObjects, and dispatches InterfacesAdded/Removed to a
callback consumer. iwd_manager owns hashes of Iwd_Device and
Iwd_Network keyed by object path; sub-objects subscribe to their
PropertiesChanged signals via Eldbus and ping the manager so
listeners can refresh. Aggregated state (off/idle/scanning/
connecting/connected) is recomputed from the active station.

iwd_device exposes Powered toggle plus Station Scan/Disconnect.
iwd_network calls Network.Connect() (the iwd Agent will be wired
in next) and Forget via the referenced KnownNetwork object.

Builds against EFL 1.28 / Enlightenment 0.27.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00
b9eb5de878 Phase 0: scaffold e_iwd Enlightenment module
Meson build, module entry points, and stub layout for the iwd backend
(D-Bus client, gadget, popup, config, UI widgets). Bodies are TODOs;
this compiles against EFL/E headers but performs no D-Bus work yet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00