Import gksu-polkit-0.0.2.
This is the new generation of gksu, a simple utility to run programs as root, even in X-based environments. This version uses the new libgksu-polkit library, which uses PolicyKit for authorization purposes and a D-Bus service to actually perform the work. ok jasper@
This commit is contained in:
parent
5a57c0a382
commit
0ec613faa4
57
security/gksu-polkit/Makefile
Normal file
57
security/gksu-polkit/Makefile
Normal file
@ -0,0 +1,57 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
COMMENT= command line utility to run programs as root
|
||||
|
||||
DISTNAME= gksu-polkit-0.0.2
|
||||
|
||||
SHARED_LIBS += gksu-polkit 0.0 # 0.1
|
||||
|
||||
CATEGORIES= security sysutils x11
|
||||
|
||||
HOMEPAGE= http://live.gnome.org/gksu
|
||||
|
||||
MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
|
||||
|
||||
# LGPLv3
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
WANTLIB += ICE SM X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext png
|
||||
WANTLIB += Xfixes Xi Xinerama Xrandr Xrender c expat fontconfig glitz
|
||||
WANTLIB += freetype m pixman-1 pthread pthread-stubs xcb xcb-atom gee
|
||||
WANTLIB += xcb-aux xcb-event xcb-render xcb-render-util z cairo pcre
|
||||
WANTLIB += dbus-1 dbus-glib-1 eggdbus-1 execinfo gdk-x11-2.0 atk-1.0
|
||||
WANTLIB += gdk_pixbuf-2.0 gio-2.0 glib-2.0 gmodule-2.0 gobject-2.0
|
||||
WANTLIB += gthread-2.0 gtk-x11-2.0 pango-1.0 pangocairo-1.0 pangoft2-1.0
|
||||
WANTLIB += polkit-gobject-1 startup-notification-1
|
||||
|
||||
MASTER_SITES= http://people.debian.org/~kov/gksu/
|
||||
|
||||
LIB_DEPENDS= ::sysutils/polkit \
|
||||
::x11/gtk+2 \
|
||||
::devel/libgee \
|
||||
::devel/startup-notification
|
||||
|
||||
BUILD_DEPENDS= ::lang/vala
|
||||
RUN_DEPENDS= :polkit-gnome-*|polkit-qt4-*:x11/polkit-gnome
|
||||
|
||||
MODULES= devel/gettext
|
||||
|
||||
USE_GMAKE= Yes
|
||||
USE_LIBTOOL= Yes
|
||||
|
||||
CONFIGURE_STYLE=gnu
|
||||
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
|
||||
--disable-gtk-doc
|
||||
|
||||
FAKE_FLAGS= DBUS_SYS_DIR=${PREFIX}/share/examples/gksu-polkit/dbus-1/system.d
|
||||
|
||||
post-extract:
|
||||
cp ${FILESDIR}/gksu-environment.vala ${WRKSRC}/common
|
||||
|
||||
pre-configure:
|
||||
${SUBST_CMD} ${WRKSRC}/mechanism/gksu-controller.c
|
||||
|
||||
.include <bsd.port.mk>
|
5
security/gksu-polkit/distinfo
Normal file
5
security/gksu-polkit/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (gksu-polkit-0.0.2.tar.gz) = G2bhcBBzmHEBX/XE5BBXNA==
|
||||
RMD160 (gksu-polkit-0.0.2.tar.gz) = H1FTT3ihcSbqg3nPT9FUYqfpl38=
|
||||
SHA1 (gksu-polkit-0.0.2.tar.gz) = dIC8uzvVHAELYTVGCYN0W+FzLxU=
|
||||
SHA256 (gksu-polkit-0.0.2.tar.gz) = 9i0O74X2QMDBx0gb0fcdSIXePi2nHzDUPrE6kGOqLM0=
|
||||
SIZE (gksu-polkit-0.0.2.tar.gz) = 363586
|
144
security/gksu-polkit/files/gksu-environment.vala
Normal file
144
security/gksu-polkit/files/gksu-environment.vala
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Gustavo Noronha Silva
|
||||
*
|
||||
* This file is part of the Gksu PolicyKit library.
|
||||
*
|
||||
* This program 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 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details. You should have received
|
||||
* a copy of the GNU General Public License along with this program;
|
||||
* if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
using GLib;
|
||||
using Gee;
|
||||
|
||||
namespace Gksu {
|
||||
class Variable: Object {
|
||||
public string name;
|
||||
public string regex;
|
||||
}
|
||||
|
||||
public class Environment: Object {
|
||||
HashMap<string,Variable> variables;
|
||||
|
||||
construct {
|
||||
weak string[] search_path = GLib.Environment.get_system_data_dirs();
|
||||
variables = new HashMap<string,Variable>(GLib.str_hash, GLib.str_equal);
|
||||
|
||||
foreach(string path in search_path) {
|
||||
string full_path = path.concat("gksu-polkit-1/environment/");
|
||||
read_variables_from_path(full_path);
|
||||
}
|
||||
}
|
||||
|
||||
public HashTable<string,string>? get_variables() {
|
||||
Set<string> keysset = variables.keys;
|
||||
HashTable<string,string> envpairs = new HashTable<string,string>(str_hash, str_equal);
|
||||
|
||||
foreach(string variable in keysset) {
|
||||
string value = GLib.Environment.get_variable(variable);
|
||||
envpairs.insert(variable, value);
|
||||
}
|
||||
|
||||
return envpairs;
|
||||
}
|
||||
|
||||
public bool validate_hash_table(HashTable<string,string> hash_table) {
|
||||
GLib.List<weak string> varnames = hash_table.get_keys();
|
||||
|
||||
foreach(string name in varnames) {
|
||||
weak string value = hash_table.lookup(name);
|
||||
if(!is_variable_valid(name, value))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* this verifies that the variable should be passed through,
|
||||
* and that it contains a valid value
|
||||
*/
|
||||
public bool is_variable_valid(string name, string value) {
|
||||
/* first we verify that the variable is specified */
|
||||
if(variables.get(name) == null)
|
||||
return false;
|
||||
|
||||
/* then we verify that the variable regular expression matches */
|
||||
Variable variable = variables.get(name);
|
||||
if((variable.regex != null) && (variable.regex != "") ) {
|
||||
try {
|
||||
Regex regex = new Regex(variable.regex);
|
||||
return regex.match(value);
|
||||
} catch (RegexError error) {
|
||||
warning("bad regular expression for variable %s", name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* the variable looks OK */
|
||||
return true;
|
||||
}
|
||||
|
||||
private void read_variables_from_path(string path) {
|
||||
Dir directory;
|
||||
|
||||
try {
|
||||
directory = Dir.open(path, 0);
|
||||
} catch (FileError error) {
|
||||
return;
|
||||
}
|
||||
|
||||
weak string entry;
|
||||
while((entry = directory.read_name()) != null) {
|
||||
if(entry.has_suffix(".variables")) {
|
||||
string full_path = path.concat(entry);
|
||||
read_variables_from_file(full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void read_variables_from_file(string path) {
|
||||
KeyFile file = new KeyFile();
|
||||
string[] variable_names;
|
||||
|
||||
try {
|
||||
file.load_from_file(path, 0);
|
||||
} catch (KeyFileError error) {
|
||||
warning("%s", error.message);
|
||||
return;
|
||||
} catch (FileError error) {
|
||||
warning("%s", error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
variable_names = file.get_groups();
|
||||
foreach(string name in variable_names) {
|
||||
string policy;
|
||||
try {
|
||||
policy = file.get_value(name, "Policy");
|
||||
} catch (KeyFileError error) {
|
||||
policy = null;
|
||||
}
|
||||
|
||||
if(policy != "send")
|
||||
continue;
|
||||
|
||||
Variable variable = new Variable();
|
||||
variable.name = name;
|
||||
try {
|
||||
variable.regex = file.get_value(name, "Regex");
|
||||
} catch (KeyFileError error) {}
|
||||
|
||||
variables.set(name, variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
$OpenBSD: patch-common_gksu-environment_vala,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
From openSUSE:
|
||||
Fix issues reading environment .variables files. We can't guarantee
|
||||
there's a trailing slash in directories from XDG_DATA_DIRS.
|
||||
|
||||
--- common/gksu-environment.vala.orig Mon Sep 20 12:23:04 2010
|
||||
+++ common/gksu-environment.vala Mon Sep 20 12:23:32 2010
|
||||
@@ -34,7 +34,7 @@ namespace Gksu {
|
||||
variables = new HashMap<string,Variable>(GLib.str_hash, GLib.str_equal);
|
||||
|
||||
foreach(string path in search_path) {
|
||||
- string full_path = path.concat("gksu-polkit-1/environment/");
|
||||
+ string full_path = Path.build_filename (path, "gksu-polkit-1", "environment");
|
||||
read_variables_from_path(full_path);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace Gksu {
|
||||
weak string entry;
|
||||
while((entry = directory.read_name()) != null) {
|
||||
if(entry.has_suffix(".variables")) {
|
||||
- string full_path = path.concat(entry);
|
||||
+ string full_path = Path.build_filename (path, entry);
|
||||
read_variables_from_file(full_path);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-data_org_gnome_gksu_policy,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
--- data/org.gnome.gksu.policy.orig Sat Jan 30 17:38:25 2010
|
||||
+++ data/org.gnome.gksu.policy Mon Sep 20 08:59:05 2010
|
||||
@@ -10,9 +10,9 @@
|
||||
<description>spawn</description>
|
||||
<message>System policy prevents executing a program with administration privileges</message>
|
||||
<defaults>
|
||||
- <allow_any>auth_self</allow_any>
|
||||
- <allow_inactive>auth_self</allow_inactive>
|
||||
- <allow_active>auth_self</allow_active>
|
||||
+ <allow_any>auth_admin</allow_any>
|
||||
+ <allow_inactive>auth_admin</allow_inactive>
|
||||
+ <allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
</action>
|
||||
|
49
security/gksu-polkit/patches/patch-gksu_gksu-polkit_c
Normal file
49
security/gksu-polkit/patches/patch-gksu_gksu-polkit_c
Normal file
@ -0,0 +1,49 @@
|
||||
$OpenBSD: patch-gksu_gksu-polkit_c,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
Do not take 100% of the CPU in gksu-polkit when there's no stdin master
|
||||
(upstream commit d7e31609efe8031dbd56b87caf4200330594488f)
|
||||
|
||||
--- gksu/gksu-polkit.c.orig Wed Feb 18 13:33:18 2009
|
||||
+++ gksu/gksu-polkit.c Mon Sep 20 12:03:27 2010
|
||||
@@ -20,7 +20,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
+#ifdef __OpenBSD__
|
||||
+#include <sys/wait.h>
|
||||
+#else
|
||||
#include <wait.h>
|
||||
+#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gksu-process.h>
|
||||
@@ -89,6 +93,7 @@ static gboolean input_received (GIOChannel *channel,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GString *retstring;
|
||||
+ GIOStatus status = G_IO_STATUS_AGAIN;
|
||||
gchar buffer[1024];
|
||||
gsize length = -1;
|
||||
|
||||
@@ -102,7 +107,6 @@ static gboolean input_received (GIOChannel *channel,
|
||||
|
||||
while(length != 0)
|
||||
{
|
||||
- GIOStatus status;
|
||||
status = g_io_channel_read_chars(channel, buffer, 1024, &length, &error);
|
||||
if(error)
|
||||
{
|
||||
@@ -112,10 +116,11 @@ static gboolean input_received (GIOChannel *channel,
|
||||
g_string_append_len(retstring, buffer, length);
|
||||
}
|
||||
|
||||
- gksu_write_queue_add(queue, retstring->str, retstring->len);
|
||||
+ if (retstring->len > 0)
|
||||
+ gksu_write_queue_add(queue, retstring->str, retstring->len);
|
||||
g_string_free(retstring, TRUE);
|
||||
|
||||
- return TRUE;
|
||||
+ return status != G_IO_STATUS_EOF;
|
||||
}
|
||||
|
||||
static void kill_process_handler(int signum)
|
107
security/gksu-polkit/patches/patch-libgksu_gksu-process_c
Normal file
107
security/gksu-polkit/patches/patch-libgksu_gksu-process_c
Normal file
@ -0,0 +1,107 @@
|
||||
$OpenBSD: patch-libgksu_gksu-process_c,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
Prevent stdin, stdout and stderr definitions clash.
|
||||
|
||||
Use uint64 instead of uint for sizes, and use casts where needed
|
||||
(upstream 0cf804a8666404444968c995b03fe8af9893a58f)
|
||||
|
||||
From openSUSE:
|
||||
Make xauth do not cause DNS lookups. This can slow down things, so we
|
||||
use nlist instead of list.
|
||||
Also pass -q, just to be sure we don't unsolicited output.
|
||||
|
||||
--- libgksu/gksu-process.c.orig Sat Jan 30 17:38:25 2010
|
||||
+++ libgksu/gksu-process.c Mon Sep 20 12:24:41 2010
|
||||
@@ -62,7 +62,7 @@ struct _GksuProcessPrivate {
|
||||
* application decides to close an FD we also keep a 'mirror'
|
||||
* GIOChannel for its side of the pipe, so that we can monitor the
|
||||
* application closing an FD, for instance */
|
||||
- gint stdin[2];
|
||||
+ gint gksu_stdin[2];
|
||||
GIOChannel *stdin_channel;
|
||||
guint stdin_source_id;
|
||||
GIOChannel *stdin_mirror;
|
||||
@@ -73,13 +73,13 @@ struct _GksuProcessPrivate {
|
||||
* because the buffer is filled, and application needs to read some
|
||||
* of it; we need to give it a chance to read the buffer, thus, but
|
||||
* still need to remember to write what is left */
|
||||
- gint stdout[2];
|
||||
+ gint gksu_stdout[2];
|
||||
GIOChannel *stdout_channel;
|
||||
GIOChannel *stdout_mirror;
|
||||
guint stdout_mirror_id;
|
||||
GksuWriteQueue *stdout_write_queue;
|
||||
|
||||
- gint stderr[2];
|
||||
+ gint gksu_stderr[2];
|
||||
GIOChannel *stderr_channel;
|
||||
GIOChannel *stderr_mirror;
|
||||
guint stderr_mirror_id;
|
||||
@@ -126,6 +126,7 @@ static void output_available_cb(DBusGProxy *server, gi
|
||||
GksuProcessPrivate *priv = GKSU_PROCESS_GET_PRIVATE(self);
|
||||
GError *error = NULL;
|
||||
gchar *data = NULL;
|
||||
+ guint64 uint_length;
|
||||
gsize length;
|
||||
|
||||
if(pid != priv->pid)
|
||||
@@ -136,9 +137,11 @@ static void output_available_cb(DBusGProxy *server, gi
|
||||
G_TYPE_INT, fd,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &data,
|
||||
- G_TYPE_UINT, &length,
|
||||
+ G_TYPE_UINT64, &uint_length,
|
||||
G_TYPE_INVALID);
|
||||
|
||||
+ length = (gsize)uint_length;
|
||||
+
|
||||
if(error)
|
||||
{
|
||||
g_warning("%s", error->message);
|
||||
@@ -334,8 +337,8 @@ get_xauth_token(const gchar *explicit_display)
|
||||
}
|
||||
|
||||
/* get the authorization token */
|
||||
- tmp = g_strdup_printf ("%s -i list %s | "
|
||||
- "head -1 | awk '{ print $3 }'",
|
||||
+ tmp = g_strdup_printf ("%s -q -i nlist %s | "
|
||||
+ "head -1 | awk '{ print $9 }'",
|
||||
xauth_bin,
|
||||
display);
|
||||
if ((xauth_output = popen (tmp, "r")) == NULL)
|
||||
@@ -522,7 +525,7 @@ gksu_process_stdin_ready_to_send_cb(GIOChannel *channe
|
||||
dbus_g_proxy_call(priv->server, "WriteInput", &error,
|
||||
G_TYPE_UINT, priv->cookie,
|
||||
G_TYPE_STRING, data,
|
||||
- G_TYPE_UINT, length,
|
||||
+ G_TYPE_UINT64, (guint64)length,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_INVALID);
|
||||
g_free(data);
|
||||
@@ -648,7 +651,7 @@ gksu_process_spawn_async_with_pipes(GksuProcess *self,
|
||||
{
|
||||
gksu_process_prepare_pipe(&(priv->stdin_channel),
|
||||
&(priv->stdin_mirror),
|
||||
- priv->stdin,
|
||||
+ priv->gksu_stdin,
|
||||
standard_input,
|
||||
TRUE);
|
||||
|
||||
@@ -668,7 +671,7 @@ gksu_process_spawn_async_with_pipes(GksuProcess *self,
|
||||
{
|
||||
gksu_process_prepare_pipe(&(priv->stdout_channel),
|
||||
&(priv->stdout_mirror),
|
||||
- priv->stdout,
|
||||
+ priv->gksu_stdout,
|
||||
standard_output,
|
||||
FALSE);
|
||||
|
||||
@@ -685,7 +688,7 @@ gksu_process_spawn_async_with_pipes(GksuProcess *self,
|
||||
{
|
||||
gksu_process_prepare_pipe(&(priv->stderr_channel),
|
||||
&(priv->stderr_mirror),
|
||||
- priv->stderr,
|
||||
+ priv->gksu_stderr,
|
||||
standard_error,
|
||||
FALSE);
|
||||
|
@ -0,0 +1,25 @@
|
||||
$OpenBSD: patch-mechanism_dbus-gksu-server_xml,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
Use uint64 instead of uint for sizes, and use casts where needed
|
||||
(upstream 0cf804a8666404444968c995b03fe8af9893a58f)
|
||||
|
||||
--- mechanism/dbus-gksu-server.xml.orig Wed Feb 18 13:33:18 2009
|
||||
+++ mechanism/dbus-gksu-server.xml Mon Sep 20 08:59:19 2010
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<method name="ReadOutput">
|
||||
<arg type="s" name="data" direction="out" />
|
||||
- <arg type="u" name="length" direction="out" />
|
||||
+ <arg type="t" name="length" direction="out" />
|
||||
<arg type="u" name="cookie" direction="in" />
|
||||
<arg type="i" name="fd" direction="in" />
|
||||
</method>
|
||||
@@ -25,7 +25,7 @@
|
||||
<method name="WriteInput">
|
||||
<arg type="u" name="cookie" direction="in" />
|
||||
<arg type="s" name="data" direction="in" />
|
||||
- <arg type="u" name="length" direction="in" />
|
||||
+ <arg type="t" name="length" direction="in" />
|
||||
</method>
|
||||
|
||||
<method name="CloseFD">
|
241
security/gksu-polkit/patches/patch-mechanism_gksu-controller_c
Normal file
241
security/gksu-polkit/patches/patch-mechanism_gksu-controller_c
Normal file
@ -0,0 +1,241 @@
|
||||
$OpenBSD: patch-mechanism_gksu-controller_c,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
|
||||
Prevent stdin, stdout and stderr definitions clash.
|
||||
|
||||
--- mechanism/gksu-controller.c.orig Sat Jan 30 17:38:25 2010
|
||||
+++ mechanism/gksu-controller.c Mon Sep 20 11:51:12 2010
|
||||
@@ -50,13 +50,13 @@ struct _GksuControllerPrivate {
|
||||
* control a process after Spawn; it is generated by GksuServer */
|
||||
guint32 cookie;
|
||||
|
||||
- GIOChannel *stdin;
|
||||
+ GIOChannel *gksu_stdin;
|
||||
guint stdin_source_id;
|
||||
|
||||
- GIOChannel *stdout;
|
||||
+ GIOChannel *gksu_stdout;
|
||||
guint stdout_source_id;
|
||||
|
||||
- GIOChannel *stderr;
|
||||
+ GIOChannel *gksu_stderr;
|
||||
guint stderr_source_id;
|
||||
};
|
||||
|
||||
@@ -98,25 +98,25 @@ static void gksu_controller_finalize(GObject *object)
|
||||
GksuController *self = GKSU_CONTROLLER(object);
|
||||
GksuControllerPrivate *priv = self->priv;
|
||||
|
||||
- if(priv->stdin)
|
||||
+ if(priv->gksu_stdin)
|
||||
{
|
||||
g_source_remove(priv->stdin_source_id);
|
||||
- g_io_channel_shutdown(priv->stdin, FALSE, NULL);
|
||||
- g_io_channel_unref(priv->stdin);
|
||||
+ g_io_channel_shutdown(priv->gksu_stdin, FALSE, NULL);
|
||||
+ g_io_channel_unref(priv->gksu_stdin);
|
||||
}
|
||||
|
||||
- if(priv->stdout)
|
||||
+ if(priv->gksu_stdout)
|
||||
{
|
||||
g_source_remove(priv->stdout_source_id);
|
||||
- g_io_channel_shutdown(priv->stdout, FALSE, NULL);
|
||||
- g_io_channel_unref(priv->stdout);
|
||||
+ g_io_channel_shutdown(priv->gksu_stdout, FALSE, NULL);
|
||||
+ g_io_channel_unref(priv->gksu_stdout);
|
||||
}
|
||||
|
||||
- if(priv->stderr)
|
||||
+ if(priv->gksu_stderr)
|
||||
{
|
||||
g_source_remove(priv->stderr_source_id);
|
||||
- g_io_channel_shutdown(priv->stderr, FALSE, NULL);
|
||||
- g_io_channel_unref(priv->stderr);
|
||||
+ g_io_channel_shutdown(priv->gksu_stderr, FALSE, NULL);
|
||||
+ g_io_channel_unref(priv->gksu_stderr);
|
||||
}
|
||||
|
||||
g_free(priv->working_directory);
|
||||
@@ -166,7 +166,7 @@ static void gksu_controller_process_exited_cb(GPid pid
|
||||
g_signal_emit(self, signals[PROCESS_EXITED], 0, status);
|
||||
}
|
||||
|
||||
-static gboolean gksu_controller_stdin_hangup_cb(GIOChannel *stdin,
|
||||
+static gboolean gksu_controller_stdin_hangup_cb(GIOChannel *gksu_stdin,
|
||||
GIOCondition condition,
|
||||
GksuController *self)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ static gboolean gksu_controller_stdin_hangup_cb(GIOCha
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-static gboolean gksu_controller_stdout_ready_to_read_cb(GIOChannel *stdout,
|
||||
+static gboolean gksu_controller_stdout_ready_to_read_cb(GIOChannel *gksu_stdout,
|
||||
GIOCondition condition,
|
||||
GksuController *self)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ static gboolean gksu_controller_stdout_ready_to_read_c
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-static gboolean gksu_controller_stderr_ready_to_read_cb(GIOChannel *stderr,
|
||||
+static gboolean gksu_controller_stderr_ready_to_read_cb(GIOChannel *gksu_stderr,
|
||||
GIOCondition condition,
|
||||
GksuController *self)
|
||||
{
|
||||
@@ -271,8 +271,8 @@ static gboolean gksu_controller_prepare_xauth(GksuCont
|
||||
/* actually create the real file */
|
||||
if (g_file_test("/usr/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
|
||||
xauth_bin = "/usr/bin/xauth";
|
||||
- else if (g_file_test("/usr/X11R6/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
|
||||
- xauth_bin = "/usr/X11R6/bin/xauth";
|
||||
+ else if (g_file_test("${X11BASE}/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
|
||||
+ xauth_bin = "${X11BASE}/bin/xauth";
|
||||
else
|
||||
{
|
||||
unlink(tmpfilename);
|
||||
@@ -333,9 +333,9 @@ GksuController* gksu_controller_run(GksuController *se
|
||||
|
||||
/* the pointers are just to allow us to only pass in fds in which
|
||||
* our caller is interested */
|
||||
- gint *stdin = NULL;
|
||||
- gint *stdout = NULL;
|
||||
- gint *stderr = NULL;
|
||||
+ gint *gksu_stdin = NULL;
|
||||
+ gint *gksu_stdout = NULL;
|
||||
+ gint *gksu_stderr = NULL;
|
||||
gint stdin_real, stdout_real, stderr_real;
|
||||
|
||||
GError *internal_error = NULL;
|
||||
@@ -383,21 +383,21 @@ GksuController* gksu_controller_run(GksuController *se
|
||||
* g_spawn_async_with_pipes handles it correctly
|
||||
*/
|
||||
if(using_stdin)
|
||||
- stdin = &stdin_real;
|
||||
+ gksu_stdin = &stdin_real;
|
||||
|
||||
if(using_stdout)
|
||||
- stdout = &stdout_real;
|
||||
+ gksu_stdout = &stdout_real;
|
||||
else
|
||||
spawn_flags |= G_SPAWN_STDOUT_TO_DEV_NULL;
|
||||
|
||||
if(using_stderr)
|
||||
- stderr = &stderr_real;
|
||||
+ gksu_stderr = &stderr_real;
|
||||
else
|
||||
spawn_flags |= G_SPAWN_STDERR_TO_DEV_NULL;
|
||||
|
||||
g_spawn_async_with_pipes(priv->working_directory, priv->arguments, environmentv,
|
||||
spawn_flags, NULL, NULL, pid,
|
||||
- stdin, stdout, stderr, &internal_error);
|
||||
+ gksu_stdin, gksu_stdout, gksu_stderr, &internal_error);
|
||||
g_strfreev(environmentv);
|
||||
|
||||
if(internal_error)
|
||||
@@ -414,34 +414,34 @@ GksuController* gksu_controller_run(GksuController *se
|
||||
*/
|
||||
if(stdin)
|
||||
{
|
||||
- priv->stdin = g_io_channel_unix_new(stdin_real);
|
||||
- g_io_channel_set_encoding(priv->stdin, NULL, NULL);
|
||||
- g_io_channel_set_buffered(priv->stdin, FALSE);
|
||||
+ priv->gksu_stdin = g_io_channel_unix_new(stdin_real);
|
||||
+ g_io_channel_set_encoding(priv->gksu_stdin, NULL, NULL);
|
||||
+ g_io_channel_set_buffered(priv->gksu_stdin, FALSE);
|
||||
priv->stdin_source_id =
|
||||
- g_io_add_watch(priv->stdin, G_IO_HUP|G_IO_NVAL,
|
||||
+ g_io_add_watch(priv->gksu_stdin, G_IO_HUP|G_IO_NVAL,
|
||||
(GIOFunc)gksu_controller_stdin_hangup_cb,
|
||||
(gpointer)self);
|
||||
}
|
||||
|
||||
if(stdout)
|
||||
{
|
||||
- priv->stdout = g_io_channel_unix_new(stdout_real);
|
||||
- g_io_channel_set_flags(priv->stdout, G_IO_FLAG_NONBLOCK, NULL);
|
||||
+ priv->gksu_stdout = g_io_channel_unix_new(stdout_real);
|
||||
+ g_io_channel_set_flags(priv->gksu_stdout, G_IO_FLAG_NONBLOCK, NULL);
|
||||
/* the child may output binary data; we don't care */
|
||||
- g_io_channel_set_encoding(priv->stdout, NULL, NULL);
|
||||
+ g_io_channel_set_encoding(priv->gksu_stdout, NULL, NULL);
|
||||
priv->stdout_source_id =
|
||||
- g_io_add_watch(priv->stdout, G_IO_IN|G_IO_PRI|G_IO_HUP,
|
||||
+ g_io_add_watch(priv->gksu_stdout, G_IO_IN|G_IO_PRI|G_IO_HUP,
|
||||
(GIOFunc)gksu_controller_stdout_ready_to_read_cb,
|
||||
(gpointer)self);
|
||||
}
|
||||
|
||||
if(stderr)
|
||||
{
|
||||
- priv->stderr = g_io_channel_unix_new(stderr_real);
|
||||
- g_io_channel_set_flags(priv->stderr, G_IO_FLAG_NONBLOCK, NULL);
|
||||
- g_io_channel_set_encoding(priv->stderr, NULL, NULL);
|
||||
+ priv->gksu_stderr = g_io_channel_unix_new(stderr_real);
|
||||
+ g_io_channel_set_flags(priv->gksu_stderr, G_IO_FLAG_NONBLOCK, NULL);
|
||||
+ g_io_channel_set_encoding(priv->gksu_stderr, NULL, NULL);
|
||||
priv->stderr_source_id =
|
||||
- g_io_add_watch(priv->stderr, G_IO_IN|G_IO_PRI|G_IO_HUP,
|
||||
+ g_io_add_watch(priv->gksu_stderr, G_IO_IN|G_IO_PRI|G_IO_HUP,
|
||||
(GIOFunc)gksu_controller_stderr_ready_to_read_cb,
|
||||
(gpointer)self);
|
||||
}
|
||||
@@ -484,13 +484,13 @@ void gksu_controller_close_fd(GksuController *self, gi
|
||||
switch(fd)
|
||||
{
|
||||
case 0:
|
||||
- channel = priv->stdin;
|
||||
+ channel = priv->gksu_stdin;
|
||||
break;
|
||||
case 1:
|
||||
- channel = priv->stdout;
|
||||
+ channel = priv->gksu_stdout;
|
||||
break;
|
||||
case 2:
|
||||
- channel = priv->stderr;
|
||||
+ channel = priv->gksu_stderr;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Trying to close invalid FD '%d' for PID '%d'\n",
|
||||
@@ -526,12 +526,12 @@ gchar* gksu_controller_read_output(GksuController *sel
|
||||
switch(fd)
|
||||
{
|
||||
case 1:
|
||||
- channel = priv->stdout;
|
||||
+ channel = priv->gksu_stdout;
|
||||
source_id = &(priv->stdout_source_id);
|
||||
handler_func = (GIOFunc)gksu_controller_stdout_ready_to_read_cb;
|
||||
break;
|
||||
case 2:
|
||||
- channel = priv->stderr;
|
||||
+ channel = priv->gksu_stderr;
|
||||
source_id = &(priv->stderr_source_id);
|
||||
handler_func = (GIOFunc)gksu_controller_stderr_ready_to_read_cb;
|
||||
break;
|
||||
@@ -588,7 +588,7 @@ gboolean gksu_controller_write_input(GksuController *s
|
||||
const gsize length, GError **error)
|
||||
{
|
||||
GksuControllerPrivate *priv = self->priv;
|
||||
- GIOChannel *channel = priv->stdin;
|
||||
+ GIOChannel *channel = priv->gksu_stdin;
|
||||
GError *internal_error = NULL;
|
||||
gsize bytes_written =0;
|
||||
gsize bytes_left = length;
|
||||
@@ -616,7 +616,7 @@ gboolean gksu_controller_is_using_stdout(GksuControlle
|
||||
{
|
||||
GksuControllerPrivate *priv = self->priv;
|
||||
|
||||
- if(priv->stdout)
|
||||
+ if(priv->gksu_stdout)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@@ -626,7 +626,7 @@ gboolean gksu_controller_is_using_stderr(GksuControlle
|
||||
{
|
||||
GksuControllerPrivate *priv = self->priv;
|
||||
|
||||
- if(priv->stderr)
|
||||
+ if(priv->gksu_stderr)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
@ -0,0 +1,18 @@
|
||||
$OpenBSD: patch-mechanism_gksu-polkit_conf,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
--- mechanism/gksu-polkit.conf.orig Mon Sep 20 12:23:05 2010
|
||||
+++ mechanism/gksu-polkit.conf Mon Sep 20 12:27:40 2010
|
||||
@@ -0,0 +1,14 @@
|
||||
+<!DOCTYPE busconfig PUBLIC
|
||||
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
+<busconfig>
|
||||
+
|
||||
+ <policy user="root">
|
||||
+ <allow own="org.gnome.Gksu"/>
|
||||
+ </policy>
|
||||
+
|
||||
+ <policy context="default">
|
||||
+ <allow send_destination="org.gnome.Gksu" send_interface="org.gnome.Gksu"/>
|
||||
+ </policy>
|
||||
+
|
||||
+</busconfig>
|
5
security/gksu-polkit/pkg/DESCR
Executable file
5
security/gksu-polkit/pkg/DESCR
Executable file
@ -0,0 +1,5 @@
|
||||
This is the new generation of gksu, a simple utility to run programs as
|
||||
root, even in X-based environments.
|
||||
This version uses the new libgksu-polkit library, which uses PolicyKit
|
||||
for authorization purposes and a D-Bus service to actually perform the
|
||||
work.
|
2
security/gksu-polkit/pkg/PFRAG.shared
Normal file
2
security/gksu-polkit/pkg/PFRAG.shared
Normal file
@ -0,0 +1,2 @@
|
||||
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
@lib lib/libgksu-polkit.so.${LIBgksu-polkit_VERSION}
|
36
security/gksu-polkit/pkg/PLIST
Normal file
36
security/gksu-polkit/pkg/PLIST
Normal file
@ -0,0 +1,36 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
|
||||
%%SHARED%%
|
||||
@bin bin/gksu-polkit
|
||||
include/gksu-polkit/
|
||||
include/gksu-polkit/gksu-polkit.h
|
||||
include/gksu-polkit/gksu-process.h
|
||||
lib/libgksu-polkit.a
|
||||
lib/libgksu-polkit.la
|
||||
lib/pkgconfig/libgksu-polkit-1.pc
|
||||
@bin sbin/gksu-server
|
||||
share/dbus-1/
|
||||
share/dbus-1/system-services/
|
||||
share/dbus-1/system-services/org.gnome.Gksu.service
|
||||
share/examples/gksu-polkit/
|
||||
share/examples/gksu-polkit/dbus-1/
|
||||
share/examples/gksu-polkit/dbus-1/system.d/
|
||||
share/examples/gksu-polkit/dbus-1/system.d/gksu-polkit.conf
|
||||
@sample ${SYSCONFDIR}/dbus-1/system.d/gksu-polkit.conf
|
||||
share/gksu-polkit-1/
|
||||
share/gksu-polkit-1/environment/
|
||||
share/gksu-polkit-1/environment/common.variables
|
||||
share/gtk-doc/
|
||||
share/gtk-doc/html/
|
||||
share/gtk-doc/html/libgksu-polkit/
|
||||
share/gtk-doc/html/libgksu-polkit/ch01.html
|
||||
share/gtk-doc/html/libgksu-polkit/home.png
|
||||
share/gtk-doc/html/libgksu-polkit/index.html
|
||||
share/gtk-doc/html/libgksu-polkit/left.png
|
||||
share/gtk-doc/html/libgksu-polkit/libgksu-polkit.devhelp
|
||||
share/gtk-doc/html/libgksu-polkit/libgksu-polkit.devhelp2
|
||||
share/gtk-doc/html/libgksu-polkit/right.png
|
||||
share/gtk-doc/html/libgksu-polkit/style.css
|
||||
share/gtk-doc/html/libgksu-polkit/up.png
|
||||
share/polkit-1/
|
||||
share/polkit-1/actions/
|
||||
share/polkit-1/actions/org.gnome.gksu.policy
|
Loading…
Reference in New Issue
Block a user