From 96e73f52582e3517d0925fa402bb4bb349123b10 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 28 Mar 2007 14:50:02 -0400 Subject: [PATCH] split libpolkit into more source/header files --- libpolkit.pc.in | 2 +- libpolkit/Makefile.am | 26 +++- libpolkit/libpolkit-caller.c | 116 +++++++++++++++ libpolkit/libpolkit-caller.h | 55 +++++++ libpolkit/libpolkit-context.c | 69 +++++++++ libpolkit/libpolkit-context.h | 61 ++++++++ libpolkit/libpolkit-privilege.c | 72 ++++++++++ libpolkit/libpolkit-privilege.h | 45 ++++++ libpolkit/libpolkit-resource.c | 83 +++++++++++ libpolkit/libpolkit-resource.h | 47 ++++++ libpolkit/libpolkit-seat.c | 72 ++++++++++ libpolkit/libpolkit-seat.h | 45 ++++++ libpolkit/libpolkit-session.c | 128 +++++++++++++++++ libpolkit/libpolkit-session.h | 57 ++++++++ libpolkit/libpolkit.c | 312 ---------------------------------------- libpolkit/libpolkit.h | 98 +------------ 16 files changed, 876 insertions(+), 412 deletions(-) create mode 100644 libpolkit/libpolkit-caller.c create mode 100644 libpolkit/libpolkit-caller.h create mode 100644 libpolkit/libpolkit-context.c create mode 100644 libpolkit/libpolkit-context.h create mode 100644 libpolkit/libpolkit-privilege.c create mode 100644 libpolkit/libpolkit-privilege.h create mode 100644 libpolkit/libpolkit-resource.c create mode 100644 libpolkit/libpolkit-resource.h create mode 100644 libpolkit/libpolkit-seat.c create mode 100644 libpolkit/libpolkit-seat.h create mode 100644 libpolkit/libpolkit-session.c create mode 100644 libpolkit/libpolkit-session.h diff --git a/libpolkit.pc.in b/libpolkit.pc.in index 1d8d60a..3f36d2d 100644 --- a/libpolkit.pc.in +++ b/libpolkit.pc.in @@ -8,4 +8,4 @@ Description: library for querying system-wide policy Version: @VERSION@ Requires: glib-2.0 Libs: -L${libdir} -lpolkit -Cflags: -I${includedir}/libpolkit +Cflags: -I${includedir}/PolicyKit diff --git a/libpolkit/Makefile.am b/libpolkit/Makefile.am index 68338b8..55408c1 100644 --- a/libpolkit/Makefile.am +++ b/libpolkit/Makefile.am @@ -12,13 +12,25 @@ INCLUDES = \ lib_LTLIBRARIES=libpolkit.la -libpolkitincludedir=$(includedir)/libpolkit - -libpolkitinclude_HEADERS = \ - libpolkit.h - -libpolkit_la_SOURCES = \ - libpolkit.c libpolkit.h +libpolkitincludedir=$(includedir)/PolicyKit/libpolkit + +libpolkitinclude_HEADERS = \ + libpolkit.h \ + libpolkit-context.h \ + libpolkit-privilege.h \ + libpolkit-resource.h \ + libpolkit-seat.h \ + libpolkit-session.h \ + libpolkit-caller.h + +libpolkit_la_SOURCES = \ + libpolkit.h libpolkit.c \ + libpolkit-context.h libpolkit-context.c \ + libpolkit-privilege.h libpolkit-privilege.c \ + libpolkit-resource.h libpolkit-resource.c \ + libpolkit-seat.h libpolkit-seat.c \ + libpolkit-session.h libpolkit-session.c \ + libpolkit-caller.h libpolkit-caller.c libpolkit_la_LIBADD = @GLIB_LIBS@ diff --git a/libpolkit/libpolkit-caller.c b/libpolkit/libpolkit-caller.c new file mode 100644 index 0000000..0801378 --- /dev/null +++ b/libpolkit/libpolkit-caller.c @@ -0,0 +1,116 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-caller.c : callers + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-caller.h" + +struct PolKitCaller_s +{ +}; + +PolKitCaller * +libpolkit_caller_new (void) +{ + return NULL; +} + +PolKitCaller * +libpolkit_caller_ref (PolKitCaller *caller) +{ + return caller; +} + +void +libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name) +{ +} + +void +libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid) +{ +} + +void +libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid) +{ +} + +void +libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context) +{ +} + +void +libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session) +{ +} + +gboolean +libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name) +{ + return FALSE; +} + +gboolean +libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid) +{ + return FALSE; +} + +gboolean +libpolkit_caller_get_pid (PolKitCaller *caller, uid_t *out_pid) +{ + return FALSE; +} + +gboolean +libpolkit_caller_get_selinux_context (PolKitCaller *caller, char *out_selinux_context) +{ + return FALSE; +} + +gboolean +libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session) +{ + return FALSE; +} + +void +libpolkit_caller_unref (PolKitCaller *caller) +{ +} diff --git a/libpolkit/libpolkit-caller.h b/libpolkit/libpolkit-caller.h new file mode 100644 index 0000000..d8928eb --- /dev/null +++ b/libpolkit/libpolkit-caller.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-caller.h : callers + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_CALLER_H +#define LIBPOLKIT_CALLER_H + +#include +#include +#include +#include + +#include + +struct PolKitCaller_s; +typedef struct PolKitCaller_s PolKitCaller; + +PolKitCaller *libpolkit_caller_new (void); +PolKitCaller *libpolkit_caller_ref (PolKitCaller *caller); +void libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name); +void libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid); +void libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid); +void libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context); +void libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session); +gboolean libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name); +gboolean libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid); +gboolean libpolkit_caller_get_pid (PolKitCaller *caller, uid_t *out_pid); +gboolean libpolkit_caller_get_selinux_context (PolKitCaller *caller, char *out_selinux_context); +gboolean libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session); +void libpolkit_caller_unref (PolKitCaller *caller); + +#endif /* LIBPOLKIT_H */ + + diff --git a/libpolkit/libpolkit-context.c b/libpolkit/libpolkit-context.c new file mode 100644 index 0000000..4f42b79 --- /dev/null +++ b/libpolkit/libpolkit-context.c @@ -0,0 +1,69 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-context.c : context for PolicyKit + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-context.h" + +struct PolKitContext_s +{ +}; + +PolKitContext * +libpolkit_context_new (void) +{ + return FALSE; +} + +PolKitContext * +libpolkit_context_ref (PolKitContext *pk_context) +{ + return pk_context; +} + +void +libpolkit_context_set_config_changed (PolKitContext *pk_context, + PolKitContextConfigChangedCB cb, + gpointer user_data) +{ +} + +void +libpolkit_context_unref (PolKitContext *pk_context) +{ +} + diff --git a/libpolkit/libpolkit-context.h b/libpolkit/libpolkit-context.h new file mode 100644 index 0000000..2a228e1 --- /dev/null +++ b/libpolkit/libpolkit-context.h @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-context.h : PolicyKit context + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_CONTEXT_H +#define LIBPOLKIT_CONTEXT_H + +#include +#include +#include +#include + +struct PolKitContext_s; + +typedef struct PolKitContext_s PolKitContext; + +/** + * PolKitContextConfigChangedCB: + * @pk_context: PolicyKit context + * @user_data: user data + * + * Called when configuration changes. Mechanisms should listen on this + * signal and e.g. reconfigure all permissions / acl's they have set + * in response to policy decisions made from information provided by + * PolicyKit. + */ +typedef void (*PolKitContextConfigChangedCB) (PolKitContext *pk_context, + gpointer user_data); + +PolKitContext *libpolkit_context_new (void); +PolKitContext *libpolkit_context_ref (PolKitContext *pk_context); +void libpolkit_context_set_config_changed (PolKitContext *pk_context, + PolKitContextConfigChangedCB cb, + gpointer user_data); +void libpolkit_context_unref (PolKitContext *pk_context); + + +#endif /* LIBPOLKIT_CONTEXT_H */ + + diff --git a/libpolkit/libpolkit-privilege.c b/libpolkit/libpolkit-privilege.c new file mode 100644 index 0000000..80d9b67 --- /dev/null +++ b/libpolkit/libpolkit-privilege.c @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-privilege.c : privilege + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-privilege.h" + +struct PolKitPrivilege_s +{ +}; + +PolKitPrivilege * +libpolkit_privilege_new (void) +{ + return NULL; +} + +PolKitPrivilege * +libpolkit_privilege_ref (PolKitPrivilege *privilege) +{ + return privilege; +} + +void +libpolkit_privilege_set_privilege_id (PolKitPrivilege *privilege, const char *privilege_id) +{ +} + +gboolean +libpolkit_privilege_get_privilege_id (PolKitPrivilege *privilege, char **out_privilege_id) +{ + return FALSE; +} + +void +libpolkit_privilege_unref (PolKitPrivilege *privilege) +{ +} diff --git a/libpolkit/libpolkit-privilege.h b/libpolkit/libpolkit-privilege.h new file mode 100644 index 0000000..549a846 --- /dev/null +++ b/libpolkit/libpolkit-privilege.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-privilege.h : privileges + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_PRIVILEGE_H +#define LIBPOLKIT_PRIVILEGE_H + +#include +#include +#include +#include + +struct PolKitPrivilege_s; +typedef struct PolKitPrivilege_s PolKitPrivilege; + +PolKitPrivilege *libpolkit_privilege_new (void); +PolKitPrivilege *libpolkit_privilege_ref (PolKitPrivilege *privilege); +void libpolkit_privilege_set_privilege_id (PolKitPrivilege *privilege, const char *privilege_id); +gboolean libpolkit_privilege_get_privilege_id (PolKitPrivilege *privilege, char **out_privilege_id); +void libpolkit_privilege_unref (PolKitPrivilege *privilege); + +#endif /* LIBPOLKIT_PRIVILEGE_H */ + + diff --git a/libpolkit/libpolkit-resource.c b/libpolkit/libpolkit-resource.c new file mode 100644 index 0000000..15b62c6 --- /dev/null +++ b/libpolkit/libpolkit-resource.c @@ -0,0 +1,83 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-resource.c : resources + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-resource.h" + +struct PolKitResource_s +{ +}; + +PolKitResource * +libpolkit_resource_new (void) +{ + return NULL; +} + +PolKitResource * +libpolkit_resource_ref (PolKitResource *resource) +{ + return resource; +} + +void +libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type) +{ +} + +void +libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id) +{ +} + +gboolean +libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type) +{ + return FALSE; +} + +gboolean +libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id) +{ + return FALSE; +} + +void +libpolkit_resource_unref (PolKitResource *resource) +{ +} diff --git a/libpolkit/libpolkit-resource.h b/libpolkit/libpolkit-resource.h new file mode 100644 index 0000000..4751f59 --- /dev/null +++ b/libpolkit/libpolkit-resource.h @@ -0,0 +1,47 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-resource.h : resources + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_RESOURCE_H +#define LIBPOLKIT_RESOURCE_H + +#include +#include +#include +#include + +struct PolKitResource_s; +typedef struct PolKitResource_s PolKitResource; + +PolKitResource *libpolkit_resource_new (void); +PolKitResource *libpolkit_resource_ref (PolKitResource *resource); +void libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type); +void libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id); +gboolean libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type); +gboolean libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id); +void libpolkit_resource_unref (PolKitResource *resource); + +#endif /* LIBPOLKIT_RESOURCE_H */ + + diff --git a/libpolkit/libpolkit-seat.c b/libpolkit/libpolkit-seat.c new file mode 100644 index 0000000..adaa45f --- /dev/null +++ b/libpolkit/libpolkit-seat.c @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-seat.c : seat + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-seat.h" + +struct PolKitSeat_s +{ +}; + +PolKitSeat * +libpolkit_seat_new (void) +{ + return NULL; +} + +PolKitSeat * +libpolkit_seat_ref (PolKitSeat *seat) +{ + return seat; +} + +void +libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref) +{ +} + +gboolean +libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref) +{ + return FALSE; +} + +void +libpolkit_seat_unref (PolKitSeat *seat) +{ +} diff --git a/libpolkit/libpolkit-seat.h b/libpolkit/libpolkit-seat.h new file mode 100644 index 0000000..aeeaebc --- /dev/null +++ b/libpolkit/libpolkit-seat.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-seat.h : seats + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_SEAT_H +#define LIBPOLKIT_SEAT_H + +#include +#include +#include +#include + +struct PolKitSeat_s; +typedef struct PolKitSeat_s PolKitSeat; + +PolKitSeat *libpolkit_seat_new (void); +PolKitSeat *libpolkit_seat_ref (PolKitSeat *seat); +void libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref); +gboolean libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref); +void libpolkit_seat_unref (PolKitSeat *seat); + +#endif /* LIBPOLKIT_SEAT_H */ + + diff --git a/libpolkit/libpolkit-session.c b/libpolkit/libpolkit-session.c new file mode 100644 index 0000000..13971ea --- /dev/null +++ b/libpolkit/libpolkit-session.c @@ -0,0 +1,128 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-session.c : sessions + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * + **************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "libpolkit-session.h" + +struct PolKitSession_s +{ +}; + +PolKitSession * +libpolkit_session_new (void) +{ + return NULL; +} + +PolKitSession * +libpolkit_session_ref (PolKitSession *session) +{ + return NULL; +} + +void +libpolkit_session_set_uid (PolKitSession *session, uid_t uid) +{ +} + +void +libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref) +{ +} + +void +libpolkit_session_set_ck_is_active (PolKitSession *session, gboolean is_active) +{ +} + +void +libpolkit_session_set_ck_is_local (PolKitSession *session, gboolean is_local) +{ +} + +void +libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host) +{ +} + +void +libpolkit_session_set_ck_seat (PolKitSession *session, PolKitSeat *seat) +{ +} + +gboolean +libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid) +{ + return FALSE; +} + +gboolean +libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref) +{ + return FALSE; +} + +gboolean +libpolkit_session_get_ck_is_active (PolKitSession *session, gboolean *out_is_active) +{ + return FALSE; +} + +gboolean +libpolkit_session_get_ck_is_local (PolKitSession *session, gboolean *out_is_local) +{ + return FALSE; +} + +gboolean +libpolkit_session_get_ck_remote_host (PolKitSession *session, char *out_remote_host) +{ + return FALSE; +} + +gboolean +libpolkit_session_get_ck_seat (PolKitSession *session, PolKitSeat **out_seat) +{ + return FALSE; +} + + +void +libpolkit_session_unref (PolKitSession *session) +{ +} diff --git a/libpolkit/libpolkit-session.h b/libpolkit/libpolkit-session.h new file mode 100644 index 0000000..2356e2d --- /dev/null +++ b/libpolkit/libpolkit-session.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ +/*************************************************************************** + * + * libpolkit-session.h : sessions + * + * Copyright (C) 2007 David Zeuthen, + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + **************************************************************************/ + +#ifndef LIBPOLKIT_SESSION_H +#define LIBPOLKIT_SESSION_H + +#include +#include +#include +#include + +#include + +struct PolKitSession_s; +typedef struct PolKitSession_s PolKitSession; + +PolKitSession *libpolkit_session_new (void); +PolKitSession *libpolkit_session_ref (PolKitSession *session); +void libpolkit_session_set_uid (PolKitSession *session, uid_t uid); +void libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref); +void libpolkit_session_set_ck_is_active (PolKitSession *session, gboolean is_active); +void libpolkit_session_set_ck_is_local (PolKitSession *session, gboolean is_local); +void libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host); +void libpolkit_session_set_ck_seat (PolKitSession *session, PolKitSeat *seat); +gboolean libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid); +gboolean libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref); +gboolean libpolkit_session_get_ck_is_active (PolKitSession *session, gboolean *out_is_active); +gboolean libpolkit_session_get_ck_is_local (PolKitSession *session, gboolean *out_is_local); +gboolean libpolkit_session_get_ck_remote_host (PolKitSession *session, char *out_remote_host); +gboolean libpolkit_session_get_ck_seat (PolKitSession *session, PolKitSeat **out_seat); +void libpolkit_session_unref (PolKitSession *session); + +#endif /* LIBPOLKIT_SESSION_H */ + + diff --git a/libpolkit/libpolkit.c b/libpolkit/libpolkit.c index df53d7c..ae4e017 100644 --- a/libpolkit/libpolkit.c +++ b/libpolkit/libpolkit.c @@ -39,318 +39,6 @@ #include #include "libpolkit.h" -struct PolKitContext_s -{ -}; - -PolKitContext * -libpolkit_context_new (void) -{ - return FALSE; -} - -PolKitContext * -libpolkit_context_ref (PolKitContext *pk_context) -{ - return pk_context; -} - -void -libpolkit_context_set_config_changed (PolKitContext *pk_context, - PolKitContextConfigChangedCB cb, - gpointer user_data) -{ -} - -void -libpolkit_context_unref (PolKitContext *pk_context) -{ -} - -/******************************************************************************************************/ - -struct PolKitPrivilege_s -{ -}; - -PolKitPrivilege * -libpolkit_privilege_new (void) -{ - return NULL; -} - -PolKitPrivilege * -libpolkit_privilege_ref (PolKitPrivilege *privilege) -{ - return privilege; -} - -void -libpolkit_privilege_set_privilege_id (PolKitPrivilege *privilege, const char *privilege_id) -{ -} - -gboolean -libpolkit_privilege_get_privilege_id (PolKitPrivilege *privilege, char **out_privilege_id) -{ - return FALSE; -} - -void -libpolkit_privilege_unref (PolKitPrivilege *privilege) -{ -} - -/******************************************************************************************************/ - -struct PolKitResource_s -{ -}; - -PolKitResource * -libpolkit_resource_new (void) -{ - return NULL; -} - -PolKitResource * -libpolkit_resource_ref (PolKitResource *resource) -{ - return resource; -} - -void -libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type) -{ -} - -void -libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id) -{ -} - -gboolean -libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type) -{ - return FALSE; -} - -gboolean -libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id) -{ - return FALSE; -} - -void -libpolkit_resource_unref (PolKitResource *resource) -{ -} - -/******************************************************************************************************/ - -struct PolKitSeat_s -{ -}; - -PolKitSeat * -libpolkit_seat_new (void) -{ - return NULL; -} - -PolKitSeat * -libpolkit_seat_ref (PolKitSeat *seat) -{ - return seat; -} - -void -libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref) -{ -} - -gboolean -libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref) -{ - return FALSE; -} - -void -libpolkit_seat_unref (PolKitSeat *seat) -{ -} - -/******************************************************************************************************/ - -struct PolKitSession_s -{ -}; - -PolKitSession * -libpolkit_session_new (void) -{ - return NULL; -} - -PolKitSession * -libpolkit_session_ref (PolKitSession *session) -{ - return NULL; -} - -void -libpolkit_session_set_uid (PolKitSession *session, uid_t uid) -{ -} - -void -libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref) -{ -} - -void -libpolkit_session_set_ck_is_active (PolKitSession *session, gboolean is_active) -{ -} - -void -libpolkit_session_set_ck_is_local (PolKitSession *session, gboolean is_local) -{ -} - -void -libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host) -{ -} - -void -libpolkit_session_set_ck_seat (PolKitSession *session, PolKitSeat *seat) -{ -} - -gboolean -libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid) -{ - return FALSE; -} - -gboolean -libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref) -{ - return FALSE; -} - -gboolean -libpolkit_session_get_ck_is_active (PolKitSession *session, gboolean *out_is_active) -{ - return FALSE; -} - -gboolean -libpolkit_session_get_ck_is_local (PolKitSession *session, gboolean *out_is_local) -{ - return FALSE; -} - -gboolean -libpolkit_session_get_ck_remote_host (PolKitSession *session, char *out_remote_host) -{ - return FALSE; -} - -gboolean -libpolkit_session_get_ck_seat (PolKitSession *session, PolKitSeat **out_seat) -{ - return FALSE; -} - - -void -libpolkit_session_unref (PolKitSession *session) -{ -} - -/******************************************************************************************************/ - -struct PolKitCaller_s -{ -}; - -PolKitCaller * -libpolkit_caller_new (void) -{ - return NULL; -} - -PolKitCaller * -libpolkit_caller_ref (PolKitCaller *caller) -{ - return caller; -} - -void -libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name) -{ -} - -void -libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid) -{ -} - -void -libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid) -{ -} - -void -libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context) -{ -} - -void -libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session) -{ -} - -gboolean -libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name) -{ - return FALSE; -} - -gboolean -libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid) -{ - return FALSE; -} - -gboolean -libpolkit_caller_get_pid (PolKitCaller *caller, uid_t *out_pid) -{ - return FALSE; -} - -gboolean -libpolkit_caller_get_selinux_context (PolKitCaller *caller, char *out_selinux_context) -{ - return FALSE; -} - -gboolean -libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session) -{ - return FALSE; -} - -void -libpolkit_caller_unref (PolKitCaller *caller) -{ -} - -/******************************************************************************************************/ - - /** * libpolkit_get_seat_resource_association: * @pk_context: the PolicyKit context diff --git a/libpolkit/libpolkit.h b/libpolkit/libpolkit.h index ff96fc0..a5aedab 100644 --- a/libpolkit/libpolkit.h +++ b/libpolkit/libpolkit.h @@ -31,98 +31,12 @@ #include #include -struct PolKitContext_s; -typedef struct PolKitContext_s PolKitContext; - -/** - * PolKitContextConfigChangedCB: - * @pk_context: PolicyKit context - * @resources_associated_with_seat: A NULL terminated array of resources associated with the seat - * @user_data: user data - * - * Called when configuration changes. Mechanisms should listen on this - * signal and e.g. reconfigure all permissions / acl's they have set - * in response to policy decisions made from information provided by - * PolicyKit. - */ -typedef void (*PolKitContextConfigChangedCB) (PolKitContext *pk_context, - gpointer user_data); - -PolKitContext *libpolkit_context_new (void); -PolKitContext *libpolkit_context_ref (PolKitContext *pk_context); -void libpolkit_context_set_config_changed (PolKitContext *pk_context, - PolKitContextConfigChangedCB cb, - gpointer user_data); -void libpolkit_context_unref (PolKitContext *pk_context); - - -struct PolKitPrivilege_s; -typedef struct PolKitPrivilege_s PolKitPrivilege; - -PolKitPrivilege *libpolkit_privilege_new (void); -PolKitPrivilege *libpolkit_privilege_ref (PolKitPrivilege *privilege); -void libpolkit_privilege_set_privilege_id (PolKitPrivilege *privilege, const char *privilege_id); -gboolean libpolkit_privilege_get_privilege_id (PolKitPrivilege *privilege, char **out_privilege_id); -void libpolkit_privilege_unref (PolKitPrivilege *privilege); - -struct PolKitResource_s; -typedef struct PolKitResource_s PolKitResource; - -PolKitResource *libpolkit_resource_new (void); -PolKitResource *libpolkit_resource_ref (PolKitResource *resource); -void libpolkit_resource_set_resource_type (PolKitResource *resource, const char *resource_type); -void libpolkit_resource_set_resource_id (PolKitResource *resource, const char *resource_id); -gboolean libpolkit_resource_get_resource_type (PolKitResource *resource, char **out_resource_type); -gboolean libpolkit_resource_get_resource_id (PolKitResource *resource, char **out_resource_id); -void libpolkit_resource_unref (PolKitResource *resource); - - -struct PolKitSeat_s; -typedef struct PolKitSeat_s PolKitSeat; - -PolKitSeat *libpolkit_seat_new (void); -PolKitSeat *libpolkit_seat_ref (PolKitSeat *seat); -void libpolkit_seat_set_ck_objref (PolKitSeat *seat, const char *ck_objref); -gboolean libpolkit_seat_get_ck_objref (PolKitSeat *seat, char **out_ck_objref); -void libpolkit_seat_unref (PolKitSeat *seat); - - -struct PolKitSession_s; -typedef struct PolKitSession_s PolKitSession; - -PolKitSession *libpolkit_session_new (void); -PolKitSession *libpolkit_session_ref (PolKitSession *session); -void libpolkit_session_set_uid (PolKitSession *session, uid_t uid); -void libpolkit_session_set_ck_objref (PolKitSession *session, const char *ck_objref); -void libpolkit_session_set_ck_is_active (PolKitSession *session, gboolean is_active); -void libpolkit_session_set_ck_is_local (PolKitSession *session, gboolean is_local); -void libpolkit_session_set_ck_remote_host (PolKitSession *session, const char *remote_host); -void libpolkit_session_set_ck_seat (PolKitSession *session, PolKitSeat *seat); -gboolean libpolkit_session_get_uid (PolKitSession *session, uid_t *out_uid); -gboolean libpolkit_session_get_ck_objref (PolKitSession *session, char **out_ck_objref); -gboolean libpolkit_session_get_ck_is_active (PolKitSession *session, gboolean *out_is_active); -gboolean libpolkit_session_get_ck_is_local (PolKitSession *session, gboolean *out_is_local); -gboolean libpolkit_session_get_ck_remote_host (PolKitSession *session, char *out_remote_host); -gboolean libpolkit_session_get_ck_seat (PolKitSession *session, PolKitSeat **out_seat); -void libpolkit_session_unref (PolKitSession *session); - - -struct PolKitCaller_s; -typedef struct PolKitCaller_s PolKitCaller; - -PolKitCaller *libpolkit_caller_new (void); -PolKitCaller *libpolkit_caller_ref (PolKitCaller *caller); -void libpolkit_caller_set_dbus_name (PolKitCaller *caller, const char *dbus_name); -void libpolkit_caller_set_uid (PolKitCaller *caller, uid_t uid); -void libpolkit_caller_set_pid (PolKitCaller *caller, pid_t pid); -void libpolkit_caller_set_selinux_context (PolKitCaller *caller, const char *selinux_context); -void libpolkit_caller_set_ck_session (PolKitCaller *caller, PolKitSession *session); -gboolean libpolkit_caller_get_dbus_name (PolKitCaller *caller, char **out_dbus_name); -gboolean libpolkit_caller_get_uid (PolKitCaller *caller, uid_t *out_uid); -gboolean libpolkit_caller_get_pid (PolKitCaller *caller, uid_t *out_pid); -gboolean libpolkit_caller_get_selinux_context (PolKitCaller *caller, char *out_selinux_context); -gboolean libpolkit_caller_get_ck_session (PolKitCaller *caller, PolKitSession **out_session); -void libpolkit_caller_unref (PolKitCaller *caller); +#include +#include +#include +#include +#include +#include /** * PolKitSeatVisitorCB: -- 2.7.4