diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-14 13:34:57 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-09-29 13:51:11 +0200 |
commit | eabe7d856c243673bbaba3295ce74d72e188596d (patch) | |
tree | 3c85e2d33dace5f644d8e605fd47f02d3367372c /src/nm-config.c | |
parent | 63a8c6a184a58176b656d9e22f99a280682e0e5f (diff) | |
download | NetworkManager-eabe7d856c243673bbaba3295ce74d72e188596d.tar.gz |
auth: rework polkit autorization to use DBUS interface directly
This makes NetworkManager independent of <polkit/polkit.h>
development headers and libpolkit-gobject-1.so library.
Instead communicate directly with polkit using its DBUS
interface.
PolicyKit support is now always compiled in. You can control
polkit authorization with the configuration option
[main]
auth-polkit=yes|no
If the configure option is omitted, a build time default
value is used. This default value can be set with the
configure option --enable-polkit.
This commit adds a new class NMAuthManager that reimplements the
relevant DBUS client parts. It takes source code from the polkit
library.
https://bugzilla.gnome.org/show_bug.cgi?id=734146
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'src/nm-config.c')
-rw-r--r-- | src/nm-config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nm-config.c b/src/nm-config.c index 3978b56626..2580541a62 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -46,6 +46,7 @@ typedef struct { char **plugins; gboolean monitor_connection_files; + gboolean auth_polkit; char *dhcp_client; char *dns_mode; @@ -142,6 +143,14 @@ nm_config_get_monitor_connection_files (NMConfig *config) return NM_CONFIG_GET_PRIVATE (config)->monitor_connection_files; } +gboolean +nm_config_get_auth_polkit (NMConfig *config) +{ + g_return_val_if_fail (NM_IS_CONFIG (config), NM_CONFIG_DEFAULT_AUTH_POLKIT); + + return NM_CONFIG_GET_PRIVATE (config)->auth_polkit; +} + const char * nm_config_get_dhcp_client (NMConfig *config) { @@ -580,6 +589,16 @@ nm_config_new (GError **error) g_free (value); } + value = g_key_file_get_value (priv->keyfile, "main", "auth-polkit", NULL); + priv->auth_polkit = NM_CONFIG_DEFAULT_AUTH_POLKIT; + if (value) { + if (!_parse_bool_str (value, &priv->auth_polkit)) { + nm_log_warn (LOGD_CORE, "Unrecognized value for main.auth-polkit: %s. Assuming '%s'", value, + NM_CONFIG_DEFAULT_AUTH_POLKIT ? "true" : "false"); + } + g_free (value); + } + priv->dhcp_client = g_key_file_get_value (priv->keyfile, "main", "dhcp", NULL); priv->dns_mode = g_key_file_get_value (priv->keyfile, "main", "dns", NULL); @@ -610,6 +629,8 @@ nm_config_init (NMConfig *config) { NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (config); + priv->auth_polkit = NM_CONFIG_DEFAULT_AUTH_POLKIT; + priv->keyfile = g_key_file_new (); g_key_file_set_list_separator (priv->keyfile, ','); |