Bug#266832: libgksuui1.0-0: please return a different errorcode when gksu fails to run

Michael Vogt Michael Vogt <mvogt@acm.org>, 266832@bugs.debian.org
Wed, 3 Nov 2004 17:28:32 +0100


--x+6KMIRAuhnl3hBn
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline

On Sat, Oct 16, 2004 at 08:41:45PM -0300, Gustavo Noronha Silva wrote:
> > It would be nice if gksu returned a zero exit code after a successfull
> > run and a non-zero exit code when the user clicks cancel or enters a
> > wrong password. I dont't know if this has any security implications,
> > but if not, please add this feature :)

I think the attached patch is enough for me. It returns error-codes if
the password was wrong or if the user clicks cancel. Do you think it
can be included into the package?

thanks,
 Michael

-- 
The first rule of holes is: when you find yourself in one, stop digging. - PJ
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo

--x+6KMIRAuhnl3hBn
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="error-code.diff"

--- gksu-1.2.2.orig/gksu/gksu.c
+++ gksu-1.2.2/gksu/gksu.c
@@ -315,7 +315,7 @@
 	 closed the window 
       */
       if (retvalue != GTK_RESPONSE_OK)
-	  return 0;
+	  return 2;
 
       {
 	gchar *tmp;
@@ -391,7 +391,7 @@
 	    gtk_main_iteration ();
 
 	  if (retvalue != GTK_RESPONSE_OK)
-	    return 0;
+	    return 2;
 
 	  {
 	    gchar *tmp;
@@ -410,6 +410,7 @@
 		       gksu_context_get_command (context),
 		       gksu_context_get_user (context),
 		       error->message);
+	  return 3;
 	}
     }
   else
@@ -437,7 +438,7 @@
 	gtk_main_iteration ();
 
       if (retvalue != GTK_RESPONSE_OK)
-	  return 0;
+	  return 2;
 
       {
 	gchar *tmp;
@@ -449,12 +450,14 @@
       gksu_context_set_password (context, password);
       gksu_context_run (context, &error);
 
-      if (error)
+      if (error) {
 	gk_dialog (GTK_MESSAGE_ERROR, 
 		   _("Failed to run %s as user %s:\n %s"),
 		   gksu_context_get_command (context),
 		   gksu_context_get_user (context),
 		   error->message);
+	return 3;
+      }
     }
   
   return 0;

--x+6KMIRAuhnl3hBn--