1*2912Sartem /*************************************************************************** 2*2912Sartem * 3*2912Sartem * libpolkit.h : Wraps a subset of methods on the PolicyKit daemon 4*2912Sartem * 5*2912Sartem * Copyright (C) 2006 David Zeuthen, <david@fubar.dk> 6*2912Sartem * 7*2912Sartem * Licensed under the Academic Free License version 2.1 8*2912Sartem * 9*2912Sartem * This program is free software; you can redistribute it and/or modify 10*2912Sartem * it under the terms of the GNU General Public License as published by 11*2912Sartem * the Free Software Foundation; either version 2 of the License, or 12*2912Sartem * (at your option) any later version. 13*2912Sartem * 14*2912Sartem * This program is distributed in the hope that it will be useful, 15*2912Sartem * but WITHOUT ANY WARRANTY; without even the implied warranty of 16*2912Sartem * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*2912Sartem * GNU General Public License for more details. 18*2912Sartem * 19*2912Sartem * You should have received a copy of the GNU General Public License 20*2912Sartem * along with this program; if not, write to the Free Software 21*2912Sartem * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22*2912Sartem * 23*2912Sartem **************************************************************************/ 24*2912Sartem 25*2912Sartem #ifndef LIBPOLKIT_H 26*2912Sartem #define LIBPOLKIT_H 27*2912Sartem 28*2912Sartem #include <stdio.h> 29*2912Sartem #include <unistd.h> 30*2912Sartem #include <sys/types.h> 31*2912Sartem #include <glib.h> 32*2912Sartem #include <dbus/dbus.h> 33*2912Sartem 34*2912Sartem typedef enum { 35*2912Sartem LIBPOLKIT_RESULT_OK, 36*2912Sartem LIBPOLKIT_RESULT_ERROR, 37*2912Sartem LIBPOLKIT_RESULT_INVALID_CONTEXT, 38*2912Sartem LIBPOLKIT_RESULT_NOT_PRIVILEGED, 39*2912Sartem LIBPOLKIT_RESULT_NO_SUCH_PRIVILEGE, 40*2912Sartem LIBPOLKIT_RESULT_NO_SUCH_USER 41*2912Sartem } LibPolKitResult; 42*2912Sartem 43*2912Sartem struct LibPolKitContext_s; 44*2912Sartem typedef struct LibPolKitContext_s LibPolKitContext; 45*2912Sartem 46*2912Sartem LibPolKitContext *libpolkit_new_context (DBusConnection *connection); 47*2912Sartem 48*2912Sartem gboolean libpolkit_free_context (LibPolKitContext *ctx); 49*2912Sartem 50*2912Sartem LibPolKitResult libpolkit_get_privilege_list (LibPolKitContext *ctx, 51*2912Sartem GList **result); 52*2912Sartem 53*2912Sartem LibPolKitResult libpolkit_is_uid_allowed_for_privilege (LibPolKitContext *ctx, 54*2912Sartem const char *system_bus_unique_name, 55*2912Sartem const char *user, 56*2912Sartem const char *privilege, 57*2912Sartem const char *resource, 58*2912Sartem gboolean *out_is_allowed, 59*2912Sartem gboolean *out_is_temporary, 60*2912Sartem char **out_is_privileged_but_restricted_to_system_bus_unique_name); 61*2912Sartem 62*2912Sartem LibPolKitResult libpolkit_revoke_temporary_privilege (LibPolKitContext *ctx, 63*2912Sartem const char *user, 64*2912Sartem const char *privilege, 65*2912Sartem const char *resource, 66*2912Sartem gboolean *result); 67*2912Sartem 68*2912Sartem LibPolKitResult libpolkit_get_allowed_resources_for_privilege_for_uid (LibPolKitContext *ctx, 69*2912Sartem const char *user, 70*2912Sartem const char *privilege, 71*2912Sartem GList **resources, 72*2912Sartem GList **restrictions, 73*2912Sartem int *num_non_temporary); 74*2912Sartem 75*2912Sartem #endif /* LIBPOLKIT_H */ 76*2912Sartem 77*2912Sartem 78