config: refactor parsing of boolean config values

Allow for the special values "1" and "0". Also, ignore the
letter case when comparing the configuration value.

Signed-off-by: Thomas Haller <thaller@redhat.com>
auth: rename file nm-manager-auth.* to nm-auth-utils.*

Signed-off-by: Thomas Haller <thaller@redhat.com>
build: generate man/NetworkManager.conf.xml by autoconf

Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
auth: support disabling POLKIT authentication entirely at compile time

Let the user completly disable polkit authentication by
building NM with configure option  '--enable-polkit=disabled'.

In that case, configuring 'main.auth-polkit=yes' will fail all
authentication requests (except root-requests, which are always granted).

This reduces the size of the NetworkManager binary by some 26KB (16KB
stripped).

Signed-off-by: Thomas Haller <thaller@redhat.com>
auth: merge branch 'th/bgo734146_polkit'

Implement polkit requests by directly using the DBUS interface.
This makes NetworkManager independent from libpolkit-gobject-1 library.

https://bugzilla.gnome.org/show_bug.cgi?id=734146

Signed-off-by: Thomas Haller <thaller@redhat.com>
core/dbus: minor refactoring not to clone the string tag

Since we already intenalize the @tag to a GQuark, just use
the constant string, instead of duplicating the string.

Signed-off-by: Thomas Haller <thaller@redhat.com>
core: fix assertion when comparing missing hwaddr while searching connection for device

A device (e.g. of type tun) might not have a hwaddr. Avoid the assertion
in nm_utils_hwaddr_matches().

Backtrace:

    #0  0x00007fd0920444e9 in g_logv (log_domain=0x5a5be3 "libnm", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff2551e590) at gmessages.c:989
    #1  0x00007fd09204463f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
    #2  0x0000000000555d31 in nm_utils_hwaddr_matches (hwaddr1=0x7fff2551e6a0, hwaddr1_len=6, hwaddr2=0x0, hwaddr2_len=-1) at ../libnm-core/nm-utils.c:2414
    #3  0x000000000049e7a0 in have_connection_for_device (self=0x7fd084008710, device=0x168e5c0) at settings/nm-settings.c:1513
    #4  0x000000000049e23d in nm_settings_device_added (self=0x7fd084008710, device=0x168e5c0) at settings/nm-settings.c:1599
    #5  0x00000000004e6447 in add_device (self=0x1654150, device=0x168e5c0, try_assume=1) at nm-manager.c:1840
    #6  0x00000000004e8fb6 in platform_link_added (self=0x1654150, ifindex=6, plink=0x165c328, reason=NM_PLATFORM_REASON_INTERNAL) at nm-manager.c:2163
    #7  0x00000000004e3252 in platform_link_cb (platform=0x15b1870, ifindex=6, plink=0x165c328, change_type=NM_PLATFORM_SIGNAL_ADDED, reason=NM_PLATFORM_REASON_INTERNAL, user_data=0x1654150) at nm-manager.c:2178
    #8  0x000000381dc05d8c in ffi_call_unix64 () at ../src/x86/unix64.S:76
    #9  0x000000381dc056bc in ffi_call (cif=cif@entry=0x7fff2551ed00, fn=0x4e31e0 <platform_link_cb>, rvalue=0x7fff2551ec70, avalue=avalue@entry=0x7fff2551ebf0) at ../src/x86/ffi64.c:522
    #10 0x00007fd092331ad8 in g_cclosure_marshal_generic (closure=0x1607710, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1454
    #11 0x00007fd092331298 in g_closure_invoke (closure=0x1607710, return_value=return_value@entry=0x0, n_param_values=5, param_values=param_values@entry=0x7fff2551ef00, invocation_hint=invocation_hint@entry=0x7fff2551eea0)
        at gclosure.c:777
    #12 0x00007fd09234335d in signal_emit_unlocked_R (node=node@entry=0x15b03a0, detail=detail@entry=0, instance=instance@entry=0x15b1870, emission_return=emission_return@entry=0x0,
        instance_and_params=instance_and_params@entry=0x7fff2551ef00) at gsignal.c:3586
    #13 0x00007fd09234b0f2 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fff2551f0e0) at gsignal.c:3330
    #14 0x00007fd09234b3af in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3386
    #15 0x000000000048353d in nm_platform_query_devices () at platform/nm-platform.c:345
    #16 0x00000000004e12d2 in nm_manager_start (self=0x1654150) at nm-manager.c:4170
    #17 0x000000000044349a in main (argc=1, argv=0x7fff2551f938) at main.c:661

Fixes: b019348fdde223f39c91150e6b7a11e366fade63
Signed-off-by: Thomas Haller <thaller@redhat.com>
core/dbus: debug log unix file descriptor when accpeting private dbus connection

Signed-off-by: Thomas Haller <thaller@redhat.com>
core/dbus: disable verbose logging when registering object to private socket

This creates a large amount of debug logging, that is not generally useful.

Signed-off-by: Thomas Haller <thaller@redhat.com>
libnm: g_variant_new() for strings does not allow NULLs

So pass "" instead of NULL.

GLib-CRITICAL **: g_variant_new_string: assertion `string != NULL' failed
devices: fix default ethernet connection code

Creation of default wired connections got broken by an incomplete
rebase of dcbw/internal-device-factories after danw/libnm-props
landed.

https://bugzilla.gnome.org/show_bug.cgi?id=737273
build: support building against libsystemd >= 209 library

In systemd v209, the various libraries were merged into a single
libsystemd library [1].
Add support for building against this new library and fall back to the
old library names if not found.

[1] http://lists.freedesktop.org/archives/systemd-devel/2014-February/017146.html
libnm: fix argument type passed to RequestScan() D-Bus call

GLib-ERROR **: g_variant_new: expected GVariant of type `a{sv}' but received value has type `aa{sv}'
cli: rename network-manager.[ch] to general.[ch]
cli: strip errors from D-Bus before presenting to a user
libnm: return errors in nm_client_networking_set_enabled()

and do not print an error in the library. The caller can decide what to do
on an error.
cli: fix NetworkManager.pot after renmaing network-manager.[ch] to general.[ch]

Fixes: f5850859075074e3dc97b5b372bda3b7672dbe01
Signed-off-by: Thomas Haller <thaller@redhat.com>
core: minor fix in nm_utils_kill_child_sync() having side-effects in MIN() macro

Signed-off-by: Thomas Haller <thaller@redhat.com>
bluez: split out errors

We'll use them from more places than nm nm-bt-device.c in the future.