1) Start synce-gnome/src/test.py
2) Set your device to require password
3) Plug your device to USB (or Bluetoot, not tested). Password dialog appears.
4) Press Cancel button (or press escape key).

What happens: The dialog disappears and appears again.
What should happen: The dialog should disappear and not reappear.

Attached patch fixes this behavior.

I did not find (by searching docs, sources and asking people) why
CeDevice instances react on PasswordFlagsChanged D-Bus event, so I
removed subscription to this event. Testing did not reveal situation
when device would cause odccm to send PasswordFlagsChanged, except for
plugging it in.

(Some background: I spent full day peeking though odccm. I still do
not know what it exactly does. The odccm kept notifying the poor
synce-gnome now and then. Obviously there were race conditions. Also
bugs/exceptions in Python's D-Bus binding appear to be discarded. So
much wasted time.)

I also added some diagnostics printed on stdout because authentization
to device crosses trust boundary and it would be nice for user to know
which party fails/rejects.

Petr4
Index: synce-gnome.cleaned/src/test.py
===================================================================
--- synce-gnome/src/test.py	(revision 3029)
+++ synce-gnome/src/test.py	(working copy)
@@ -55,8 +55,6 @@
         self.model_name = dev.GetModelName()
         self.dev_iface = dev
         
-        dev.connect_to_signal("PasswordFlagsChanged", self.password_flags_changed_cb)
-        
         self._print_debug()
         
         self._password_flags_changed()
@@ -90,9 +88,17 @@
                 dlg = EntryDialog(None, "Password required",
                                   "The PDA '%s' is password-protected.  Enter password:" % self.name,
                                   True)
-                if dlg.run() == gtk.RESPONSE_ACCEPT:
-                    authenticated = self.dev_iface.ProvidePassword(dlg.get_text())
+                if dlg.run() != gtk.RESPONSE_ACCEPT:
+                    print "Dialog canceled by user"
+                    dlg.destroy()
+                    return
+                authenticated = self.dev_iface.ProvidePassword(dlg.get_text())
                 dlg.destroy()
+                if not authenticated:
+                    print "Password mismatch"
+            print "Password accepted. Have a nice day."
+        else:
+            print "Device is not requiring a password"
 
 
 class EntryDialog(gtk.Dialog):
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to