1 /***************************************************************************
3 * libpolkit.h : Wraps a subset of methods on the PolicyKit daemon
5 * Copyright (C) 2006 David Zeuthen, <david@fubar.dk>
7 * Licensed under the Academic Free License version 2.1
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 **************************************************************************/
30 #include <sys/types.h>
32 #include <dbus/dbus.h>
36 LIBPOLKIT_RESULT_ERROR
,
37 LIBPOLKIT_RESULT_INVALID_CONTEXT
,
38 LIBPOLKIT_RESULT_NOT_PRIVILEGED
,
39 LIBPOLKIT_RESULT_NO_SUCH_PRIVILEGE
,
40 LIBPOLKIT_RESULT_NO_SUCH_USER
43 struct LibPolKitContext_s
;
44 typedef struct LibPolKitContext_s LibPolKitContext
;
46 LibPolKitContext
*libpolkit_new_context (DBusConnection
*connection
);
48 gboolean
libpolkit_free_context (LibPolKitContext
*ctx
);
50 LibPolKitResult
libpolkit_get_privilege_list (LibPolKitContext
*ctx
,
53 LibPolKitResult
libpolkit_is_uid_allowed_for_privilege (LibPolKitContext
*ctx
,
54 const char *system_bus_unique_name
,
56 const char *privilege
,
58 gboolean
*out_is_allowed
,
59 gboolean
*out_is_temporary
,
60 char **out_is_privileged_but_restricted_to_system_bus_unique_name
);
62 LibPolKitResult
libpolkit_revoke_temporary_privilege (LibPolKitContext
*ctx
,
64 const char *privilege
,
68 LibPolKitResult
libpolkit_get_allowed_resources_for_privilege_for_uid (LibPolKitContext
*ctx
,
70 const char *privilege
,
73 int *num_non_temporary
);
75 #endif /* LIBPOLKIT_H */