diff options
Diffstat (limited to 'libnm-glib')
| -rw-r--r-- | libnm-glib/Makefile.am | 22 | ||||
| -rw-r--r-- | libnm-glib/Makefile.in | 118 | ||||
| -rw-r--r-- | libnm-glib/libnm-glib.ver | 10 | ||||
| -rw-r--r-- | libnm-glib/nm-access-point.c | 7 | ||||
| -rw-r--r-- | libnm-glib/nm-client.c | 86 | ||||
| -rw-r--r-- | libnm-glib/nm-client.h | 5 | ||||
| -rw-r--r-- | libnm-glib/nm-device-bridge.c | 346 | ||||
| -rw-r--r-- | libnm-glib/nm-device-bridge.h | 84 | ||||
| -rw-r--r-- | libnm-glib/nm-device-wifi.c | 90 | ||||
| -rw-r--r-- | libnm-glib/nm-device-wifi.h | 7 | ||||
| -rw-r--r-- | libnm-glib/nm-device.c | 23 | ||||
| -rw-r--r-- | libnm-glib/nm-glib-enum-types.c | 22 | ||||
| -rw-r--r-- | libnm-glib/nm-glib-enum-types.h | 2 | ||||
| -rw-r--r-- | libnm-glib/nm-remote-settings.c | 101 | ||||
| -rw-r--r-- | libnm-glib/nm-secret-agent.c | 79 | ||||
| -rw-r--r-- | libnm-glib/nm-secret-agent.h | 21 | ||||
| -rw-r--r-- | libnm-glib/tests/Makefile.am | 5 | ||||
| -rw-r--r-- | libnm-glib/tests/Makefile.in | 135 |
18 files changed, 974 insertions, 189 deletions
diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index 600b0405..372f0311 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -1,6 +1,6 @@ include $(GLIB_MAKEFILE) -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/include \ @@ -45,7 +45,7 @@ libdeprecated_HEADERS = libnm_glib.h lib_LTLIBRARIES = libnm-glib.la libnm-glib-vpn.la libnm_glib_la_CFLAGS = \ - $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) @@ -63,6 +63,7 @@ libnminclude_HEADERS = \ nm-device-bt.h \ nm-device-olpc-mesh.h \ nm-device-bond.h \ + nm-device-bridge.h \ nm-device-vlan.h \ nm-access-point.h \ nm-ip4-config.h \ @@ -97,6 +98,7 @@ libnm_glib_la_csources = \ nm-device-bt.c \ nm-device-olpc-mesh.c \ nm-device-bond.c \ + nm-device-bridge.c \ nm-device-vlan.c \ nm-access-point.c \ nm-ip4-config.c \ @@ -139,7 +141,7 @@ nm_glib_marshal_sources = $(libnm_glib_la_SOURCES) libnm_glib_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(builddir)/libdeprecated-nm-glib.la \ - $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(DBUS_LIBS) \ $(GUDEV_LIBS) @@ -151,8 +153,8 @@ libnm_glib_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ noinst_PROGRAMS = libnm-glib-test libnm_glib_test_SOURCES = libnm-glib-test.c -libnm_glib_test_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS) -libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS) +libnm_glib_test_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) +libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS) libnm_glib_vpn_la_SOURCES = \ @@ -162,8 +164,8 @@ libnm_glib_vpn_la_SOURCES = \ nm-vpn-enum-types.c GLIB_GENERATED += nm-vpn-enum-types.h nm-vpn-enum-types.c nm_vpn_enum_types_sources = $(libnmvpn_HEADERS) -libnm_glib_vpn_la_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS) -libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS) +libnm_glib_vpn_la_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) +libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS) libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \ -version-info "2:0:1" @@ -174,7 +176,7 @@ BUILT_SOURCES += $(GLIB_GENERATED) ##################################################### libnm_glib_test_la_CFLAGS = \ - $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ -DLIBNM_GLIB_TEST @@ -185,7 +187,7 @@ libnm_glib_test_la_SOURCES = \ libnm_glib_test_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(DBUS_LIBS) \ $(GUDEV_LIBS) @@ -232,7 +234,7 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) endif -if WITH_TESTS +if ENABLE_TESTS check-local: $(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm-glib.so $(SYMBOL_VIS_FILE) diff --git a/libnm-glib/Makefile.in b/libnm-glib/Makefile.in index c2a76652..c506402b 100644 --- a/libnm-glib/Makefile.in +++ b/libnm-glib/Makefile.in @@ -64,16 +64,18 @@ DIST_COMMON = $(libdeprecated_HEADERS) $(libnminclude_HEADERS) \ $(srcdir)/libnm-glib.pc.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -136,6 +138,7 @@ am__objects_2 = libnm_glib_test_la-nm-object.lo \ libnm_glib_test_la-nm-device-bt.lo \ libnm_glib_test_la-nm-device-olpc-mesh.lo \ libnm_glib_test_la-nm-device-bond.lo \ + libnm_glib_test_la-nm-device-bridge.lo \ libnm_glib_test_la-nm-device-vlan.lo \ libnm_glib_test_la-nm-access-point.lo \ libnm_glib_test_la-nm-ip4-config.lo \ @@ -183,6 +186,7 @@ am__objects_4 = libnm_glib_la-nm-object.lo libnm_glib_la-nm-client.lo \ libnm_glib_la-nm-device-wifi.lo libnm_glib_la-nm-device-bt.lo \ libnm_glib_la-nm-device-olpc-mesh.lo \ libnm_glib_la-nm-device-bond.lo \ + libnm_glib_la-nm-device-bridge.lo \ libnm_glib_la-nm-device-vlan.lo \ libnm_glib_la-nm-access-point.lo \ libnm_glib_la-nm-ip4-config.lo \ @@ -308,6 +312,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -322,9 +330,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -334,17 +340,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -385,6 +388,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -401,11 +405,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -420,6 +420,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -429,6 +431,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -455,13 +458,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -516,6 +520,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -530,6 +539,10 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/include \ @@ -569,7 +582,7 @@ libdeprecated_HEADERS = libnm_glib.h ##################################################### lib_LTLIBRARIES = libnm-glib.la libnm-glib-vpn.la libnm_glib_la_CFLAGS = \ - $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) @@ -586,6 +599,7 @@ libnminclude_HEADERS = \ nm-device-bt.h \ nm-device-olpc-mesh.h \ nm-device-bond.h \ + nm-device-bridge.h \ nm-device-vlan.h \ nm-access-point.h \ nm-ip4-config.h \ @@ -620,6 +634,7 @@ libnm_glib_la_csources = \ nm-device-bt.c \ nm-device-olpc-mesh.c \ nm-device-bond.c \ + nm-device-bridge.c \ nm-device-vlan.c \ nm-access-point.c \ nm-ip4-config.c \ @@ -661,7 +676,7 @@ nm_glib_marshal_sources = $(libnm_glib_la_SOURCES) libnm_glib_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(builddir)/libdeprecated-nm-glib.la \ - $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(DBUS_LIBS) \ $(GUDEV_LIBS) @@ -670,8 +685,8 @@ libnm_glib_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ -version-info "8:0:4" libnm_glib_test_SOURCES = libnm-glib-test.c -libnm_glib_test_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS) -libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS) +libnm_glib_test_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) +libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS) libnm_glib_vpn_la_SOURCES = \ nm-vpn-plugin.c \ nm-vpn-plugin-ui-interface.c \ @@ -679,8 +694,8 @@ libnm_glib_vpn_la_SOURCES = \ nm-vpn-enum-types.c nm_vpn_enum_types_sources = $(libnmvpn_HEADERS) -libnm_glib_vpn_la_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS) -libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS) +libnm_glib_vpn_la_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) +libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GLIB_LIBS) $(DBUS_LIBS) libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \ -version-info "2:0:1" @@ -689,7 +704,7 @@ libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \ # Test libnm-glib stuff ##################################################### libnm_glib_test_la_CFLAGS = \ - $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ -DLIBNM_GLIB_TEST @@ -700,7 +715,7 @@ libnm_glib_test_la_SOURCES = \ libnm_glib_test_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(DBUS_LIBS) \ $(GUDEV_LIBS) @@ -836,6 +851,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-adsl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-bond.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-bridge.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-bt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-ethernet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_la-nm-device-infiniband.Plo@am__quote@ @@ -865,6 +881,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-adsl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-bond.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-bridge.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-bt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-ethernet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test_la-nm-device-infiniband.Plo@am__quote@ @@ -894,25 +911,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_vpn_la-nm-vpn-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -994,6 +1008,13 @@ libnm_glib_test_la-nm-device-bond.lo: nm-device-bond.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_la_CFLAGS) $(CFLAGS) -c -o libnm_glib_test_la-nm-device-bond.lo `test -f 'nm-device-bond.c' || echo '$(srcdir)/'`nm-device-bond.c +libnm_glib_test_la-nm-device-bridge.lo: nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_la_CFLAGS) $(CFLAGS) -MT libnm_glib_test_la-nm-device-bridge.lo -MD -MP -MF $(DEPDIR)/libnm_glib_test_la-nm-device-bridge.Tpo -c -o libnm_glib_test_la-nm-device-bridge.lo `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_glib_test_la-nm-device-bridge.Tpo $(DEPDIR)/libnm_glib_test_la-nm-device-bridge.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-device-bridge.c' object='libnm_glib_test_la-nm-device-bridge.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_la_CFLAGS) $(CFLAGS) -c -o libnm_glib_test_la-nm-device-bridge.lo `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c + libnm_glib_test_la-nm-device-vlan.lo: nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_la_CFLAGS) $(CFLAGS) -MT libnm_glib_test_la-nm-device-vlan.lo -MD -MP -MF $(DEPDIR)/libnm_glib_test_la-nm-device-vlan.Tpo -c -o libnm_glib_test_la-nm-device-vlan.lo `test -f 'nm-device-vlan.c' || echo '$(srcdir)/'`nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_glib_test_la-nm-device-vlan.Tpo $(DEPDIR)/libnm_glib_test_la-nm-device-vlan.Plo @@ -1218,6 +1239,13 @@ libnm_glib_la-nm-device-bond.lo: nm-device-bond.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_la_CFLAGS) $(CFLAGS) -c -o libnm_glib_la-nm-device-bond.lo `test -f 'nm-device-bond.c' || echo '$(srcdir)/'`nm-device-bond.c +libnm_glib_la-nm-device-bridge.lo: nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_la_CFLAGS) $(CFLAGS) -MT libnm_glib_la-nm-device-bridge.lo -MD -MP -MF $(DEPDIR)/libnm_glib_la-nm-device-bridge.Tpo -c -o libnm_glib_la-nm-device-bridge.lo `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_glib_la-nm-device-bridge.Tpo $(DEPDIR)/libnm_glib_la-nm-device-bridge.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-device-bridge.c' object='libnm_glib_la-nm-device-bridge.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_la_CFLAGS) $(CFLAGS) -c -o libnm_glib_la-nm-device-bridge.lo `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c + libnm_glib_la-nm-device-vlan.lo: nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_la_CFLAGS) $(CFLAGS) -MT libnm_glib_la-nm-device-vlan.lo -MD -MP -MF $(DEPDIR)/libnm_glib_la-nm-device-vlan.Tpo -c -o libnm_glib_la-nm-device-vlan.lo `test -f 'nm-device-vlan.c' || echo '$(srcdir)/'`nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_glib_la-nm-device-vlan.Tpo $(DEPDIR)/libnm_glib_la-nm-device-vlan.Plo @@ -1680,7 +1708,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: $(BUILT_SOURCES) @@ -1841,8 +1869,8 @@ nm-secret-agent-glue.h: $(top_srcdir)/introspection/nm-secret-agent.xml @HAVE_INTROSPECTION_TRUE@NMClient-1.0.gir: libnm-glib.la -@WITH_TESTS_TRUE@check-local: -@WITH_TESTS_TRUE@ $(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm-glib.so $(SYMBOL_VIS_FILE) +@ENABLE_TESTS_TRUE@check-local: +@ENABLE_TESTS_TRUE@ $(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm-glib.so $(SYMBOL_VIS_FILE) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver index b063ffac..9fb956af 100644 --- a/libnm-glib/libnm-glib.ver +++ b/libnm-glib/libnm-glib.ver @@ -36,6 +36,7 @@ global: nm_client_get_device_by_iface; nm_client_get_device_by_path; nm_client_get_devices; + nm_client_get_logging; nm_client_get_manager_running; nm_client_get_permission_result; nm_client_get_state; @@ -48,6 +49,7 @@ global: nm_client_new_finish; nm_client_permission_get_type; nm_client_permission_result_get_type; + nm_client_set_logging; nm_client_sleep; nm_client_wimax_get_enabled; nm_client_wimax_hardware_get_enabled; @@ -70,6 +72,13 @@ global: nm_device_bond_get_slaves; nm_device_bond_get_type; nm_device_bond_new; + nm_device_bridge_error_get_type; + nm_device_bridge_error_quark; + nm_device_bridge_get_carrier; + nm_device_bridge_get_hw_address; + nm_device_bridge_get_slaves; + nm_device_bridge_get_type; + nm_device_bridge_new; nm_device_bt_error_get_type; nm_device_bt_error_quark; nm_device_bt_get_capabilities; @@ -149,6 +158,7 @@ global: nm_device_wifi_get_permanent_hw_address; nm_device_wifi_get_type; nm_device_wifi_new; + nm_device_wifi_request_scan_simple; nm_device_wimax_error_get_type; nm_device_wimax_error_quark; nm_device_wimax_get_active_nsp; diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c index fef65575..9326d3ab 100644 --- a/libnm-glib/nm-access-point.c +++ b/libnm-glib/nm-access-point.c @@ -347,6 +347,9 @@ nm_access_point_connection_valid (NMAccessPoint *ap, NMConnection *connection) return FALSE; if (!strcmp (setting_mode, "adhoc") && (ap_mode != NM_802_11_MODE_ADHOC)) return FALSE; + /* Hotspot never matches against APs as it's a device-specific mode. */ + if (!strcmp (setting_mode, "ap")) + return FALSE; } /* Band and Channel/Frequency */ @@ -658,7 +661,9 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) /** * NMAccessPoint:mode: * - * The mode of the access point. + * The mode of the access point; either "infrastructure" (a central + * coordinator of the wireless network allowing clients to connect) or + * "ad-hoc" (a network with no central controller). **/ g_object_class_install_property (object_class, PROP_MODE, diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 178a5fdd..62e5f835 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -334,10 +334,14 @@ client_recheck_permissions (DBusGProxy *proxy, gpointer user_data) * nm_client_get_devices: * @client: a #NMClient * - * Gets all the detected devices. + * Gets all the known network devices. Use nm_device_get_type() or the + * NM_IS_DEVICE_XXXX() functions to determine what kind of device member of the + * returned array is, and then you may use device-specific methods such as + * nm_device_ethernet_get_hw_address(). * - * Returns: (transfer none) (element-type NMClient.Device): a #GPtrArray containing all the #NMDevice<!-- -->s. - * The returned array is owned by the client and should not be modified. + * Returns: (transfer none) (element-type NMClient.Device): a #GPtrArray + * containing all the #NMDevice<!-- -->s. The returned array is owned by the + * #NMClient object and should not be modified. **/ const GPtrArray * nm_client_get_devices (NMClient *client) @@ -1041,6 +1045,82 @@ nm_client_get_permission_result (NMClient *client, NMClientPermission permission return GPOINTER_TO_UINT (result); } +/** + * nm_client_get_logging: + * @client: a #NMClient + * @level: (allow-none): return location for logging level string + * @domains: (allow-none): return location for log domains string. The string is + * a list of domains separated by "," + * @error: (allow-none): return location for a #GError, or %NULL + * + * Gets NetworkManager current logging level and domains. + * + * Returns: %TRUE on success, %FALSE otherwise + **/ +gboolean +nm_client_get_logging (NMClient *client, char **level, char **domains, GError **error) +{ + GError *err = NULL; + + g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + g_return_val_if_fail (level == NULL || *level == NULL, FALSE); + g_return_val_if_fail (domains == NULL || *domains == NULL, FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!level && !domains) + return TRUE; + + if (!dbus_g_proxy_call (NM_CLIENT_GET_PRIVATE (client)->client_proxy, "GetLogging", &err, + G_TYPE_INVALID, + G_TYPE_STRING, level, + G_TYPE_STRING, domains, + G_TYPE_INVALID)) { + if (error) + *error = g_error_copy (err); + g_error_free (err); + return FALSE; + } + + return TRUE; +} + +/** + * nm_client_set_logging: + * @client: a #NMClient + * @level: (allow-none): logging level to set (%NULL or an empty string for no change) + * @domains: (allow-none): logging domains to set. The string should be a list of log + * domains separated by ",". (%NULL or an empty string for no change) + * @error: (allow-none): return location for a #GError, or %NULL + * + * Sets NetworkManager logging level and/or domains. + * + * Returns: %TRUE on success, %FALSE otherwise + **/ +gboolean +nm_client_set_logging (NMClient *client, const char *level, const char *domains, GError **error) +{ + GError *err = NULL; + + g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!level && !domains) + return TRUE; + + if (!dbus_g_proxy_call (NM_CLIENT_GET_PRIVATE (client)->client_proxy, "SetLogging", &err, + G_TYPE_STRING, level ? level : "", + G_TYPE_STRING, domains ? domains : "", + G_TYPE_INVALID, + G_TYPE_INVALID)) { + if (error) + *error = g_error_copy (err); + g_error_free (err); + return FALSE; + } + + return TRUE; +} + /****************************************************************/ static void diff --git a/libnm-glib/nm-client.h b/libnm-glib/nm-client.h index 64cbce21..6c83e4ce 100644 --- a/libnm-glib/nm-client.h +++ b/libnm-glib/nm-client.h @@ -18,7 +18,7 @@ * Boston, MA 02110-1301 USA. * * Copyright (C) 2007 - 2008 Novell, Inc. - * Copyright (C) 2007 - 2011 Red Hat, Inc. + * Copyright (C) 2007 - 2012 Red Hat, Inc. */ #ifndef NM_CLIENT_H @@ -209,6 +209,9 @@ void nm_client_sleep (NMClient *client, gboolean sleep_); NMClientPermissionResult nm_client_get_permission_result (NMClient *client, NMClientPermission permission); +gboolean nm_client_get_logging (NMClient *client, char **level, char **domains, GError **error); +gboolean nm_client_set_logging (NMClient *client, const char *level, const char *domains, GError **error); + G_END_DECLS #endif /* NM_CLIENT_H */ diff --git a/libnm-glib/nm-device-bridge.c b/libnm-glib/nm-device-bridge.c new file mode 100644 index 00000000..34e02d6d --- /dev/null +++ b/libnm-glib/nm-device-bridge.c @@ -0,0 +1,346 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * libnm_glib -- Access network status & information from glib applications + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright (C) 2012 Red Hat, Inc. + */ + +#include <config.h> +#include <string.h> +#include <netinet/ether.h> + +#include "nm-glib-compat.h" + +#include <nm-setting-connection.h> +#include <nm-setting-bridge.h> +#include <nm-utils.h> + +#include "nm-device-bridge.h" +#include "nm-device-private.h" +#include "nm-object-private.h" +#include "nm-types.h" + +G_DEFINE_TYPE (NMDeviceBridge, nm_device_bridge, NM_TYPE_DEVICE) + +#define NM_DEVICE_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgePrivate)) + +typedef struct { + DBusGProxy *proxy; + + char *hw_address; + gboolean carrier; + GPtrArray *slaves; +} NMDeviceBridgePrivate; + +enum { + PROP_0, + PROP_HW_ADDRESS, + PROP_CARRIER, + PROP_SLAVES, + + LAST_PROP +}; + +#define DBUS_PROP_HW_ADDRESS "HwAddress" +#define DBUS_PROP_CARRIER "Carrier" +#define DBUS_PROP_SLAVES "Slaves" + +/** + * nm_device_bridge_error_quark: + * + * Registers an error quark for #NMDeviceBridge if necessary. + * + * Returns: the error quark used for #NMDeviceBridge errors. + **/ +GQuark +nm_device_bridge_error_quark (void) +{ + static GQuark quark = 0; + + if (G_UNLIKELY (quark == 0)) + quark = g_quark_from_static_string ("nm-device-bridge-error-quark"); + return quark; +} + +/** + * nm_device_bridge_new: + * @connection: the #DBusGConnection + * @path: the DBus object path of the device + * + * Creates a new #NMDeviceBridge. + * + * Returns: (transfer full): a new device + **/ +GObject * +nm_device_bridge_new (DBusGConnection *connection, const char *path) +{ + GObject *device; + + g_return_val_if_fail (connection != NULL, NULL); + g_return_val_if_fail (path != NULL, NULL); + + device = g_object_new (NM_TYPE_DEVICE_BRIDGE, + NM_OBJECT_DBUS_CONNECTION, connection, + NM_OBJECT_DBUS_PATH, path, + NULL); + _nm_object_ensure_inited (NM_OBJECT (device)); + return device; +} + +/** + * nm_device_bridge_get_hw_address: + * @device: a #NMDeviceBridge + * + * Gets the hardware (MAC) address of the #NMDeviceBridge + * + * Returns: the hardware address. This is the internal string used by the + * device, and must not be modified. + **/ +const char * +nm_device_bridge_get_hw_address (NMDeviceBridge *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), NULL); + + _nm_object_ensure_inited (NM_OBJECT (device)); + return NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address; +} + +/** + * nm_device_bridge_get_carrier: + * @device: a #NMDeviceBridge + * + * Whether the device has carrier. + * + * Returns: %TRUE if the device has carrier + **/ +gboolean +nm_device_bridge_get_carrier (NMDeviceBridge *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), FALSE); + + _nm_object_ensure_inited (NM_OBJECT (device)); + return NM_DEVICE_BRIDGE_GET_PRIVATE (device)->carrier; +} + +/** + * nm_device_bridge_get_slaves: + * @device: a #NMDeviceBridge + * + * Gets the devices currently slaved to @device. + * + * Returns: (element-type NMClient.Device): the #GPtrArray containing + * #NMDevice<!-- -->s that are slaves of @device. This is the internal + * copy used by the device, and must not be modified. + **/ +const GPtrArray * +nm_device_bridge_get_slaves (NMDeviceBridge *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), FALSE); + + _nm_object_ensure_inited (NM_OBJECT (device)); + return handle_ptr_array_return (NM_DEVICE_BRIDGE_GET_PRIVATE (device)->slaves); +} + +static gboolean +connection_compatible (NMDevice *device, NMConnection *connection, GError **error) +{ + NMSettingConnection *s_con; + NMSettingBridge *s_bridge; + const char *ctype, *dev_iface_name, *bridge_iface_name; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + + ctype = nm_setting_connection_get_connection_type (s_con); + if (strcmp (ctype, NM_SETTING_BRIDGE_SETTING_NAME) != 0) { + g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION, + "The connection was not a bridge connection."); + return FALSE; + } + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge) { + g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION, + "The connection was not a valid bridge connection."); + return FALSE; + } + + dev_iface_name = nm_device_get_iface (device); + bridge_iface_name = nm_setting_bridge_get_interface_name (s_bridge); + if (g_strcmp0 (dev_iface_name, bridge_iface_name) != 0) { + g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH, + "The interfaces of the device and the connection didn't match."); + return FALSE; + } + + /* FIXME: check ports? */ + + return TRUE; +} + +/***********************************************************/ + +static void +nm_device_bridge_init (NMDeviceBridge *device) +{ + _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BRIDGE); +} + +static void +register_properties (NMDeviceBridge *device) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); + const NMPropertiesInfo property_info[] = { + { NM_DEVICE_BRIDGE_HW_ADDRESS, &priv->hw_address }, + { NM_DEVICE_BRIDGE_CARRIER, &priv->carrier }, + { NM_DEVICE_BRIDGE_SLAVES, &priv->slaves, NULL, NM_TYPE_DEVICE }, + { NULL }, + }; + + _nm_object_register_properties (NM_OBJECT (device), + priv->proxy, + property_info); +} + +static void +constructed (GObject *object) +{ + NMDeviceBridgePrivate *priv; + + G_OBJECT_CLASS (nm_device_bridge_parent_class)->constructed (object); + + priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object); + + priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)), + NM_DBUS_SERVICE, + nm_object_get_path (NM_OBJECT (object)), + NM_DBUS_INTERFACE_DEVICE_BRIDGE); + + register_properties (NM_DEVICE_BRIDGE (object)); +} + +static void +dispose (GObject *object) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object); + + g_clear_object (&priv->proxy); + + if (priv->slaves) { + g_ptr_array_foreach (priv->slaves, (GFunc) g_object_unref, NULL); + g_ptr_array_free (priv->slaves, TRUE); + priv->slaves = NULL; + } + + G_OBJECT_CLASS (nm_device_bridge_parent_class)->dispose (object); +} + +static void +finalize (GObject *object) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object); + + g_free (priv->hw_address); + + G_OBJECT_CLASS (nm_device_bridge_parent_class)->finalize (object); +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + NMDeviceBridge *device = NM_DEVICE_BRIDGE (object); + + _nm_object_ensure_inited (NM_OBJECT (object)); + + switch (prop_id) { + case PROP_HW_ADDRESS: + g_value_set_string (value, nm_device_bridge_get_hw_address (device)); + break; + case PROP_CARRIER: + g_value_set_boolean (value, nm_device_bridge_get_carrier (device)); + break; + case PROP_SLAVES: + g_value_set_boxed (value, nm_device_bridge_get_slaves (device)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (bridge_class); + NMDeviceClass *device_class = NM_DEVICE_CLASS (bridge_class); + + g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate)); + + /* virtual methods */ + object_class->constructed = constructed; + object_class->dispose = dispose; + object_class->finalize = finalize; + object_class->get_property = get_property; + device_class->connection_compatible = connection_compatible; + + /* properties */ + + /** + * NMDeviceBridge:hw-address: + * + * The hardware (MAC) address of the device. + **/ + g_object_class_install_property + (object_class, PROP_HW_ADDRESS, + g_param_spec_string (NM_DEVICE_BRIDGE_HW_ADDRESS, + "Active MAC Address", + "Currently set hardware MAC address", + NULL, + G_PARAM_READABLE)); + + /** + * NMDeviceBridge:carrier: + * + * Whether the device has carrier. + **/ + g_object_class_install_property + (object_class, PROP_CARRIER, + g_param_spec_boolean (NM_DEVICE_BRIDGE_CARRIER, + "Carrier", + "Carrier", + FALSE, + G_PARAM_READABLE)); + + /** + * NMDeviceBridge:slaves: + * + * The devices (#NMDevice) slaved to the bridge device. + **/ + g_object_class_install_property + (object_class, PROP_SLAVES, + g_param_spec_boxed (NM_DEVICE_BRIDGE_SLAVES, + "Slaves", + "Slaves", + NM_TYPE_OBJECT_ARRAY, + G_PARAM_READABLE)); +} diff --git a/libnm-glib/nm-device-bridge.h b/libnm-glib/nm-device-bridge.h new file mode 100644 index 00000000..3462063d --- /dev/null +++ b/libnm-glib/nm-device-bridge.h @@ -0,0 +1,84 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * libnm_glib -- Access network status & information from glib applications + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright (C) 2012 Red Hat, Inc. + */ + +#ifndef NM_DEVICE_BRIDGE_H +#define NM_DEVICE_BRIDGE_H + +#include "nm-device.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DEVICE_BRIDGE (nm_device_bridge_get_type ()) +#define NM_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridge)) +#define NM_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass)) +#define NM_IS_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_BRIDGE)) +#define NM_IS_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BRIDGE)) +#define NM_DEVICE_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass)) + +/** + * NMDeviceBridgeError: + * @NM_DEVICE_BRIDGE_ERROR_UNKNOWN: unknown or unclassified error + * @NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION: the connection was not of bridge type + * @NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION: the bridge connection was invalid + * @NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched + */ +typedef enum { + NM_DEVICE_BRIDGE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/ + NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION, /*< nick=NotBridgeConnection >*/ + NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION, /*< nick=InvalidBridgeConnection >*/ + NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/ +} NMDeviceBridgeError; + +#define NM_DEVICE_BRIDGE_ERROR nm_device_bridge_error_quark () +GQuark nm_device_bridge_error_quark (void); + +#define NM_DEVICE_BRIDGE_HW_ADDRESS "hw-address" +#define NM_DEVICE_BRIDGE_CARRIER "carrier" +#define NM_DEVICE_BRIDGE_SLAVES "slaves" + +typedef struct { + NMDevice parent; +} NMDeviceBridge; + +typedef struct { + NMDeviceClass parent; + + /* Padding for future expansion */ + void (*_reserved1) (void); + void (*_reserved2) (void); + void (*_reserved3) (void); + void (*_reserved4) (void); + void (*_reserved5) (void); + void (*_reserved6) (void); +} NMDeviceBridgeClass; + +GType nm_device_bridge_get_type (void); + +GObject * nm_device_bridge_new (DBusGConnection *connection, const char *path); + +const char *nm_device_bridge_get_hw_address (NMDeviceBridge *device); +gboolean nm_device_bridge_get_carrier (NMDeviceBridge *device); +const GPtrArray *nm_device_bridge_get_slaves (NMDeviceBridge *device); + +G_END_DECLS + +#endif /* NM_DEVICE_BRIDGE_H */ diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c index 0058fd10..e61554df 100644 --- a/libnm-glib/nm-device-wifi.c +++ b/libnm-glib/nm-device-wifi.c @@ -45,6 +45,12 @@ G_DEFINE_TYPE (NMDeviceWifi, nm_device_wifi, NM_TYPE_DEVICE) void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); typedef struct { + NMDeviceWifi *device; + NMDeviceWifiRequestScanFn callback; + gpointer user_data; +} RequestScanInfo; + +typedef struct { DBusGProxy *proxy; char *hw_address; @@ -55,7 +61,8 @@ typedef struct { NMDeviceWifiCapabilities wireless_caps; GPtrArray *aps; - gboolean wireless_enabled; + DBusGProxyCall *scan_call; + RequestScanInfo *scan_info; } NMDeviceWifiPrivate; enum { @@ -319,6 +326,69 @@ nm_device_wifi_get_access_point_by_path (NMDeviceWifi *device, } static void +request_scan_cb (DBusGProxy *proxy, + DBusGProxyCall *call, + gpointer user_data) +{ + RequestScanInfo *info = user_data; + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (info->device); + GError *error = NULL; + + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + + if (info->callback) + info->callback (info->device, error, info->user_data); + + g_clear_error (&error); + g_slice_free (RequestScanInfo, info); + + priv->scan_call = NULL; + priv->scan_info = NULL; +} + +/** + * nm_device_wifi_request_scan_simple: + * @device: a #NMDeviceWifi + * @callback: (scope async) (allow-none): the function to call when the call is done + * @user_data: (closure): user data to pass to the callback function + * + * Request NM to scan for access points on the #NMDeviceWifi. This function only + * instructs NM to perform scanning. Use nm_device_wifi_get_access_points() + * to get available access points. + * + **/ +void +nm_device_wifi_request_scan_simple (NMDeviceWifi *device, + NMDeviceWifiRequestScanFn callback, + gpointer user_data) +{ + RequestScanInfo *info; + GHashTable *options; + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device); + + g_return_if_fail (NM_IS_DEVICE_WIFI (device)); + + /* If a scan is in progress, just return */ + if (priv->scan_call) + return; + + options = g_hash_table_new (g_str_hash, g_str_equal); + + info = g_slice_new0 (RequestScanInfo); + info->device = device; + info->callback = callback; + info->user_data = user_data; + + priv->scan_info = info; + priv->scan_call = dbus_g_proxy_begin_call (NM_DEVICE_WIFI_GET_PRIVATE (device)->proxy, "RequestScan", + request_scan_cb, info, NULL, + DBUS_TYPE_G_MAP_OF_VARIANT, options, + G_TYPE_INVALID); + + g_hash_table_unref (options); +} + +static void access_point_added (NMObject *self, NMObject *ap) { g_signal_emit (self, signals[ACCESS_POINT_ADDED], 0, ap); @@ -608,6 +678,22 @@ static void dispose (GObject *object) { NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (object); + GError *error = NULL; + + if (priv->scan_call) { + g_set_error_literal (&error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_UNKNOWN, + "Wi-Fi device was destroyed"); + if (priv->scan_info) { + if (priv->scan_info->callback) + priv->scan_info->callback (NULL, error, priv->scan_info->user_data); + g_slice_free (RequestScanInfo, priv->scan_info); + priv->scan_info = NULL; + } + g_clear_error (&error); + + dbus_g_proxy_cancel_call (priv->proxy, priv->scan_call); + priv->scan_call = NULL; + } clean_up_aps (NM_DEVICE_WIFI (object), FALSE); g_clear_object (&priv->proxy); @@ -679,7 +765,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) g_param_spec_uint (NM_DEVICE_WIFI_MODE, "Mode", "Mode", - NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA, + NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_AP, NM_802_11_MODE_INFRA, G_PARAM_READABLE)); /** diff --git a/libnm-glib/nm-device-wifi.h b/libnm-glib/nm-device-wifi.h index d909c65c..76d76b4d 100644 --- a/libnm-glib/nm-device-wifi.h +++ b/libnm-glib/nm-device-wifi.h @@ -104,6 +104,13 @@ NMAccessPoint * nm_device_wifi_get_access_point_by_path (NMDeviceWifi * const GPtrArray * nm_device_wifi_get_access_points (NMDeviceWifi *device); +typedef void (*NMDeviceWifiRequestScanFn) (NMDeviceWifi *device, + GError *error, + gpointer user_data); +void nm_device_wifi_request_scan_simple (NMDeviceWifi *device, + NMDeviceWifiRequestScanFn callback, + gpointer user_data); + G_END_DECLS #endif /* NM_DEVICE_WIFI_H */ diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 865fc088..22e2844c 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -35,6 +35,7 @@ #include "nm-device-wimax.h" #include "nm-device-infiniband.h" #include "nm-device-bond.h" +#include "nm-device-bridge.h" #include "nm-device-vlan.h" #include "nm-device.h" #include "nm-device-private.h" @@ -79,6 +80,7 @@ typedef struct { NMIP6Config *ip6_config; NMDHCP6Config *dhcp6_config; NMDeviceState state; + NMDeviceState last_seen_state; NMDeviceStateReason reason; NMActiveConnection *active_connection; @@ -196,10 +198,24 @@ device_state_change_reloaded (GObject *object, gpointer user_data) { NMDevice *self = NM_DEVICE (object); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); StateChangeData *data = user_data; _nm_object_reload_properties_finish (NM_OBJECT (object), result, NULL); + /* If the device changes state several times in rapid succession, then we'll + * queue several reload_properties() calls, and there's no guarantee that + * they'll finish in the right order. In that case, only emit the signal + * for the last one. + */ + if (priv->last_seen_state != data->new_state) + return; + + /* Ensure that nm_device_get_state() will return the right value even if + * we haven't processed the corresponding PropertiesChanged yet. + */ + priv->state = data->new_state; + g_signal_emit (self, signals[STATE_CHANGED], 0, data->new_state, data->old_state, data->reason); g_slice_free (StateChangeData, data); @@ -212,6 +228,9 @@ device_state_changed (DBusGProxy *proxy, NMDeviceStateReason reason, gpointer user_data) { + NMDevice *self = NM_DEVICE (user_data); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + if (old_state != new_state) { StateChangeData *data; @@ -220,6 +239,8 @@ device_state_changed (DBusGProxy *proxy, * in the process of asynchronously reading the new values. * Wait for that to finish before emitting the signal. */ + priv->last_seen_state = new_state; + data = g_slice_new (StateChangeData); data->old_state = old_state; data->new_state = new_state; @@ -252,6 +273,8 @@ _nm_device_gtype_from_dtype (NMDeviceType dtype) return NM_TYPE_DEVICE_INFINIBAND; case NM_DEVICE_TYPE_BOND: return NM_TYPE_DEVICE_BOND; + case NM_DEVICE_TYPE_BRIDGE: + return NM_TYPE_DEVICE_BRIDGE; case NM_DEVICE_TYPE_VLAN: return NM_TYPE_DEVICE_VLAN; default: diff --git a/libnm-glib/nm-glib-enum-types.c b/libnm-glib/nm-glib-enum-types.c index 7486ff96..c2e92bee 100644 --- a/libnm-glib/nm-glib-enum-types.c +++ b/libnm-glib/nm-glib-enum-types.c @@ -15,6 +15,7 @@ #include "nm-device-bt.h" #include "nm-device-olpc-mesh.h" #include "nm-device-bond.h" +#include "nm-device-bridge.h" #include "nm-device-vlan.h" #include "nm-access-point.h" #include "nm-ip4-config.h" @@ -254,6 +255,27 @@ nm_device_bond_error_get_type (void) return g_define_type_id__volatile; } GType +nm_device_bridge_error_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { NM_DEVICE_BRIDGE_ERROR_UNKNOWN, "NM_DEVICE_BRIDGE_ERROR_UNKNOWN", "UnknownError" }, + { NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION, "NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION", "NotBridgeConnection" }, + { NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION, "NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION", "InvalidBridgeConnection" }, + { NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH, "NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH", "InterfaceMismatch" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("NMDeviceBridgeError"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType nm_device_vlan_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; diff --git a/libnm-glib/nm-glib-enum-types.h b/libnm-glib/nm-glib-enum-types.h index 6493ab19..f33db002 100644 --- a/libnm-glib/nm-glib-enum-types.h +++ b/libnm-glib/nm-glib-enum-types.h @@ -29,6 +29,8 @@ GType nm_device_olpc_mesh_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_DEVICE_OLPC_MESH_ERROR (nm_device_olpc_mesh_error_get_type ()) GType nm_device_bond_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_DEVICE_BOND_ERROR (nm_device_bond_error_get_type ()) +GType nm_device_bridge_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_DEVICE_BRIDGE_ERROR (nm_device_bridge_error_get_type ()) GType nm_device_vlan_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_DEVICE_VLAN_ERROR (nm_device_vlan_error_get_type ()) GType nm_device_modem_error_get_type (void) G_GNUC_CONST; diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 7748f4f0..0e95ef0a 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -61,6 +61,7 @@ typedef struct { DBusGProxy *dbus_proxy; guint fetch_id; + gboolean fetching; } NMRemoteSettingsPrivate; enum { @@ -381,8 +382,10 @@ connection_inited (GObject *source, GAsyncResult *result, gpointer user_data) /* Let listeners know that all connections have been found */ priv->init_left--; - if (priv->init_left == 0) + if (priv->init_left == 0) { + priv->fetching = FALSE; g_signal_emit (self, signals[CONNECTIONS_READ], 0); + } } static NMRemoteConnection * @@ -442,14 +445,16 @@ fetch_connections_done (DBusGProxy *proxy, g_clear_error (&error); /* We tried to read connections and failed */ + priv->fetching = FALSE; g_signal_emit (self, signals[CONNECTIONS_READ], 0); return; } /* Let listeners know we are done getting connections */ - if (connections->len == 0) + if (connections->len == 0) { + priv->fetching = FALSE; g_signal_emit (self, signals[CONNECTIONS_READ], 0); - else { + } else { priv->init_left = connections->len; for (i = 0; i < connections->len; i++) { char *path = g_ptr_array_index (connections, i); @@ -682,6 +687,48 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings, } static void +properties_changed_cb (DBusGProxy *proxy, + GHashTable *properties, + gpointer user_data) +{ + NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data); + NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self); + GHashTableIter iter; + gpointer key, tmp; + + g_hash_table_iter_init (&iter, properties); + while (g_hash_table_iter_next (&iter, &key, &tmp)) { + GValue *value = tmp; + + if (!strcmp ((const char *) key, "Hostname")) { + g_free (priv->hostname); + priv->hostname = g_value_dup_string (value); + g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_HOSTNAME); + } + + if (!strcmp ((const char *) key, "CanModify")) { + priv->can_modify = g_value_get_boolean (value); + g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_CAN_MODIFY); + } + } +} + +static void +nm_appeared_got_properties (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) +{ + NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data); + NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self); + GHashTable *props = NULL; + + if (dbus_g_proxy_end_call (proxy, call, NULL, + DBUS_TYPE_G_MAP_OF_VARIANT, &props, + G_TYPE_INVALID)) { + properties_changed_cb (priv->props_proxy, props, self); + g_hash_table_destroy (props); + } +} + +static void name_owner_changed (DBusGProxy *proxy, const char *name, const char *old_owner, @@ -699,38 +746,24 @@ name_owner_changed (DBusGProxy *proxy, if (new_owner && strlen (new_owner) > 0) { priv->fetch_id = g_idle_add (fetch_connections, self); priv->service_running = TRUE; + + dbus_g_proxy_begin_call (priv->props_proxy, "GetAll", + nm_appeared_got_properties, self, NULL, + G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS, + G_TYPE_INVALID); } else { priv->fetch_id = g_idle_add (remove_connections, self); priv->service_running = FALSE; - } - g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_SERVICE_RUNNING); - } -} - -static void -properties_changed_cb (DBusGProxy *proxy, - GHashTable *properties, - gpointer user_data) -{ - NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data); - NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self); - GHashTableIter iter; - gpointer key, tmp; - g_hash_table_iter_init (&iter, properties); - while (g_hash_table_iter_next (&iter, &key, &tmp)) { - GValue *value = tmp; - - if (!strcmp ((const char *) key, "Hostname")) { + /* Clear properties */ g_free (priv->hostname); - priv->hostname = g_value_dup_string (value); + priv->hostname = NULL; g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_HOSTNAME); - } - if (!strcmp ((const char *) key, "CanModify")) { - priv->can_modify = g_value_get_boolean (value); + priv->can_modify = FALSE; g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_CAN_MODIFY); } + g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_SERVICE_RUNNING); } } @@ -881,6 +914,7 @@ constructed (GObject *object) object, NULL); + priv->fetching = TRUE; priv->fetch_id = g_idle_add (fetch_connections, object); @@ -921,6 +955,12 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) return FALSE; } + /* If NM isn't running we'll grab properties from name_owner_changed() + * when it starts. + */ + if (!priv->service_running) + return TRUE; + /* Get properties */ if (!dbus_g_proxy_call (priv->props_proxy, "GetAll", error, G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS, @@ -931,8 +971,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) properties_changed_cb (priv->props_proxy, props, settings); g_hash_table_destroy (props); - /* FIXME: need a synchronous fetch_connections too */ - return TRUE; } @@ -944,6 +982,10 @@ typedef struct { static void init_async_complete (NMRemoteSettingsInitData *init_data) { + NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (init_data->settings); + + priv->inited = TRUE; + g_simple_async_result_complete (init_data->result); g_object_unref (init_data->result); g_slice_free (NMRemoteSettingsInitData, init_data); @@ -955,6 +997,7 @@ init_read_connections (NMRemoteSettings *settings, gpointer user_data) NMRemoteSettingsInitData *init_data = user_data; g_signal_handlers_disconnect_by_func (settings, G_CALLBACK (init_read_connections), user_data); + init_async_complete (init_data); } @@ -976,7 +1019,7 @@ init_async_got_properties (DBusGProxy *proxy, DBusGProxyCall *call, } else g_simple_async_result_take_error (init_data->result, error); - if (priv->init_left) { + if (priv->fetching) { /* Still creating initial connections; wait for that to complete */ g_signal_connect (init_data->settings, "connections-read", G_CALLBACK (init_read_connections), init_data); diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index ae048d80..bfa4fcfc 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -19,7 +19,6 @@ */ #include <config.h> -#include <ctype.h> #include <string.h> #include <dbus/dbus-glib-lowlevel.h> @@ -215,21 +214,17 @@ name_owner_changed (DBusGProxy *proxy, } static gboolean -verify_request (NMSecretAgent *self, - DBusGMethodInvocation *context, - GHashTable *connection_hash, - const char *connection_path, - NMConnection **out_connection, - GError **error) +verify_sender (NMSecretAgent *self, + DBusGMethodInvocation *context, + GError **error) { NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self); - NMConnection *connection = NULL; DBusConnection *bus; char *sender; const char *nm_owner; DBusError dbus_error; uid_t sender_uid = G_MAXUINT; - GError *local = NULL; + gboolean allowed = FALSE; g_return_val_if_fail (context != NULL, FALSE); @@ -285,6 +280,7 @@ verify_request (NMSecretAgent *self, goto out; } + /* We only accept requests from NM, which always runs as root */ if (0 != sender_uid) { g_set_error_literal (error, NM_SECRET_AGENT_ERROR, @@ -293,26 +289,55 @@ verify_request (NMSecretAgent *self, goto out; } - /* And make sure the connection is actually valid */ - if (connection_hash) { - connection = nm_connection_new_from_hash (connection_hash, &local); - if (connection && connection_path) { - nm_connection_set_path (connection, connection_path); - } else { - g_set_error (error, - NM_SECRET_AGENT_ERROR, - NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, - "Invalid connection: (%d) %s", - local ? local->code : -1, - (local && local->message) ? local->message : "(unknown)"); - g_clear_error (&local); - } - } + allowed = TRUE; out: - if (out_connection) - *out_connection = connection; g_free (sender); + return allowed; +} + +static gboolean +verify_request (NMSecretAgent *self, + DBusGMethodInvocation *context, + GHashTable *connection_hash, + const char *connection_path, + NMConnection **out_connection, + GError **error) +{ + NMConnection *connection = NULL; + GError *local = NULL; + + if (!verify_sender (self, context, error)) + return FALSE; + + /* No connection? If the sender verified, then we allow the request */ + if (connection_hash == NULL) + return TRUE; + + /* If we have a connection hash, we require a path too */ + if (connection_path == NULL) { + g_set_error_literal (error, + NM_SECRET_AGENT_ERROR, + NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, + "Invalid connection: no connection path given."); + return FALSE; + } + + /* Make sure the given connection is valid */ + g_assert (out_connection); + connection = nm_connection_new_from_hash (connection_hash, &local); + if (connection) { + nm_connection_set_path (connection, connection_path); + *out_connection = connection; + } else { + g_set_error (error, + NM_SECRET_AGENT_ERROR, + NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, + "Invalid connection: (%d) %s", + local ? local->code : -1, + (local && local->message) ? local->message : "(unknown)"); + g_clear_error (&local); + } return !!connection; } @@ -766,7 +791,7 @@ validate_identifier (const char *identifier) /* FIXME: do complete validation here */ while (p && *p) { - if (!isalnum (*p) && (*p != '_') && (*p != '-') && (*p != '.')) + if (!g_ascii_isalnum (*p) && (*p != '_') && (*p != '-') && (*p != '.')) return FALSE; if ((*p == '.') && (*(p + 1) == '.')) return FALSE; diff --git a/libnm-glib/nm-secret-agent.h b/libnm-glib/nm-secret-agent.h index 6aa72438..dbc027c7 100644 --- a/libnm-glib/nm-secret-agent.h +++ b/libnm-glib/nm-secret-agent.h @@ -101,7 +101,10 @@ typedef struct { /** * NMSecretAgentGetSecretsFunc: * @agent: the secret agent object - * @connection: the connection for which secrets were requested + * @connection: (transfer none): the connection for which secrets were requested, + * note that this object will be unrefed after the callback has returned, use + * g_object_ref()/g_object_unref() if you want to use this object after the callback + * has returned * @secrets: (element-type utf8 GLib.HashTable): the #GHashTable containing * the requested secrets in the same format as an #NMConnection hash (as * created by nm_connection_to_hash() for example). Each key in @secrets @@ -109,7 +112,7 @@ typedef struct { * and each value should be a #GHashTable. The sub-hashes map string:#GValue * where the string is the setting property name (like "psk") and the value * is the secret - * @error: if the secrets request failed, give a descriptive error here + * @error: if the secrets request failed, give a descriptive error here * @user_data: caller-specific data to be passed to the function * * Called as a result of a request by NM to retrieve secrets. When the @@ -150,8 +153,11 @@ typedef void (*NMSecretAgentGetSecretsFunc) (NMSecretAgent *agent, /** * NMSecretAgentSaveSecretsFunc: * @agent: the secret agent object - * @connection: the connection for which secrets were to be saved - * @error: if the saving secrets failed, give a descriptive error here + * @connection: (transfer none): the connection for which secrets were to be saved, + * note that this object will be unrefed after the callback has returned, use + * g_object_ref()/g_object_unref() if you want to use this object after the callback + * has returned + * @error: if the saving secrets failed, give a descriptive error here * @user_data: caller-specific data to be passed to the function * * Called as a result of a request by NM to save secrets. When the @@ -166,8 +172,11 @@ typedef void (*NMSecretAgentSaveSecretsFunc) (NMSecretAgent *agent, /** * NMSecretAgentDeleteSecretsFunc: * @agent: the secret agent object - * @connection: the connection for which secrets were to be deleted - * @error: if the deleting secrets failed, give a descriptive error here + * @connection: (transfer none): the connection for which secrets were to be deleted, + * note that this object will be unrefed after the callback has returned, use + * g_object_ref()/g_object_unref() if you want to use this object after the callback + * has returned + * @error: if the deleting secrets failed, give a descriptive error here * @user_data: caller-specific data to be passed to the function * * Called as a result of a request by NM to delete secrets. When the diff --git a/libnm-glib/tests/Makefile.am b/libnm-glib/tests/Makefile.am index 0dba0793..5fda5bd2 100644 --- a/libnm-glib/tests/Makefile.am +++ b/libnm-glib/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @@ -28,10 +30,7 @@ TEST_RSS_BIN = test-remote-settings-service.py EXTRA_DIST = $(TEST_RSS_BIN) -if WITH_TESTS - check-local: test-remote-settings-client $(abs_builddir)/test-remote-settings-client $(abs_srcdir) $(TEST_RSS_BIN) endif - diff --git a/libnm-glib/tests/Makefile.in b/libnm-glib/tests/Makefile.in index d44c3db1..6884817c 100644 --- a/libnm-glib/tests/Makefile.in +++ b/libnm-glib/tests/Makefile.in @@ -51,21 +51,24 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-remote-settings-client$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = \ +@ENABLE_TESTS_TRUE@ test-remote-settings-client$(EXEEXT) subdir = libnm-glib/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-doc.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/introspection.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libnl-check.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/gnome-code-coverage.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -73,14 +76,16 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_remote_settings_client_OBJECTS = test_remote_settings_client-test-remote-settings-client.$(OBJEXT) +am__test_remote_settings_client_SOURCES_DIST = \ + test-remote-settings-client.c +@ENABLE_TESTS_TRUE@am_test_remote_settings_client_OBJECTS = test_remote_settings_client-test-remote-settings-client.$(OBJEXT) test_remote_settings_client_OBJECTS = \ $(am_test_remote_settings_client_OBJECTS) am__DEPENDENCIES_1 = -test_remote_settings_client_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/libnm-glib/libnm-glib-test.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_remote_settings_client_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib-test.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -111,7 +116,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_remote_settings_client_SOURCES) -DIST_SOURCES = $(test_remote_settings_client_SOURCES) +DIST_SOURCES = $(am__test_remote_settings_client_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -132,6 +137,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -146,9 +155,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -158,17 +165,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -209,6 +213,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -225,11 +230,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -244,6 +245,8 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ +MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ +MM_GLIB_LIBS = @MM_GLIB_LIBS@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ @@ -253,6 +256,7 @@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ +NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ NM_VERSION = @NM_VERSION@ NSS_CFLAGS = @NSS_CFLAGS@ NSS_LIBS = @NSS_LIBS@ @@ -279,13 +283,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -340,6 +345,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -354,32 +364,36 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/libnm-glib +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib ####### remote settings client test ####### -test_remote_settings_client_SOURCES = \ - test-remote-settings-client.c +@ENABLE_TESTS_TRUE@test_remote_settings_client_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-remote-settings-client.c -test_remote_settings_client_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) +@ENABLE_TESTS_TRUE@test_remote_settings_client_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) -test_remote_settings_client_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/libnm-glib/libnm-glib-test.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@test_remote_settings_client_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib-test.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) ########################################### -TEST_RSS_BIN = test-remote-settings-service.py -EXTRA_DIST = $(TEST_RSS_BIN) +@ENABLE_TESTS_TRUE@TEST_RSS_BIN = test-remote-settings-service.py +@ENABLE_TESTS_TRUE@EXTRA_DIST = $(TEST_RSS_BIN) all: all-am .SUFFIXES: @@ -436,25 +450,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_remote_settings_client-test-remote-settings-client.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -561,7 +572,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -685,8 +696,8 @@ uninstall-am: tags uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-remote-settings-client -@WITH_TESTS_TRUE@ $(abs_builddir)/test-remote-settings-client $(abs_srcdir) $(TEST_RSS_BIN) +@ENABLE_TESTS_TRUE@check-local: test-remote-settings-client +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-remote-settings-client $(abs_srcdir) $(TEST_RSS_BIN) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. |