popup: clear hidden passphrase stash on close and on radio-off

The pre-armed passphrase entered through the hidden-network dialog is
process-global, not popup-scoped. If the user closed the popup (or
toggled Wi-Fi off) before iwd asked for it, the passphrase sat in the
heap until the 30 s timer fired. Wipe it eagerly on _destroy() and
when state transitions to IWD_STATE_OFF.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-04-29 18:26:11 +07:00
commit d467231321

View file

@ -292,6 +292,9 @@ _refresh(Popup *p)
{
if (!p || !e_iwd || !e_iwd->manager) return;
Iwd_State s = iwd_manager_state(e_iwd->manager);
/* Radio went off: the stash can no longer be useful (iwd won't ask)
* and we'd rather not keep a passphrase resident across a toggle. */
if (s == IWD_STATE_OFF) _hidden_pending_clear();
if (p->status_lbl)
{
const char *err = iwd_manager_last_error(e_iwd->manager);
@ -467,6 +470,10 @@ _destroy(void)
if (_popup->gp) e_object_del(E_OBJECT(_popup->gp));
free(_popup);
_popup = NULL;
/* Drop any pre-armed hidden-network passphrase: if the user closes the
* popup before iwd asks, the stash would otherwise sit in the heap until
* the 30 s timer fires. The stash is process-global, not popup-scoped. */
_hidden_pending_clear();
}
void