gvfs r2077 - in trunk: . daemon



Author: tbzatek
Date: Fri Oct 24 13:08:38 2008
New Revision: 2077
URL: http://svn.gnome.org/viewvc/gvfs?rev=2077&view=rev

Log:
2008-10-24  Tomas Bzatek  <tbzatek redhat com> 

        * daemon/gvfsbackendsmb.c: 
        Don't ask for credentials twice when the password dialog was cancelled



Modified:
   trunk/ChangeLog
   trunk/daemon/gvfsbackendsmb.c

Modified: trunk/daemon/gvfsbackendsmb.c
==============================================================================
--- trunk/daemon/gvfsbackendsmb.c	(original)
+++ trunk/daemon/gvfsbackendsmb.c	Fri Oct 24 13:08:38 2008
@@ -78,6 +78,7 @@
   GMountSource *mount_source; /* Only used/set during mount */
   int mount_try;
   gboolean mount_try_again;
+  gboolean mount_cancelled;
 	
   gboolean password_in_keyring;
   GPasswordSave password_save;
@@ -158,6 +159,14 @@
   if (backend->user)
     strncpy (username_out, backend->user, unmaxlen);
 
+  if (backend->mount_cancelled)
+    {
+      /*  Don't prompt for credentials, let smbclient finish the mount loop  */
+      strncpy (username_out, "ABORT", unmaxlen);
+      strncpy (password_out, "", pwmaxlen);
+      return;
+    }
+
   if (backend->mount_source == NULL)
     {
       /* Not during mount, use last password */
@@ -231,6 +240,7 @@
 	    {
 	      strncpy (username_out, "ABORT", unmaxlen);
 	      strncpy (password_out, "", pwmaxlen);
+	      backend->mount_cancelled = TRUE;
 	      goto out;
 	    }
 	}
@@ -552,11 +562,12 @@
   do
     {
       op_backend->mount_try_again = FALSE;
+      op_backend->mount_cancelled = FALSE;
 
       smbc_stat = smbc_getFunctionStat (smb_context);
       res = smbc_stat (smb_context, uri, &st);
       
-      if (res == 0 ||
+      if (res == 0 || op_backend->mount_cancelled ||
 	  (errno != EACCES && errno != EPERM))
 	break;
 
@@ -581,10 +592,17 @@
     {
       /* TODO: Error from errno? */
       op_backend->mount_source = NULL;
-      g_vfs_job_failed (G_VFS_JOB (job),
-			G_IO_ERROR, G_IO_ERROR_FAILED,
-			/* translators: We tried to mount a windows (samba) share, but failed */
-			_("Failed to mount Windows share"));
+      
+      if (op_backend->mount_cancelled) 
+        g_vfs_job_failed (G_VFS_JOB (job),
+			  G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+			  _("Password dialog cancelled"));
+      else
+        g_vfs_job_failed (G_VFS_JOB (job),
+			  G_IO_ERROR, G_IO_ERROR_FAILED,
+			  /* translators: We tried to mount a windows (samba) share, but failed */
+			  _("Failed to mount Windows share"));
+
       return;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]