Search code examples
javadbusnetworkmanager

simulating nmcli --ask in direct dbus control of networkmanager


I'm going through a Java software product and replacing exec() calls to nmcli with more direct control of NetworkManager via dbus. I've got stuck on nmcli connection up (ourconnection) --ask; specifically, the --ask bit of it.

I understand that it will be a call to ActivateConnection as described in the NetworkManager documentation but can't see how to emulate --ask. When you specify --ask, is it an option which NetworkManager takes and enacts, or is nmcli that asks for the password before passing it to NetworkManager?

This question is specifically about --ask; I understand in general how to interact with NetworkManager via dbus using Java classes obtained from the reflection API calls, and have been doing so to obtain lists of SSIDs, devices and connections, as well as setting-up handlers for signals such as AccessPointAdded; but I don't see how to tell NetworkManager, programmatically, to prompt the human user for a password.


Solution

  • For other reasons, I had to dig into the source code of nmcli and found that the password is being requested by nmcli and passed over dbus.