gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24586 - in gnunet-gtk: . src/setup


From: gnunet
Subject: [GNUnet-SVN] r24586 - in gnunet-gtk: . src/setup
Date: Mon, 29 Oct 2012 00:55:39 +0100

Author: grothoff
Date: 2012-10-29 00:55:39 +0100 (Mon, 29 Oct 2012)
New Revision: 24586

Modified:
   gnunet-gtk/configure.ac
   gnunet-gtk/src/setup/Makefile.am
   gnunet-gtk/src/setup/gnunet-setup.c
Log:
-use fork exec instead libgksu due to gtk2.0/gtk3.0 incompatibility

Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac     2012-10-28 23:10:59 UTC (rev 24585)
+++ gnunet-gtk/configure.ac     2012-10-28 23:55:39 UTC (rev 24586)
@@ -28,16 +28,13 @@
 
 AC_ISC_POSIX
 AC_PROG_AWK
-AC_PROG_CC
-
+AM_PROG_CC_C_O
 AC_PROG_MKDIR_P
 AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_LIBTOOL_WIN32_DLL
-AC_PROG_CC
-AM_PROG_CC_STDC
 AC_HEADER_STDC
 AC_CANONICAL_HOST
 
@@ -263,40 +260,7 @@
 AC_CHECK_HEADERS([glib.h gmodule.h gtk/gtk.h 
gdk/gdk.h],,AC_MSG_ERROR([gnunet-gtk requires GTK]))
 
 
-# test for libgksu
-gksu=0
-GKSU_LIBS="-lgksu"     
-AC_MSG_CHECKING(for libgksu)
-AC_ARG_WITH(gksu,
-   [  --with-gksu=PFX    Base of libgksu installation],
-   [AC_MSG_RESULT([$with_gksu])
-    case $with_gksu in
-      no)
-        ;;
-      yes)
-        AC_CHECK_HEADERS(libgksu/libgksu.h,gksu=1)
-        ;;
-      *)
-        CPPFLAGS="-I$with_gksu/include $CPPFLAGS"
-        GKSU_CFLAGS="-I$with_gksu/include"
-        GKSU_LIBS="-L$with_gksu/lib -lgksu"
-        AC_CHECK_HEADERS(libgksu/libgksu.h,gksu=1)
-        ;;
-    esac
-   ],
-   [AC_MSG_RESULT([--with-gksu not specified])
-    AC_CHECK_HEADERS(libgksu/libgksu.h,gksu=1)])
 
-if test "$gksu" != 1 
-then
-GKSU_LIBS=""
-GKSU_CFLAGS=""
-fi
-
-AC_SUBST(GKSU_CFLAGS)
-AC_SUBST(GKSU_LIBS)
-
-
 # test for Glade
 glade=0
 lookin=${prefix}
@@ -553,7 +517,3 @@
  AC_MSG_WARN([gnunet-setup will not include QR support])
 fi
 
-if test "$gksu" != 1 
-then
- AC_MSG_WARN([gnunet-setup will not include GKSU support])
-fi

Modified: gnunet-gtk/src/setup/Makefile.am
===================================================================
--- gnunet-gtk/src/setup/Makefile.am    2012-10-28 23:10:59 UTC (rev 24585)
+++ gnunet-gtk/src/setup/Makefile.am    2012-10-28 23:55:39 UTC (rev 24586)
@@ -31,7 +31,7 @@
   gnunet-setup-hostlist-server.c 
 gnunet_setup_LDADD = \
   $(top_builddir)/src/lib/libgnunetgtk.la \
-  @GTK_LIBS@ @GNUNET_LIBS@ @GLADE_LIBS@ @QR_LIBS@ @GKSU_LIBS@ \
+  @GTK_LIBS@ @GNUNET_LIBS@ @GLADE_LIBS@ @QR_LIBS@ \
   $(WINLIBS) \
   -lgnunetutil -lgnunetnat -lgnunetnamestore \
   $(INTLLIBS) 
@@ -39,8 +39,7 @@
   @GTK_CFLAGS@ \
   @GNUNET_CFLAGS@ \
   @GLADE_CFLAGS@ \
-  @QR_CFLAGS@ \
-  @GKSU_CFLAGS@
+  @QR_CFLAGS@ 
 
 gnunet_setup_LDFLAGS = \
   -export-dynamic 

Modified: gnunet-gtk/src/setup/gnunet-setup.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup.c 2012-10-28 23:10:59 UTC (rev 24585)
+++ gnunet-gtk/src/setup/gnunet-setup.c 2012-10-28 23:55:39 UTC (rev 24586)
@@ -23,18 +23,16 @@
  * @brief Main function of gnunet-setup
  * @author Christian Grothoff
  */
-#if ENABLE_NLS
-#include <locale.h>
-#endif
-#if HAVE_LIBGKSU_LIBGKSU_H
-#include <libgksu/gksu.h>
-#endif
 #include "gnunet-setup.h"
 #include "gnunet-setup-options.h"
 #include "gnunet-setup-gns.h"
 #include <gnunet/gnunet_constants.h>
 #include <regex.h>
+#if ENABLE_NLS
+#include <locale.h>
+#endif
 
+
 /**
  * Main loop handle.
  */
@@ -65,13 +63,12 @@
  */
 static struct GNUNET_OS_Process *namestore;
 
-#if HAVE_LIBGKSU_LIBGKSU_H
 /**
- * Flag to emable privilege escalation.
+ * Flag to enable privilege escalation.
  */
 static int do_gksu;
-#endif
 
+
 /**
  * Show all configuration options, even if we are run
  * as a normal user and a 'gnunet' user exists and thus
@@ -441,7 +438,6 @@
 }
 
 
-#if HAVE_LIBGKSU_LIBGKSU_H
 /**
  * Try elevating user priviledges to run as user 'gnunet' or 'root'.
  *
@@ -451,23 +447,22 @@
 static int
 try_gksu (const char *username)
 {
-  GksuContext *gksu;
-  GError *err;
-  
-  gksu = gksu_context_new ();
-  gksu_context_set_user (gksu, username);
-  gksu_context_set_command (gksu, "gnunet-setup");
-  gksu_context_set_description (gksu, _("Elevate priviledges to setup GNUnet 
on the host"));
-  gksu_context_set_message (gksu, _("Enter password to run gnunet-setup as 
user 'gnunet'"));
-  if (gksu_run_full (gksu,
-                    NULL, NULL,
-                    NULL, NULL,
-                    &err))
-    return GNUNET_OK;
-  g_object_unref (err);
-  return GNUNET_SYSERR;
+  struct GNUNET_OS_Process *proc;
+
+  proc = GNUNET_OS_start_process (GNUNET_NO,
+                                 GNUNET_OS_INHERIT_STD_ALL,
+                                 NULL, NULL,
+                                 "gksu",
+                                 "-u", username,
+                                 "-D", _("Elevate priviledges to setup GNUnet 
on the host"),
+                                 "-m", _("Enter password to run gnunet-setup 
as user 'gnunet'"),
+                                 NULL);
+  if (NULL == proc)
+    return GNUNET_SYSERR;
+  GNUNET_OS_process_wait (proc);
+  GNUNET_OS_process_destroy (proc);
+  return GNUNET_OK;
 }
-#endif
 
 
 /**
@@ -485,8 +480,6 @@
 
   my_uid = getuid ();
   gnunet_pw = getpwnam ("gnunet");
-#if HAVE_LIBGKSU_LIBGKSU_H
-
   if ( (0 != do_gksu) &&
        (0 != my_uid) &&
        (NULL != gnunet_pw) &&
@@ -496,8 +489,6 @@
     GNUNET_GTK_main_loop_quit (cls);
     return;
   }
-#endif  
-
   ml = cls;
   if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
     return;
@@ -564,11 +555,9 @@
 main (int argc, char *const *argv)
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
-#if HAVE_LIBGKSU_LIBGKSU_H
     { 'e', "elevate-priviledges", NULL,
       gettext_noop ("run as user 'gnunet', if necessary by executing gksu to 
elevate rights"),
       0, &GNUNET_GETOPT_set_one, &do_gksu },
-#endif
     { 'f', "force-full-setup", NULL,
       gettext_noop ("force showing the full set of options, even if 
gnunet-setup is run as a normal user and as a user 'gnunet' exists on the 
system, most options should not apply to the normal user as GNUnet should be 
run by the 'gnunet' user"),
       0, &GNUNET_GETOPT_set_one, &force_full_setup },




reply via email to

[Prev in Thread] Current Thread [Next in Thread]