Re: nm_setting_gsm_get_pin() retuns null

2011-10-09 Thread Anders Feder
I now have the attached diff. Any chance you can help me understand why 
it segfaults when I try running it? Thanks,


Anders Feder

On 05-10-2011 23:35, Dan Williams wrote:

On Wed, 2011-10-05 at 23:21 +0200, Anders Feder wrote:

Alternatively, can I simply request SimIdentifier from unlock_reply()
instead of gsm_device_added()? That way sim_id_reply() won't be invoked
unless unlock_reply() has already completed.

You could chain them together that way, yes, if you moved the stuff from
gsm_device_added() up into unlock_reply() where you get a successful
reply for DeviceIdentifier.

Dan


Anders Feder

On 05-10-2011 22:45, Dan Williams wrote:

On Wed, 2011-10-05 at 22:12 +0200, Anders Feder wrote:

Thanks for that thorough explanation. However, I wonder if there isn't a
race condition in that implementation: if we request all three
properties in gsm_device_added(), can we be certain that we have all of
them once we are in sim_id_reply()? Isn't there a risk that
sim_id_reply() might be called back before unlock_reply()?

Yes, a small risk.  This can be alleviated by doing some logic in both
functions and tracking in the 'info' struct whether we've gotten replies
for both the initial modem properties and the initial card properties,
and then only doing the unlock dialog when both of those are true AND
the other stuff I wrote was true, and doing that check from both places.
It just means more variables.

Dan


Anders Feder

On 03-10-2011 23:18, Dan Williams wrote:

On Mon, 2011-10-03 at 14:20 +0200, Anders Feder wrote:

Where would you propose the new code be added?

In the first iteration, I imagine it would work something like this:

If (UnlockRequired)
Get SimIdentifier
If (SimIdentifier is found)
Get PIN for SimIdentifier from keyring
If (PIN is found for SimIdentifier)
Try unlock using saved PIN
While (unlock failed)
Prompt user for new PIN
Try unlock using new PIN
If (unlock succeeded)
Save new PIN for SimIdentifier to keyring

If this works, a similar procedure could be applied for
DeviceIdentifier, if SimIdentifier is not found.

Is this the best approach?

Yeah, that's basically it.  So UnlockRequired and DeviceIdentifier are
both properties of the org.freedesktop.ModemManager.Modem interface, and
thus you can retrieve them both in the same D-Bus properties call using
GetAll().  For that, in src/applet-device-gsm.c's gsm_device_added()
function, where it calls the Get() method with UnlockRequired, what you
want to do is call GetAll instead and kill the UnlockRequired
argument.  Then in the unlock_reply() for the dbus_g_proxy_end_call()
you'll do something like:

GHashTable *props = NULL;

if (dbus_g_proxy_end_call (proxy, call,error,
  DBUS_TYPE_G_MAP_OF_VARIANT,props,
  G_TYPE_INVALID)) {
   GHashTableIter iter;
   const char *prop_name;
   GValue *value;

   g_hash_table_iter_init (iter, props);
   while (g_hash_table_iter_next (iter, (gpointer)prop_name, 
(gpointer)value)) {
   if ((strcmp (prop_name, UnlockRequired) == 0)
G_VALUE_HOLDS_STRING (value)) {
g_free (info-unlock_required);
   info-unlock_required = parse_unlock_required (value);
   }

   if ((strcmp (prop_name, DeviceIdentifier) == 0)
G_VALUE_HOLDS_STRING (value)) {
   g_free (info-devid);
   info-devid = g_value_dup_string (value);
   }
   }
}

That takes care of the UnlockRequired and DeviceIdentifier properties.
Now you need to get the SimIdentifier property, which is a GSM-specific
property (unlike UnlockRequired and DeviceIdentifier which are provided
for CDMA devices too).  For that you'll want to do something like this
in gsm_device_added():

dbus_g_proxy_begin_call (info-props_proxy, Get,
 sim_id_reply, info, NULL,
 G_TYPE_STRING, 
MM_DBUS_INTERFACE_MODEM_GSM_CARD,
 G_TYPE_STRING, SimIdentifier,
 G_TYPE_INVALID);

and then basically copypaste the current unlock_reply() function as
sim_id_reply(), fix up the property stuff there (obviously you're
handling the SimIdentifier property instead of UnlockRequired) and then
at the end of that function, you want something like this:

   if (info-unlock_required(info-simid || info-devid))
unlock_dialog_new (info-device, info);

which will actually do the unlock.  You dont' want to call
unlock_dialog_new() in unlock_reply() because you don't have the
SimIdentifier yet.

Then unlock_dialog_new() is where you'd query the keyring for existing
PINs using SimIdentifier as one of the attributes the PIN would be
stored with (using gnome_keyring_find_itemsv_sync()) and if there wasn't
any result try again with 

ifnet plugin documentation

2011-10-09 Thread Patrick McMunn
It looks like ifnet is a plugin specifically for Gentoo. See these links:

http://gitorious.org/gentoo-networkmanager-plugin/pages/Home
http://gitorious.org/gentoo-networkmanager-plugin/pages/Configuration
http://qiaomuf.wordpress.com/tag/ifnet/


 Hi,

 Where can I read documentation on the ifnet plugin? I don't see it
 documented in the man pages or the website[0]. Thanks in advance.

 David E. Narvaez

 [0] http://live.gnome.org/NetworkManager/SystemSettings
 ___
 networkmanager-list mailing list
 networkmanager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list


-- 
Patrick McMunn

- Learn more about the Catholic Faith: http://www.catholic.com/
- Pray with the Church: http://www.universalis.com/
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: ifnet plugin documentation

2011-10-09 Thread David Narvaez
On Sun, Oct 9, 2011 at 8:55 PM, Patrick McMunn doctorwho...@gmail.com wrote:

 It looks like ifnet is a plugin specifically for Gentoo. See these links:

 http://gitorious.org/gentoo-networkmanager-plugin/pages/Home
 http://gitorious.org/gentoo-networkmanager-plugin/pages/Configuration
 http://qiaomuf.wordpress.com/tag/ifnet/

Thanks! Just what I needed.

David E. Narváez
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list