kov changed libgksu/branches/libgksu2/configure.ac, libgksu/branches/libgksu2/libgksu/Makefile.am, libgksu/branches/libgksu2/libgksu/defines.h, libgksu/branches/libgksu2/libgksu/gksu-context.c, libgksu/branches/libgksu2/libgksu/gksu-context.h, libgksu/branches/libgksu2/libgksu/gksu.h, libgksu/branches/libgksu2/libgksu/libgksu.c, libgksu/branches/libgksu2/libgksu/libgksu.h, libgksu/branches/libgksu2/libgksu/libgksu1.2.pc.in, libgksu/branches/libgksu2/libgksu/libgksu2.pc.in, libgksu/branches/libgksu2/po/Makevars

Gustavo Noronha kov at costa.debian.org
Sun Dec 11 23:30:17 UTC 2005


Mensagem de log: 
renaming files to make more sense on the new layout/design


-----


Modified: libgksu/branches/libgksu2/configure.ac
===================================================================
--- libgksu/branches/libgksu2/configure.ac	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/configure.ac	2005-12-11 23:30:17 UTC (rev 488)
@@ -3,9 +3,9 @@
 
 AC_PREREQ(2.57)
 
-AC_INIT(libgksu1.2, 1.3.7, kov at debian.org)
+AC_INIT(libgksu, 1.9.0, kov at debian.org)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-AC_CONFIG_SRCDIR(libgksu/gksu-context.c)
+AC_CONFIG_SRCDIR(libgksu/libgksu.c)
 AM_CONFIG_HEADER(config.h)
 
 MAJOR_VERSION=`echo $VERSION | cut -d '.' -f 1`
@@ -71,7 +71,7 @@
 	intl/Makefile
 	po/Makefile.in
 	libgksu/Makefile
-	libgksu/libgksu1.2.pc
+	libgksu/libgksu2.pc
 	libgksuui/Makefile
 	libgksuui/libgksuui1.1.pc
 	docs/Makefile

Modified: libgksu/branches/libgksu2/libgksu/Makefile.am
===================================================================
--- libgksu/branches/libgksu2/libgksu/Makefile.am	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/Makefile.am	2005-12-11 23:30:17 UTC (rev 488)
@@ -1,33 +1,33 @@
 AM_CFLAGS = -g -O2 -Wall
 INCLUDES = `pkg-config --cflags gtk+-2.0 gconf-2.0`
 AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" -DDATA_DIR=\"$(datadir)\" -DPREFIX=\"$(prefix)\"
-LTPACKAGE = $(shell echo ${PACKAGE} | sed s,.,_,g)
+LTPACKAGE = libgksu2
 
-lib_LTLIBRARIES = libgksu1.2.la
-libgksu1_2_la_SOURCES = gksu-context.c gksu-context.h
+lib_LTLIBRARIES = ${LTPACKAGE}.la
+libgksu2_la_SOURCES = libgksu.c libgksu.h
 # 0.0.0 -> major.minor.micro
 # major -> breaks backward compatibility (changes to existing ABI)
 # minor -> keeps compatibility (additions to the API)
 # micro -> no change to the API/ABI
-libgksu1_2_la_LIBADD = ../libgksuui/libgksuui1.0.la
-libgksu1_2_la_LDFLAGS = -version-info 0:5:0 -Wl,--version-script=libgksu.ver -Wl,-O1 `pkg-config --libs gtk+-2.0 gobject-2.0 gconf-2.0` -lutil
+libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la
+libgksu2_la_LDFLAGS = -version-info 0:0:0 -Wl,--version-script=libgksu.ver -Wl,-O1 `pkg-config --libs gtk+-2.0 gobject-2.0 gconf-2.0` -lutil
 
 noinst_HEADERS = defines.h
 
 include_HEADERS = gksu.h gksu-context.h
-includedir = ${prefix}/include/libgksu1.2
+includedir = ${prefix}/include/${LTPACKAGE}
 
 pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = ${PACKAGE}.pc
+pkgconfig_DATA = ${LTPACKAGE}.pc
 
-pkglibdir = ${libdir}/${PACKAGE}
+pkglibdir = ${libdir}/${LTPACKAGE}
 pkglib_PROGRAMS = gksu-run-helper
 gksu_run_helper_LDFLAGS = `pkg-config --libs glib-2.0`
 gksu_run_helper_SOURCES = gksu-run-helper.c
 
 noinst_PROGRAMS = test-gksu
 test_gksu_SOURCES = test-gksu.c
-test_gksu_LDADD = ${PACKAGE}.la
+test_gksu_LDADD = ${LTPACKAGE}.la
 test_gksu_LDFLAGS = `pkg-config --libs glib-2.0`
 
 EXTRA_DIST = libgksu.ver

Modified: libgksu/branches/libgksu2/libgksu/defines.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/defines.h	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/defines.h	2005-12-11 23:30:17 UTC (rev 488)
@@ -23,7 +23,7 @@
 
 /* Gettext */
 #include <libintl.h>
-#define _(String) dgettext (PACKAGE, String)
+#define _(String) dgettext (DOMAIN, String)
 #define gettext_noop(String) (String)
 #ifndef HAVE_GNOME
 #define N_(String) gettext_noop (String)

Deleted: libgksu/branches/libgksu2/libgksu/gksu-context.c
===================================================================
--- libgksu/branches/libgksu2/libgksu/gksu-context.c	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/gksu-context.c	2005-12-11 23:30:17 UTC (rev 488)
@@ -1,1474 +0,0 @@
-/*
- * Gksu -- a library providing access to su functionality
- * Copyright (C) 2004 Gustavo Noronha Silva
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <pty.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/select.h>
-#include <errno.h>
-
-#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
-#include <locale.h>
-
-#include "defines.h"
-#include "../config.h"
-
-#include "gksu-context.h"
-#include "../libgksuui/gksuui-dialog.h"
-
-#define BASE_PATH "/apps/gksu/"
-
-/* GLOBALS */
-gboolean print_pass = FALSE;
-gboolean force_grab = FALSE;
-gboolean grab = TRUE;
-gboolean message_changed = FALSE;
-gboolean prompt = FALSE;
-gboolean always_ask_pass = FALSE;
-
-GType
-gksu_error_get_type (void)
-{
-  static GType etype = 0;
-  if (etype == 0) {
-    static const GEnumValue values[] = {
-      { GKSU_ERROR_HELPER, "GKSU_ERROR_HELPER", "helper" },
-      { GKSU_ERROR_NOCOMMAND, "GKSU_ERROR_NOCOMMAND", "nocommand" },
-      { GKSU_ERROR_NOPASSWORD, "GKSU_ERROR_NOPASSWORD", "nopassword" },
-      { GKSU_ERROR_FORK, "GKSU_ERROR_FORK", "fork" },
-      { GKSU_ERROR_EXEC, "GKSU_ERROR_EXEC", "exec" },
-      { GKSU_ERROR_PIPE, "GKSU_ERROR_PIPE", "pipe" },
-      { GKSU_ERROR_PIPEREAD, "GKSU_ERROR_PIPEREAD", "piperead" },
-      { GKSU_ERROR_WRONGPASS, "GKSU_ERROR_WRONGPASS", "wrongpass" },
-      { GKSU_ERROR_CHILDFAILED, "GKSU_ERROR_CHILDFAILED", "childfailed" },
-      { 0, NULL, NULL }
-    };
-    etype = g_enum_register_static ("GksuError", values);
-  }
-  return etype;
-}
-
-static pid_t
-test_lock(const char* fname)
-{
-   int FD = open(fname, 0);
-   if(FD < 0) {
-      if(errno == ENOENT) {
-	 // File does not exist
-	 return 0;
-      } else {
-	 perror("open");
-	 return(-1);
-      }
-   }
-   struct flock fl;
-   fl.l_type = F_WRLCK;
-   fl.l_whence = SEEK_SET;
-   fl.l_start = 0;
-   fl.l_len = 0;
-   if (fcntl(FD, F_GETLK, &fl) < 0) {
-      g_critical("fcntl error");
-      close(FD);
-      return(-1);
-   }
-   close(FD);
-   // lock is available
-   if(fl.l_type == F_UNLCK)
-      return(0);
-   // file is locked by another process
-   return (fl.l_pid);
-}
-
-static int
-get_lock(const char *File)
-{
-   int FD = open(File,O_RDWR | O_CREAT | O_TRUNC,0640);
-   if (FD < 0)
-   {
-      // Read only .. cant have locking problems there.
-      if (errno == EROFS)
-      {
-	 g_warning(_("Not using locking for read only lock file %s"),File);
-	 return dup(0);       // Need something for the caller to close
-      }
-
-      // Feh.. We do this to distinguish the lock vs open case..
-      errno = EPERM;
-      return -1;
-   }
-   fcntl(FD,F_SETFD, FD_CLOEXEC);
-
-   // Aquire a write lock
-   struct flock fl;
-   fl.l_type = F_WRLCK;
-   fl.l_whence = SEEK_SET;
-   fl.l_start = 0;
-   fl.l_len = 0;
-   if (fcntl(FD,F_SETLK,&fl) == -1)
-   {
-      if (errno == ENOLCK)
-      {
-	 g_warning(_("Not using locking for nfs mounted lock file %s"), File);
-	 unlink(File);
-	 close(FD);
-	 return dup(0);       // Need something for the caller to close
-      }
-
-      int Tmp = errno;
-      close(FD);
-      errno = Tmp;
-      return -1;
-   }
-
-   return FD;
-}
-
-#define GRAB_TRIES	16
-#define GRAB_WAIT	250 /* milliseconds */
-
-typedef enum
-  {
-    FAILED_GRAB_MOUSE,
-    FAILED_GRAB_KEYBOARD
-  } FailedGrabWhat;
-
-void
-report_failed_grab (FailedGrabWhat what)
-{
-  GtkWidget *dialog;
-
-  dialog = g_object_new (GTK_TYPE_MESSAGE_DIALOG,
-			 "message-type", GTK_MESSAGE_WARNING,
-			 "buttons", GTK_BUTTONS_CLOSE,
-			 NULL);
-
-  switch (what)
-    {
-    case FAILED_GRAB_MOUSE:
-      gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
-				     _("<b>Could not grab your mouse.</b>\n\n"
-				       "A malicious client may be eavesdropping\n"
-				       "on your session or you may have just clicked\n"
-				       "a menu or some application just decided to get\n"
-				       "focus.\n\n"
-				       "Try again."));
-
-      break;
-    case FAILED_GRAB_KEYBOARD:
-      gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
-				     _("Could not grab your keyboard.\n"
-				       "A malicious client may be eavesdropping\n"
-				       "on your session or you may have just clicked\n"
-				       "a menu or some application just decided to get\n"
-				       "focus.\n\n"
-				       "Try again."));
-      break;
-    }
-
-  gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
-  gtk_dialog_run (GTK_DIALOG(dialog));
-  gtk_widget_destroy (dialog);
-
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
-
-}
-
-int
-grab_keyboard_and_mouse (GtkWidget *dialog)
-{
-  GdkGrabStatus status;
-  gint grab_tries = 0;
-  gint lock = -1;
-
-  gchar *fname = g_strdup_printf ("%s/.gksu.lock", getenv ("HOME"));
-  pid_t pid = test_lock (fname);
-
-  if (pid != 0)
-    {
-      g_warning ("Lock taken by pid: %i. Exiting.", pid);
-      exit (0);
-    }
-
-  lock = get_lock(fname);
-  if( lock < 0)
-    g_warning ("Unable to create lock file.");
-  g_free (fname);
-
-  gtk_widget_show_all (dialog);
-
-  /* reset cursor */
-  gdk_window_set_cursor(dialog->window, gdk_cursor_new(GDK_LEFT_PTR));
-
-  for(;;)
-    {
-      status = gdk_pointer_grab ((GTK_WIDGET(dialog))->window, TRUE, 0, NULL,
-				 NULL, GDK_CURRENT_TIME);
-      if (status == GDK_GRAB_SUCCESS)
-	break;
-      usleep (GRAB_WAIT * 1000);
-      if (++grab_tries > GRAB_TRIES)
-	{
-	  gtk_widget_hide (dialog);
-	  report_failed_grab (FAILED_GRAB_MOUSE);
-	  exit (1);
-	  break;
-	}
-    }
-
-  for(;;)
-    {
-      status = gdk_keyboard_grab ((GTK_WIDGET(dialog))->window,
-				  FALSE, GDK_CURRENT_TIME);
-      if (status == GDK_GRAB_SUCCESS)
-	break;
-
-      usleep(GRAB_WAIT * 1000);
-
-      if (++grab_tries > GRAB_TRIES)
-	{
-	  gtk_widget_hide (dialog);
-	  report_failed_grab (FAILED_GRAB_KEYBOARD);
-	  exit (1);
-	  break;
-	}
-    }
-
-  /* we "raise" the window because there is a race here for
-   * focus-follow-mouse and auto-raise WMs that may put the window
-   * in the background and confuse users
-   */
-  gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
-
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
-
-  return lock;
-}
-
-void
-ungrab_keyboard_and_mouse (int lock)
-{
-  /* Ungrab */
-  gdk_pointer_ungrab(GDK_CURRENT_TIME);
-  gdk_keyboard_ungrab(GDK_CURRENT_TIME);
-  gdk_flush();
-
-  close(lock);
-}
-
-void
-get_configuration_options (GksuContext *context)
-{
-  GConfClient *gconf_client = context->gconf_client;
-
-  grab = !gconf_client_get_bool (gconf_client, BASE_PATH "disable-grab",
-				 NULL);
-  force_grab = gconf_client_get_bool (gconf_client, BASE_PATH "force-grab",
-				      NULL);
-  context->sudo_mode = gconf_client_get_bool (gconf_client, BASE_PATH "sudo-mode",
-					      NULL);
-  prompt = gconf_client_get_bool (gconf_client, BASE_PATH "prompt",
-				  NULL);
-  always_ask_pass = gconf_client_get_bool (gconf_client,
-					   BASE_PATH "always-ask-password",
-					   NULL);
-}
-
-/**
- * gksuui_ask_password:
- * @context: a #GksuContext
- * @prompt: the prompt that should be used instead of "Password: "
- * @grab: should the X keyboard and mouse inputs be grabbed
- *
- * This is a convenience function to create a #GksuuiDialog and
- *
- *
- * Returns: a newly allocated gchar containing the password
- * or NULL if an error happens or the user cancels the action
- */
-static gchar*
-su_ask_password (GksuContext *context, gchar *prompt,
-		 gpointer data, GError **error)
-{
-  GtkWidget *dialog = NULL;
-  gchar *password = NULL, *tmp = NULL;
-
-  int retvalue = 0;
-
-  if (grab)
-    dialog = g_object_new (GKSUUI_TYPE_DIALOG,
-			   "type", GTK_WINDOW_POPUP,
-			   NULL);
-  else
-    dialog = gksuui_dialog_new ();
-
-  if (prompt)
-    gksuui_dialog_set_prompt (GKSUUI_DIALOG(dialog), prompt);
-
-  if (!message_changed)
-    {
-      gchar *msg;
-
-      if (context->sudo_mode)
-	msg = g_strdup_printf (_("<b>Please enter your password\n"
-				 "to run %s as user %s</b>"),
-			       context->command,
-			       context->user);
-      else
-	msg = g_strdup_printf (_("<b>To run the program \"%s\" you need to "
-				 "enter the %s password</b>"),
-			       context->command,
-			       context->user);
-
-      gksuui_dialog_set_message (GKSUUI_DIALOG(dialog), msg);
-      g_free (msg);
-    }
-
-  int lock = 0;
-  if (grab)
-    lock = grab_keyboard_and_mouse (dialog);
-  retvalue = gtk_dialog_run (GTK_DIALOG(dialog));
-  gtk_widget_hide (dialog);
-  if (grab)
-    ungrab_keyboard_and_mouse (lock);
-
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
-
-  if (retvalue != GTK_RESPONSE_OK)
-    return NULL;
-
-  tmp = gksuui_dialog_get_password (GKSUUI_DIALOG(dialog));
-  password = g_locale_from_utf8 (tmp, strlen (tmp), NULL, NULL, NULL);
-  g_free (tmp);
-
-  return password;
-}
-
-static void
-set_sensitivity_cb (GtkWidget *button, gpointer data)
-{
-  GtkWidget *widget = (GtkWidget*)data;
-  gboolean sensitive;
-
-  sensitive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button));
-  gtk_widget_set_sensitive (widget, sensitive);
-}
-
-static void
-cb_toggled_cb (GtkWidget *button, gpointer data)
-{
-  GConfClient *gconf_client;
-  gchar *key;
-  gboolean toggled;
-  gchar *key_name;
-
-  g_return_if_fail (data != NULL);
-
-  key_name = (gchar*)data;
-
-  gconf_client = gconf_client_get_default ();
-  toggled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button));
-
-  key = g_strdup_printf (BASE_PATH "%s", key_name);
-
-  if (!strcmp (key_name, "save-keyring"))
-    {
-      if (toggled)
-	gconf_client_set_string (gconf_client, key, "session", NULL);
-      else
-	gconf_client_set_string (gconf_client, key, "default", NULL);
-    }
-  else if (!strcmp (key_name, "display-no-pass-info"))
-    {
-      /* the meaning of the key is the exact opposite of the meaning
-	 of the answer - when the check button is checked the key must
-	 be off
-      */
-      gconf_client_set_bool (gconf_client, key, !toggled, NULL);
-    }
-  else
-    gconf_client_set_bool (gconf_client, key, toggled, NULL);
-
-  g_object_unref (gconf_client);
-
-  g_free (key);
-}
-
-void
-no_pass (GksuContext *context, gpointer data)
-{
-  GtkWidget *dialog;
-  GtkWidget *alignment;
-  GtkWidget *check_button;
-
-  dialog = gtk_message_dialog_new_with_markup (NULL, 0,
-					       GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
-					       _("<b>The \"%s\" program was started with "
-						 "the privileges of the %s user without "
-						 "the need to ask for a password, due to "
-						 "your system's authentication mechanism "
-						 "setup.</b>"
-						 "\n\n"
-						 "It is possible that you are being allowed "
-						 "to run specific programs as user %s "
-						 "without the need for a password, or that "
-						 "the password is cached."
-						 "\n"
-						 "This is not a problem report; it's "
-						 "simply a notification to make sure "
-						 "you are aware of this."),
-					       context->command,
-					       context->user,
-					       context->user);
-
-  alignment = gtk_alignment_new (0.5, 0.5, 0.6, 1);
-  gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), alignment, TRUE, TRUE, 2);
-
-  check_button = gtk_check_button_new_with_mnemonic (_("Do _not display this message again"));
-  g_signal_connect (G_OBJECT(check_button), "toggled",
-		    G_CALLBACK(cb_toggled_cb), "display-no-pass-info");
-  gtk_container_add (GTK_CONTAINER(alignment), check_button);
-
-  gtk_widget_show_all (dialog);
-  gtk_dialog_run (GTK_DIALOG(dialog));
-  gtk_widget_destroy (GTK_WIDGET(dialog));
-
-  while (gtk_events_pending ())
-    gtk_main_iteration ();
-}
-
-static void
-nullify_password (gchar *pass)
-{
-  if (pass)
-    {
-      memset(pass, 0, strlen(pass));
-      g_free (pass);
-    }
-  pass = NULL;
-}
-
-static gchar *
-get_process_name (pid_t pid)
-{
-#ifdef linux
-  FILE *f;
-  char *cmdline = malloc (sizeof(gchar*)*256);
-  char *cmdfile = g_strdup_printf("/proc/%i/status",pid);
-
-  cmdline[255] = '\0';
-
-  f = fopen(cmdfile, "r");
-  g_free (cmdfile);
-  if(f != NULL)
-    {
-      fgets(cmdline, 255, f);
-      cmdline[255] = '\0';
-      fclose(f);
-    }
-  return cmdline;
-#else
-  return NULL;
-#endif
-}
-
-/**
- * prepare_xauth:
- *
- * Sets up the variables with values for the $DISPLAY
- * environment variable and xauth-related stuff. Also
- * creates a temporary directory to hold a .Xauthority
- *
- * Returns: 0 if it suceeds.
- */
-static int
-prepare_xauth (GksuContext *context)
-{
-  FILE *xauth_output;
-  gchar xauth[256] = {0};
-
-  gchar *tmp = NULL;
-  gchar **tmpv = NULL;
-  gchar *display = NULL;
-
-  /* avoid problems with "network" DISPLAY's */
-  display = g_strdup (getenv ("DISPLAY"));
-  tmpv = g_strsplit (display, ":", 3);
-  g_free (display);
-
-  context->display = g_strdup_printf (":%s", tmpv[1]);
-
-  g_strfreev (tmpv);
-
-  /* get the authorization token */
-  tmp = g_strdup_printf ("/usr/X11R6/bin/xauth list %s | "
-			 "head -1 | awk '{ print $3 }'",
-			 context->display);
-  if ((xauth_output = popen (tmp, "r")) == NULL)
-    {
-      fprintf (stderr,
-	       _("Failed to obtain xauth key: %s"),
-	       strerror(errno));
-      return 1;
-    }
-  fread (xauth, sizeof(char), 256, xauth_output);
-  xauth[strlen(xauth) - 1] = '\0';
-  pclose (xauth_output);
-  g_free (tmp);
-
-  context->xauth = g_strdup (xauth);
-
-  if (context->debug)
-    {
-      fprintf(stderr,
-	      "xauth: -%s-\n"
-	      "display: -%s-\n",
-	      context->xauth, context->display);
-    }
-
-  return 0;
-}
-
-/* Write all of buf, even if write(2) is interrupted. */
-static ssize_t
-full_write (int d, const char *buf, size_t nbytes)
-{
-  ssize_t r, w = 0;
-
-  /* Loop until nbytes of buf have been written. */
-  while (w < nbytes) {
-    /* Keep trying until write succeeds without interruption. */
-    do {
-      r = write(d, buf + w, nbytes - w);
-    } while (r < 0 && errno == EINTR);
-
-    if (r < 0) {
-      return -1;
-    }
-
-    w += r;
-  }
-
-  return w;
-}
-
-static gboolean
-copy (const char *fn, const char *dir)
-{
-  int in, out;
-  int r;
-  char *newfn;
-  char buf[BUFSIZ];
-
-  newfn = g_strdup_printf("%s/.Xauthority", dir);
-
-  out = open(newfn, O_WRONLY | O_CREAT | O_EXCL, 0600);
-  if (out == -1)
-    {
-      if (errno == EEXIST)
-	fprintf (stderr,
-		 _("Impossible to create the .Xauthority file: a file "
-		   "already exists. This might be a security issue; "
-		   "please investigate or warn your system administrator."));
-      else
-	fprintf (stderr,
-		   _("Error copying '%s' to '%s': %s"),
-		   fn, dir, strerror(errno));
-
-      return TRUE;
-    }
-
-  in = open(fn, O_RDONLY);
-  if (in == -1)
-    {
-      fprintf (stderr,
-	       _("Error copying '%s' to '%s': %s"),
-	       fn, dir, strerror(errno));
-      return TRUE;
-    }
-
-  while ((r = read(in, buf, BUFSIZ)) > 0)
-    {
-      if (full_write(out, buf, r) == -1)
-	{
-	  fprintf (stderr,
-		   _("Error copying '%s' to '%s': %s"),
-		   fn, dir, strerror(errno));
-	  return TRUE;
-	}
-    }
-
-  if (r == -1)
-    {
-      fprintf (stderr,
-	       _("Error copying '%s' to '%s': %s"),
-	       fn, dir, strerror(errno));
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
-static gboolean
-sudo_prepare_xauth (GksuContext *context)
-{
-  gchar template[] = "/tmp/" PACKAGE "-XXXXXX";
-  gboolean error_copying = FALSE;
-  gchar *xauth = NULL;
-
-  context->dir = g_strdup (mkdtemp(template));
-  if (!context->dir)
-    {
-      fprintf (stderr, strerror(errno));
-      return 1;
-    }
-
-  xauth = g_strdup(g_getenv ("XAUTHORITY"));
-  if (xauth == NULL)
-    xauth = g_strdup_printf ("%s/.Xauthority", g_get_home_dir());
-
-  error_copying = copy (xauth, context->dir);
-  g_free (xauth);
-
-  if (error_copying)
-    return 1;
-
-  return 0;
-}
-
-static void
-sudo_reset_xauth (GksuContext *context, gchar *xauth,
-		  gchar *xauth_env)
-{
-  /* reset the env var as it was before or clean it  */
-  if (xauth_env)
-    setenv ("XAUTHORITY", xauth_env, TRUE);
-  else
-    unsetenv ("XAUTHORITY");
-
-  if (context->debug)
-    fprintf (stderr, "xauth: %s\nxauth_env: %s\ndir: %s\n",
-	     xauth, xauth_env, context->dir);
-
-  unlink (xauth);
-  rmdir (context->dir);
-
-  g_free (xauth);
-}
-
-GksuContext*
-gksu_context_new ()
-{
-  GksuContext *context;
-
-  context = g_new (GksuContext, 1);
-
-  context->xauth = NULL;
-  context->dir = NULL;
-  context->display = NULL;
-
-  context->gconf_client = gconf_client_get_default ();
-
-  context->sudo_mode = FALSE;
-
-  context->user = NULL;
-  context->command = NULL;
-
-  context->login_shell = FALSE;
-  context->keep_env = FALSE;
-
-  context->grab = TRUE;
-
-  context->debug = FALSE;
-
-  return context;
-}
-
-void
-gksu_context_free (GksuContext *context)
-{
-  g_free (context->xauth);
-  g_free (context->dir);
-  g_free (context->display);
-
-  g_object_unref (context->gconf_client);
-
-  g_free (context->user);
-  g_free (context->command);
-
-  g_free (context);
-}
-
-/**
- * gksu_context_run_full:
- * @context: a #GksuContext
- * @ask_pass: a #GksuAskPasswordFunc
- * @user_data: a #gpointer with user data to be passed to the
- * #GksuAskPasswordFunc
- * @pass_not_needed: a #GksuPasswordNotNeededFunc
- * @pnn_user_data: a #gpointer with the user data to be passed to the
- * #GksuPasswordNotNeededFunc
- * @error: a #GError object to be filled with the error code or NULL
- *
- * This could be considered one of the main functions in GKSu.
- * it is responsible for doing the 'user changing' magic calling
- * the #GksuAskPasswordFunc function to request a password if needed.
- * and the #GksuPasswordNotNeededFunc function if a password won't be
- * needed, so the application has the oportunity of warning the user
- * what it's doing.
- * Since 1.3.3.
- *
- * Returns: the child's error status, 0 if all went fine, -1 if failed
- */
-gboolean
-gksu_su_full (GksuContext *context,
-	      GksuAskPassFunc ask_pass,
-	      gpointer ask_pass_data,
-	      GksuPassNotNeededFunc pass_not_needed,
-	      gpointer pass_not_needed_data,
-	      GError **error)
-{
-  GQuark gksu_quark;
-  int i = 0;
-
-  gchar auxcommand[] = PREFIX "/lib/" PACKAGE "/gksu-run-helper";
-
-  int fdpty;
-  pid_t pid;
-
-  get_configuration_options (context);
-
-  gksu_quark = g_quark_from_string (PACKAGE);
-
-  if (!context->command)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_NOCOMMAND,
-		   _("gksu_run needs a command to be run, "
-		     "none was provided."));
-      return -1;
-    }
-
-  if (!context->user)
-    context->user = g_strdup ("root");
-
-  if (!g_file_test (auxcommand, G_FILE_TEST_IS_EXECUTABLE))
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_HELPER,
-		   _("The gksu-run-helper command was not found or "
-		     "is not executable."));
-      return -1;
-    }
-
-  /*
-     FIXME: need to provide GError stuff
-  */
-  prepare_xauth (context);
-
-  pid = forkpty (&fdpty, NULL, NULL, NULL);
-  if (pid == 0)
-    {
-      gchar **cmd = g_malloc (sizeof(gchar*)*7);
-
-      cmd[i] = g_strdup ("/bin/su"); i++;
-      if (context->login_shell)
-	{
-	  cmd[i] = g_strdup ("-"); i++;
-	}
-      cmd[i] = g_strdup (context->user); i++;
-      if (context->keep_env)
-	{
-	  cmd[i] = g_strdup ("-p"); i++;
-	}
-      cmd[i] = g_strdup ("-c"); i++;
-
-      /* needs to get X authorization prior to running the program */
-      cmd[i] = g_strdup_printf ("%s \"%s\"", auxcommand,
-				context->command); i++;
-
-      cmd[i] = NULL;
-
-      /* executes the command */
-      if (execv (cmd[0], cmd) == -1)
-	{
-	  fprintf (stderr,
-		   _("Unable to run /bin/su: %s"),
-		   strerror(errno));
-	}
-
-      for (i = 0 ; cmd[i] != NULL ; i++)
-	g_free (cmd[i]);
-      g_free(cmd);
-    }
-  else if (pid == -1)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_FORK,
-		   _("Failed to fork new process: %s"),
-		   strerror(errno));
-      return -1;
-    }
-  else
-    {
-      fd_set rfds;
-
-      struct timeval tv;
-
-      struct passwd *pwd = NULL;
-      gint target_uid = -1;
-      gint my_uid = 0;
-
-      gchar buf[256] = {0};
-      gint status;
-
-      gchar *cmdline = NULL;
-      gboolean password_needed = FALSE;
-
-      my_uid = getuid();
-      pwd = getpwnam (context->user);
-      if (pwd)
-	target_uid = pwd->pw_uid;
-
-      if (ask_pass == NULL)
-	{
-	  ask_pass = su_ask_password;
-	}
-
-      if (pass_not_needed == NULL)
-	{
-	  pass_not_needed = no_pass;
-	}
-
-      /* no need to ask for password if we're already root */
-      if (my_uid != target_uid && my_uid)
-	{
-	  struct termios tio;
-
-	  usleep (100);
-	  read (fdpty, buf, 256);
-	  if (context->debug)
-	    fprintf (stderr, "gksu_context_run: buf: -%s-\n", buf);
-
-	  usleep (100);
-
-	  tcgetattr (fdpty, &tio);
-
-	  if (!(tio.c_lflag & ECHO))
-	    {
-	      gchar *password = NULL;
-	      gchar *tmp = NULL;
-
-	      tmp = ask_pass (context, buf, ask_pass_data, error);
-	      g_return_val_if_fail (tmp != NULL, -1);
-
-	      usleep (100);
-
-	      password = g_strdup_printf ("%s\n", tmp);
-	      nullify_password (tmp);
-
-	      write (fdpty, password, strlen(password));
-
-	      nullify_password (password);
-
-	      password_needed = TRUE;
-	    }
-	}
-
-      if (!password_needed)
-	{
-	  gboolean should_display;
-
-	  should_display = gconf_client_get_bool (context->gconf_client,
-						  BASE_PATH "display-no-pass-info", NULL);
-
-	  /* configuration tells us to show this message */
-	  if (should_display)
-	    pass_not_needed (context, pass_not_needed_data);
-	}
-
-      if (context->debug)
-	fprintf (stderr, "DEBUG (run:after-pass) buf: -%s-\n", buf);
-      if (strncmp (buf, "gksu", 4) && strncmp (buf, "su", 2))
-	{
-	  /* drop the \n echoed on password entry if su did request
-	     a password */
-	  if (password_needed)
-	    read (fdpty, buf, 256);
-	  if (context->debug)
-	    fprintf (stderr, "DEBUG (run:post-after-pass) buf: -%s-\n", buf);
-	  read (fdpty, buf, 255);
-	  if (context->debug)
-	    fprintf (stderr, "DEBUG (run:post-after-pass) buf: -%s-\n", buf);
-	}
-
-      if (!strncmp (buf, "su: Authentication failure", 26))
-	{
-	  g_set_error (error, gksu_quark,
-		       GKSU_ERROR_WRONGPASS,
-		       _("Wrong password."));
-	  if (context->debug)
-	    fprintf (stderr, "DEBUG (auth_failed) buf: -%s-\n", buf);
-	}
-      else if (!strncmp (buf, "gksu: waiting", 13))
-	{
-	  gchar *line;
-
-	  if (context->debug)
-	    fprintf (stderr, "DEBUG (gksu: waiting) buf: -%s-\n", buf);
-
-	  line = g_strdup_printf ("gksu-run: %s\n", context->display);
-	  write (fdpty, line, strlen(line));
-	  g_free (line);
-
-	  line = g_strdup_printf ("gksu-run: %s\n", context->xauth);
-	  write (fdpty, line, strlen(line));
-	  g_free (line);
-
-	  tcdrain (fdpty);
-
-	  bzero (buf, 256);
-	  read (fdpty, buf, 256);
-	}
-      else
-	{
-	  gchar *emsg = g_strdup_printf (_("Failed to communicate with "
-					   "gksu-run-helper.\n\n"
-					   "Received:\n"
-					   " %s\n"
-					   "While expecting:\n"
-					   " %s"), buf, "gksu: waiting");
-	  g_set_error (error, gksu_quark, GKSU_ERROR_HELPER, emsg);
-	  g_free (emsg);
-
-	  if (context->debug)
-	    fprintf (stderr, "DEBUG (failed!) buf: -%s-\n", buf);
-
-	  return -1;
-	}
-
-      FD_ZERO(&rfds);
-      FD_SET(fdpty, &rfds);
-
-      tv.tv_sec = 0;
-      tv.tv_usec = 100;
-
-      while (!waitpid (pid, &status, WNOHANG))
-	{
-	  bzero (buf, 256);
-	  usleep (200);
-
-	  if (cmdline)
-	    g_free (cmdline);
-	  cmdline = get_process_name (pid);
-
-	  usleep(1000);
-
-	  if (select (fdpty+1, &rfds, NULL, NULL, &tv) < 0)
-	    {
-	      g_set_error (error, gksu_quark, GKSU_ERROR_PIPEREAD,
-			   _("Could not read from the pipe "
-			     "with the child: %s"),
-			   strerror(errno));
-	      return -1;
-	    }
-
-	  if(FD_ISSET(fdpty, &rfds))
-	    {
-	      bzero(buf, 256);
-	      read (fdpty, buf, 255);
-	      fprintf (stderr, "%s", buf);
-	    }
-	  else
-	    FD_SET(fdpty, &rfds);
-	}
-
-      while (1)
-	{
-	  bzero(buf, 256);
-	  if(read (fdpty, buf, 255) <= 0)
-	    break;
-	  fprintf (stderr, "%s", buf);
-	}
-
-      if (WIFEXITED(status))
-	{
-	  if (WEXITSTATUS(status))
-	    {
-	      if(cmdline)
-		{
-		  /* su already exec()ed something else, don't report
-		   * exit status errors in that case
-		   */
-		  if (!g_str_has_suffix (cmdline, "su\n"))
-		    {
-		      g_free (cmdline);
-		      return TRUE;
-		    }
-		  g_free (cmdline);
-		}
-
-	      if (error == NULL)
-		g_set_error (error, gksu_quark,
-			     GKSU_ERROR_CHILDFAILED,
-			     _("su terminated with %d status"),
-			     WEXITSTATUS(status));
-	    }
-	}
-    }
-
-  if (error)
-    return TRUE;
-
-  return FALSE;
-}
-
-gboolean
-gksu_su (gchar *command_line, GError **error)
-{
-  GksuContext *context = gksu_context_new ();
-  gboolean retval;
-
-  context->command = g_strdup (command_line);
-  context->user = g_strdup ("root");
-  retval = gksu_su_full (context,
-			 NULL, NULL,
-			 NULL, NULL,
-			 error);
-  gksu_context_free (context);
-  return retval;
-}
-
-/**
- * gksu_context_sudo_run_full:
- * @context: a #GksuContext
- * @ask_pass: a #GksuAskPasswordFunc
- * @user_data: a #gpointer with user data to be passed to the
- * #GksuAskPasswordFunc
- * @pass_not_needed: a #GksuPasswordNotNeededFunc
- * @pnn_user_data: a #gpointer with the user data to be passed to the
- * #GksuPasswordNotNeededFunc
- * @error: a #GError object to be filled with the error code or NULL
- *
- * This could be considered one of the main functions in GKSu.
- * it is responsible for doing the 'user changing' magic calling
- * the #GksuAskPasswordFunc function to request a password if needed.
- * and the #GksuPasswordNotNeededFunc function if a password won't be
- * needed, so the application has the oportunity of warning the user
- * what it's doing.
- * Since 1.3.3.
- *
- * Returns: the child's error status, 0 if all went fine, -1 if failed
- */
-gboolean
-gksu_sudo_full (GksuContext *context,
-		GksuAskPassFunc ask_pass,
-		gpointer ask_pass_data,
-		GksuPassNotNeededFunc pass_not_needed,
-		gpointer pass_not_needed_data,
-		GError **error)
-{
-  char **cmd;
-  char buffer[256] = {0};
-  int argcount = 8;
-  int i, j;
-
-  GQuark gksu_quark;
-
-  gchar *xauth = NULL,
-    *xauth_env = NULL;
-
-  pid_t pid;
-  int status;
-  size_t r;
-  FILE *infile, *outfile;
-  int parent_pipe[2];	/* For talking to the parent */
-  int child_pipe[2];	/* For talking to the child */
-
-  get_configuration_options (context);
-
-  gksu_quark = g_quark_from_string (PACKAGE);
-
-  if (!context->command)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_NOCOMMAND,
-		   _("gksu_sudo_run needs a command to be run, "
-		     "none was provided."));
-      return -1;
-    }
-
-  if (!context->user)
-    context->user = g_strdup ("root");
-
-  if (ask_pass == NULL)
-    {
-      if (context->debug)
-	fprintf (stderr, "No ask_pass set, using default!\n");
-      ask_pass = su_ask_password;
-    }
-
-  if (pass_not_needed == NULL)
-    {
-      pass_not_needed = no_pass;
-    }
-
-  /*
-     FIXME: need to set GError in a more detailed way
-  */
-  if (sudo_prepare_xauth (context) == 1)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_XAUTH,
-		   _("Unable to copy the user's Xauthorization file."));
-      return -1;
-    }
-
-  /* sets XAUTHORITY */
-  xauth = g_strdup_printf ("%s/.Xauthority", context->dir);
-  xauth_env = getenv ("XAUTHORITY");
-  setenv ("XAUTHORITY", xauth, TRUE);
-
-  if (context->debug)
-    fprintf (stderr, "xauth: %s\n", xauth);
-
-  cmd = g_new (gchar *, argcount + 1);
-
-  argcount = 0;
-
-  /* sudo binary */
-  cmd[argcount] = g_strdup("/usr/bin/sudo");
-  argcount++;
-
-  if (!context->keep_env)
-    {
-      /* Make sudo set $HOME */
-      cmd[argcount] = g_strdup("-H");
-      argcount++;
-    }
-
-  /* Make sudo read from stdin */
-  cmd[argcount] = g_strdup("-S");
-  argcount++;
-
-  /* Make sudo use next arg as prompt */
-  cmd[argcount] = g_strdup("-p");
-  argcount++;
-
-  /* prompt */
-  cmd[argcount] = g_strdup("GNOME_SUDO_PASS");
-  argcount++;
-
-  /* Make sudo use the selected user */
-  cmd[argcount] = g_strdup("-u");
-  argcount++;
-
-  /* user */
-  cmd[argcount] = g_strdup(context->user);
-  argcount++;
-
-  /* sudo does not understand this if we do not use -H
-     weird.
-  */
-  if (!context->keep_env)
-    {
-      /* Make sudo stop processing options */
-      cmd[argcount] = g_strdup("--");
-      argcount++;
-    }
-
-  {
-    gchar *tmp_arg = g_malloc (sizeof(gchar)*1);
-    gboolean inside_quotes = FALSE;
-
-    tmp_arg[0] = '\0';
-
-    for (i = j = 0; ; i++)
-      {
-	if ((context->command[i] == '\'') && (context->command[i-1] != '\\'))
-	  {
-	    i = i + 1;
-	    inside_quotes = !inside_quotes;
-	  }
-
-	if ((context->command[i] == ' ' && inside_quotes == FALSE)
-	    || context->command[i] == '\0')
-	  {
-	    tmp_arg = g_realloc (tmp_arg, sizeof(gchar)*(j+1));
-	    tmp_arg[j] = '\0';
-	    cmd = g_realloc (cmd, sizeof(gchar*) * (argcount + 1));
-	    cmd[argcount] = g_strdup (tmp_arg);
-
-	    g_free (tmp_arg);
-
-	    argcount = argcount + 1;
-	    j = 0;
-
-	    if (context->command[i] == '\0')
-	      break;
-
-	    tmp_arg = g_malloc (sizeof(gchar)*1);
-	    tmp_arg[0] = '\0';
-	  }
-	else
-	  {
-	    if (context->command[i] == '\\')
-	      i = i + 1;
-	    tmp_arg = g_realloc (tmp_arg, sizeof(gchar)*(j+1));
-	    tmp_arg[j] = context->command[i];
-	    j = j + 1;
-	  }
-      }
-  }
-  cmd = g_realloc (cmd, sizeof(gchar*) * (argcount + 1));
-  cmd[argcount] = NULL;
-
-  if (context->debug)
-    {
-      for (i = 0; cmd[i] != NULL; i++)
-	fprintf (stderr, "cmd[%d]: %s\n", i, cmd[i]);
-    }
-
-  if ((pipe(parent_pipe)) == -1)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
-		   _("Error creating pipe: %s"),
-		   strerror(errno));
-      sudo_reset_xauth (context, xauth, xauth_env);
-      return -1;
-    }
-
-  if ((pipe(child_pipe)) == -1)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
-		   _("Error creating pipe: %s"),
-		   strerror(errno));
-      sudo_reset_xauth (context, xauth, xauth_env);
-      return -1;
-    }
-
-  pid = fork();
-  if (pid == -1)
-    {
-      g_set_error (error, gksu_quark, GKSU_ERROR_FORK,
-		   _("Failed to fork new process: %s"),
-		   strerror(errno));
-      sudo_reset_xauth (context, xauth, xauth_env);
-      return -1;
-    }
-  else if (pid == 0)
-    {
-      // Child
-      setsid();   // make us session leader
-      close(child_pipe[1]);
-      dup2(child_pipe[0], STDIN_FILENO);
-      dup2(parent_pipe[1], STDERR_FILENO);
-
-      execv(cmd[0], cmd);
-
-      g_set_error (error, gksu_quark, GKSU_ERROR_EXEC,
-		   _("Failed to exec new process: %s"),
-		   strerror(errno));
-      sudo_reset_xauth (context, xauth, xauth_env);
-      return -1;
-    }
-  else
-    {
-      gchar *cmdline = NULL;
-
-      // Parent
-      close(parent_pipe[1]);
-
-      infile = fdopen(parent_pipe[0], "r");
-      if (!infile)
-	{
-	  g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
-		       _("Error opening pipe: %s"),
-		       strerror(errno));
-	  sudo_reset_xauth (context, xauth, xauth_env);
-	  return -1;
-	}
-
-      outfile = fdopen(child_pipe[1], "w");
-      if (!outfile)
-	{
-	  g_set_error (error, gksu_quark, GKSU_ERROR_PIPE,
-		       _("Error opening pipe: %s"),
-		       strerror(errno));
-	  sudo_reset_xauth (context, xauth, xauth_env);
-	  return -1;
-	}
-
-      /*
-	we are expecting to receive a GNOME_SUDO_PASS
-	if we don't there are two possibilities: an error
-	or a password is not needed
-      */
-      r = read(parent_pipe[0], buffer, 16);
-
-      if (context->debug)
-	fprintf (stderr, "buffer: -%s-\n", buffer);
-
-      if (strncmp(buffer, "GNOME_SUDO_PASS", 15) == 0)
-	{
-	  gchar *password = NULL;
-
-	  if (context->debug)
-	    fprintf (stderr, "Yeah, we're in...\n");
-
-	  password = ask_pass (context, _("Password: "),
-			       ask_pass_data, error);
-	  g_return_val_if_fail (password != NULL, -1);
-
-	  usleep (100);
-
-	  fprintf (outfile, "%s\n", password);
-	  fclose (outfile);
-
-	  nullify_password (password);
-
-	  /* ignore the newline that comes right after sudo receives
-	     the password
-	  */
-	  fgets (buffer, 255, infile);
-	  fgets (buffer, 255, infile);
-	}
-      else
-	{
-	  gboolean should_display;
-	  if (context->debug)
-	    fprintf (stderr, "No password prompt found; we'll assume we don't need a password.\n");
-
-	  should_display = gconf_client_get_bool (context->gconf_client,
-						  BASE_PATH "display-no-pass-info", NULL);
-
-	  /* configuration tells us to show this message */
-	  if (should_display)
-	    pass_not_needed (context, pass_not_needed_data);
-
-	  fprintf (stderr, "%s", buffer);
-	}
-
-      if (!strcmp (buffer, "Sorry, try again.\n"))
-	g_set_error (error, gksu_quark, GKSU_ERROR_WRONGPASS,
-		     _("Wrong password."));
-      else if (!strncmp (buffer, "Sorry, user ", 12))
-	g_set_error (error, gksu_quark, GKSU_ERROR_NOT_ALLOWED,
-		     _("The underlying authorization mechanism (sudo) "
-		       "does not allow you to run this program. Contact "
-		       "the system administrator."));
-      else
-	{
-	  gchar *haystack = buffer;
-	  gchar *needle;
-
-	  needle = g_strstr_len (haystack, strlen (haystack), " ");
-	  if (needle && (needle + 1))
-	    {
-	      needle += 1;
-	      if (!strncmp (needle, "is not in", 9))
-		g_set_error (error, gksu_quark, GKSU_ERROR_NOT_ALLOWED,
-			     _("The underlying authorization mechanism (sudo) "
-			       "does not allow you to run this program. Contact "
-			       "the system administrator."));
-	    }
-	}
-
-      while (!waitpid (pid, &status, WNOHANG))
-	{
-	  if (cmdline)
-	    g_free (cmdline);
-	  cmdline = get_process_name (pid);
-
-	  usleep(1000);
-
-	  bzero(buffer, 256);
-	  if(!fgets (buffer, 255, infile))
-	    break;
-	  fprintf (stderr, "%s", buffer);
-	}
-
-      /* make sure we did read everything */
-      while (1)
-	{
-	  bzero(buffer, 256);
-	  if(!fread (buffer, sizeof(gchar), 255, infile))
-	    break;
-	  fprintf (stderr, "%s", buffer);
-	  fflush (stderr);
-	}
-
-      sudo_reset_xauth (context, xauth, xauth_env);
-
-      if (WIFEXITED(status))
-	{
-	  if (WEXITSTATUS(status))
-	    {
-	      if(cmdline)
-		{
-		  /* sudo already exec()ed something else, don't report
-		   * exit status errors in that case
-		   */
-		  if (!g_str_has_suffix (cmdline, "sudo\n"))
-		    {
-		      g_free (cmdline);
-		      return TRUE;
-		    }
-		  g_free (cmdline);
-		}
-
-	      if (error == NULL)
-		g_set_error (error, gksu_quark,
-			     GKSU_ERROR_CHILDFAILED,
-			     _("sudo terminated with %d status"),
-			     WEXITSTATUS(status));
-	    }
-	}
-    }
-
-  /* if error is set we have found an error condition */
-  if (error)
-    return TRUE;
-
-  return FALSE;
-}
-
-gboolean
-gksu_sudo (gchar *command_line,
-	   GError **error)
-{
-  GksuContext *context = gksu_context_new ();
-  gboolean retval;
-
-  context->command = g_strdup (command_line);
-  context->user = g_strdup ("root");
-  retval = gksu_sudo_full (context,
-			   NULL, NULL,
-			   NULL, NULL,
-			   error);
-  gksu_context_free (context);
-
-  return retval;
-}

Deleted: libgksu/branches/libgksu2/libgksu/gksu-context.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/gksu-context.h	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/gksu-context.h	2005-12-11 23:30:17 UTC (rev 488)
@@ -1,121 +0,0 @@
-/*
- * Gksu -- a library providing access to su functionality
- * Copyright (C) 2004 Gustavo Noronha Silva
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GKSU_CONTEXT_H__
-#define __GKSU_CONTEXT_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <gtk/gtk.h>
-
-#include <gconf/gconf-client.h>
-
-G_BEGIN_DECLS
-
-typedef struct
-{
-  /*
-   * Protected
-   */
-
-  /* Xauth stuff */
-  gchar *xauth;
-  gchar *dir;
-  gchar *display;
-
-  gboolean sudo_mode;
-
-  GConfClient *gconf_client;
-
-  /*
-   * Public
-   */
-
-  /* what to run, with whose powers */
-  gchar *user;
-  gchar *command;
-
-  gboolean login_shell;
-  gboolean keep_env;
-
-  /* UI options */
-  gboolean grab;
-
-  gboolean debug;
-} GksuContext;
-
-typedef enum
-{
-  GKSU_ERROR_XAUTH,
-  GKSU_ERROR_HELPER,
-  GKSU_ERROR_NOCOMMAND,
-  GKSU_ERROR_NOPASSWORD,
-  GKSU_ERROR_FORK,
-  GKSU_ERROR_EXEC,
-  GKSU_ERROR_PIPE,
-  GKSU_ERROR_PIPEREAD,
-  GKSU_ERROR_WRONGPASS,
-  GKSU_ERROR_CHILDFAILED,
-  GKSU_ERROR_NOT_ALLOWED
-} GksuError;
-
-typedef
-gchar*
-(*GksuAskPassFunc) (GksuContext *context, gchar *prompt,
-		    gpointer user_data, GError**);
-
-typedef
-void
-(*GksuPassNotNeededFunc) (GksuContext *context, gpointer user_data);
-
-GksuContext*
-gksu_context_new ();
-
-void
-gksu_context_free (GksuContext *context);
-
-gboolean
-gksu_su_full (GksuContext *context,
-	      GksuAskPassFunc ask_pass,
-	      gpointer ask_pass_data,
-	      GksuPassNotNeededFunc pass_not_needed,
-	      gpointer pass_not_needed_data,
-	      GError **error);
-
-gboolean
-gksu_su (gchar *command_line,
-	 GError **error);
-
-gboolean
-gksu_sudo_full (GksuContext *context,
-		GksuAskPassFunc ask_pass,
-		gpointer ask_pass_data,
-		GksuPassNotNeededFunc pass_not_needed,
-		gpointer pass_not_needed_data,
-		GError **error);
-
-gboolean
-gksu_sudo (gchar *command_line,
-	   GError **error);
-
-G_END_DECLS
-
-#endif

Modified: libgksu/branches/libgksu2/libgksu/gksu.h
===================================================================
--- libgksu/branches/libgksu2/libgksu/gksu.h	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/gksu.h	2005-12-11 23:30:17 UTC (rev 488)
@@ -21,6 +21,6 @@
 #ifndef  __GKSU_H__
 #define __GKSU_H__
 
-#include <gksu-context.h>
+#include <libgksu.h>
 
 #endif

Copied: libgksu/branches/libgksu2/libgksu/libgksu.c (from rev 487, libgksu/branches/libgksu2/libgksu/gksu-context.c)

Copied: libgksu/branches/libgksu2/libgksu/libgksu.h (from rev 487, libgksu/branches/libgksu2/libgksu/gksu-context.h)

Deleted: libgksu/branches/libgksu2/libgksu/libgksu1.2.pc.in
===================================================================
--- libgksu/branches/libgksu2/libgksu/libgksu1.2.pc.in	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/libgksu/libgksu1.2.pc.in	2005-12-11 23:30:17 UTC (rev 488)
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@prefix@/include
- 
-Name: LibGKSu
-Version: @VERSION@
-Description: GKSu library version 0.
-Requires: glib-2.0
-Libs: -L${libdir} -lgksu1.2 @LIBS@
-Cflags: -I${includedir}/libgksu1.2

Copied: libgksu/branches/libgksu2/libgksu/libgksu2.pc.in (from rev 484, libgksu/branches/libgksu2/libgksu/libgksu1.2.pc.in)

Modified: libgksu/branches/libgksu2/po/Makevars
===================================================================
--- libgksu/branches/libgksu2/po/Makevars	2005-12-11 23:14:16 UTC (rev 487)
+++ libgksu/branches/libgksu2/po/Makevars	2005-12-11 23:30:17 UTC (rev 488)
@@ -1,7 +1,7 @@
 # Makefile variables for PO directory in any package using GNU gettext.
 
 # Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
+DOMAIN = libgksu2
 
 # These two variables depend on the location of this directory.
 subdir = po




More information about the gksu-commits mailing list