diff options
author | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
commit | 2c032d8f1c6292c1338a615e6ec40252889ba85c (patch) | |
tree | 1f77182220b2b0264288ba4a476ab47e5bc48716 /libnm-util | |
parent | 33491bc4279481db8ae47213e34a6d695a0e8830 (diff) |
Imported Upstream version 1.0.0upstream/1.0.0
Diffstat (limited to 'libnm-util')
97 files changed, 4110 insertions, 4495 deletions
diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index 01b2026ab..3fdc79e50 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -5,8 +5,8 @@ SUBDIRS = . tests AM_CPPFLAGS = \ -I${top_srcdir} \ -I${top_srcdir}/include \ - -I${top_builddir}/include \ -DG_LOG_DOMAIN=\""libnm-util"\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ @@ -23,6 +23,8 @@ endif lib_LTLIBRARIES=libnm-util.la libnm_util_include_HEADERS = \ + NetworkManager.h \ + NetworkManagerVPN.h \ nm-connection.h \ nm-setting.h \ nm-setting-8021x.h \ @@ -51,9 +53,12 @@ libnm_util_include_HEADERS = \ nm-setting-wireless.h \ nm-setting-wireless-security.h \ nm-setting-vpn.h \ - nm-utils-enum-types.h \ nm-utils.h +nodist_libnm_util_include_HEADERS = \ + nm-utils-enum-types.h \ + nm-version.h + libnm_util_la_private_headers = \ crypto.h \ nm-param-spec-specialized.h \ @@ -101,7 +106,7 @@ libnm_util_la_SOURCES = \ GLIB_GENERATED = nm-utils-enum-types.h nm-utils-enum-types.c BUILT_SOURCES = $(GLIB_GENERATED) -nm_utils_enum_types_sources = $(libnm_util_include_HEADERS) +nm_utils_enum_types_sources = $(filter-out NetworkManager%,$(libnm_util_include_HEADERS)) GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM @@ -110,7 +115,7 @@ libnm_util_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) $(UUID_LIBS) SYMBOL_VIS_FILE=$(srcdir)/libnm-util.ver libnm_util_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ - -version-info "8:0:6" + -version-info "9:0:7" if WITH_GNUTLS libnm_util_la_SOURCES += crypto_gnutls.c @@ -150,9 +155,9 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm-util.pc DISTCLEANFILES = libnm-util.pc -CLEANFILES = +CLEANFILES = nm-version.h -EXTRA_DIST = libnm-util.pc.in libnm-util.ver +EXTRA_DIST = libnm-util.pc.in libnm-util.ver nm-version.h.in -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = @@ -160,7 +165,7 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) if HAVE_INTROSPECTION -introspection_sources = $(libnm_util_include_HEADERS) $(libnm_util_la_csources) $(top_srcdir)/include/NetworkManager.h $(top_srcdir)/include/NetworkManagerVPN.h +introspection_sources = $(libnm_util_include_HEADERS) $(nodist_libnm_util_include_HEADERS) $(libnm_util_la_csources) NetworkManager-1.0.gir: libnm-util.la NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 @@ -179,6 +184,7 @@ typelibdir = $(libdir)/girepository-1.0 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) + endif if ENABLE_TESTS diff --git a/libnm-util/Makefile.in b/libnm-util/Makefile.in index fa461f1ff..5dea1b42b 100644 --- a/libnm-util/Makefile.in +++ b/libnm-util/Makefile.in @@ -94,8 +94,9 @@ host_triplet = @host@ @HAVE_INTROSPECTION_TRUE@am__append_12 = $(gir_DATA) $(typelib_DATA) subdir = libnm-util DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/libnm-util.pc.in $(top_srcdir)/build-aux/depcomp \ - $(libnm_util_include_HEADERS) COPYING + $(srcdir)/libnm-util.pc.in $(srcdir)/nm-version.h.in \ + $(top_srcdir)/build-aux/depcomp $(libnm_util_include_HEADERS) \ + COPYING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/compiler_warnings.m4 \ @@ -114,7 +115,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libnm-util.pc +CONFIG_CLEAN_FILES = libnm-util.pc nm-version.h CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -145,6 +146,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ + "$(DESTDIR)$(libnm_util_includedir)" \ "$(DESTDIR)$(libnm_util_includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = @@ -253,7 +255,8 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) -HEADERS = $(libnm_util_include_HEADERS) +HEADERS = $(libnm_util_include_HEADERS) \ + $(nodist_libnm_util_include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ @@ -317,6 +320,8 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ +BLUEZ5_LIBS = @BLUEZ5_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -440,6 +445,7 @@ NEWT_CFLAGS = @NEWT_CFLAGS@ NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ @@ -459,6 +465,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -485,7 +492,7 @@ 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@ +UDEV_DIR = @UDEV_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ @@ -566,11 +573,14 @@ with_resolvconf = @with_resolvconf@ with_valgrind = @with_valgrind@ SUBDIRS = . tests AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/include \ - -I${top_builddir}/include -DG_LOG_DOMAIN=\""libnm-util"\" \ + -DG_LOG_DOMAIN=\""libnm-util"\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) $(UUID_CFLAGS) $(am__append_1) $(am__append_2) lib_LTLIBRARIES = libnm-util.la libnm_util_include_HEADERS = \ + NetworkManager.h \ + NetworkManagerVPN.h \ nm-connection.h \ nm-setting.h \ nm-setting-8021x.h \ @@ -599,9 +609,12 @@ libnm_util_include_HEADERS = \ nm-setting-wireless.h \ nm-setting-wireless-security.h \ nm-setting-vpn.h \ - nm-utils-enum-types.h \ nm-utils.h +nodist_libnm_util_include_HEADERS = \ + nm-utils-enum-types.h \ + nm-version.h + libnm_util_la_private_headers = \ crypto.h \ nm-param-spec-specialized.h \ @@ -648,14 +661,14 @@ libnm_util_la_SOURCES = $(libnm_util_la_csources) \ $(am__append_5) GLIB_GENERATED = nm-utils-enum-types.h nm-utils-enum-types.c BUILT_SOURCES = $(GLIB_GENERATED) -nm_utils_enum_types_sources = $(libnm_util_include_HEADERS) +nm_utils_enum_types_sources = $(filter-out NetworkManager%,$(libnm_util_include_HEADERS)) GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM libnm_util_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) $(UUID_LIBS) \ $(am__append_4) $(am__append_6) SYMBOL_VIS_FILE = $(srcdir)/libnm-util.ver libnm_util_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ - -version-info "8:0:6" + -version-info "9:0:7" libnm_util_includedir = $(includedir)/NetworkManager @@ -669,12 +682,12 @@ libtest_crypto_la_LIBADD = $(GLIB_LIBS) $(am__append_8) \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm-util.pc DISTCLEANFILES = libnm-util.pc -CLEANFILES = $(am__append_12) -EXTRA_DIST = libnm-util.pc.in libnm-util.ver +CLEANFILES = nm-version.h $(am__append_12) +EXTRA_DIST = libnm-util.pc.in libnm-util.ver nm-version.h.in INTROSPECTION_GIRS = $(am__append_11) INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) -@HAVE_INTROSPECTION_TRUE@introspection_sources = $(libnm_util_include_HEADERS) $(libnm_util_la_csources) $(top_srcdir)/include/NetworkManager.h $(top_srcdir)/include/NetworkManagerVPN.h +@HAVE_INTROSPECTION_TRUE@introspection_sources = $(libnm_util_include_HEADERS) $(nodist_libnm_util_include_HEADERS) $(libnm_util_la_csources) @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util @@ -723,6 +736,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): libnm-util.pc: $(top_builddir)/config.status $(srcdir)/libnm-util.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nm-version.h: $(top_builddir)/config.status $(srcdir)/nm-version.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @@ -928,6 +943,27 @@ uninstall-libnm_util_includeHEADERS: @list='$(libnm_util_include_HEADERS)'; test -n "$(libnm_util_includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(libnm_util_includedir)'; $(am__uninstall_files_from_dir) +install-nodist_libnm_util_includeHEADERS: $(nodist_libnm_util_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nodist_libnm_util_include_HEADERS)'; test -n "$(libnm_util_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libnm_util_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libnm_util_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libnm_util_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(libnm_util_includedir)" || exit $$?; \ + done + +uninstall-nodist_libnm_util_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_libnm_util_include_HEADERS)'; test -n "$(libnm_util_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libnm_util_includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. @@ -1091,7 +1127,7 @@ check: $(BUILT_SOURCES) all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(libnm_util_includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(libnm_util_includedir)" "$(DESTDIR)$(libnm_util_includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -1152,7 +1188,8 @@ info: info-recursive info-am: install-data-am: install-girDATA install-libnm_util_includeHEADERS \ - install-pkgconfigDATA install-typelibDATA + install-nodist_libnm_util_includeHEADERS install-pkgconfigDATA \ + install-typelibDATA install-dvi: install-dvi-recursive @@ -1199,8 +1236,9 @@ ps: ps-recursive ps-am: uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ - uninstall-libnm_util_includeHEADERS uninstall-pkgconfigDATA \ - uninstall-typelibDATA + uninstall-libnm_util_includeHEADERS \ + uninstall-nodist_libnm_util_includeHEADERS \ + uninstall-pkgconfigDATA uninstall-typelibDATA .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-strip @@ -1214,7 +1252,8 @@ uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-girDATA install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ - install-libnm_util_includeHEADERS install-man install-pdf \ + install-libnm_util_includeHEADERS install-man \ + install-nodist_libnm_util_includeHEADERS install-pdf \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ install-strip install-typelibDATA installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ @@ -1222,6 +1261,7 @@ uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-girDATA \ uninstall-libLTLIBRARIES uninstall-libnm_util_includeHEADERS \ + uninstall-nodist_libnm_util_includeHEADERS \ uninstall-pkgconfigDATA uninstall-typelibDATA include $(GLIB_MAKEFILE) diff --git a/libnm-util/NetworkManager.h b/libnm-util/NetworkManager.h new file mode 100644 index 000000000..08b4e6cf6 --- /dev/null +++ b/libnm-util/NetworkManager.h @@ -0,0 +1,563 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2004 - 2014 Red Hat, Inc. + */ + +/* Definitions related to NetworkManager's D-Bus interfaces. + * + * Note that although this header is installed as part of libnm-util, it is also + * used by some external code that does not link to libnm-util. + */ + +#ifndef NETWORK_MANAGER_H +#define NETWORK_MANAGER_H + +#include "nm-version.h" + +/* + * dbus services details + */ +#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager" + +#define NM_DBUS_PATH "/org/freedesktop/NetworkManager" +#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager" +#define NM_DBUS_INTERFACE_DEVICE NM_DBUS_INTERFACE ".Device" +#define NM_DBUS_INTERFACE_DEVICE_WIRED NM_DBUS_INTERFACE_DEVICE ".Wired" +#define NM_DBUS_INTERFACE_DEVICE_ADSL NM_DBUS_INTERFACE_DEVICE ".Adsl" +#define NM_DBUS_INTERFACE_DEVICE_WIRELESS NM_DBUS_INTERFACE_DEVICE ".Wireless" +#define NM_DBUS_INTERFACE_DEVICE_BLUETOOTH NM_DBUS_INTERFACE_DEVICE ".Bluetooth" +#define NM_DBUS_INTERFACE_DEVICE_OLPC_MESH NM_DBUS_INTERFACE_DEVICE ".OlpcMesh" +#define NM_DBUS_PATH_ACCESS_POINT NM_DBUS_PATH "/AccessPoint" +#define NM_DBUS_INTERFACE_ACCESS_POINT NM_DBUS_INTERFACE ".AccessPoint" +#define NM_DBUS_INTERFACE_DEVICE_MODEM NM_DBUS_INTERFACE_DEVICE ".Modem" +#define NM_DBUS_INTERFACE_DEVICE_WIMAX NM_DBUS_INTERFACE_DEVICE ".WiMax" +#define NM_DBUS_INTERFACE_WIMAX_NSP NM_DBUS_INTERFACE ".WiMax.Nsp" +#define NM_DBUS_PATH_WIMAX_NSP NM_DBUS_PATH "/Nsp" +#define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active" +#define NM_DBUS_INTERFACE_IP4_CONFIG NM_DBUS_INTERFACE ".IP4Config" +#define NM_DBUS_INTERFACE_DHCP4_CONFIG NM_DBUS_INTERFACE ".DHCP4Config" +#define NM_DBUS_INTERFACE_IP6_CONFIG NM_DBUS_INTERFACE ".IP6Config" +#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config" +#define NM_DBUS_INTERFACE_DEVICE_INFINIBAND NM_DBUS_INTERFACE_DEVICE ".Infiniband" +#define NM_DBUS_INTERFACE_DEVICE_BOND NM_DBUS_INTERFACE_DEVICE ".Bond" +#define NM_DBUS_INTERFACE_DEVICE_TEAM NM_DBUS_INTERFACE_DEVICE ".Team" +#define NM_DBUS_INTERFACE_DEVICE_VLAN NM_DBUS_INTERFACE_DEVICE ".Vlan" +#define NM_DBUS_INTERFACE_DEVICE_BRIDGE NM_DBUS_INTERFACE_DEVICE ".Bridge" +#define NM_DBUS_INTERFACE_DEVICE_GENERIC NM_DBUS_INTERFACE_DEVICE ".Generic" +#define NM_DBUS_INTERFACE_DEVICE_VETH NM_DBUS_INTERFACE_DEVICE ".Veth" +#define NM_DBUS_INTERFACE_DEVICE_TUN NM_DBUS_INTERFACE_DEVICE ".Tun" +#define NM_DBUS_INTERFACE_DEVICE_MACVLAN NM_DBUS_INTERFACE_DEVICE ".Macvlan" +#define NM_DBUS_INTERFACE_DEVICE_VXLAN NM_DBUS_INTERFACE_DEVICE ".Vxlan" +#define NM_DBUS_INTERFACE_DEVICE_GRE NM_DBUS_INTERFACE_DEVICE ".Gre" + + +#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManager.Settings" +#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManager/Settings" + +#define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManager.Settings.Connection" +#define NM_DBUS_PATH_SETTINGS_CONNECTION "/org/freedesktop/NetworkManager/Settings/Connection" +#define NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS "org.freedesktop.NetworkManager.Settings.Connection.Secrets" + +#define NM_DBUS_INTERFACE_AGENT_MANAGER NM_DBUS_INTERFACE ".AgentManager" +#define NM_DBUS_PATH_AGENT_MANAGER "/org/freedesktop/NetworkManager/AgentManager" + +#define NM_DBUS_INTERFACE_SECRET_AGENT NM_DBUS_INTERFACE ".SecretAgent" +#define NM_DBUS_PATH_SECRET_AGENT "/org/freedesktop/NetworkManager/SecretAgent" + +/** + * NMState: + * @NM_STATE_UNKNOWN: networking state is unknown + * @NM_STATE_ASLEEP: networking is not enabled + * @NM_STATE_DISCONNECTED: there is no active network connection + * @NM_STATE_DISCONNECTING: network connections are being cleaned up + * @NM_STATE_CONNECTING: a network connection is being started + * @NM_STATE_CONNECTED_LOCAL: there is only local IPv4 and/or IPv6 connectivity + * @NM_STATE_CONNECTED_SITE: there is only site-wide IPv4 and/or IPv6 connectivity + * @NM_STATE_CONNECTED_GLOBAL: there is global IPv4 and/or IPv6 Internet connectivity + * + * #NMState values indicate the current overall networking state. + * + * (Corresponds to the NM_STATE type in nm-manager.xml.) + **/ +typedef enum { + NM_STATE_UNKNOWN = 0, + NM_STATE_ASLEEP = 10, + NM_STATE_DISCONNECTED = 20, + NM_STATE_DISCONNECTING = 30, + NM_STATE_CONNECTING = 40, + NM_STATE_CONNECTED_LOCAL = 50, + NM_STATE_CONNECTED_SITE = 60, + NM_STATE_CONNECTED_GLOBAL = 70 +} NMState; + +/* For backwards compat */ +#define NM_STATE_CONNECTED NM_STATE_CONNECTED_GLOBAL + +/** + * NMConnectivityState: + * @NM_CONNECTIVITY_UNKNOWN: Network connectivity is unknown. + * @NM_CONNECTIVITY_NONE: The host is not connected to any network. + * @NM_CONNECTIVITY_PORTAL: The host is behind a captive portal and + * cannot reach the full Internet. + * @NM_CONNECTIVITY_LIMITED: The host is connected to a network, but + * does not appear to be able to reach the full Internet. + * @NM_CONNECTIVITY_FULL: The host is connected to a network, and + * appears to be able to reach the full Internet. + * + * (Corresponds to the NM_CONNECTIVITY type in nm-manager.xml.) + * + * Since: 0.9.8.6 + */ +typedef enum { + NM_CONNECTIVITY_UNKNOWN, + NM_CONNECTIVITY_NONE, + NM_CONNECTIVITY_PORTAL, + NM_CONNECTIVITY_LIMITED, + NM_CONNECTIVITY_FULL +} NMConnectivityState; + +/** + * NMDeviceType: + * @NM_DEVICE_TYPE_UNKNOWN: unknown device + * @NM_DEVICE_TYPE_GENERIC: generic support for unrecognized device types + * @NM_DEVICE_TYPE_ETHERNET: a wired ethernet device + * @NM_DEVICE_TYPE_WIFI: an 802.11 WiFi device + * @NM_DEVICE_TYPE_UNUSED1: not used + * @NM_DEVICE_TYPE_UNUSED2: not used + * @NM_DEVICE_TYPE_BT: a Bluetooth device supporting PAN or DUN access protocols + * @NM_DEVICE_TYPE_OLPC_MESH: an OLPC XO mesh networking device + * @NM_DEVICE_TYPE_WIMAX: an 802.16e Mobile WiMAX broadband device + * @NM_DEVICE_TYPE_MODEM: a modem supporting analog telephone, CDMA/EVDO, + * GSM/UMTS, or LTE network access protocols + * @NM_DEVICE_TYPE_INFINIBAND: an IP-over-InfiniBand device + * @NM_DEVICE_TYPE_BOND: a bond master interface + * @NM_DEVICE_TYPE_VLAN: an 802.1Q VLAN interface + * @NM_DEVICE_TYPE_ADSL: ADSL modem + * @NM_DEVICE_TYPE_BRIDGE: a bridge master interface + * @NM_DEVICE_TYPE_TEAM: a team master interface + * + * #NMDeviceType values indicate the type of hardware represented by + * an #NMDevice. + * + * (Corresponds to the NM_DEVICE_TYPE type in nm-device.xml.) + **/ +typedef enum { + NM_DEVICE_TYPE_UNKNOWN = 0, + NM_DEVICE_TYPE_ETHERNET = 1, + NM_DEVICE_TYPE_WIFI = 2, + NM_DEVICE_TYPE_UNUSED1 = 3, + NM_DEVICE_TYPE_UNUSED2 = 4, + NM_DEVICE_TYPE_BT = 5, /* Bluetooth */ + NM_DEVICE_TYPE_OLPC_MESH = 6, + NM_DEVICE_TYPE_WIMAX = 7, + NM_DEVICE_TYPE_MODEM = 8, + NM_DEVICE_TYPE_INFINIBAND = 9, + NM_DEVICE_TYPE_BOND = 10, + NM_DEVICE_TYPE_VLAN = 11, + NM_DEVICE_TYPE_ADSL = 12, + NM_DEVICE_TYPE_BRIDGE = 13, + NM_DEVICE_TYPE_GENERIC = 14, + NM_DEVICE_TYPE_TEAM = 15, +} NMDeviceType; + +/** + * NMDeviceCapabilities: + * @NM_DEVICE_CAP_NONE: device has no special capabilities + * @NM_DEVICE_CAP_NM_SUPPORTED: NetworkManager supports this device + * @NM_DEVICE_CAP_CARRIER_DETECT: this device can indicate carrier status + * @NM_DEVICE_CAP_IS_SOFTWARE: this device is a software device + * + * General device capability flags. + * + * (Corresponds to the NM_DEVICE_CAP type in nm-device-wifi.xml.) + **/ +typedef enum { + NM_DEVICE_CAP_NONE = 0x00000000, + NM_DEVICE_CAP_NM_SUPPORTED = 0x00000001, + NM_DEVICE_CAP_CARRIER_DETECT = 0x00000002, + NM_DEVICE_CAP_IS_SOFTWARE = 0x00000004, +} NMDeviceCapabilities; + + +/** + * NMDeviceWifiCapabilities: + * @NM_WIFI_DEVICE_CAP_NONE: device has no encryption/authentication capabilities + * @NM_WIFI_DEVICE_CAP_CIPHER_WEP40: device supports 40/64-bit WEP encryption + * @NM_WIFI_DEVICE_CAP_CIPHER_WEP104: device supports 104/128-bit WEP encryption + * @NM_WIFI_DEVICE_CAP_CIPHER_TKIP: device supports TKIP encryption + * @NM_WIFI_DEVICE_CAP_CIPHER_CCMP: device supports AES/CCMP encryption + * @NM_WIFI_DEVICE_CAP_WPA: device supports WPA1 authentication + * @NM_WIFI_DEVICE_CAP_RSN: device supports WPA2/RSN authentication + * @NM_WIFI_DEVICE_CAP_AP: device supports Access Point mode + * @NM_WIFI_DEVICE_CAP_ADHOC: device supports Ad-Hoc mode + * + * 802.11 specific device encryption and authentication capabilities. + * + * (Corresponds to the NM_802_11_DEVICE_CAP type in nm-device-wifi.xml.) + **/ +typedef enum { + NM_WIFI_DEVICE_CAP_NONE = 0x00000000, + NM_WIFI_DEVICE_CAP_CIPHER_WEP40 = 0x00000001, + NM_WIFI_DEVICE_CAP_CIPHER_WEP104 = 0x00000002, + NM_WIFI_DEVICE_CAP_CIPHER_TKIP = 0x00000004, + NM_WIFI_DEVICE_CAP_CIPHER_CCMP = 0x00000008, + NM_WIFI_DEVICE_CAP_WPA = 0x00000010, + NM_WIFI_DEVICE_CAP_RSN = 0x00000020, + NM_WIFI_DEVICE_CAP_AP = 0x00000040, + NM_WIFI_DEVICE_CAP_ADHOC = 0x00000080 +} NMDeviceWifiCapabilities; + + +/** + * NM80211ApFlags: + * @NM_802_11_AP_FLAGS_NONE: access point has no special capabilities + * @NM_802_11_AP_FLAGS_PRIVACY: access point requires authentication and + * encryption (usually means WEP) + * + * 802.11 access point flags. + * + * (Corresponds to the NM_802_11_AP_FLAGS type in nm-access-point.xml.) + **/ +typedef enum { + NM_802_11_AP_FLAGS_NONE = 0x00000000, + NM_802_11_AP_FLAGS_PRIVACY = 0x00000001 +} NM80211ApFlags; + +/** + * NM80211ApSecurityFlags: + * @NM_802_11_AP_SEC_NONE: the access point has no special security requirements + * @NM_802_11_AP_SEC_PAIR_WEP40: 40/64-bit WEP is supported for + * pairwise/unicast encryption + * @NM_802_11_AP_SEC_PAIR_WEP104: 104/128-bit WEP is supported for + * pairwise/unicast encryption + * @NM_802_11_AP_SEC_PAIR_TKIP: TKIP is supported for pairwise/unicast encryption + * @NM_802_11_AP_SEC_PAIR_CCMP: AES/CCMP is supported for pairwise/unicast encryption + * @NM_802_11_AP_SEC_GROUP_WEP40: 40/64-bit WEP is supported for group/broadcast + * encryption + * @NM_802_11_AP_SEC_GROUP_WEP104: 104/128-bit WEP is supported for + * group/broadcast encryption + * @NM_802_11_AP_SEC_GROUP_TKIP: TKIP is supported for group/broadcast encryption + * @NM_802_11_AP_SEC_GROUP_CCMP: AES/CCMP is supported for group/broadcast + * encryption + * @NM_802_11_AP_SEC_KEY_MGMT_PSK: WPA/RSN Pre-Shared Key encryption is + * supported + * @NM_802_11_AP_SEC_KEY_MGMT_802_1X: 802.1x authentication and key management + * is supported + * + * 802.11 access point security and authentication flags. These flags describe + * the current security requirements of an access point as determined from the + * access point's beacon. + * + * (Corresponds to the NM_802_11_AP_SEC type in nm-access-point.xml.) + **/ +typedef enum { + NM_802_11_AP_SEC_NONE = 0x00000000, + NM_802_11_AP_SEC_PAIR_WEP40 = 0x00000001, + NM_802_11_AP_SEC_PAIR_WEP104 = 0x00000002, + NM_802_11_AP_SEC_PAIR_TKIP = 0x00000004, + NM_802_11_AP_SEC_PAIR_CCMP = 0x00000008, + NM_802_11_AP_SEC_GROUP_WEP40 = 0x00000010, + NM_802_11_AP_SEC_GROUP_WEP104 = 0x00000020, + NM_802_11_AP_SEC_GROUP_TKIP = 0x00000040, + NM_802_11_AP_SEC_GROUP_CCMP = 0x00000080, + NM_802_11_AP_SEC_KEY_MGMT_PSK = 0x00000100, + NM_802_11_AP_SEC_KEY_MGMT_802_1X = 0x00000200 +} NM80211ApSecurityFlags; + +/** + * NM80211Mode: + * @NM_802_11_MODE_UNKNOWN: the device or access point mode is unknown + * @NM_802_11_MODE_ADHOC: for both devices and access point objects, indicates + * the object is part of an Ad-Hoc 802.11 network without a central + * coordinating access point. + * @NM_802_11_MODE_INFRA: the device or access point is in infrastructure mode. + * For devices, this indicates the device is an 802.11 client/station. For + * access point objects, this indicates the object is an access point that + * provides connectivity to clients. + * @NM_802_11_MODE_AP: the device is an access point/hotspot. Not valid for + * access point objects; used only for hotspot mode on the local machine. + * + * Indicates the 802.11 mode an access point or device is currently in. + * + * (Corresponds to the NM_802_11_MODE type in generic-types.xml.) + **/ +typedef enum { + NM_802_11_MODE_UNKNOWN = 0, + NM_802_11_MODE_ADHOC, + NM_802_11_MODE_INFRA, + NM_802_11_MODE_AP +} NM80211Mode; + +/** + * NMBluetoothCapabilities: + * @NM_BT_CAPABILITY_NONE: device has no usable capabilities + * @NM_BT_CAPABILITY_DUN: device provides Dial-Up Networking capability + * @NM_BT_CAPABILITY_NAP: device provides Network Access Point capability + * + * #NMBluetoothCapabilities values indicate the usable capabilities of a + * Bluetooth device. + * + * (Corresponds to the NM_BT_CAPABILITY type in nm-device-bt.xml.) + **/ +typedef enum { + NM_BT_CAPABILITY_NONE = 0x00000000, + NM_BT_CAPABILITY_DUN = 0x00000001, + NM_BT_CAPABILITY_NAP = 0x00000002, +} NMBluetoothCapabilities; + +/** + * NMDeviceModemCapabilities: + * @NM_DEVICE_MODEM_CAPABILITY_NONE: modem has no usable capabilities + * @NM_DEVICE_MODEM_CAPABILITY_POTS: modem uses the analog wired telephone + * network and is not a wireless/cellular device + * @NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO: modem supports at least one of CDMA + * 1xRTT, EVDO revision 0, EVDO revision A, or EVDO revision B + * @NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS: modem supports at least one of GSM, + * GPRS, EDGE, UMTS, HSDPA, HSUPA, or HSPA+ packet switched data capability + * @NM_DEVICE_MODEM_CAPABILITY_LTE: modem has LTE data capability + * + * #NMDeviceModemCapabilities values indicate the generic radio access + * technology families a modem device supports. For more information on the + * specific access technologies the device supports use the ModemManager D-Bus + * API. + * + * (Corresponds to the NM_DEVICE_MODEM_CAPABILITY type in nm-device-modem.xml.) + **/ +typedef enum { + NM_DEVICE_MODEM_CAPABILITY_NONE = 0x00000000, + NM_DEVICE_MODEM_CAPABILITY_POTS = 0x00000001, + NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO = 0x00000002, + NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS = 0x00000004, + NM_DEVICE_MODEM_CAPABILITY_LTE = 0x00000008, +} NMDeviceModemCapabilities; + + +/** + * NMDeviceState: + * @NM_DEVICE_STATE_UNKNOWN: the device's state is unknown + * @NM_DEVICE_STATE_UNMANAGED: the device is recognized, but not managed by + * NetworkManager + * @NM_DEVICE_STATE_UNAVAILABLE: the device is managed by NetworkManager, but + * is not available for use. Reasons may include the wireless switched off, + * missing firmware, no ethernet carrier, missing supplicant or modem manager, + * etc. + * @NM_DEVICE_STATE_DISCONNECTED: the device can be activated, but is currently + * idle and not connected to a network. + * @NM_DEVICE_STATE_PREPARE: the device is preparing the connection to the + * network. This may include operations like changing the MAC address, + * setting physical link properties, and anything else required to connect + * to the requested network. + * @NM_DEVICE_STATE_CONFIG: the device is connecting to the requested network. + * This may include operations like associating with the WiFi AP, dialing + * the modem, connecting to the remote Bluetooth device, etc. + * @NM_DEVICE_STATE_NEED_AUTH: the device requires more information to continue + * connecting to the requested network. This includes secrets like WiFi + * passphrases, login passwords, PIN codes, etc. + * @NM_DEVICE_STATE_IP_CONFIG: the device is requesting IPv4 and/or IPv6 + * addresses and routing information from the network. + * @NM_DEVICE_STATE_IP_CHECK: the device is checking whether further action is + * required for the requested network connection. This may include checking + * whether only local network access is available, whether a captive portal + * is blocking access to the Internet, etc. + * @NM_DEVICE_STATE_SECONDARIES: the device is waiting for a secondary + * connection (like a VPN) which must activated before the device can be + * activated + * @NM_DEVICE_STATE_ACTIVATED: the device has a network connection, either local + * or global. + * @NM_DEVICE_STATE_DEACTIVATING: a disconnection from the current network + * connection was requested, and the device is cleaning up resources used for + * that connection. The network connection may still be valid. + * @NM_DEVICE_STATE_FAILED: the device failed to connect to the requested + * network and is cleaning up the connection request + * + * (Corresponds to the NM_DEVICE_STATE type in nm-device.xml.) + **/ +typedef enum { + NM_DEVICE_STATE_UNKNOWN = 0, + NM_DEVICE_STATE_UNMANAGED = 10, + NM_DEVICE_STATE_UNAVAILABLE = 20, + NM_DEVICE_STATE_DISCONNECTED = 30, + NM_DEVICE_STATE_PREPARE = 40, + NM_DEVICE_STATE_CONFIG = 50, + NM_DEVICE_STATE_NEED_AUTH = 60, + NM_DEVICE_STATE_IP_CONFIG = 70, + NM_DEVICE_STATE_IP_CHECK = 80, + NM_DEVICE_STATE_SECONDARIES = 90, + NM_DEVICE_STATE_ACTIVATED = 100, + NM_DEVICE_STATE_DEACTIVATING = 110, + NM_DEVICE_STATE_FAILED = 120 +} NMDeviceState; + + +/** + * NMDeviceStateReason: + * @NM_DEVICE_STATE_REASON_NONE: No reason given + * @NM_DEVICE_STATE_REASON_UNKNOWN: Unknown error + * @NM_DEVICE_STATE_REASON_NOW_MANAGED: Device is now managed + * @NM_DEVICE_STATE_REASON_NOW_UNMANAGED: Device is now unmanaged + * @NM_DEVICE_STATE_REASON_CONFIG_FAILED: The device could not be readied for configuration + * @NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE: IP configuration could not be reserved (no available address, timeout, etc) + * @NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED: The IP config is no longer valid + * @NM_DEVICE_STATE_REASON_NO_SECRETS: Secrets were required, but not provided + * @NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT: 802.1x supplicant disconnected + * @NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED: 802.1x supplicant configuration failed + * @NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED: 802.1x supplicant failed + * @NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT: 802.1x supplicant took too long to authenticate + * @NM_DEVICE_STATE_REASON_PPP_START_FAILED: PPP service failed to start + * @NM_DEVICE_STATE_REASON_PPP_DISCONNECT: PPP service disconnected + * @NM_DEVICE_STATE_REASON_PPP_FAILED: PPP failed + * @NM_DEVICE_STATE_REASON_DHCP_START_FAILED: DHCP client failed to start + * @NM_DEVICE_STATE_REASON_DHCP_ERROR: DHCP client error + * @NM_DEVICE_STATE_REASON_DHCP_FAILED: DHCP client failed + * @NM_DEVICE_STATE_REASON_SHARED_START_FAILED: Shared connection service failed to start + * @NM_DEVICE_STATE_REASON_SHARED_FAILED: Shared connection service failed + * @NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED: AutoIP service failed to start + * @NM_DEVICE_STATE_REASON_AUTOIP_ERROR: AutoIP service error + * @NM_DEVICE_STATE_REASON_AUTOIP_FAILED: AutoIP service failed + * @NM_DEVICE_STATE_REASON_MODEM_BUSY: The line is busy + * @NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE: No dial tone + * @NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER: No carrier could be established + * @NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT: The dialing request timed out + * @NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED: The dialing attempt failed + * @NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED: Modem initialization failed + * @NM_DEVICE_STATE_REASON_GSM_APN_FAILED: Failed to select the specified APN + * @NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING: Not searching for networks + * @NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED: Network registration denied + * @NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT: Network registration timed out + * @NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED: Failed to register with the requested network + * @NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED: PIN check failed + * @NM_DEVICE_STATE_REASON_FIRMWARE_MISSING: Necessary firmware for the device may be missing + * @NM_DEVICE_STATE_REASON_REMOVED: The device was removed + * @NM_DEVICE_STATE_REASON_SLEEPING: NetworkManager went to sleep + * @NM_DEVICE_STATE_REASON_CONNECTION_REMOVED: The device's active connection disappeared + * @NM_DEVICE_STATE_REASON_USER_REQUESTED: Device disconnected by user or client + * @NM_DEVICE_STATE_REASON_CARRIER: Carrier/link changed + * @NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED: The device's existing connection was assumed + * @NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE: The supplicant is now available + * @NM_DEVICE_STATE_REASON_MODEM_NOT_FOUND: The modem could not be found + * @NM_DEVICE_STATE_REASON_BT_FAILED: The Bluetooth connection failed or timed out + * @NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED: GSM Modem's SIM Card not inserted + * @NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED: GSM Modem's SIM Pin required + * @NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED: GSM Modem's SIM Puk required + * @NM_DEVICE_STATE_REASON_GSM_SIM_WRONG: GSM Modem's SIM wrong + * @NM_DEVICE_STATE_REASON_INFINIBAND_MODE: InfiniBand device does not support connected mode + * @NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: A dependency of the connection failed + * @NM_DEVICE_STATE_REASON_BR2684_FAILED: Problem with the RFC 2684 Ethernet over ADSL bridge + * @NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE: ModemManager not running + * @NM_DEVICE_STATE_REASON_SSID_NOT_FOUND: The WiFi network could not be found + * @NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED: A secondary connection of the base connection failed + * @NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED: DCB or FCoE setup failed + * @NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED: teamd control failed + * @NM_DEVICE_STATE_REASON_MODEM_FAILED: Modem failed or no longer available + * @NM_DEVICE_STATE_REASON_MODEM_AVAILABLE: Modem now ready and available + * @NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT: SIM PIN was incorrect + * + * Device state change reason codes + * + * (Corresponds to the NM_DEVICE_STATE_REASON type in nm-device.xml.) + */ +typedef enum { + NM_DEVICE_STATE_REASON_NONE = 0, + NM_DEVICE_STATE_REASON_UNKNOWN = 1, + NM_DEVICE_STATE_REASON_NOW_MANAGED = 2, + NM_DEVICE_STATE_REASON_NOW_UNMANAGED = 3, + NM_DEVICE_STATE_REASON_CONFIG_FAILED = 4, + NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE = 5, + NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED = 6, + NM_DEVICE_STATE_REASON_NO_SECRETS = 7, + NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT = 8, + NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED = 9, + NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED = 10, + NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT = 11, + NM_DEVICE_STATE_REASON_PPP_START_FAILED = 12, + NM_DEVICE_STATE_REASON_PPP_DISCONNECT = 13, + NM_DEVICE_STATE_REASON_PPP_FAILED = 14, + NM_DEVICE_STATE_REASON_DHCP_START_FAILED = 15, + NM_DEVICE_STATE_REASON_DHCP_ERROR = 16, + NM_DEVICE_STATE_REASON_DHCP_FAILED = 17, + NM_DEVICE_STATE_REASON_SHARED_START_FAILED = 18, + NM_DEVICE_STATE_REASON_SHARED_FAILED = 19, + NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED = 20, + NM_DEVICE_STATE_REASON_AUTOIP_ERROR = 21, + NM_DEVICE_STATE_REASON_AUTOIP_FAILED = 22, + NM_DEVICE_STATE_REASON_MODEM_BUSY = 23, + NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE = 24, + NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER = 25, + NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT = 26, + NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED = 27, + NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED = 28, + NM_DEVICE_STATE_REASON_GSM_APN_FAILED = 29, + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING = 30, + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED = 31, + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT = 32, + NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED = 33, + NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED = 34, + NM_DEVICE_STATE_REASON_FIRMWARE_MISSING = 35, + NM_DEVICE_STATE_REASON_REMOVED = 36, + NM_DEVICE_STATE_REASON_SLEEPING = 37, + NM_DEVICE_STATE_REASON_CONNECTION_REMOVED = 38, + NM_DEVICE_STATE_REASON_USER_REQUESTED = 39, + NM_DEVICE_STATE_REASON_CARRIER = 40, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED = 41, + NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE = 42, + NM_DEVICE_STATE_REASON_MODEM_NOT_FOUND = 43, + NM_DEVICE_STATE_REASON_BT_FAILED = 44, + NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED = 45, + NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED = 46, + NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED = 47, + NM_DEVICE_STATE_REASON_GSM_SIM_WRONG = 48, + NM_DEVICE_STATE_REASON_INFINIBAND_MODE = 49, + NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED = 50, + NM_DEVICE_STATE_REASON_BR2684_FAILED = 51, + NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE = 52, + NM_DEVICE_STATE_REASON_SSID_NOT_FOUND = 53, + NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED = 54, + NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED = 55, + NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED = 56, + NM_DEVICE_STATE_REASON_MODEM_FAILED = 57, + NM_DEVICE_STATE_REASON_MODEM_AVAILABLE = 58, + NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT = 59, + + NM_DEVICE_STATE_REASON_LAST = 0xFFFF +} NMDeviceStateReason; + + +/** + * NMActiveConnectionState: + * @NM_ACTIVE_CONNECTION_STATE_UNKNOWN: the state of the connection is unknown + * @NM_ACTIVE_CONNECTION_STATE_ACTIVATING: a network connection is being prepared + * @NM_ACTIVE_CONNECTION_STATE_ACTIVATED: there is a connection to the network + * @NM_ACTIVE_CONNECTION_STATE_DEACTIVATING: the network connection is being + * torn down and cleaned up + * @NM_ACTIVE_CONNECTION_STATE_DEACTIVATED: the network connection is disconnected + * and will be removed + * + * #NMActiveConnectionState values indicate the state of a connection to a + * specific network while it is starting, connected, or disconnecting from that + * network. + * + * (Corresponds to the NM_ACTIVE_CONNECTION_STATE type in nm-active-connection.xml.) + **/ +typedef enum { + NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0, + NM_ACTIVE_CONNECTION_STATE_ACTIVATING, + NM_ACTIVE_CONNECTION_STATE_ACTIVATED, + NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, + NM_ACTIVE_CONNECTION_STATE_DEACTIVATED +} NMActiveConnectionState; + +#endif /* NETWORK_MANAGER_H */ diff --git a/libnm-util/NetworkManagerVPN.h b/libnm-util/NetworkManagerVPN.h new file mode 100644 index 000000000..882d39739 --- /dev/null +++ b/libnm-util/NetworkManagerVPN.h @@ -0,0 +1,307 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2004 Red Hat, Inc. + */ + +/* D-Bus-related definitions for NetworkManager VPN plugins. + * + * Note that although this header is installed as part of libnm-util, it is also + * used by some external code that does not link to libnm-util. + */ + +#ifndef NETWORK_MANAGER_VPN_H +#define NETWORK_MANAGER_VPN_H + +/* + * dbus services details + */ +#define NM_DBUS_PATH_VPN "/org/freedesktop/NetworkManager/VPN/Manager" +#define NM_DBUS_INTERFACE_VPN "org.freedesktop.NetworkManager.VPN.Manager" + +#define NM_DBUS_PATH_VPN_CONNECTION "/org/freedesktop/NetworkManager/VPN/Connection" +#define NM_DBUS_INTERFACE_VPN_CONNECTION "org.freedesktop.NetworkManager.VPN.Connection" + +#define NM_VPN_DBUS_PLUGIN_PATH "/org/freedesktop/NetworkManager/VPN/Plugin" +#define NM_VPN_DBUS_PLUGIN_INTERFACE "org.freedesktop.NetworkManager.VPN.Plugin" + +/* + * VPN Errors + */ +#define NM_DBUS_NO_ACTIVE_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.NoActiveVPNConnection" +#define NM_DBUS_NO_VPN_CONNECTIONS "org.freedesktop.NetworkManager.VPNConnections.NoVPNConnections" +#define NM_DBUS_INVALID_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.InvalidVPNConnection" + +#define NM_DBUS_VPN_ERROR_PREFIX "org.freedesktop.NetworkManager.VPN.Error" +#define NM_DBUS_VPN_STARTING_IN_PROGRESS "StartingInProgress" +#define NM_DBUS_VPN_ALREADY_STARTED "AlreadyStarted" +#define NM_DBUS_VPN_STOPPING_IN_PROGRESS "StoppingInProgress" +#define NM_DBUS_VPN_ALREADY_STOPPED "AlreadyStopped" +#define NM_DBUS_VPN_WRONG_STATE "WrongState" +#define NM_DBUS_VPN_BAD_ARGUMENTS "BadArguments" +#define NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED "InteractiveNotSupported" + + +/* + * VPN daemon signals + */ +#define NM_DBUS_VPN_SIGNAL_LOGIN_BANNER "LoginBanner" +#define NM_DBUS_VPN_SIGNAL_LOGIN_FAILED "LoginFailed" +#define NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED "LaunchFailed" +#define NM_DBUS_VPN_SIGNAL_CONNECT_FAILED "ConnectFailed" +#define NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD "VPNConfigBad" +#define NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD "IPConfigBad" +#define NM_DBUS_VPN_SIGNAL_STATE_CHANGE "StateChange" +#define NM_DBUS_VPN_SIGNAL_IP4_CONFIG "IP4Config" + +/** + * NMVPNServiceState: + * @NM_VPN_SERVICE_STATE_UNKNOWN: The state of the VPN plugin is unknown. + * @NM_VPN_SERVICE_STATE_INIT: The VPN plugin is initialized. + * @NM_VPN_SERVICE_STATE_SHUTDOWN: Not used. + * @NM_VPN_SERVICE_STATE_STARTING: The plugin is attempting to connect to a VPN server. + * @NM_VPN_SERVICE_STATE_STARTED: The plugin has connected to a VPN server. + * @NM_VPN_SERVICE_STATE_STOPPING: The plugin is disconnecting from the VPN server. + * @NM_VPN_SERVICE_STATE_STOPPED: The plugin has disconnected from the VPN server. + * + * VPN daemon states + * + * (Corresponds to the NM_VPN_SERVICE_STATE type in nm-vpn-connection.xml.) + */ +typedef enum NMVPNServiceState { + NM_VPN_SERVICE_STATE_UNKNOWN = 0, + NM_VPN_SERVICE_STATE_INIT, + NM_VPN_SERVICE_STATE_SHUTDOWN, + NM_VPN_SERVICE_STATE_STARTING, + NM_VPN_SERVICE_STATE_STARTED, + NM_VPN_SERVICE_STATE_STOPPING, + NM_VPN_SERVICE_STATE_STOPPED +} NMVPNServiceState; + + +/** + * NMVPNConnectionState: + * @NM_VPN_CONNECTION_STATE_UNKNOWN: The state of the VPN connection is + * unknown. + * @NM_VPN_CONNECTION_STATE_PREPARE: The VPN connection is preparing to + * connect. + * @NM_VPN_CONNECTION_STATE_NEED_AUTH: The VPN connection needs authorization + * credentials. + * @NM_VPN_CONNECTION_STATE_CONNECT: The VPN connection is being established. + * @NM_VPN_CONNECTION_STATE_IP_CONFIG_GET: The VPN connection is getting an IP + * address. + * @NM_VPN_CONNECTION_STATE_ACTIVATED: The VPN connection is active. + * @NM_VPN_CONNECTION_STATE_FAILED: The VPN connection failed. + * @NM_VPN_CONNECTION_STATE_DISCONNECTED: The VPN connection is disconnected. + * + * VPN connection states + * + * (Corresponds to the NM_VPN_CONNECTION_STATE type in nm-vpn-connection.xml.) + */ +typedef enum NMVPNConnectionState { + NM_VPN_CONNECTION_STATE_UNKNOWN = 0, + NM_VPN_CONNECTION_STATE_PREPARE, + NM_VPN_CONNECTION_STATE_NEED_AUTH, + NM_VPN_CONNECTION_STATE_CONNECT, + NM_VPN_CONNECTION_STATE_IP_CONFIG_GET, + NM_VPN_CONNECTION_STATE_ACTIVATED, + NM_VPN_CONNECTION_STATE_FAILED, + NM_VPN_CONNECTION_STATE_DISCONNECTED +} NMVPNConnectionState; + +/** + * NMVPNConnectionStateReason: + * @NM_VPN_CONNECTION_STATE_REASON_UNKNOWN: The reason for the VPN connection + * state change is unknown. + * @NM_VPN_CONNECTION_STATE_REASON_NONE: No reason was given for the VPN + * connection state change. + * @NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED: The VPN connection changed + * state because the user disconnected it. + * @NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED: The VPN connection + * changed state because the device it was using was disconnected. + * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED: The service providing the + * VPN connection was stopped. + * @NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID: The IP config of the VPN + * connection was invalid. + * @NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT: The connection attempt to + * the VPN service timed out. + * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT: A timeout occurred + * while starting the service providing the VPN connection. + * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED: Starting the service + * starting the service providing the VPN connection failed. + * @NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS: Necessary secrets for the VPN + * connection were not provided. + * @NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED: Authentication to the VPN + * server failed. + * @NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED: The connection was + * deleted from settings. + * + * VPN connection state reasons + * + * (Corresponds to the NM_VPN_CONNECTION_STATE_REASON type in nm-vpn-connection.xml.) + */ +typedef enum NMVPNConnectionStateReason { + NM_VPN_CONNECTION_STATE_REASON_UNKNOWN = 0, + NM_VPN_CONNECTION_STATE_REASON_NONE, + NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED, + NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED, + NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED, + NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID, + NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT, + NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT, + NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED, + NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS, + NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED, + NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED +} NMVPNConnectionStateReason; + +/** + * NMVPNPluginFailure: + * @NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED: Login failed. + * @NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED: Connect failed. + * @NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG: Invalid IP configuration returned from + * the VPN plugin. + * + * VPN plugin failure reasons + * + * (Corresponds to the NM_VPN_PLUGIN_FAILURE type in nm-vpn-plugin.xml.) + */ +typedef enum { + NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED, + NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED, + NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG +} NMVPNPluginFailure; + + +/*** Generic config ***/ + +/* string: VPN interface name (tun0, tap0, etc) */ +#define NM_VPN_PLUGIN_CONFIG_TUNDEV "tundev" + +/* string: Login message */ +#define NM_VPN_PLUGIN_CONFIG_BANNER "banner" + +/* uint32 / array of uint8: IP address of the public external VPN gateway (network byte order) */ +#define NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY "gateway" + +/* uint32: Maximum Transfer Unit that the VPN interface should use */ +#define NM_VPN_PLUGIN_CONFIG_MTU "mtu" + +/* boolean: Has IP4 configuration? */ +#define NM_VPN_PLUGIN_CONFIG_HAS_IP4 "has-ip4" + +/* boolean: Has IP6 configuration? */ +#define NM_VPN_PLUGIN_CONFIG_HAS_IP6 "has-ip6" + +/* boolean: If %TRUE the VPN plugin can persist/reconnect the connection over + * link changes and VPN server dropouts. + */ +#define NM_VPN_PLUGIN_CAN_PERSIST "can-persist" + + +/*** Ip4Config ***/ + +/* uint32: IP address of the internal gateway of the subnet the VPN interface is + * on, if the VPN uses subnet configuration (network byte order) + */ +#define NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY "internal-gateway" + +/* uint32: internal IP address of the local VPN interface (network byte order) */ +#define NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS "address" + +/* uint32: IP address of the other side of Point-to-Point connection if the VPN + * uses Point-to-Point configuration. (network byte order) + */ +#define NM_VPN_PLUGIN_IP4_CONFIG_PTP "ptp" + +/* uint32: IP prefix of the VPN interface; 1 - 32 inclusive */ +#define NM_VPN_PLUGIN_IP4_CONFIG_PREFIX "prefix" + +/* array of uint32: IP addresses of DNS servers for the VPN (network byte order) */ +#define NM_VPN_PLUGIN_IP4_CONFIG_DNS "dns" + +/* array of uint32: IP addresses of NBNS/WINS servers for the VPN (network byte order) */ +#define NM_VPN_PLUGIN_IP4_CONFIG_NBNS "nbns" + +/* uint32: Message Segment Size that the VPN interface should use */ +#define NM_VPN_PLUGIN_IP4_CONFIG_MSS "mss" + +/* string: DNS domain name */ +#define NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN "domain" + +/* array of strings: DNS domain names */ +#define NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS "domains" + +/* [ip4 routes]: custom routes the client should apply, in the format used + * by nm_utils_ip4_routes_to/from_gvalue + */ +#define NM_VPN_PLUGIN_IP4_CONFIG_ROUTES "routes" + +/* boolean: prevent this VPN connection from ever getting the default route */ +#define NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT "never-default" + +/* Deprecated */ +#define NM_VPN_PLUGIN_IP4_CONFIG_GATEWAY NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY + +/* Legacy IP4 items; these are included in the IP4 config by older plugins, + * but in the generic config by newer plugins. + */ + +#define NM_VPN_PLUGIN_IP4_CONFIG_BANNER NM_VPN_PLUGIN_CONFIG_BANNER +#define NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY +#define NM_VPN_PLUGIN_IP4_CONFIG_MTU NM_VPN_PLUGIN_CONFIG_MTU +#define NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV NM_VPN_PLUGIN_CONFIG_TUNDEV + + +/*** Ip6Config ***/ + +/* array of uint8: IP address of the internal gateway of the subnet the VPN interface is + * on, if the VPN uses subnet configuration (network byte order) + */ +#define NM_VPN_PLUGIN_IP6_CONFIG_INT_GATEWAY "internal-gateway" + +/* array of uint8: internal IP address of the local VPN interface (network byte order) */ +#define NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS "address" + +/* array of uint8: IP address of the other side of Point-to-Point connection if the VPN + * uses Point-to-Point configuration. (network byte order) + */ +#define NM_VPN_PLUGIN_IP6_CONFIG_PTP "ptp" + +/* uint32: prefix length of the VPN interface; 1 - 128 inclusive */ +#define NM_VPN_PLUGIN_IP6_CONFIG_PREFIX "prefix" + +/* array of array of uint8: IP addresses of DNS servers for the VPN (network byte order) */ +#define NM_VPN_PLUGIN_IP6_CONFIG_DNS "dns" + +/* uint32: Message Segment Size that the VPN interface should use */ +#define NM_VPN_PLUGIN_IP6_CONFIG_MSS "mss" + +/* string: DNS domain name */ +#define NM_VPN_PLUGIN_IP6_CONFIG_DOMAIN "domain" + +/* array of strings: DNS domain names */ +#define NM_VPN_PLUGIN_IP6_CONFIG_DOMAINS "domains" + +/* [ip6 routes]: custom routes the client should apply, in the format used + * by nm_utils_ip6_routes_to/from_gvalue + */ +#define NM_VPN_PLUGIN_IP6_CONFIG_ROUTES "routes" + +/* boolean: prevent this VPN connection from ever getting the default route */ +#define NM_VPN_PLUGIN_IP6_CONFIG_NEVER_DEFAULT "never-default" + +#endif /* NETWORK_MANAGER_VPN_H */ diff --git a/libnm-util/crypto.c b/libnm-util/crypto.c index 0ac4fbacd..8a10af945 100644 --- a/libnm-util/crypto.c +++ b/libnm-util/crypto.c @@ -18,7 +18,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. */ #include "config.h" @@ -28,7 +28,7 @@ #include <strings.h> #include <unistd.h> #include <stdlib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "crypto.h" @@ -360,8 +360,8 @@ convert_iv (const char *src, conv[2] = '\0'; for (i = 0; i < num; i++) { - conv[0] = src[(i * 2)]; - conv[1] = src[(i * 2) + 1]; + conv[0] = src[(i * 2)]; + conv[1] = src[(i * 2) + 1]; if (!g_ascii_isxdigit (conv[0]) || !g_ascii_isxdigit (conv[1])) { g_set_error (error, NM_CRYPTO_ERROR, NM_CRYPTO_ERR_RAW_IV_INVALID, @@ -526,11 +526,11 @@ crypto_decrypt_private_key_data (const GByteArray *contents, if (password) { decrypted = decrypt_key (cipher, - key_type, - data, - iv, - password, - error); + key_type, + data, + iv, + password, + error); } g_byte_array_free (data, TRUE); } @@ -569,18 +569,18 @@ extract_pem_cert_data (GByteArray *contents, GError **error) if (!find_tag (PEM_CERT_BEGIN, contents, 0, &start)) { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERR_FILE_FORMAT_INVALID, - _("PEM certificate had no start tag '%s'."), - PEM_CERT_BEGIN); + NM_CRYPTO_ERR_FILE_FORMAT_INVALID, + _("PEM certificate had no start tag '%s'."), + PEM_CERT_BEGIN); goto done; } start += strlen (PEM_CERT_BEGIN); if (!find_tag (PEM_CERT_END, contents, start, &end)) { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERR_FILE_FORMAT_INVALID, - _("PEM certificate had no end tag '%s'."), - PEM_CERT_END); + NM_CRYPTO_ERR_FILE_FORMAT_INVALID, + _("PEM certificate had no end tag '%s'."), + PEM_CERT_END); goto done; } @@ -596,8 +596,8 @@ extract_pem_cert_data (GByteArray *contents, GError **error) g_assert (cert->len == length); } else { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERR_DECODE_FAILED, - _("Failed to decode certificate.")); + NM_CRYPTO_ERR_DECODE_FAILED, + _("Failed to decode certificate.")); } done: @@ -747,4 +747,3 @@ crypto_verify_private_key (const char *filename, } return format; } - diff --git a/libnm-util/crypto.h b/libnm-util/crypto.h index 1cbf61c12..315d8fec8 100644 --- a/libnm-util/crypto.h +++ b/libnm-util/crypto.h @@ -18,7 +18,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef __CRYPTO_H__ @@ -70,8 +70,6 @@ GQuark _nm_crypto_error_quark (void); gboolean crypto_init (GError **error); -void crypto_deinit (void); - GByteArray *crypto_decrypt_private_key_data (const GByteArray *contents, const char *password, NMCryptoKeyType *out_key_type, diff --git a/libnm-util/crypto_gnutls.c b/libnm-util/crypto_gnutls.c index e829c23c1..3bec24ad6 100644 --- a/libnm-util/crypto_gnutls.c +++ b/libnm-util/crypto_gnutls.c @@ -18,12 +18,13 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2009 Red Hat, Inc. + * Copyright 2007 - 2009 Red Hat, Inc. */ #include "config.h" + #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <gcrypt.h> #include <gnutls/gnutls.h> @@ -55,11 +56,6 @@ crypto_init (GError **error) return TRUE; } -void -crypto_deinit (void) -{ -} - gboolean crypto_md5_hash (const char *salt, const gsize salt_len, @@ -105,7 +101,7 @@ crypto_md5_hash (const char *salt, gcry_md_final (ctx); memcpy (digest, gcry_md_read (ctx, 0), digest_len); gcry_md_reset (ctx); - + while (nkey && (i < digest_len)) { *(p++) = digest[i++]; nkey--; @@ -347,7 +343,7 @@ crypto_verify_cert (const unsigned char *data, GError **error) { gnutls_x509_crt_t der; - gnutls_datum dt; + gnutls_datum_t dt; int err; err = gnutls_x509_crt_init (&der); @@ -387,7 +383,7 @@ crypto_verify_pkcs12 (const GByteArray *data, GError **error) { gnutls_pkcs12_t p12; - gnutls_datum dt; + gnutls_datum_t dt; gboolean success = FALSE; int err; @@ -441,7 +437,7 @@ crypto_verify_pkcs8 (const GByteArray *data, GError **error) { gnutls_x509_privkey_t p8; - gnutls_datum dt; + gnutls_datum_t dt; int err; g_return_val_if_fail (data != NULL, FALSE); @@ -475,9 +471,9 @@ crypto_verify_pkcs8 (const GByteArray *data, */ } else { g_set_error (error, NM_CRYPTO_ERROR, - NM_CRYPTO_ERR_FILE_FORMAT_INVALID, - _("Couldn't decode PKCS#8 file: %s"), - gnutls_strerror (err)); + NM_CRYPTO_ERR_FILE_FORMAT_INVALID, + _("Couldn't decode PKCS#8 file: %s"), + gnutls_strerror (err)); return FALSE; } } @@ -491,4 +487,3 @@ crypto_randomize (void *buffer, gsize buffer_len, GError **error) gcry_randomize (buffer, buffer_len, GCRY_STRONG_RANDOM); return TRUE; } - diff --git a/libnm-util/crypto_nss.c b/libnm-util/crypto_nss.c index af3de6664..edd19b54f 100644 --- a/libnm-util/crypto_nss.c +++ b/libnm-util/crypto_nss.c @@ -18,13 +18,13 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2009 Red Hat, Inc. + * Copyright 2007 - 2009 Red Hat, Inc. */ #include "config.h" #include <glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <prinit.h> #include <nss.h> @@ -71,11 +71,6 @@ crypto_init (GError **error) return TRUE; } -void -crypto_deinit (void) -{ -} - gboolean crypto_md5_hash (const char *salt, const gsize salt_len, @@ -560,4 +555,3 @@ crypto_randomize (void *buffer, gsize buffer_len, GError **error) } return TRUE; } - diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver index e14f08d90..9d78e5024 100644 --- a/libnm-util/libnm-util.ver +++ b/libnm-util/libnm-util.ver @@ -13,6 +13,7 @@ global: nm_connection_for_each_setting_value; nm_connection_get_connection_type; nm_connection_get_id; + nm_connection_get_interface_name; nm_connection_get_path; nm_connection_get_setting; nm_connection_get_setting_802_1x; @@ -52,6 +53,7 @@ global: nm_connection_need_secrets; nm_connection_new; nm_connection_new_from_hash; + nm_connection_normalize; nm_connection_remove_setting; nm_connection_replace_settings; nm_connection_replace_settings_from_connection; @@ -365,6 +367,7 @@ global: nm_setting_ip4_config_get_num_dns_searches; nm_setting_ip4_config_get_num_routes; nm_setting_ip4_config_get_route; + nm_setting_ip4_config_get_route_metric; nm_setting_ip4_config_get_type; nm_setting_ip4_config_new; nm_setting_ip4_config_remove_address; @@ -400,6 +403,7 @@ global: nm_setting_ip6_config_get_num_dns_searches; nm_setting_ip6_config_get_num_routes; nm_setting_ip6_config_get_route; + nm_setting_ip6_config_get_route_metric; nm_setting_ip6_config_get_type; nm_setting_ip6_config_new; nm_setting_ip6_config_privacy_get_type; @@ -608,6 +612,7 @@ global: nm_utils_deinit; nm_utils_escape_ssid; nm_utils_file_is_pkcs12; + nm_utils_file_search_in_paths; nm_utils_get_private; nm_utils_gvalue_hash_dup; nm_utils_hex2byte; diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index b0b683bd5..a1350f544 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <glib-object.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <dbus/dbus-glib.h> #include <string.h> #include "nm-connection.h" @@ -122,6 +121,10 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; + +static NMSettingVerifyResult _nm_connection_verify (NMConnection *connection, GError **error); + + /*************************************************************/ /** @@ -184,12 +187,23 @@ setting_changed_cb (NMSetting *setting, g_signal_emit (self, signals[CHANGED], 0); } +static gboolean +_setting_release (gpointer key, gpointer value, gpointer user_data) +{ + g_signal_handlers_disconnect_by_func (user_data, setting_changed_cb, value); + return TRUE; +} + static void _nm_connection_add_setting (NMConnection *connection, NMSetting *setting) { - g_hash_table_insert (NM_CONNECTION_GET_PRIVATE (connection)->settings, - (gpointer) G_OBJECT_TYPE_NAME (setting), - setting); + NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection); + const char *name = G_OBJECT_TYPE_NAME (setting); + NMSetting *s_old; + + if ((s_old = g_hash_table_lookup (priv->settings, (gpointer) name))) + g_signal_handlers_disconnect_by_func (s_old, setting_changed_cb, connection); + g_hash_table_insert (priv->settings, (gpointer) name, setting); /* Listen for property changes so we can emit the 'changed' signal */ g_signal_connect (setting, "notify", (GCallback) setting_changed_cb, connection); } @@ -346,7 +360,7 @@ hash_to_connection (NMConnection *connection, GHashTable *new, GError **error) NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection); if ((changed = g_hash_table_size (priv->settings) > 0)) - g_hash_table_remove_all (priv->settings); + g_hash_table_foreach_remove (priv->settings, _setting_release, connection); g_hash_table_iter_init (&iter, new); while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, (gpointer) &setting_hash)) { @@ -434,7 +448,7 @@ nm_connection_replace_settings_from_connection (NMConnection *connection, priv = NM_CONNECTION_GET_PRIVATE (connection); if ((changed = g_hash_table_size (priv->settings) > 0)) - g_hash_table_remove_all (priv->settings); + g_hash_table_foreach_remove (priv->settings, _setting_release, connection); if (g_hash_table_size (NM_CONNECTION_GET_PRIVATE (new_connection)->settings)) { g_hash_table_iter_init (&iter, NM_CONNECTION_GET_PRIVATE (new_connection)->settings); @@ -476,7 +490,7 @@ nm_connection_compare (NMConnection *a, /* B / A: ensure settings in B that are not in A make the comparison fail */ if (g_hash_table_size (NM_CONNECTION_GET_PRIVATE (a)->settings) != - g_hash_table_size (NM_CONNECTION_GET_PRIVATE (b)->settings)) + g_hash_table_size (NM_CONNECTION_GET_PRIVATE (b)->settings)) return FALSE; /* A / B: ensure all settings in A match corresponding ones in B */ @@ -575,6 +589,113 @@ nm_connection_diff (NMConnection *a, return *out_settings ? FALSE : TRUE; } +static gboolean +_normalize_virtual_iface_name (NMConnection *self) +{ + NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (self); + GHashTableIter h_iter; + NMSetting *setting; + NMSettingConnection *s_con; + const char *interface_name; + char *virtual_iface_name = NULL; + gboolean was_modified = FALSE; + const char *prop_name = NULL; + + /* search for settings that might need normalization of the interface name. */ + g_hash_table_iter_init (&h_iter, priv->settings); + while ( !prop_name + && g_hash_table_iter_next (&h_iter, NULL, (void **) &setting)) { + if (NM_IS_SETTING_BOND (setting)) + prop_name = NM_SETTING_BOND_INTERFACE_NAME; + else if (NM_IS_SETTING_BRIDGE (setting)) + prop_name = NM_SETTING_BRIDGE_INTERFACE_NAME; + else if (NM_IS_SETTING_TEAM (setting)) + prop_name = NM_SETTING_TEAM_INTERFACE_NAME; + else if (NM_IS_SETTING_VLAN (setting)) + prop_name = NM_SETTING_VLAN_INTERFACE_NAME; + } + if (!prop_name) + return FALSE; + + s_con = nm_connection_get_setting_connection (self); + g_return_val_if_fail (s_con, FALSE); + + interface_name = nm_setting_connection_get_interface_name (s_con); + + /* read the potential virtual_iface_name from the setting. */ + g_object_get (setting, prop_name, &virtual_iface_name, NULL); + + if (g_strcmp0 (interface_name, virtual_iface_name) != 0) { + if (interface_name) { + /* interface_name is set and overwrites the virtual_iface_name. */ + g_object_set (setting, prop_name, interface_name, NULL); + } else { + /* interface in NMSettingConnection must be set. */ + g_object_set (s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, virtual_iface_name, NULL); + } + was_modified = TRUE; + } + + g_free (virtual_iface_name); + + return was_modified; +} + +static gboolean +_normalize_ip_config (NMConnection *self, GHashTable *parameters) +{ + NMSettingConnection *s_con = nm_connection_get_setting_connection (self); + const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO; + const char *default_ip6_method = NULL; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + NMSetting *setting; + + if (parameters) + default_ip6_method = g_hash_table_lookup (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD); + if (!default_ip6_method) + default_ip6_method = NM_SETTING_IP6_CONFIG_METHOD_AUTO; + + s_ip4 = nm_connection_get_setting_ip4_config (self); + s_ip6 = nm_connection_get_setting_ip6_config (self); + + if (nm_setting_connection_get_master (s_con)) { + /* Slave connections don't have IP configuration. */ + + if (s_ip4) + nm_connection_remove_setting (self, NM_TYPE_SETTING_IP4_CONFIG); + + if (s_ip6) + nm_connection_remove_setting (self, NM_TYPE_SETTING_IP6_CONFIG); + + return s_ip4 || s_ip6; + } else { + /* Ensure all non-slave connections have IP4 and IP6 settings objects. If no + * IP6 setting was specified, then assume that means IP6 config is allowed + * to fail. But if no IP4 setting was specified, assume the caller was just + * being lazy. + */ + if (!s_ip4) { + setting = nm_setting_ip4_config_new (); + + g_object_set (setting, + NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method, + NULL); + nm_connection_add_setting (self, setting); + } + if (!s_ip6) { + setting = nm_setting_ip6_config_new (); + + g_object_set (setting, + NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method, + NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NULL); + nm_connection_add_setting (self, setting); + } + return !s_ip4 || !s_ip6; + } +} + /** * nm_connection_verify: * @connection: the #NMConnection to verify @@ -584,7 +705,7 @@ nm_connection_diff (NMConnection *a, * have allowed values, and some values are dependent on other values. For * example, if a Wi-Fi connection is security enabled, the #NMSettingWireless * setting object's 'security' property must contain the setting name of the - * #NMSettingWirelessSecurity object, which must also be present in the + * #NMSettingWirelessSecurity object, which must also be present in the * connection for the connection to be valid. As another example, the * #NMSettingWired object's 'mac-address' property must be a validly formatted * MAC address. The returned #GError contains information about which @@ -595,24 +716,42 @@ nm_connection_diff (NMConnection *a, gboolean nm_connection_verify (NMConnection *connection, GError **error) { + NMSettingVerifyResult result; + + result = _nm_connection_verify (connection, error); + + /* we treat normalizable connections as valid. */ + if (result == NM_SETTING_VERIFY_NORMALIZABLE) + g_clear_error (error); + + return result == NM_SETTING_VERIFY_SUCCESS || result == NM_SETTING_VERIFY_NORMALIZABLE; +} + +static NMSettingVerifyResult +_nm_connection_verify (NMConnection *connection, GError **error) +{ NMConnectionPrivate *priv; NMSettingConnection *s_con; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; GHashTableIter iter; gpointer value; - GSList *all_settings = NULL; - gboolean success = TRUE; + GSList *all_settings = NULL, *setting_i; + NMSettingVerifyResult success = NM_SETTING_VERIFY_ERROR; NMSetting *base; const char *ctype; + GError *normalizable_error = NULL; + NMSettingVerifyResult normalizable_error_type = NM_SETTING_VERIFY_SUCCESS; if (error) - g_return_val_if_fail (*error == NULL, FALSE); + g_return_val_if_fail (*error == NULL, NM_SETTING_VERIFY_ERROR); if (!NM_IS_CONNECTION (connection)) { g_set_error_literal (error, NM_SETTING_CONNECTION_ERROR, NM_SETTING_CONNECTION_ERROR_UNKNOWN, "invalid connection; failed verification"); - g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); + g_return_val_if_fail (NM_IS_CONNECTION (connection), NM_SETTING_VERIFY_ERROR); } priv = NM_CONNECTION_GET_PRIVATE (connection); @@ -624,23 +763,62 @@ nm_connection_verify (NMConnection *connection, GError **error) NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, "connection setting not found"); - return FALSE; + goto EXIT; } /* Build up the list of settings */ g_hash_table_iter_init (&iter, priv->settings); - while (g_hash_table_iter_next (&iter, NULL, &value)) - all_settings = g_slist_append (all_settings, value); + while (g_hash_table_iter_next (&iter, NULL, &value)) { + /* Order NMSettingConnection so that it will be verified first. + * The reason is, that NMSettingConnection:verify() modifies the connection + * by setting NMSettingConnection:interface_name. So we want to call that + * verify() first, because the order can affect the outcome. + * Another reason is, that errors in this setting might be more fundamental + * and should be checked and reported with higher priority. + * Another reason is, that some settings look especially at the + * NMSettingConnection, so they find it first in the all_settings list. */ + if (value == s_con) + all_settings = g_slist_append (all_settings, value); + else + all_settings = g_slist_prepend (all_settings, value); + } + all_settings = g_slist_reverse (all_settings); /* Now, run the verify function of each setting */ - g_hash_table_iter_init (&iter, priv->settings); - while (g_hash_table_iter_next (&iter, NULL, &value) && success) - success = nm_setting_verify (NM_SETTING (value), all_settings, error); + for (setting_i = all_settings; setting_i; setting_i = setting_i->next) { + GError *verify_error = NULL; + NMSettingVerifyResult verify_result; + + /* verify all settings. We stop if we find the first non-normalizable + * @NM_SETTING_VERIFY_ERROR. If we find normalizable errors we continue + * but remember the error to return it to the user. + * @NM_SETTING_VERIFY_NORMALIZABLE_ERROR has a higher priority then + * @NM_SETTING_VERIFY_NORMALIZABLE, so, if we encounter such an error type, + * we remember it instead (to return it as output). + **/ + verify_result = _nm_setting_verify (NM_SETTING (setting_i->data), all_settings, &verify_error); + if (verify_result == NM_SETTING_VERIFY_NORMALIZABLE || + verify_result == NM_SETTING_VERIFY_NORMALIZABLE_ERROR) { + if ( verify_result == NM_SETTING_VERIFY_NORMALIZABLE_ERROR + && normalizable_error_type == NM_SETTING_VERIFY_NORMALIZABLE) { + /* NORMALIZABLE_ERROR has higher priority. */ + g_clear_error (&normalizable_error); + } + if (!normalizable_error) { + g_propagate_error (&normalizable_error, verify_error); + verify_error = NULL; + normalizable_error_type = verify_result; + } + } else if (verify_result != NM_SETTING_VERIFY_SUCCESS) { + g_propagate_error (error, verify_error); + g_slist_free (all_settings); + g_return_val_if_fail (verify_result == NM_SETTING_VERIFY_ERROR, success); + goto EXIT; + } + g_clear_error (&verify_error); + } g_slist_free (all_settings); - if (success == FALSE) - return FALSE; - /* Now make sure the given 'type' setting can actually be the base setting * of the connection. Can't have type=ppp for example. */ @@ -650,7 +828,7 @@ nm_connection_verify (NMConnection *connection, GError **error) NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, "connection type missing"); - return FALSE; + goto EXIT; } base = nm_connection_get_setting_by_name (connection, ctype); @@ -659,19 +837,125 @@ nm_connection_verify (NMConnection *connection, GError **error) NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, "base setting GType not found"); - return FALSE; + goto EXIT; } if (!_nm_setting_is_base_type (base)) { g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, - "connection type '%s' is not a base type", - ctype); - return FALSE; + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, + "connection type '%s' is not a base type", + ctype); + goto EXIT; } - return TRUE; + s_ip4 = nm_connection_get_setting_ip4_config (connection); + s_ip6 = nm_connection_get_setting_ip6_config (connection); + + if (nm_setting_connection_get_master (s_con)) { + if ((normalizable_error_type == NM_SETTING_VERIFY_SUCCESS || + (normalizable_error_type == NM_SETTING_VERIFY_NORMALIZABLE)) && (s_ip4 || s_ip6)) { + g_clear_error (&normalizable_error); + g_set_error (&normalizable_error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_SETTING, + "slave connection cannot have an IP%c setting", + s_ip4 ? '4' : '6'); + /* having a slave with IP config *was* and is a verify() error. */ + normalizable_error_type = NM_SETTING_VERIFY_NORMALIZABLE_ERROR; + } + } else { + if (normalizable_error_type == NM_SETTING_VERIFY_SUCCESS && (!s_ip4 || !s_ip6)) { + g_set_error (&normalizable_error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_SETTING_NOT_FOUND, + "connection needs an IP%c setting", + !s_ip4 ? '4' : '6'); + /* having a master without IP config was not a verify() error, accept + * it for backward compatibility. */ + normalizable_error_type = NM_SETTING_VERIFY_NORMALIZABLE; + } + } + + if (normalizable_error_type != NM_SETTING_VERIFY_SUCCESS) { + g_propagate_error (error, normalizable_error); + normalizable_error = NULL; + success = normalizable_error_type; + } else + success = NM_SETTING_VERIFY_SUCCESS; + +EXIT: + g_clear_error (&normalizable_error); + return success; +} + +/** + * nm_connection_normalize: + * @connection: the #NMConnection to normalize + * @parameters: (allow-none) (element-type utf8 gpointer): a #GHashTable with + * normalization parameters to allow customization of the normalization by providing + * specific arguments. Unknown arguments will be ignored and the default will be + * used. The keys must be strings, hashed by g_str_hash() and g_str_equal() functions. + * The values are opaque and depend on the parameter name. + * @modified: (out) (allow-none): outputs whether any settings were modified. + * @error: location to store error, or %NULL. Contains the reason, + * why the connection is invalid, if the function returns an error. + * + * Does some basic normalization and fixup of well known inconsistencies + * and deprecated fields. If the connection was modified in any way, + * the output parameter @modified is set %TRUE. + * + * Finally the connection will be verified and %TRUE returns if the connection + * is valid. As this function only performs some specific normalization steps + * it cannot repair all connections. If the connection has errors that + * cannot be normalized, the connection will not be modified. + * + * Returns: %TRUE if the connection is valid, %FALSE if it is not + * + * Since: 1.0 + **/ +gboolean +nm_connection_normalize (NMConnection *connection, + GHashTable *parameters, + gboolean *modified, + GError **error) +{ + NMSettingVerifyResult success; + gboolean was_modified = FALSE; + GError *normalizable_error = NULL; + + success = _nm_connection_verify (connection, &normalizable_error); + + if (success == NM_SETTING_VERIFY_ERROR || + success == NM_SETTING_VERIFY_SUCCESS) { + if (normalizable_error) + g_propagate_error (error, normalizable_error); + goto EXIT; + } + g_assert (success == NM_SETTING_VERIFY_NORMALIZABLE || success == NM_SETTING_VERIFY_NORMALIZABLE_ERROR); + g_clear_error (&normalizable_error); + + /* Try to perform all kind of normalizations on the settings to fix it. + * We only do this, after verifying that the connection contains no un-normalizable + * errors, because in that case we rather fail without touching the settings. */ + + was_modified |= _normalize_virtual_iface_name (connection); + was_modified |= _normalize_ip_config (connection, parameters); + + /* Verify anew. */ + success = _nm_connection_verify (connection, error); + + /* we would expect, that after normalization, the connection can be verified. */ + g_return_val_if_fail (success == NM_SETTING_VERIFY_SUCCESS, success); + + /* we would expect, that the connection was modified during normalization. */ + g_return_val_if_fail (was_modified, success); + +EXIT: + if (modified) + *modified = was_modified; + + return success == NM_SETTING_VERIFY_SUCCESS; } /** @@ -751,8 +1035,8 @@ nm_connection_update_secrets (NMConnection *connection, g_signal_handlers_block_by_func (setting, (GCallback) setting_changed_cb, connection); success_detail = _nm_setting_update_secrets (setting, - setting_hash ? setting_hash : secrets, - error); + setting_hash ? setting_hash : secrets, + error); g_signal_handlers_unblock_by_func (setting, (GCallback) setting_changed_cb, connection); if (success_detail == NM_SETTING_UPDATE_SECRET_ERROR) @@ -983,7 +1267,7 @@ nm_connection_to_hash (NMConnection *connection, NMSettingHashFlags flags) /** * nm_connection_is_type: * @connection: the #NMConnection - * @type: a setting name to check the connection's type against (like + * @type: a setting name to check the connection's type against (like * %NM_SETTING_WIRELESS_SETTING_NAME or %NM_SETTING_WIRED_SETTING_NAME) * * A convenience function to check if the given @connection is a particular @@ -1106,6 +1390,33 @@ nm_connection_get_path (NMConnection *connection) } /** + * nm_connection_get_interface_name: + * @connection: The #NMConnection + * + * Returns the interface name as stored in NMSettingConnection:interface_name. + * If the connection contains no NMSettingConnection, it will return %NULL. + * + * For hardware devices and software devices created outside of NetworkManager, + * this name is used to match the device. for software devices created by + * NetworkManager, this is the name of the created interface. + * + * Returns: Name of the kernel interface or %NULL + * + * Since: 1.0 + */ +const char * +nm_connection_get_interface_name (NMConnection *connection) +{ + NMSettingConnection *s_con; + + g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); + + s_con = nm_connection_get_setting_connection (connection); + + return s_con ? nm_setting_connection_get_interface_name (s_con) : NULL; +} + +/** * nm_connection_get_virtual_iface_name: * @connection: The #NMConnection * @@ -1196,7 +1507,7 @@ nm_connection_duplicate (NMConnection *connection) g_hash_table_iter_init (&iter, NM_CONNECTION_GET_PRIVATE (connection)->settings); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting)) - nm_connection_add_setting (dup, nm_setting_duplicate (setting)); + _nm_connection_add_setting (dup, nm_setting_duplicate (setting)); return dup; } @@ -1750,14 +2061,8 @@ dispose (GObject *object) { NMConnection *self = NM_CONNECTION (object); NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (self); - GHashTableIter iter; - NMSetting *setting; - g_hash_table_iter_init (&iter, priv->settings); - while (g_hash_table_iter_next (&iter, NULL, (gpointer) &setting)) { - g_signal_handlers_disconnect_by_func (setting, setting_changed_cb, self); - g_hash_table_iter_remove (&iter); - } + g_hash_table_foreach_remove (priv->settings, _setting_release, self); G_OBJECT_CLASS (nm_connection_parent_class)->dispose (object); } @@ -1768,6 +2073,7 @@ finalize (GObject *object) NMConnection *connection = NM_CONNECTION (object); NMConnectionPrivate *priv = NM_CONNECTION_GET_PRIVATE (connection); + g_assert (g_hash_table_size (priv->settings) == 0); g_hash_table_destroy (priv->settings); g_free (priv->path); @@ -1776,7 +2082,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMConnection *connection = NM_CONNECTION (object); @@ -1792,7 +2098,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMConnection *connection = NM_CONNECTION (object); @@ -1829,40 +2135,40 @@ nm_connection_class_init (NMConnectionClass *klass) **/ g_object_class_install_property (object_class, PROP_PATH, - g_param_spec_string (NM_CONNECTION_PATH, - "Path", - "Path", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_string (NM_CONNECTION_PATH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /* Signals */ /** - * NMConnection::secrets-updated: - * @connection: the object on which the signal is emitted - * @setting_name: the setting name of the #NMSetting for which secrets were - * updated - * - * The ::secrets-updated signal is emitted when the secrets of a setting - * have been changed. - */ + * NMConnection::secrets-updated: + * @connection: the object on which the signal is emitted + * @setting_name: the setting name of the #NMSetting for which secrets were + * updated + * + * The ::secrets-updated signal is emitted when the secrets of a setting + * have been changed. + */ signals[SECRETS_UPDATED] = g_signal_new (NM_CONNECTION_SECRETS_UPDATED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionClass, secrets_updated), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMConnectionClass, secrets_updated), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); /** - * NMConnection::secrets-cleared: - * @connection: the object on which the signal is emitted - * - * The ::secrets-cleared signal is emitted when the secrets of a connection - * are cleared. - */ + * NMConnection::secrets-cleared: + * @connection: the object on which the signal is emitted + * + * The ::secrets-cleared signal is emitted when the secrets of a connection + * are cleared. + */ signals[SECRETS_CLEARED] = g_signal_new (NM_CONNECTION_SECRETS_CLEARED, G_OBJECT_CLASS_TYPE (object_class), @@ -1872,15 +2178,15 @@ nm_connection_class_init (NMConnectionClass *klass) G_TYPE_NONE, 0); /** - * NMConnection::changed: - * @connection: the object on which the signal is emitted - * - * The ::changed signal is emitted when any property of any property - * (including secrets) of any setting of the connection is modified, - * or when settings are added or removed. - * - * Since: 0.9.10 - */ + * NMConnection::changed: + * @connection: the object on which the signal is emitted + * + * The ::changed signal is emitted when any property of any property + * (including secrets) of any setting of the connection is modified, + * or when settings are added or removed. + * + * Since: 0.9.10 + */ signals[CHANGED] = g_signal_new (NM_CONNECTION_CHANGED, G_OBJECT_CLASS_TYPE (object_class), @@ -1889,4 +2195,3 @@ nm_connection_class_init (NMConnectionClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } - diff --git a/libnm-util/nm-connection.h b/libnm-util/nm-connection.h index 4524c8f62..2cee2be56 100644 --- a/libnm-util/nm-connection.h +++ b/libnm-util/nm-connection.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_CONNECTION_H @@ -86,6 +83,8 @@ G_BEGIN_DECLS * #NMSettingWireless. * @NM_CONNECTION_ERROR_SETTING_NOT_FOUND: the #NMConnection object * did not contain the specified #NMSetting object + *@NM_CONNECTION_ERROR_INVALID_SETTING: the #NMConnection object contains + * a conflicting setting object * * Describes errors that may result from operations involving a #NMConnection. * @@ -95,9 +94,17 @@ typedef enum NM_CONNECTION_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/ NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, /*< nick=ConnectionSettingNotFound >*/ NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, /*< nick=ConnectionTypeInvalid >*/ - NM_CONNECTION_ERROR_SETTING_NOT_FOUND /*< nick=SettingNotFound >*/ + NM_CONNECTION_ERROR_SETTING_NOT_FOUND, /*< nick=SettingNotFound >*/ + NM_CONNECTION_ERROR_INVALID_SETTING, /*< nick=InvalidSetting >*/ } NMConnectionError; +/* + * NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD: overwrite the ip6 method + * when normalizing ip6 configuration. If omited, this defaults to + * @NM_SETTING_IP6_CONFIG_METHOD_AUTO. + */ +#define NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD "ip6-config-method" + #define NM_CONNECTION_ERROR nm_connection_error_quark () GQuark nm_connection_error_quark (void); @@ -159,6 +166,11 @@ gboolean nm_connection_diff (NMConnection *a, GHashTable **out_settings); gboolean nm_connection_verify (NMConnection *connection, GError **error); +NM_AVAILABLE_IN_1_0 +gboolean nm_connection_normalize (NMConnection *connection, + GHashTable *parameters, + gboolean *modified, + GError **error); const char * nm_connection_need_secrets (NMConnection *connection, GPtrArray **hints); @@ -181,6 +193,9 @@ const char * nm_connection_get_path (NMConnection *connection); const char * nm_connection_get_virtual_iface_name (NMConnection *connection); +NM_AVAILABLE_IN_1_0 +const char * nm_connection_get_interface_name (NMConnection *connection); + gboolean nm_connection_is_type (NMConnection *connection, const char *type); void nm_connection_for_each_setting_value (NMConnection *connection, diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index 27e498b5b..acb8aec33 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,10 +16,12 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include "nm-param-spec-specialized.h" #include "nm-glib-compat.h" @@ -246,7 +245,7 @@ static void iterate_collection (const GValue *value, gpointer user_data) { GSList **list = (GSList **) user_data; - + *list = g_slist_prepend (*list, _gvalue_dup (value)); } @@ -286,8 +285,8 @@ _gvalues_compare_collection (const GValue *value1, const GValue *value2) GSList *iter2; for (iter1 = list1, iter2 = list2, ret = 0; - ret == 0 && iter1 && iter2; - iter1 = iter1->next, iter2 = iter2->next) + ret == 0 && iter1 && iter2; + iter1 = iter1->next, iter2 = iter2->next) ret = _gvalues_compare ((GValue *) iter1->data, (GValue *) iter2->data); } @@ -300,8 +299,8 @@ _gvalues_compare_collection (const GValue *value1, const GValue *value2) static void iterate_map (const GValue *key_val, - const GValue *value_val, - gpointer user_data) + const GValue *value_val, + gpointer user_data) { GHashTable **hash = (GHashTable **) user_data; @@ -340,7 +339,7 @@ _gvalues_compare_map (const GValue *value1, const GValue *value2) if (dbus_g_type_get_map_key_specialization (G_VALUE_TYPE (value1)) != G_TYPE_STRING) { g_warning ("Can not compare maps with '%s' for keys", - g_type_name (dbus_g_type_get_map_key_specialization (G_VALUE_TYPE (value1)))); + g_type_name (dbus_g_type_get_map_key_specialization (G_VALUE_TYPE (value1)))); return 0; } @@ -528,7 +527,7 @@ _gvalues_compare (const GValue *value1, const GValue *value2) if (type_is_fixed_size (type1, NULL)) ret = _gvalues_compare_fixed (value1, value2); - else if (type1 == G_TYPE_STRING) + else if (type1 == G_TYPE_STRING) ret = _gvalues_compare_string (value1, value2); else if (G_VALUE_HOLDS_BOXED (value1)) { gpointer p1 = g_value_get_boxed (value1); @@ -592,8 +591,8 @@ param_specialized_validate (GParamSpec *pspec, GValue *value) static gint param_specialized_values_cmp (GParamSpec *pspec, - const GValue *value1, - const GValue *value2) + const GValue *value1, + const GValue *value2) { return _gvalues_compare (value1, value2); } @@ -622,17 +621,17 @@ _nm_param_spec_specialized_get_type (void) GParamSpec * _nm_param_spec_specialized (const char *name, - const char *nick, - const char *blurb, - GType specialized_type, - GParamFlags flags) + const char *nick, + const char *blurb, + GType specialized_type, + GParamFlags flags) { NMParamSpecSpecialized *pspec; g_return_val_if_fail (g_type_is_a (specialized_type, G_TYPE_BOXED), NULL); pspec = g_param_spec_internal (NM_TYPE_PARAM_SPEC_SPECIALIZED, - name, nick, blurb, flags); + name, nick, blurb, flags); G_PARAM_SPEC (pspec)->value_type = specialized_type; diff --git a/libnm-util/nm-param-spec-specialized.h b/libnm-util/nm-param-spec-specialized.h index a6173674d..7803e919a 100644 --- a/libnm-util/nm-param-spec-specialized.h +++ b/libnm-util/nm-param-spec-specialized.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2008 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_PARAM_SPEC_SPECIALIZED_H @@ -38,9 +35,9 @@ typedef struct _NMParamSpecSpecialized NMParamSpecSpecialized; GType _nm_param_spec_specialized_get_type (void); GParamSpec *_nm_param_spec_specialized (const char *name, - const char *nick, - const char *blurb, - GType specialized_type, - GParamFlags flags); + const char *nick, + const char *blurb, + GType specialized_type, + GParamFlags flags); #endif /* NM_PARAM_SPEC_SPECIALIZED_H */ diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c index d85b87b89..6d5268a17 100644 --- a/libnm-util/nm-setting-8021x.c +++ b/libnm-util/nm-setting-8021x.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,13 +16,15 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-8021x.h" #include "nm-param-spec-specialized.h" @@ -92,6 +91,11 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_802_1X) #define NM_SETTING_802_1X_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_802_1X, NMSetting8021xPrivate)) +G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_UNKNOWN == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_UNKNOWN) ); +G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_X509 == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_X509) ); +G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_RAW_KEY == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_RAW_KEY) ); +G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_PKCS12 == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_PKCS12) ); + typedef struct { GSList *eap; /* GSList of strings */ char *identity; @@ -408,7 +412,7 @@ nm_setting_802_1x_get_ca_path (NMSetting8021x *setting) * properties are ignored if the #NMSetting8021x:system-ca-certs property is * %TRUE, in which case a system-wide CA certificate directory specified at * compile time (using the --system-ca-path configure option) is used in place - * of these properties. + * of these properties. * * Returns: %TRUE if a system CA certificate path should be used, %FALSE if not **/ @@ -836,7 +840,7 @@ nm_setting_802_1x_get_client_cert_path (NMSetting8021x *setting) * @setting: the #NMSetting8021x * @cert_path: when @scheme is set to either %NM_SETTING_802_1X_CK_SCHEME_PATH * or %NM_SETTING_802_1X_CK_SCHEME_BLOB, pass the path of the client - * certificate file (PEM, DER, or PKCS#12 format). The path must be UTF-8 + * certificate file (PEM, DER, or PKCS#<!-- -->12 format). The path must be UTF-8 * encoded; use g_filename_to_utf8() to convert if needed. Passing %NULL with * any @scheme clears the client certificate. * @scheme: desired storage scheme for the certificate @@ -1421,7 +1425,7 @@ nm_setting_802_1x_get_phase2_client_cert_path (NMSetting8021x *setting) * @setting: the #NMSetting8021x * @cert_path: when @scheme is set to either %NM_SETTING_802_1X_CK_SCHEME_PATH * or %NM_SETTING_802_1X_CK_SCHEME_BLOB, pass the path of the "phase2" client - * certificate file (PEM, DER, or PKCS#12 format). The path must be UTF-8 + * certificate file (PEM, DER, or PKCS#<!-- -->12 format). The path must be UTF-8 * encoded; use g_filename_to_utf8() to convert if needed. Passing %NULL with * any @scheme clears the "phase2" client certificate. * @scheme: desired storage scheme for the certificate @@ -1696,7 +1700,7 @@ file_to_byte_array (const char *filename) * @setting: the #NMSetting8021x * @key_path: when @scheme is set to either %NM_SETTING_802_1X_CK_SCHEME_PATH or * %NM_SETTING_802_1X_CK_SCHEME_BLOB, pass the path of the private key file - * (PEM, DER, or PKCS#12 format). The path must be UTF-8 encoded; use + * (PEM, DER, or PKCS#<!-- -->12 format). The path must be UTF-8 encoded; use * g_filename_to_utf8() to convert if needed. Passing %NULL with any @scheme * clears the private key. * @password: password used to decrypt the private key, or %NULL if the password @@ -1824,7 +1828,7 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *setting, g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD); if (out_format) - *out_format = format; + *out_format = (NMSetting8021xCKFormat) format; return priv->private_key != NULL; } @@ -2007,7 +2011,7 @@ nm_setting_802_1x_get_phase2_private_key_path (NMSetting8021x *setting) * @setting: the #NMSetting8021x * @key_path: when @scheme is set to either %NM_SETTING_802_1X_CK_SCHEME_PATH or * %NM_SETTING_802_1X_CK_SCHEME_BLOB, pass the path of the "phase2" private - * key file (PEM, DER, or PKCS#12 format). The path must be UTF-8 encoded; + * key file (PEM, DER, or PKCS#<!-- -->12 format). The path must be UTF-8 encoded; * use g_filename_to_utf8() to convert if needed. Passing %NULL with any * @scheme clears the private key. * @password: password used to decrypt the private key, or %NULL if the password @@ -2135,7 +2139,7 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *setting, g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD); if (out_format) - *out_format = format; + *out_format = (NMSetting8021xCKFormat) format; return priv->phase2_private_key != NULL; } @@ -2819,7 +2823,7 @@ set_cert_prop_helper (const GValue *value, const char *prop_name, GError **error static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSetting8021x *setting = NM_SETTING_802_1X (object); NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE (setting); @@ -3005,7 +3009,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSetting8021x *setting = NM_SETTING_802_1X (object); NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE (setting); @@ -3143,17 +3147,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_EAP, - _nm_param_spec_specialized (NM_SETTING_802_1X_EAP, - "EAP", - "The allowed EAP method to be used when " - "authenticating to the network with 802.1x. " - "Valid methods are: 'leap', 'md5', 'tls', 'peap', " - "'ttls', 'pwd', and 'fast'. Each method requires " - "different configuration using the properties of " - "this setting; refer to wpa_supplicant " - "documentation for the allowed combinations.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_EAP, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:identity: @@ -3163,12 +3160,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IDENTITY, - g_param_spec_string (NM_SETTING_802_1X_IDENTITY, - "Identity", - "Identity string for EAP authentication methods. " - "Often the user's user or login name.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_IDENTITY, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:anonymous-identity: @@ -3179,14 +3174,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ANONYMOUS_IDENTITY, - g_param_spec_string (NM_SETTING_802_1X_ANONYMOUS_IDENTITY, - "Anonymous identity", - "Anonymous identity string for EAP authentication " - "methods. Used as the unencrypted identity with EAP " - "types that support different tunneled identity like " - "EAP-TTLS.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_ANONYMOUS_IDENTITY, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:pac-file: @@ -3195,11 +3186,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PAC_FILE, - g_param_spec_string (NM_SETTING_802_1X_PAC_FILE, - "PAC file", - "UTF-8 encoded file path containing PAC for EAP-FAST.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PAC_FILE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:ca-cert: @@ -3221,24 +3211,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CA_CERT, - _nm_param_spec_specialized (NM_SETTING_802_1X_CA_CERT, - "CA certificate", - "Contains the CA certificate if used by the EAP " - "method specified in the 'eap' property. " - "Certificate data is specified using a 'scheme'; " - "two are currently supported: blob and path. " - "When using the blob scheme (which is backwards " - "compatible with NM 0.7.x) this property should " - "be set to the certificate's DER encoded data. " - "When using the path scheme, this property should " - "be set to the full UTF-8 encoded path of the " - "certificate, prefixed with the string 'file://' " - "and ending with a terminating NULL byte. This " - "property can be unset even if the EAP method " - "supports CA certificates, but this allows " - "man-in-the-middle attacks and is NOT recommended.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_CA_CERT, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:ca-path: @@ -3249,14 +3225,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CA_PATH, - g_param_spec_string (NM_SETTING_802_1X_CA_PATH, - "CA path", - "UTF-8 encoded path to a directory containing PEM or " - "DER formatted certificates to be added to the " - "verification chain in addition to the certificate " - "specified in the 'ca-cert' property.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_CA_PATH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:subject-match: @@ -3267,15 +3239,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SUBJECT_MATCH, - g_param_spec_string (NM_SETTING_802_1X_SUBJECT_MATCH, - "Subject match", - "Substring to be matched against the subject of " - "the certificate presented by the authentication " - "server. When unset, no verification of the " - "authentication server certificate's subject is " - "performed.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_SUBJECT_MATCH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:altsubject-matches: @@ -3284,18 +3251,12 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * certificate presented by the authentication server. If the list is empty, * no verification of the server certificate's altSubjectName is performed. **/ - g_object_class_install_property - (object_class, PROP_ALTSUBJECT_MATCHES, - _nm_param_spec_specialized (NM_SETTING_802_1X_ALTSUBJECT_MATCHES, - "altSubjectName matches", - "List of strings to be matched against " - "the altSubjectName of the certificate " - "presented by the authentication server. " - "If the list is empty, no verification " - "of the server certificate's " - "altSubjectName is performed.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + g_object_class_install_property + (object_class, PROP_ALTSUBJECT_MATCHES, + _nm_param_spec_specialized (NM_SETTING_802_1X_ALTSUBJECT_MATCHES, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:client-cert: @@ -3315,21 +3276,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CLIENT_CERT, - _nm_param_spec_specialized (NM_SETTING_802_1X_CLIENT_CERT, - "Client certificate", - "Contains the client certificate if used by the " - "EAP method specified in the 'eap' property. " - "Certificate data is specified using a 'scheme'; " - "two are currently supported: blob and path. " - "When using the blob scheme (which is backwards " - "compatible with NM 0.7.x) this property should " - "be set to the certificate's DER encoded data. " - "When using the path scheme, this property should " - "be set to the full UTF-8 encoded path of the " - "certificate, prefixed with the string 'file://' " - "and ending with a terminating NULL byte.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_CLIENT_CERT, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase1-peapver: @@ -3343,17 +3293,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE1_PEAPVER, - g_param_spec_string (NM_SETTING_802_1X_PHASE1_PEAPVER, - "Phase1 PEAPVER", - "Forces which PEAP version is used when PEAP is set " - "as the EAP method in 'eap' property. When unset, " - "the version reported by the server will be used. " - "Sometimes when using older RADIUS servers, it is " - "necessary to force the client to use a particular " - "PEAP version. To do so, this property may be set to " - "'0' or '1' to force that specific PEAP version.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE1_PEAPVER, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase1-peaplabel: @@ -3365,15 +3308,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE1_PEAPLABEL, - g_param_spec_string (NM_SETTING_802_1X_PHASE1_PEAPLABEL, - "Phase1 PEAP label", - "Forces use of the new PEAP label during key " - "derivation. Some RADIUS servers may require forcing " - "the new PEAP label to interoperate with PEAPv1. " - "Set to '1' to force use of the new PEAP label. See " - "the wpa_supplicant documentation for more details.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE1_PEAPLABEL, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase1-fast-provisioning: @@ -3387,18 +3325,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE1_FAST_PROVISIONING, - g_param_spec_string (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, - "Phase1 fast provisioning", - "Enables or disables in-line provisioning of EAP-FAST " - "credentials when FAST is specified as the EAP method " - "in the #NMSetting8021x:eap property. Allowed values " - "are '0' (disabled), '1' (allow unauthenticated " - "provisioning), '2' (allow authenticated provisioning), " - "and '3' (allow both authenticated and unauthenticated " - "provisioning). See the wpa_supplicant documentation " - "for more details.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-auth: @@ -3412,18 +3342,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_AUTH, - g_param_spec_string (NM_SETTING_802_1X_PHASE2_AUTH, - "Phase2 auth", - "Specifies the allowed 'phase 2' inner non-EAP " - "authentication methods when an EAP method that uses " - "an inner TLS tunnel is specified in the 'eap' " - "property. Recognized non-EAP phase2 methods are 'pap', " - "'chap', 'mschap', 'mschapv2', 'gtc', 'otp', 'md5', " - "and 'tls'. Each 'phase 2' inner method requires " - "specific parameters for successful authentication; " - "see the wpa_supplicant documentation for more details.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE2_AUTH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-autheap: @@ -3437,18 +3359,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_AUTHEAP, - g_param_spec_string (NM_SETTING_802_1X_PHASE2_AUTHEAP, - "Phase2 autheap", - "Specifies the allowed 'phase 2' inner EAP-based " - "authentication methods when an EAP method that uses " - "an inner TLS tunnel is specified in the 'eap' " - "property. Recognized EAP-based 'phase 2' methods are " - "'md5', 'mschapv2', 'otp', 'gtc', and 'tls'. Each " - "'phase 2' inner method requires specific parameters " - "for successful authentication; see the wpa_supplicant " - "documentation for more details.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE2_AUTHEAP, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-ca-cert: @@ -3471,25 +3385,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_CA_CERT, - _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_CA_CERT, - "Phase2 CA certificate", - "Contains the 'phase 2' CA certificate if used by " - "the EAP method specified in the 'phase2-auth' or " - "'phase2-autheap' properties. Certificate data " - "is specified using a 'scheme'; two are currently" - "supported: blob and path. When using the blob " - "scheme (which is backwards compatible with NM " - "0.7.x) this property should be set to the " - "certificate's DER encoded data. When using the " - "path scheme, this property should be set to the " - "full UTF-8 encoded path of the certificate, " - "prefixed with the string 'file://' and ending " - "with a terminating NULL byte. This property can " - "be unset even if the EAP method supports CA " - "certificates, but this allows man-in-the-middle " - "attacks and is NOT recommended.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_CA_CERT, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-ca-path: @@ -3500,14 +3399,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_CA_PATH, - g_param_spec_string (NM_SETTING_802_1X_PHASE2_CA_PATH, - "Phase2 auth CA path", - "UTF-8 encoded path to a directory containing PEM or " - "DER formatted certificates to be added to the " - "verification chain in addition to the certificate " - "specified in the 'phase2-ca-cert' property.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE2_CA_PATH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-subject-match: @@ -3519,16 +3414,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_SUBJECT_MATCH, - g_param_spec_string (NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, - "Phase2 subject match", - "Substring to be matched against the subject of " - "the certificate presented by the authentication " - "server during the inner 'phase2' " - "authentication. When unset, no verification of " - "the authentication server certificate's subject " - "is performed.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-altsubject-matches: @@ -3538,20 +3427,12 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * "phase 2" authentication. If the list is empty, no verification of the * server certificate's altSubjectName is performed. **/ - g_object_class_install_property - (object_class, PROP_PHASE2_ALTSUBJECT_MATCHES, - _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES, - "altSubjectName matches", - "List of strings to be matched against " - "List of strings to be matched against " - "the altSubjectName of the certificate " - "presented by the authentication server " - "during the inner 'phase 2' " - "authentication. If the list is empty, no " - "verification of the server certificate's " - "altSubjectName is performed.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + g_object_class_install_property + (object_class, PROP_PHASE2_ALTSUBJECT_MATCHES, + _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-client-cert: @@ -3574,22 +3455,10 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PHASE2_CLIENT_CERT, - _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_CLIENT_CERT, - "Phase2 client certificate", - "Contains the 'phase 2' client certificate if " - "used by the EAP method specified in the " - "'phase2-auth' or 'phase2-autheap' properties. " - "Certificate data is specified using a 'scheme'; " - "two are currently supported: blob and path. " - "When using the blob scheme (which is backwards " - "compatible with NM 0.7.x) this property should " - "be set to the certificate's DER encoded data. " - "When using the path scheme, this property should " - "be set to the full UTF-8 encoded path of the " - "certificate, prefixed with the string 'file://' " - "and ending with a terminating NULL byte.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_CLIENT_CERT, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:password: @@ -3600,25 +3469,25 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD, - g_param_spec_string (NM_SETTING_802_1X_PASSWORD, - "Password", - "UTF-8 encoded password used for EAP authentication methods.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_802_1X_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:password-flags: * * Flags indicating how to handle the #NMSetting8021x:password property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_FLAGS, - "Password Flags", - "Flags indicating how to handle the 802.1x password.", + g_object_class_install_property + (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:password-raw: @@ -3630,30 +3499,25 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD_RAW, - _nm_param_spec_specialized (NM_SETTING_802_1X_PASSWORD_RAW, - "Password byte array", - "Password used for EAP authentication " - "methods, given as a byte array to allow " - "passwords in other encodings than UTF-8 " - "to be used. If both 'password' and " - "'password-raw' are given, 'password' is " - "preferred.", + _nm_param_spec_specialized (NM_SETTING_802_1X_PASSWORD_RAW, "", "", DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:password-raw-flags: * * Flags indicating how to handle the #NMSetting8021x:password-raw property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_RAW_FLAGS, - g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, - "Password byte array Flags", - "Flags indicating how to handle the 802.1x password byte array.", + g_object_class_install_property + (object_class, PROP_PASSWORD_RAW_FLAGS, + g_param_spec_uint (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:private-key: @@ -3666,15 +3530,15 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * should be set to the key's encrypted PEM encoded data. When using private * keys with the path scheme, this property should be set to the full UTF-8 * encoded path of the key, prefixed with the string "file://" and ending - * with a terminating NUL byte. When using PKCS#12 format private keys and - * the blob scheme, this property should be set to the PKCS#12 data and the + * with a terminating NUL byte. When using PKCS#<!-- -->12 format private keys and + * the blob scheme, this property should be set to the PKCS#<!-- -->12 data and the * #NMSetting8021x:private-key-password property must be set to password - * used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files + * used to decrypt the PKCS#<!-- -->12 certificate and key. When using PKCS#<!-- -->12 files * and the path scheme, this property should be set to the full UTF-8 * encoded path of the key, prefixed with the string "file://" and and * ending with a terminating NUL byte, and as with the blob scheme the * "private-key-password" property must be set to the password used to - * decode the PKCS#12 private key and certificate. + * decode the PKCS#<!-- -->12 private key and certificate. * * Setting this property directly is discouraged; use the * nm_setting_802_1x_set_private_key() function instead. @@ -3687,54 +3551,28 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIVATE_KEY, - _nm_param_spec_specialized (NM_SETTING_802_1X_PRIVATE_KEY, - "Private key", - "Contains the private key when the 'eap' property " - "is set to 'tls'. Key data is specified using a " - "'scheme'; two are currently supported: blob and " - "path. When using the blob scheme and private " - "keys, this property should be set to the key's " - "encrypted PEM encoded data. When using private " - "keys with the path scheme, this property should " - "be set to the full UTF-8 encoded path of the key, " - "prefixed with the string 'file://' and ending " - "with a terminating NULL byte. When using " - "PKCS#12 format private keys and the blob " - "scheme, this property should be set to the " - "PKCS#12 data and the 'private-key-password' " - "property must be set to password used to " - "decrypt the PKCS#12 certificate and key. When " - "using PKCS#12 files and the path scheme, this " - "property should be set to the full UTF-8 encoded " - "path of the key, prefixed with the string " - "'file://' and and ending with a terminating NULL " - "byte, and as with the blob scheme the " - "'private-key-password' property must be set to " - "the password used to decode the PKCS#12 private " - "key and certificate.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_PRIVATE_KEY, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:private-key-password: * * The password used to decrypt the private key specified in the * #NMSetting8021x:private-key property when the private key either uses the - * path scheme, or if the private key is a PKCS#12 format key. Setting this + * path scheme, or if the private key is a PKCS#<!-- -->12 format key. Setting this * property directly is not generally necessary except when returning * secrets to NetworkManager; it is generally set automatically when setting * the private key by the nm_setting_802_1x_set_private_key() function. **/ g_object_class_install_property (object_class, PROP_PRIVATE_KEY_PASSWORD, - g_param_spec_string (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD, - "Private key password", - "The password used to decrypt the private key " - "specified in the 'private-key' property when the " - "private key either uses the path scheme, or if the " - "private key is a PKCS#12 format key.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:private-key-password-flags: @@ -3742,15 +3580,14 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * Flags indicating how to handle the #NMSetting8021x:private-key-password * property. **/ - g_object_class_install_property (object_class, PROP_PRIVATE_KEY_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, - "Private Key Password Flags", - "Flags indicating how to handle the 802.1x private " - "key password.", + g_object_class_install_property + (object_class, PROP_PRIVATE_KEY_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-private-key: @@ -3764,70 +3601,43 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * should be set to the key's encrypted PEM encoded data. When using private * keys with the path scheme, this property should be set to the full UTF-8 * encoded path of the key, prefixed with the string "file://" and ending - * with a terminating NUL byte. When using PKCS#12 format private keys and - * the blob scheme, this property should be set to the PKCS#12 data and the + * with a terminating NUL byte. When using PKCS#<!-- -->12 format private keys and + * the blob scheme, this property should be set to the PKCS#<!-- -->12 data and the * #NMSetting8021x:phase2-private-key-password property must be set to - * password used to decrypt the PKCS#12 certificate and key. When using - * PKCS#12 files and the path scheme, this property should be set to the + * password used to decrypt the PKCS#<!-- -->12 certificate and key. When using + * PKCS#<!-- -->12 files and the path scheme, this property should be set to the * full UTF-8 encoded path of the key, prefixed with the string "file://" * and and ending with a terminating NUL byte, and as with the blob scheme * the #NMSetting8021x:phase2-private-key-password property must be set to - * the password used to decode the PKCS#12 private key and certificate. + * the password used to decode the PKCS#<!-- -->12 private key and certificate. * * Setting this property directly is discouraged; use the * nm_setting_802_1x_set_phase2_private_key() function instead. **/ g_object_class_install_property (object_class, PROP_PHASE2_PRIVATE_KEY, - _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, - "Phase2 private key", - "Contains the 'phase 2' inner private key when " - "the 'phase2-auth' or 'phase2-autheap' property " - "is set to 'tls'. Key data is specified using a " - "'scheme'; two are currently supported: blob and " - "path. When using the blob scheme and private " - "keys, this property should be set to the key's " - "encrypted PEM encoded data. When using private " - "keys with the path scheme, this property should " - "be set to the full UTF-8 encoded path of the key, " - "prefixed with the string 'file://' and ending " - "with a terminating NULL byte. When using " - "PKCS#12 format private keys and the blob " - "scheme, this property should be set to the " - "PKCS#12 data and the 'phase2-private-key-password' " - "property must be set to password used to " - "decrypt the PKCS#12 certificate and key. When " - "using PKCS#12 files and the path scheme, this " - "property should be set to the full UTF-8 encoded " - "path of the key, prefixed with the string " - "'file://' and and ending with a terminating NULL " - "byte, and as with the blob scheme the " - "'phase2-private-key-password' property must be " - "set to the password used to decode the PKCS#12 " - "private key and certificate.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-private-key-password: * * The password used to decrypt the "phase 2" private key specified in the * #NMSetting8021x:phase2-private-key property when the private key either - * uses the path scheme, or is a PKCS#12 format key. Setting this property + * uses the path scheme, or is a PKCS#<!-- -->12 format key. Setting this property * directly is not generally necessary except when returning secrets to * NetworkManager; it is generally set automatically when setting the * private key by the nm_setting_802_1x_set_phase2_private_key() function. **/ g_object_class_install_property (object_class, PROP_PHASE2_PRIVATE_KEY_PASSWORD, - g_param_spec_string (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD, - "Phase2 private key password", - "The password used to decrypt the 'phase 2' private " - "key specified in the 'private-key' property when the " - "phase2 private key either uses the path scheme, or " - "if the phase2 private key is a PKCS#12 format key.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:phase2-private-key-password-flags: @@ -3835,15 +3645,14 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) * Flags indicating how to handle the * #NMSetting8021x:phase2-private-key-password property. **/ - g_object_class_install_property (object_class, PROP_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, - "Phase2 Private Key Password Flags", - "Flags indicating how to handle the 802.1x phase2 " - "private key password.", + g_object_class_install_property + (object_class, PROP_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:pin: @@ -3852,25 +3661,25 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PIN, - g_param_spec_string (NM_SETTING_802_1X_PIN, - "PIN", - "PIN used for EAP authentication methods.", + g_param_spec_string (NM_SETTING_802_1X_PIN, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:pin-flags: * * Flags indicating how to handle the #NMSetting8021x:pin property. **/ - g_object_class_install_property (object_class, PROP_PIN_FLAGS, - g_param_spec_uint (NM_SETTING_802_1X_PIN_FLAGS, - "PIN Flags", - "Flags indicating how to handle the 802.1x PIN.", + g_object_class_install_property + (object_class, PROP_PIN_FLAGS, + g_param_spec_uint (NM_SETTING_802_1X_PIN_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSetting8021x:system-ca-certs: @@ -3884,17 +3693,11 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SYSTEM_CA_CERTS, - g_param_spec_boolean (NM_SETTING_802_1X_SYSTEM_CA_CERTS, - "Use system CA certificates", - "When TRUE, overrides 'ca-path' and 'phase2-ca-path' " - "properties using the system CA directory " - "specified at configure time with the " - "--system-ca-path switch. The certificates in " - "this directory are added to the verification " - "chain in addition to any certificates specified " - "by the 'ca-cert' and 'phase2-ca-cert' properties.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_802_1X_SYSTEM_CA_CERTS, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /* Initialize crypto lbrary. */ if (!nm_utils_init (&error)) { @@ -3902,5 +3705,4 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class) error->code, error->message); g_error_free (error); } - } diff --git a/libnm-util/nm-setting-8021x.h b/libnm-util/nm-setting-8021x.h index 263630ec0..62b439050 100644 --- a/libnm-util/nm-setting-8021x.h +++ b/libnm-util/nm-setting-8021x.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_8021X_H @@ -36,7 +33,7 @@ G_BEGIN_DECLS * @NM_SETTING_802_1X_CK_FORMAT_X509: file contains an X.509 format certificate * @NM_SETTING_802_1X_CK_FORMAT_RAW_KEY: file contains an old-style OpenSSL PEM * or DER private key - * @NM_SETTING_802_1X_CK_FORMAT_PKCS12: file contains a PKCS#12 certificate + * @NM_SETTING_802_1X_CK_FORMAT_PKCS12: file contains a PKCS#<!-- -->12 certificate * and private key * * #NMSetting8021xCKFormat values indicate the general type of a certificate diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c index 00cbb4aff..601ebc2b2 100644 --- a/libnm-util/nm-setting-adsl.c +++ b/libnm-util/nm-setting-adsl.c @@ -1,10 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Hicham HAOUARI <hicham.haouari@gmail.com> - * Pantelis Koukousoulas <pktoss@gmail.com> - * * 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 @@ -20,11 +16,13 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2013 Red Hat, Inc. + * Copyright 2011 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-adsl.h" #include "nm-setting-ppp.h" @@ -230,20 +228,22 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } - if (strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) && - strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) && - strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM)) { + if ( !priv->protocol + || ( strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) + && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) + && strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM))){ g_set_error (error, NM_SETTING_ADSL_ERROR, NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, _("'%s' is not a valid value for the property"), - priv->protocol); + priv->protocol ? priv->protocol : "(null)"); g_prefix_error (error, "%s.%s: ", NM_SETTING_ADSL_SETTING_NAME, NM_SETTING_ADSL_PROTOCOL); return FALSE; } - if (strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) && - strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) ) { + if ( priv->encapsulation + && ( strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) + && strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) )) { g_set_error (error, NM_SETTING_ADSL_ERROR, NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, @@ -387,11 +387,10 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_USERNAME, - g_param_spec_string (NM_SETTING_ADSL_USERNAME, - "Username", - "Username used to authenticate with the pppoa service.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_ADSL_USERNAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:password: @@ -400,25 +399,25 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD, - g_param_spec_string (NM_SETTING_ADSL_PASSWORD, - "Password", - "Password used to authenticate with the pppoa service.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_ADSL_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:password-flags: * * Flags indicating how to handle the #NMSettingAdsl:password property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_ADSL_PASSWORD_FLAGS, - "Password Flags", - "Flags indicating how to handle the ADSL password.", + g_object_class_install_property + (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_ADSL_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:protocol: @@ -427,11 +426,10 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PROTOCOL, - g_param_spec_string (NM_SETTING_ADSL_PROTOCOL, - "Protocol", - "ADSL connection protocol.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_ADSL_PROTOCOL, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:encapsulation: @@ -440,11 +438,10 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ENCAPSULATION, - g_param_spec_string (NM_SETTING_ADSL_ENCAPSULATION, - "Encapsulation", - "Encapsulation of ADSL connection", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_ADSL_ENCAPSULATION, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:vpi: @@ -453,11 +450,10 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_VPI, - g_param_spec_uint (NM_SETTING_ADSL_VPI, - "VPI", - "VPI of ADSL connection", - 0, 65536, 0, - G_PARAM_READWRITE)); + g_param_spec_uint (NM_SETTING_ADSL_VPI, "", "", + 0, 65536, 0, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingAdsl:vci: @@ -466,9 +462,8 @@ nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) **/ g_object_class_install_property (object_class, PROP_VCI, - g_param_spec_uint (NM_SETTING_ADSL_VCI, - "VCI", - "VCI of ADSL connection", - 0, 65536, 0, - G_PARAM_READWRITE)); + g_param_spec_uint (NM_SETTING_ADSL_VCI, "", "", + 0, 65536, 0, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-adsl.h b/libnm-util/nm-setting-adsl.h index 484e8a395..82af6ebdd 100644 --- a/libnm-util/nm-setting-adsl.h +++ b/libnm-util/nm-setting-adsl.h @@ -1,10 +1,6 @@ /* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Hicham HAOUARI <hicham.haouari@gmail.com> - * Pantelis Koukousoulas <pantelis@gmail.com> - * * 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 @@ -20,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2008 Red Hat, Inc. + * Copyright 2007 - 2008 Red Hat, Inc. */ #ifndef NM_SETTING_ADSL_H diff --git a/libnm-util/nm-setting-bluetooth.c b/libnm-util/nm-setting-bluetooth.c index 5c13257c4..2867d73ba 100644 --- a/libnm-util/nm-setting-bluetooth.c +++ b/libnm-util/nm-setting-bluetooth.c @@ -1,10 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Bastien Nocera <hadess@hadess.net> - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -20,13 +16,15 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <net/ethernet.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-param-spec-specialized.h" #include "nm-dbus-glib-types.h" @@ -105,7 +103,8 @@ NMSetting *nm_setting_bluetooth_new (void) * Returns the connection method for communicating with the remote device (i.e. * either DUN to a DUN-capable device or PANU to a NAP-capable device). * - * Returns: the type, either %NM_SETTING_BLUETOOTH_PANU or %NM_SETTING_BLUETOOTH_DUN + * Returns: the type, either %NM_SETTING_BLUETOOTH_TYPE_PANU or + * %NM_SETTING_BLUETOOTH_TYPE_DUN **/ const char * nm_setting_bluetooth_get_connection_type (NMSettingBluetooth *setting) @@ -163,7 +162,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) g_prefix_error (error, "%s.%s: ", NM_SETTING_BLUETOOTH_SETTING_NAME, NM_SETTING_BLUETOOTH_TYPE); return FALSE; } else if (!g_str_equal (priv->type, NM_SETTING_BLUETOOTH_TYPE_DUN) && - !g_str_equal (priv->type, NM_SETTING_BLUETOOTH_TYPE_PANU)) { + !g_str_equal (priv->type, NM_SETTING_BLUETOOTH_TYPE_PANU)) { g_set_error (error, NM_SETTING_BLUETOOTH_ERROR, NM_SETTING_BLUETOOTH_ERROR_INVALID_PROPERTY, @@ -217,7 +216,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingBluetoothPrivate *priv = NM_SETTING_BLUETOOTH_GET_PRIVATE (object); @@ -239,7 +238,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingBluetooth *setting = NM_SETTING_BLUETOOTH (object); @@ -279,11 +278,11 @@ nm_setting_bluetooth_class_init (NMSettingBluetoothClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BDADDR, - _nm_param_spec_specialized (NM_SETTING_BLUETOOTH_BDADDR, - "Bluetooth address", - "The Bluetooth address of the device", + _nm_param_spec_specialized (NM_SETTING_BLUETOOTH_BDADDR, "", "", DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBluetooth:type: @@ -293,12 +292,9 @@ nm_setting_bluetooth_class_init (NMSettingBluetoothClass *setting_class) **/ g_object_class_install_property (object_class, PROP_TYPE, - g_param_spec_string (NM_SETTING_BLUETOOTH_TYPE, - "Connection type", - "Either '" NM_SETTING_BLUETOOTH_TYPE_DUN "' for " - "Dial-Up Networking connections or " - "'" NM_SETTING_BLUETOOTH_TYPE_PANU "' for " - "Personal Area Networking connections.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_BLUETOOTH_TYPE, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-bluetooth.h b/libnm-util/nm-setting-bluetooth.h index 95a8852ab..caf12158c 100644 --- a/libnm-util/nm-setting-bluetooth.h +++ b/libnm-util/nm-setting-bluetooth.h @@ -1,10 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Bastien Nocera <hadess@hadess.net> - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -20,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2009 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2009 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_BLUETOOTH_H diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c index 5f919027d..fa12cf0ea 100644 --- a/libnm-util/nm-setting-bond.c +++ b/libnm-util/nm-setting-bond.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Thomas Graf <tgraf@redhat.com> - * * 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 @@ -18,16 +16,18 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2013 Red Hat, Inc. + * Copyright 2011 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> #include <stdlib.h> #include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-bond.h" #include "nm-param-spec-specialized.h" @@ -122,6 +122,8 @@ static const BondDefault defaults[] = { { NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY, "0", TYPE_BOTH, 0, 2, { "layer2", "layer3+4", "layer2+3", NULL } }, { NM_SETTING_BOND_OPTION_RESEND_IGMP, "1", TYPE_INT, 0, 255 }, + { NM_SETTING_BOND_OPTION_LACP_RATE, "0", TYPE_BOTH, 0, 1, + { "slow", "fast", NULL } }, }; /** @@ -313,8 +315,8 @@ nm_setting_bond_validate_option (const char *name, case TYPE_STR: return validate_list (name, value, &defaults[i]); case TYPE_BOTH: - return validate_int (name, value, &defaults[i]) - || validate_list (name, value, &defaults[i]); + return ( validate_int (name, value, &defaults[i]) + || validate_list (name, value, &defaults[i])); case TYPE_IP: return validate_ip (name, value); case TYPE_IFNAME: @@ -489,26 +491,9 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) NULL }; int miimon = 0, arp_interval = 0; const char *arp_ip_target = NULL; + const char *lacp_rate; const char *primary; - if (!priv->interface_name || !strlen(priv->interface_name)) { - g_set_error_literal (error, - NM_SETTING_BOND_ERROR, - NM_SETTING_BOND_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_INTERFACE_NAME); - return FALSE; - } - - if (!nm_utils_iface_valid_name (priv->interface_name)) { - g_set_error_literal (error, - NM_SETTING_BOND_ERROR, - NM_SETTING_BOND_ERROR_INVALID_PROPERTY, - _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_INTERFACE_NAME); - return FALSE; - } - g_hash_table_iter_init (&iter, priv->options); while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) { if (!value[0] || !nm_setting_bond_validate_option (key, value)) { @@ -688,7 +673,26 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } } - return TRUE; + lacp_rate = g_hash_table_lookup (priv->options, NM_SETTING_BOND_OPTION_LACP_RATE); + if ( lacp_rate + && (g_strcmp0 (value, "802.3ad") != 0 && g_strcmp0 (value, "4") != 0) + && (strcmp (lacp_rate, "slow") != 0 && strcmp (lacp_rate, "0") != 0)) { + g_set_error (error, + NM_SETTING_BOND_ERROR, + NM_SETTING_BOND_ERROR_INVALID_OPTION, + _("'%s' option is only valid with mode '%s'"), + NM_SETTING_BOND_OPTION_LACP_RATE, "802.3ad"); + g_prefix_error (error, "%s.%s: ", NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_OPTIONS); + return FALSE; + } + + return _nm_setting_verify_deprecated_virtual_iface_name ( + priv->interface_name, FALSE, + NM_SETTING_BOND_SETTING_NAME, NM_SETTING_BOND_INTERFACE_NAME, + NM_SETTING_BOND_ERROR, + NM_SETTING_BOND_ERROR_INVALID_PROPERTY, + NM_SETTING_BOND_ERROR_MISSING_PROPERTY, + all_settings, error); } static const char * @@ -765,7 +769,7 @@ get_property (GObject *object, guint prop_id, break; case PROP_OPTIONS: g_value_set_boxed (value, priv->options); - break; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -795,11 +799,11 @@ nm_setting_bond_class_init (NMSettingBondClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_BOND_INTERFACE_NAME, - "InterfaceName", - "The name of the virtual in-kernel bonding network interface", + g_param_spec_string (NM_SETTING_BOND_INTERFACE_NAME, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBond:options: @@ -810,12 +814,9 @@ nm_setting_bond_class_init (NMSettingBondClass *setting_class) **/ g_object_class_install_property (object_class, PROP_OPTIONS, - _nm_param_spec_specialized (NM_SETTING_BOND_OPTIONS, - "Options", - "Dictionary of key/value pairs of bonding " - "options. Both keys and values must be " - "strings. Option names must contain only " - "alphanumeric characters (ie, [a-zA-Z0-9]).", + _nm_param_spec_specialized (NM_SETTING_BOND_OPTIONS, "", "", DBUS_TYPE_G_MAP_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-bond.h b/libnm-util/nm-setting-bond.h index f3358c7f8..cf969995e 100644 --- a/libnm-util/nm-setting-bond.h +++ b/libnm-util/nm-setting-bond.h @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Thomas Graf <tgraf@redhat.com> - * * 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 @@ -18,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2013 Red Hat, Inc. + * Copyright 2011 - 2013 Red Hat, Inc. */ #ifndef NM_SETTING_BOND_H @@ -73,6 +71,7 @@ GQuark nm_setting_bond_error_quark (void); #define NM_SETTING_BOND_OPTION_AD_SELECT "ad_select" #define NM_SETTING_BOND_OPTION_XMIT_HASH_POLICY "xmit_hash_policy" #define NM_SETTING_BOND_OPTION_RESEND_IGMP "resend_igmp" +#define NM_SETTING_BOND_OPTION_LACP_RATE "lacp_rate" typedef struct { NMSetting parent; diff --git a/libnm-util/nm-setting-bridge-port.c b/libnm-util/nm-setting-bridge-port.c index 64be56627..b3afa5005 100644 --- a/libnm-util/nm-setting-bridge-port.c +++ b/libnm-util/nm-setting-bridge-port.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * * 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 @@ -18,14 +16,16 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2012 - 2013 Red Hat, Inc. + * Copyright 2012 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> #include <ctype.h> #include <stdlib.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-bridge-port.h" #include "nm-utils.h" @@ -264,11 +264,12 @@ nm_setting_bridge_port_class_init (NMSettingBridgePortClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY, - g_param_spec_uint (NM_SETTING_BRIDGE_PORT_PRIORITY, - "Priority", - "The Spanning Tree Protocol (STP) priority of this bridge port", + g_param_spec_uint (NM_SETTING_BRIDGE_PORT_PRIORITY, "", "", 0, BR_MAX_PORT_PRIORITY, BR_DEF_PRIORITY, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridgePort:path-cost: @@ -278,14 +279,14 @@ nm_setting_bridge_port_class_init (NMSettingBridgePortClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_PATH_COST, - g_param_spec_uint (NM_SETTING_BRIDGE_PORT_PATH_COST, - "Path Cost", - "The Spanning Tree Protocol (STP) port cost for " - "destinations via this port.", + g_object_class_install_property + (object_class, PROP_PATH_COST, + g_param_spec_uint (NM_SETTING_BRIDGE_PORT_PATH_COST, "", "", 0, BR_MAX_PATH_COST, 100, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridgePort:hairpin-mode: @@ -295,13 +296,11 @@ nm_setting_bridge_port_class_init (NMSettingBridgePortClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_HAIRPIN_MODE, - g_param_spec_boolean (NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, - "Hairpin Mode", - "Enables or disabled 'hairpin mode' for the " - "port, which allows frames to be sent back out " - "through the port the frame was received on.", + g_object_class_install_property + (object_class, PROP_HAIRPIN_MODE, + g_param_spec_boolean (NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, "", "", FALSE, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-bridge-port.h b/libnm-util/nm-setting-bridge-port.h index 7848b75ff..fcaf22ed0 100644 --- a/libnm-util/nm-setting-bridge-port.h +++ b/libnm-util/nm-setting-bridge-port.h @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * * 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 @@ -18,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2012 Red Hat, Inc. + * Copyright 2012 Red Hat, Inc. */ #ifndef NM_SETTING_BRIDGE_PORT_H diff --git a/libnm-util/nm-setting-bridge.c b/libnm-util/nm-setting-bridge.c index 0908573d2..bdaa75f97 100644 --- a/libnm-util/nm-setting-bridge.c +++ b/libnm-util/nm-setting-bridge.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Thomas Graf <tgraf@redhat.com> - * * 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 @@ -18,14 +16,16 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2013 Red Hat, Inc. + * Copyright 2011 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> #include <ctype.h> #include <stdlib.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <linux/if_ether.h> #include "nm-setting-bridge.h" @@ -280,25 +280,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) { NMSettingBridgePrivate *priv = NM_SETTING_BRIDGE_GET_PRIVATE (setting); - if (!priv->interface_name || !strlen(priv->interface_name)) { - g_set_error_literal (error, - NM_SETTING_BRIDGE_ERROR, - NM_SETTING_BRIDGE_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_BRIDGE_SETTING_NAME, NM_SETTING_BRIDGE_INTERFACE_NAME); - return FALSE; - } - - if (!nm_utils_iface_valid_name (priv->interface_name)) { - g_set_error (error, - NM_SETTING_BRIDGE_ERROR, - NM_SETTING_BRIDGE_ERROR_INVALID_PROPERTY, - _("'%s' is not a valid interface name"), - priv->interface_name); - g_prefix_error (error, "%s.%s: ", NM_SETTING_BRIDGE_SETTING_NAME, NM_SETTING_BRIDGE_INTERFACE_NAME); - return FALSE; - } - if (priv->mac_address && priv->mac_address->len != ETH_ALEN) { g_set_error_literal (error, NM_SETTING_BRIDGE_ERROR, @@ -336,7 +317,13 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) error)) return FALSE; - return TRUE; + return _nm_setting_verify_deprecated_virtual_iface_name ( + priv->interface_name, FALSE, + NM_SETTING_BRIDGE_SETTING_NAME, NM_SETTING_BRIDGE_INTERFACE_NAME, + NM_SETTING_BRIDGE_ERROR, + NM_SETTING_BRIDGE_ERROR_INVALID_PROPERTY, + NM_SETTING_BRIDGE_ERROR_MISSING_PROPERTY, + all_settings, error); } static const char * @@ -468,11 +455,11 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_BRIDGE_INTERFACE_NAME, - "InterfaceName", - "The name of the virtual in-kernel bridging network interface", + g_param_spec_string (NM_SETTING_BRIDGE_INTERFACE_NAME, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:mac-address: @@ -484,12 +471,12 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * Since: 0.9.10 **/ g_object_class_install_property - (object_class, PROP_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_BRIDGE_MAC_ADDRESS, - "MAC Address", - "The MAC address of the bridge", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + (object_class, PROP_MAC_ADDRESS, + _nm_param_spec_specialized (NM_SETTING_BRIDGE_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:stp: @@ -498,14 +485,14 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_STP, - g_param_spec_boolean (NM_SETTING_BRIDGE_STP, - "STP", - "Controls whether Spanning Tree Protocol (STP) " - "is enabled for this bridge.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_STP, + g_param_spec_boolean (NM_SETTING_BRIDGE_STP, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:priority: @@ -516,16 +503,14 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_PRIORITY, - g_param_spec_uint (NM_SETTING_BRIDGE_PRIORITY, - "Priority", - "Sets the Spanning Tree Protocol (STP) priority " - "for this bridge. Lower values are 'better'; the " - "lowest priority bridge will be elected the root " - "bridge.", - 0, G_MAXUINT16, 0x8000, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_PRIORITY, + g_param_spec_uint (NM_SETTING_BRIDGE_PRIORITY, "", "", + 0, G_MAXUINT16, 0x8000, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:forward-delay: @@ -534,14 +519,14 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_FORWARD_DELAY, - g_param_spec_uint (NM_SETTING_BRIDGE_FORWARD_DELAY, - "ForwardDelay", - "The Spanning Tree Protocol (STP) forwarding " - "delay, in seconds.", - 0, BR_MAX_FORWARD_DELAY, 15, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_FORWARD_DELAY, + g_param_spec_uint (NM_SETTING_BRIDGE_FORWARD_DELAY, "", "", + 0, BR_MAX_FORWARD_DELAY, 15, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:hello-time: @@ -550,14 +535,14 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_HELLO_TIME, - g_param_spec_uint (NM_SETTING_BRIDGE_HELLO_TIME, - "HelloTime", - "The Spanning Tree Protocol (STP) hello time, in " - "seconds.", - 0, BR_MAX_HELLO_TIME, 2, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_HELLO_TIME, + g_param_spec_uint (NM_SETTING_BRIDGE_HELLO_TIME, "", "", + 0, BR_MAX_HELLO_TIME, 2, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:max-age: @@ -566,14 +551,14 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_MAX_AGE, - g_param_spec_uint (NM_SETTING_BRIDGE_MAX_AGE, - "MaxAge", - "The Spanning Tree Protocol (STP) maximum message " - "age, in seconds.", - 0, BR_MAX_MAX_AGE, 20, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_MAX_AGE, + g_param_spec_uint (NM_SETTING_BRIDGE_MAX_AGE, "", "", + 0, BR_MAX_MAX_AGE, 20, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingBridge:ageing-time: @@ -582,12 +567,12 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class) * * Since: 0.9.8 **/ - g_object_class_install_property - (object_class, PROP_AGEING_TIME, - g_param_spec_uint (NM_SETTING_BRIDGE_AGEING_TIME, - "AgeingTime", - "The Ethernet MAC address aging time, in seconds.", - 0, BR_MAX_AGEING_TIME, 300, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_object_class_install_property + (object_class, PROP_AGEING_TIME, + g_param_spec_uint (NM_SETTING_BRIDGE_AGEING_TIME, "", "", + 0, BR_MAX_AGEING_TIME, 300, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm-util/nm-setting-bridge.h b/libnm-util/nm-setting-bridge.h index 1e8957045..f6b59262b 100644 --- a/libnm-util/nm-setting-bridge.h +++ b/libnm-util/nm-setting-bridge.h @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Thomas Graf <tgraf@redhat.com> - * * 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 @@ -18,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2012 Red Hat, Inc. + * Copyright 2011 - 2012 Red Hat, Inc. */ #ifndef NM_SETTING_BRIDGE_H diff --git a/libnm-util/nm-setting-cdma.c b/libnm-util/nm-setting-cdma.c index 7acfe8520..44a893c7b 100644 --- a/libnm-util/nm-setting-cdma.c +++ b/libnm-util/nm-setting-cdma.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * * 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 @@ -18,11 +16,13 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-cdma.h" #include "nm-utils.h" @@ -231,7 +231,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingCdmaPrivate *priv = NM_SETTING_CDMA_GET_PRIVATE (object); @@ -259,7 +259,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingCdma *setting = NM_SETTING_CDMA (object); @@ -308,14 +308,10 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NUMBER, - g_param_spec_string (NM_SETTING_CDMA_NUMBER, - "Number", - "Number to dial when establishing a PPP data session " - "with the CDMA-based mobile broadband network. If not " - "specified, the default number (#777) is used when " - "required.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_CDMA_NUMBER, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingCdma:username: @@ -326,13 +322,10 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class) **/ g_object_class_install_property (object_class, PROP_USERNAME, - g_param_spec_string (NM_SETTING_CDMA_USERNAME, - "Username", - "Username used to authenticate with the network, if " - "required. Note that many providers do not require " - "a username or accept any username.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_CDMA_USERNAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingCdma:password: @@ -343,25 +336,23 @@ nm_setting_cdma_class_init (NMSettingCdmaClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD, - g_param_spec_string (NM_SETTING_CDMA_PASSWORD, - "Password", - "Password used to authenticate with the network, if " - "required. Note that many providers do not require " - "a password or accept any password.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_CDMA_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingCdma:password-flags: * * Flags indicating how to handle the #NMSettingCdma:password property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_CDMA_PASSWORD_FLAGS, - "Password Flags", - "Flags indicating how to handle the CDMA password.", + g_object_class_install_property + (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_CDMA_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-cdma.h b/libnm-util/nm-setting-cdma.h index 0dc290dac..eee442059 100644 --- a/libnm-util/nm-setting-cdma.h +++ b/libnm-util/nm-setting-cdma.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_CDMA_H diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c index 56e87a4df..162ae7cb0 100644 --- a/libnm-util/nm-setting-connection.c +++ b/libnm-util/nm-setting-connection.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-utils.h" #include "nm-dbus-glib-types.h" @@ -459,7 +458,7 @@ nm_setting_connection_remove_permission (NMSettingConnection *setting, * be a username. See #NMSettingConnection:permissions: for more details. * * Returns: %TRUE if the permission was found and removed; %FALSE if it was not. - * + * * Since: 0.9.10 */ gboolean @@ -796,29 +795,35 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } - /* If the connection has a virtual interface name, it must match - * the connection setting's interface name. + /* FIXME: previously, verify() set the NMSettingConnection:interface_name property, + * thus modifying the setting. verify() should not do this, but keep this not to change + * behaviour. */ - for (iter = all_settings; iter; iter = iter->next) { - const char *virtual_iface; - - virtual_iface = nm_setting_get_virtual_iface_name (iter->data); - if (virtual_iface) { - if (priv->interface_name) { - if (strcmp (priv->interface_name, virtual_iface) != 0) { - g_set_error (error, - NM_SETTING_CONNECTION_ERROR, - NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' doesn't match the virtual interface name '%s'"), - priv->interface_name, virtual_iface); - g_prefix_error (error, "%s.%s: ", - NM_SETTING_CONNECTION_SETTING_NAME, - NM_SETTING_CONNECTION_INTERFACE_NAME); - return FALSE; + if (!priv->interface_name) { + for (iter = all_settings; iter; iter = iter->next) { + NMSetting *s_current = iter->data; + char *virtual_iface_name = NULL; + + if (NM_IS_SETTING_BOND (s_current)) + g_object_get (s_current, NM_SETTING_BOND_INTERFACE_NAME, &virtual_iface_name, NULL); + else if (NM_IS_SETTING_BRIDGE (s_current)) + g_object_get (s_current, NM_SETTING_BRIDGE_INTERFACE_NAME, &virtual_iface_name, NULL); + else if (NM_IS_SETTING_TEAM (s_current)) + g_object_get (s_current, NM_SETTING_TEAM_INTERFACE_NAME, &virtual_iface_name, NULL); + else if (NM_IS_SETTING_VLAN (s_current)) + g_object_get (s_current, NM_SETTING_VLAN_INTERFACE_NAME, &virtual_iface_name, NULL); + /* For NMSettingInfiniband, virtual_iface_name has no backing field. + * No need to set the (unset) interface_name to the default value. + **/ + + if (virtual_iface_name) { + if (nm_utils_iface_valid_name (virtual_iface_name)) { + /* found a new interface name. */ + priv->interface_name = virtual_iface_name; + break; } - } else - priv->interface_name = g_strdup (virtual_iface); - break; + g_free (virtual_iface_name); + } } } @@ -861,39 +866,37 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } - is_slave = ( !g_strcmp0 (priv->slave_type, NM_SETTING_BOND_SETTING_NAME) - || !g_strcmp0 (priv->slave_type, NM_SETTING_BRIDGE_SETTING_NAME) - || !g_strcmp0 (priv->slave_type, NM_SETTING_TEAM_SETTING_NAME)); + is_slave = ( priv->slave_type + && ( !strcmp (priv->slave_type, NM_SETTING_BOND_SETTING_NAME) + || !strcmp (priv->slave_type, NM_SETTING_BRIDGE_SETTING_NAME) + || !strcmp (priv->slave_type, NM_SETTING_TEAM_SETTING_NAME))); + + if (priv->slave_type && !is_slave) { + g_set_error (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, + _("Unknown slave type '%s'"), priv->slave_type); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_SLAVE_TYPE); + return NM_SETTING_VERIFY_ERROR; + } - /* Bond/bridge/team slaves are not allowed to have any IP configuration. */ if (is_slave) { - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; - - s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_find_in_list (all_settings, NM_SETTING_IP4_CONFIG_SETTING_NAME)); - if (s_ip4) { - if (strcmp (nm_setting_ip4_config_get_method (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) { - g_set_error_literal (error, - NM_SETTING_CONNECTION_ERROR, - NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED, - _("IPv4 configuration is not allowed for slave")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_SLAVE_TYPE); - return FALSE; - } + if (!priv->master) { + g_set_error_literal (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY, + _("Slave connections need a valid '" NM_SETTING_CONNECTION_MASTER "' property")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_MASTER); + return NM_SETTING_VERIFY_ERROR; } - - s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_find_in_list (all_settings, NM_SETTING_IP6_CONFIG_SETTING_NAME)); - if (s_ip6) { - if (strcmp (nm_setting_ip6_config_get_method (s_ip6), - NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { - g_set_error_literal (error, - NM_SETTING_CONNECTION_ERROR, - NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED, - _("IPv6 configuration is not allowed for slave")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_SLAVE_TYPE); - return FALSE; - } + } else { + if (priv->master) { + g_set_error_literal (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY, + _("Cannot set '" NM_SETTING_CONNECTION_MASTER "' without '" NM_SETTING_CONNECTION_SLAVE_TYPE "'")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_SLAVE_TYPE); + return NM_SETTING_VERIFY_ERROR; } } @@ -1103,13 +1106,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ID, - g_param_spec_string (NM_SETTING_CONNECTION_ID, - "ID", - "User-readable connection identifier/name. Must be " - "one or more characters and may change over the lifetime " - "of the connection if the user decides to rename it.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_string (NM_SETTING_CONNECTION_ID, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:uuid: @@ -1129,20 +1130,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_UUID, - g_param_spec_string (NM_SETTING_CONNECTION_UUID, - "UUID", - "Universally unique connection identifier. Must be " - "in the format '2815492f-7e56-435e-b2e9-246bd7cdc664' " - "(ie, contains only hexadecimal characters and '-'). " - "The UUID should be assigned when the connection is " - "created and never changed as long as the connection " - "still applies to the same network. For example, " - "it should not be changed when the user changes the " - "connection's 'id', but should be recreated when the " - "Wi-Fi SSID, mobile broadband network provider, or the " - "connection type changes.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_string (NM_SETTING_CONNECTION_UUID, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:interface-name: @@ -1151,6 +1143,8 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * set, then the connection can be attached to any interface of the * appropriate type (subject to restrictions imposed by other settings). * + * For software devices this specifies the name of the created device. + * * For connection types where interface names cannot easily be made * persistent (e.g. mobile broadband or USB Ethernet), this property should * not be used. Setting this property restricts the interfaces a connection @@ -1161,21 +1155,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_CONNECTION_INTERFACE_NAME, - "Interface name", - "Interface name this connection is bound to. " - "If not set, then the connection can be attached " - "to any interface of the appropriate type (subject " - "to restrictions imposed by other settings). For " - "connection types where interface names cannot easily " - "be made persistent (e.g. mobile broadband or USB " - "Ethernet), this property should not be used. Setting " - "this property restricts the interfaces a connection can " - "be used with, and if interface names change or are " - "reordered the connection may be applied to the wrong " - "interface.", + g_param_spec_string (NM_SETTING_CONNECTION_INTERFACE_NAME, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:type: @@ -1188,21 +1172,15 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_TYPE, - g_param_spec_string (NM_SETTING_CONNECTION_TYPE, - "Type", - "Base type of the connection. For hardware-dependent " - "connections, should contain the setting name of the " - "hardware-type specific setting (ie, '802-3-ethernet' " - "or '802-11-wireless' or 'bluetooth', etc), and for " - "non-hardware dependent connections like VPN or " - "otherwise, should contain the setting name of that " - "setting type (ie, 'vpn' or 'bridge', etc).", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_CONNECTION_TYPE, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:permissions: - * + * * An array of strings defining what access a given user has to this * connection. If this is %NULL or empty, all users are allowed to access * this connection. Otherwise a user is allowed to access this connection @@ -1217,25 +1195,10 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) */ g_object_class_install_property (object_class, PROP_PERMISSIONS, - _nm_param_spec_specialized (NM_SETTING_CONNECTION_PERMISSIONS, - "Permissions", - "An array of strings defining what access a given " - "user has to this connection. If this is NULL or " - "empty, all users are allowed to access this " - "connection. Otherwise a user is allowed to access " - "this connection if and only if they are in this " - "array. Each entry is of the form " - "\"[type]:[id]:[reserved]\", for example: " - "\"user:dcbw:blah\" At this time only the 'user' " - "[type] is allowed. Any other values are ignored and " - "reserved for future use. [id] is the username that " - "this permission refers to, which may not contain the " - "':' character. Any [reserved] information (if " - "present) must be ignored and is reserved for future " - "use. All of [type], [id], and [reserved] must be " - "valid UTF-8.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_CONNECTION_PERMISSIONS, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:autoconnect: @@ -1247,14 +1210,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_AUTOCONNECT, - g_param_spec_boolean (NM_SETTING_CONNECTION_AUTOCONNECT, - "Autoconnect", - "If TRUE, NetworkManager will activate this connection " - "when its network resources are available. If FALSE, " - "the connection must be manually activated by the user " - "or some other mechanism.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_boolean (NM_SETTING_CONNECTION_AUTOCONNECT, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:timestamp: @@ -1269,16 +1230,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_TIMESTAMP, - g_param_spec_uint64 (NM_SETTING_CONNECTION_TIMESTAMP, - "Timestamp", - "Timestamp (in seconds since the Unix Epoch) that the " - "connection was last successfully activated. NetworkManager " - "updates the connection timestamp periodically when the " - "connection is active to ensure that an active connection " - "has the latest timestamp. The property is only meant for " - "reading (changes to this property will not be preserved).", + g_param_spec_uint64 (NM_SETTING_CONNECTION_TIMESTAMP, "", "", 0, G_MAXUINT64, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:read-only: @@ -1288,15 +1245,13 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * connection is read-only and cannot be modified. **/ g_object_class_install_property - (object_class, PROP_READ_ONLY, - g_param_spec_boolean (NM_SETTING_CONNECTION_READ_ONLY, - "Read-Only", - "If TRUE, the connection is read-only and cannot be " - "changed by the user or any other mechanism. This is " - "normally set for system connections whose plugin " - "cannot yet write updated connections back out.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + (object_class, PROP_READ_ONLY, + g_param_spec_boolean (NM_SETTING_CONNECTION_READ_ONLY, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:zone: @@ -1308,16 +1263,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ZONE, - g_param_spec_string (NM_SETTING_CONNECTION_ZONE, - "Zone", - "The trust level of a the connection." - "Free form case-insensitive string (for example " - "\"Home\", \"Work\", \"Public\"). NULL or " - "unspecified zone means the connection will be " - "placed in the default zone as defined by the " - "firewall.", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_string (NM_SETTING_CONNECTION_ZONE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:master: @@ -1326,12 +1277,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MASTER, - g_param_spec_string (NM_SETTING_CONNECTION_MASTER, - "Master", - "Interface name of the master device or UUID of " - "the master connection", + g_param_spec_string (NM_SETTING_CONNECTION_MASTER, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:slave-type: @@ -1342,13 +1293,12 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SLAVE_TYPE, - g_param_spec_string (NM_SETTING_CONNECTION_SLAVE_TYPE, - "Slave-Type", - "Setting name describing the type of slave " - "this connection is (ie, 'bond') or NULL if this " - "connection is not a slave.", + g_param_spec_string (NM_SETTING_CONNECTION_SLAVE_TYPE, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:secondaries: @@ -1361,13 +1311,11 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SECONDARIES, - _nm_param_spec_specialized (NM_SETTING_CONNECTION_SECONDARIES, - "Secondaries", - "List of connection UUIDs that should be activated " - "when the base connection itself is activated. " - "Currently only VPN connections are supported.", + _nm_param_spec_specialized (NM_SETTING_CONNECTION_SECONDARIES, "", "", DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingConnection:gateway-ping-timeout: @@ -1379,11 +1327,9 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) **/ g_object_class_install_property (object_class, PROP_GATEWAY_PING_TIMEOUT, - g_param_spec_uint (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, - "Gateway Ping Timeout", - "If greater than zero, delay success of IP " - "addressing until either the timeout is reached, or " - "an IP gateway replies to a ping.", + g_param_spec_uint (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, "", "", 0, 30, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-connection.h b/libnm-util/nm-setting-connection.h index ff2af7a2c..143fa11d5 100644 --- a/libnm-util/nm-setting-connection.h +++ b/libnm-util/nm-setting-connection.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_CONNECTION_H @@ -136,7 +133,7 @@ gboolean nm_setting_connection_remove_permission_by_value (NMSettingConnectio const char *nm_setting_connection_get_master (NMSettingConnection *setting); gboolean nm_setting_connection_is_slave_type (NMSettingConnection *setting, - const char *type); + const char *type); const char *nm_setting_connection_get_slave_type (NMSettingConnection *setting); guint32 nm_setting_connection_get_num_secondaries (NMSettingConnection *setting); diff --git a/libnm-util/nm-setting-dcb.c b/libnm-util/nm-setting-dcb.c index 54b115dd4..2376581e7 100644 --- a/libnm-util/nm-setting-dcb.c +++ b/libnm-util/nm-setting-dcb.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * * 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 @@ -18,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2013 Red Hat, Inc. + * Copyright 2013 Red Hat, Inc. */ +#include "config.h" + #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-dcb.h" #include "nm-param-spec-specialized.h" @@ -969,13 +969,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_FCOE_FLAGS, - g_param_spec_uint (NM_SETTING_DCB_APP_FCOE_FLAGS, - "App FCoE Flags", - "Specifies the flags for the DCB FCoE application. " - "Flags may be any combination of 0x1 (enable), 0x2 " - "(advertise), and 0x4 (willing).", + g_param_spec_uint (NM_SETTING_DCB_APP_FCOE_FLAGS, "", "", 0, DCB_FLAGS_ALL, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-fcoe-priority: @@ -988,14 +985,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_FCOE_PRIORITY, - g_param_spec_int (NM_SETTING_DCB_APP_FCOE_PRIORITY, - "App FCoE Priority", - "The highest User Priority (0 - 7) which FCoE " - "frames should use, or -1 for default priority. Only " - "used when the 'app-fcoe-flags' property includes " - "the 'enabled' flag.", + g_param_spec_int (NM_SETTING_DCB_APP_FCOE_PRIORITY, "", "", -1, 7, -1, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-fcoe-mode: @@ -1007,12 +1001,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_FCOE_MODE, - g_param_spec_string (NM_SETTING_DCB_APP_FCOE_MODE, - "App FCoE Mode", - "The FCoe controller mode; either 'fabric' (default) " - "or 'vn2vn'.", + g_param_spec_string (NM_SETTING_DCB_APP_FCOE_MODE, "", "", NM_SETTING_DCB_FCOE_MODE_FABRIC, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-iscsi-flags: @@ -1025,13 +1018,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_ISCSI_FLAGS, - g_param_spec_uint (NM_SETTING_DCB_APP_ISCSI_FLAGS, - "App iSCSI Flags", - "Specifies the flags for the DCB iSCSI application. " - "Flags may be any combination of 0x1 (enable), 0x2 " - "(advertise), and 0x4 (willing).", + g_param_spec_uint (NM_SETTING_DCB_APP_ISCSI_FLAGS, "", "", 0, DCB_FLAGS_ALL, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-iscsi-priority: @@ -1044,14 +1034,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_ISCSI_PRIORITY, - g_param_spec_int (NM_SETTING_DCB_APP_ISCSI_PRIORITY, - "App iSCSI Priority", - "The highest User Priority (0 - 7) which iSCSI " - "frames should use, or -1 for default priority. Only " - "used when the 'app-iscsi-flags' property includes " - "the 'enabled' flag.", + g_param_spec_int (NM_SETTING_DCB_APP_ISCSI_PRIORITY, "", "", -1, 7, -1, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-fip-flags: @@ -1064,13 +1051,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_FIP_FLAGS, - g_param_spec_uint (NM_SETTING_DCB_APP_FIP_FLAGS, - "App FIP Flags", - "Specifies the flags for the DCB FIP application. " - "Flags may be any combination of 0x1 (enable), 0x2 " - "(advertise), and 0x4 (willing).", + g_param_spec_uint (NM_SETTING_DCB_APP_FIP_FLAGS, "", "", 0, DCB_FLAGS_ALL, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:app-fip-priority: @@ -1083,14 +1067,11 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APP_FIP_PRIORITY, - g_param_spec_int (NM_SETTING_DCB_APP_FIP_PRIORITY, - "App FIP Priority", - "The highest User Priority (0 - 7) which FIP " - "frames should use, or -1 for default priority. Only " - "used when the 'app-fip-flags' property includes " - "the 'enabled' flag.", + g_param_spec_int (NM_SETTING_DCB_APP_FIP_PRIORITY, "", "", -1, 7, -1, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-flow-control-flags: @@ -1103,13 +1084,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PFC_FLAGS, - g_param_spec_uint (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, - "Priority Flow Control Flags", - "Specifies the flags for DCB Priority Flow Control. " - "Flags may be any combination of 0x1 (enable), 0x2 " - "(advertise), and 0x4 (willing).", + g_param_spec_uint (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, "", "", 0, DCB_FLAGS_ALL, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-flow-control: @@ -1123,16 +1101,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PFC, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL, - "Priority Flow Control", - "An array of 8 uint values, where the array index " - "corresponds to the User Priority (0 - 7) and the " - "value indicates whether or not the corresponding " - "priority should transmit priority pause. Allowed " - "values are 0 (do not transmit pause) and 1 " - "(transmit pause).", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-group-flags: @@ -1145,13 +1117,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_GROUP_FLAGS, - g_param_spec_uint (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, - "Priority Group Flags", - "Specifies the flags for DCB Priority Groups. " - "Flags may be any combination of 0x1 (enable), 0x2 " - "(advertise), and 0x4 (willing).", + g_param_spec_uint (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, "", "", 0, DCB_FLAGS_ALL, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-group-id: @@ -1164,15 +1133,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_GROUP_ID, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_GROUP_ID, - "Priority Group ID", - "An array of 8 uint values, where the array " - "index corresponds to the User Priority (0 - 7) " - "and the value indicates the Priority Group ID. " - "Allowed Priority Group ID values are 0 - 7 or " - "15 for the unrestricted group.", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_GROUP_ID, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-group-bandwidth: @@ -1186,15 +1150,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_GROUP_BANDWIDTH, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH, - "Priority Group Bandwidth", - "An array of 8 uint values, where the array index " - "corresponds to the Priority Group ID (0 - 7) and " - "the value indicates the percentage of link bandwidth " - "allocated to that group. Allowed values are 0 - 100, " - "and the sum of all values must total 100 percent.", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-bandwidth: @@ -1209,16 +1168,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_BANDWIDTH, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_BANDWIDTH, - "Priority Bandwidth", - "An array of 8 uint values, where the array index " - "corresponds to the User Priority (0 - 7) and the " - "value indicates the percentage of bandwidth of " - "the priority's assigned group that the priority may " - "use. The sum of all percentages for priorities which " - "belong to the same group must total 100 percent.", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_BANDWIDTH, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-strict-bandwidth: @@ -1233,17 +1186,10 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_STRICT, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH, - "Priority Strict Bandwidth", - "An array of 8 uint values, where the array index " - "corresponds to the User Priority (0 - 7) and the " - "value indicates whether or not the priority may " - "use all of the bandwidth allocated to its assigned " - "group. Allowed values are 0 (the priority may not " - "utilize all bandwidth) or 1 (the priority may " - "utilize all bandwidth).", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingDcb:priority-traffic-class: @@ -1256,13 +1202,8 @@ nm_setting_dcb_class_init (NMSettingDcbClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PRIORITY_TRAFFIC_CLASS, - _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS, - "Priority Traffic Class", - "An array of 8 uint values, where the array index " - "corresponds to the User Priority (0 - 7) and the " - "value indicates the traffic class (0 - 7) to which " - "the priority is mapped.", + _nm_param_spec_specialized (NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS, "", "", DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm-util/nm-setting-dcb.h b/libnm-util/nm-setting-dcb.h index 37dd36e7b..ac34521e0 100644 --- a/libnm-util/nm-setting-dcb.h +++ b/libnm-util/nm-setting-dcb.h @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * * 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 @@ -18,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2013 Red Hat, Inc. + * Copyright 2013 Red Hat, Inc. */ #ifndef NM_SETTING_DCB_H diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c index f96a997b8..a17d18b7e 100644 --- a/libnm-util/nm-setting-gsm.c +++ b/libnm-util/nm-setting-gsm.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-gsm.h" #include "nm-utils.h" @@ -424,7 +423,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingGsmPrivate *priv = NM_SETTING_GSM_GET_PRIVATE (object); char *tmp; @@ -483,7 +482,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingGsm *setting = NM_SETTING_GSM (object); @@ -554,16 +553,10 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NUMBER, - g_param_spec_string (NM_SETTING_GSM_NUMBER, - "Number", - "Number to dial when establishing a PPP data session " - "with the GSM-based mobile broadband network. Many " - "modems do not require PPP for connections to the " - "mobile network and thus this property should be left " - "blank, which allows NetworkManager to select the " - "appropriate settings automatically.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_GSM_NUMBER, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:username: @@ -574,13 +567,10 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_USERNAME, - g_param_spec_string (NM_SETTING_GSM_USERNAME, - "Username", - "Username used to authenticate with the network, if " - "required. Note that many providers do not require " - "a username or accept any username.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_GSM_USERNAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:password: @@ -591,27 +581,25 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD, - g_param_spec_string (NM_SETTING_GSM_PASSWORD, - "Password", - "Password used to authenticate with the network, if " - "required. Note that many providers do not require " - "a password or accept any password.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_GSM_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:password-flags: * * Flags indicating how to handle the #NMSettingGsm:password property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_GSM_PASSWORD_FLAGS, - "Password Flags", - "Flags indicating how to handle the GSM password.", + g_object_class_install_property + (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_GSM_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:apn: @@ -626,19 +614,10 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_APN, - g_param_spec_string (NM_SETTING_GSM_APN, - "APN", - "The GPRS Access Point Name specifying the APN used " - "when establishing a data session with the GSM-based " - "network. The APN often determines how the user will " - "be billed for their network usage and whether the " - "user has access to the Internet or just a provider-" - "specific walled-garden, so it is important to use " - "the correct APN for the user's mobile broadband " - "plan. The APN may only be composed of the characters " - "a-z, 0-9, ., and - per GSM 03.60 Section 14.9.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_GSM_APN, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:network-id: @@ -651,17 +630,10 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NETWORK_ID, - g_param_spec_string (NM_SETTING_GSM_NETWORK_ID, - "Network ID", - "The Network ID (GSM LAI format, ie MCC-MNC) to force " - "specific network registration. If the Network ID is " - "specified, NetworkManager will attempt to force the " - "device to register only on the specified network. " - "This can be used to ensure that the device does not " - "roam when direct roaming control of the device is " - "not otherwise possible.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_GSM_NETWORK_ID, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:network-type: @@ -681,19 +653,13 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NETWORK_TYPE, - g_param_spec_int (NM_SETTING_GSM_NETWORK_TYPE, - "Network type", - "Network preference to force the device to only use " - "specific network technologies. The permitted values " - "are: -1: any, 0: 3G only, 1: GPRS/EDGE only, " - "2: prefer 3G, 3: prefer 2G, 4: prefer 4G/LTE, 5: 4G/LTE only. " - "Notes: This property is deprecated and NetworkManager from 0.9.10 " - "onwards doesn't use this property when talking to ModemManager." - "Also, not all devices allow network preference control.", + g_param_spec_int (NM_SETTING_GSM_NETWORK_TYPE, "", "", NM_SETTING_GSM_NETWORK_TYPE_ANY, NM_SETTING_GSM_NETWORK_TYPE_4G, NM_SETTING_GSM_NETWORK_TYPE_ANY, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:allowed-bands: @@ -707,16 +673,13 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ALLOWED_BANDS, - g_param_spec_uint (NM_SETTING_GSM_ALLOWED_BANDS, - "Allowed Bands", - "Bitfield of allowed frequency bands." - "Notes: This property is deprecated and NetworkManager from 0.9.10 " - "onwards doesn't use this property when talking to ModemManager." - "Also, not all devices allow frequency band control.", + g_param_spec_uint (NM_SETTING_GSM_ALLOWED_BANDS, "", "", NM_SETTING_GSM_BAND_UNKNOWN, NM_SETTING_GSM_BANDS_MAX, NM_SETTING_GSM_BAND_ANY, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:pin: @@ -727,27 +690,25 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PIN, - g_param_spec_string (NM_SETTING_GSM_PIN, - "PIN", - "If the SIM is locked with a PIN it must be unlocked " - "before any other operations are requested. Specify " - "the PIN here to allow operation of the device.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_GSM_PIN, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:pin-flags: * * Flags indicating how to handle the #NMSettingGsm:pin property. **/ - g_object_class_install_property (object_class, PROP_PIN_FLAGS, - g_param_spec_uint (NM_SETTING_GSM_PIN_FLAGS, - "PIN Flags", - "Flags indicating how to handle the GSM SIM PIN.", + g_object_class_install_property + (object_class, PROP_PIN_FLAGS, + g_param_spec_uint (NM_SETTING_GSM_PIN_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingGsm:home-only: @@ -757,11 +718,8 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class) **/ g_object_class_install_property (object_class, PROP_HOME_ONLY, - g_param_spec_boolean (NM_SETTING_GSM_HOME_ONLY, - "Home Only", - "When TRUE, only connections to the home network will " - "be allowed. Connections to roaming networks will " - "not be made.", - FALSE, - G_PARAM_READWRITE)); + g_param_spec_boolean (NM_SETTING_GSM_HOME_ONLY, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-gsm.h b/libnm-util/nm-setting-gsm.h index 6d8e46d0a..564a8b4b9 100644 --- a/libnm-util/nm-setting-gsm.h +++ b/libnm-util/nm-setting-gsm.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_GSM_H diff --git a/libnm-util/nm-setting-infiniband.c b/libnm-util/nm-setting-infiniband.c index 5af504483..1036702fe 100644 --- a/libnm-util/nm-setting-infiniband.c +++ b/libnm-util/nm-setting-infiniband.c @@ -19,10 +19,12 @@ * Copyright 2011 - 2013 Red Hat, Inc. */ +#include "config.h" + #include <stdlib.h> #include <dbus/dbus-glib.h> #include <linux/if_infiniband.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-infiniband.h" #include "nm-param-spec-specialized.h" @@ -194,6 +196,7 @@ get_virtual_iface_name (NMSetting *setting) static gboolean verify (NMSetting *setting, GSList *all_settings, GError **error) { + NMSettingConnection *s_con; NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (setting); if (priv->mac_address && priv->mac_address->len != INFINIBAND_ALEN) { @@ -205,6 +208,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } + /* FIXME: verify() should not modify the setting, but return NORMALIZABLE success. */ if (!g_strcmp0 (priv->transport_mode, "datagram")) { if (priv->mtu > 2044) priv->mtu = 2044; @@ -249,6 +253,45 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } } + s_con = NM_SETTING_CONNECTION (nm_setting_find_in_list (all_settings, NM_SETTING_CONNECTION_SETTING_NAME)); + if (s_con) { + const char *interface_name = nm_setting_connection_get_interface_name (s_con); + + if (!interface_name) + ; + else if (!nm_utils_iface_valid_name (interface_name)) { + /* report the error for NMSettingConnection:interface-name, because + * it's that property that is invalid -- although we currently verify() + * NMSettingInfiniband. + **/ + g_set_error (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, + _("'%s' is not a valid interface name"), + interface_name); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); + return FALSE; + } else { + if (priv->p_key != -1) { + if (!priv->virtual_iface_name) + priv->virtual_iface_name = g_strdup_printf ("%s.%04x", priv->parent, priv->p_key); + + if (strcmp (interface_name, priv->virtual_iface_name) != 0) { + /* We don't support renaming software infiniband devices. Later we might, but + * for now just reject such connections. + **/ + g_set_error (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, + _("interface name of software infiniband device must be '%s' or unset (instead it is '%s')"), + priv->virtual_iface_name, interface_name); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); + return FALSE; + } + } + } + } + return TRUE; } @@ -359,14 +402,11 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_INFINIBAND_MAC_ADDRESS, - "Device MAC Address", - "If specified, this connection will only apply to " - "the IPoIB device whose permanent MAC address matches. " - "This property does not change the MAC address " - "of the device (i.e. MAC spoofing).", + _nm_param_spec_specialized (NM_SETTING_INFINIBAND_MAC_ADDRESS, "", "", DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingInfiniband:mtu: @@ -376,13 +416,12 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MTU, - g_param_spec_uint (NM_SETTING_INFINIBAND_MTU, - "MTU", - "If non-zero, only transmit packets of the specified " - "size or smaller, breaking larger packets up into " - "multiple frames.", + g_param_spec_uint (NM_SETTING_INFINIBAND_MTU, "", "", 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingInfiniband:transport-mode: @@ -392,11 +431,12 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class) **/ g_object_class_install_property (object_class, PROP_TRANSPORT_MODE, - g_param_spec_string (NM_SETTING_INFINIBAND_TRANSPORT_MODE, - "Transport Mode", - "The IPoIB transport mode. Either 'datagram' or 'connected'.", + g_param_spec_string (NM_SETTING_INFINIBAND_TRANSPORT_MODE, "", "", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingInfiniband:p-key: @@ -408,12 +448,12 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class) **/ g_object_class_install_property (object_class, PROP_P_KEY, - g_param_spec_int (NM_SETTING_INFINIBAND_P_KEY, - "P_Key", - "The InfiniBand P_Key. Either -1 for the " - "default, or a 16-bit unsigned integer.", + g_param_spec_int (NM_SETTING_INFINIBAND_P_KEY, "", "", -1, 0xFFFF, -1, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingInfiniband:parent: @@ -425,10 +465,11 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PARENT, - g_param_spec_string (NM_SETTING_INFINIBAND_PARENT, - "Parent", - "The interface name of the parent device, or NULL", + g_param_spec_string (NM_SETTING_INFINIBAND_PARENT, "", "", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index a2c104d53..532231ab4 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,13 +16,15 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-ip4-config.h" #include "nm-param-spec-specialized.h" @@ -78,8 +77,8 @@ typedef struct { GArray *dns; /* array of guint32; elements in network byte order */ GSList *dns_search; /* list of strings */ GSList *addresses; /* array of NMIP4Address */ - GSList *address_labels; /* list of strings */ GSList *routes; /* array of NMIP4Route */ + gint64 route_metric; gboolean ignore_auto_routes; gboolean ignore_auto_dns; char *dhcp_client_id; @@ -95,8 +94,8 @@ enum { PROP_DNS, PROP_DNS_SEARCH, PROP_ADDRESSES, - PROP_ADDRESS_LABELS, PROP_ROUTES, + PROP_ROUTE_METRIC, PROP_IGNORE_AUTO_ROUTES, PROP_IGNORE_AUTO_DNS, PROP_DHCP_CLIENT_ID, @@ -442,19 +441,6 @@ nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i) return (NMIP4Address *) g_slist_nth_data (priv->addresses, i); } -const char * -nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting, guint32 i) -{ - NMSettingIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL); - - priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - g_return_val_if_fail (i <= g_slist_length (priv->address_labels), NULL); - - return (const char *) g_slist_nth_data (priv->address_labels, i); -} - /** * nm_setting_ip4_config_add_address: * @setting: the #NMSettingIP4Config @@ -470,14 +456,6 @@ gboolean nm_setting_ip4_config_add_address (NMSettingIP4Config *setting, NMIP4Address *address) { - return nm_setting_ip4_config_add_address_with_label (setting, address, NULL); -} - -gboolean -nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting, - NMIP4Address *address, - const char *label) -{ NMSettingIP4ConfigPrivate *priv; NMIP4Address *copy; GSList *iter; @@ -493,8 +471,6 @@ nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting, copy = nm_ip4_address_dup (address); priv->addresses = g_slist_append (priv->addresses, copy); - priv->address_labels = g_slist_append (priv->address_labels, g_strdup (label)); - g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); return TRUE; } @@ -510,21 +486,16 @@ void nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i) { NMSettingIP4ConfigPrivate *priv; - GSList *addr, *label; + GSList *elt; g_return_if_fail (NM_IS_SETTING_IP4_CONFIG (setting)); priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - addr = g_slist_nth (priv->addresses, i); - label = g_slist_nth (priv->address_labels, i); - g_return_if_fail (addr != NULL && label != NULL); - - nm_ip4_address_unref ((NMIP4Address *) addr->data); - priv->addresses = g_slist_delete_link (priv->addresses, addr); - if (label->data) - g_free (label->data); - priv->address_labels = g_slist_delete_link (priv->address_labels, label); + elt = g_slist_nth (priv->addresses, i); + g_return_if_fail (elt != NULL); + nm_ip4_address_unref ((NMIP4Address *) elt->data); + priv->addresses = g_slist_delete_link (priv->addresses, elt); g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); } @@ -576,8 +547,6 @@ nm_setting_ip4_config_clear_addresses (NMSettingIP4Config *setting) g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref); priv->addresses = NULL; - g_slist_free_full (priv->address_labels, g_free); - priv->address_labels = NULL; g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ADDRESSES); } @@ -724,6 +693,26 @@ nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting) } /** + * nm_setting_ip4_config_get_route_metric: + * @setting: the #NMSettingIP4Config + * + * Returns the value contained in the #NMSettingIP4Config:route-metric + * property. + * + * Returns: the route metric that is used for IPv4 routes that don't explicitly + * specify a metric. See #NMSettingIP4Config:route-metric for more details. + * + * Since: 1.0 + **/ +gint64 +nm_setting_ip4_config_get_route_metric (NMSettingIP4Config *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), -1); + + return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->route_metric; +} + +/** * nm_setting_ip4_config_get_ignore_auto_routes: * @setting: the #NMSettingIP4Config * @@ -850,34 +839,10 @@ nm_setting_ip4_config_get_may_fail (NMSettingIP4Config *setting) } static gboolean -verify_label (const char *label) -{ - const char *p; - char *iface; - - p = strchr (label, ':'); - if (!p) - return FALSE; - iface = g_strndup (label, p - label); - if (!nm_utils_iface_valid_name (iface)) { - g_free (iface); - return FALSE; - } - g_free (iface); - - for (p++; *p; p++) { - if (!g_ascii_isalnum (*p) && *p != '_') - return FALSE; - } - - return TRUE; -} - -static gboolean verify (NMSetting *setting, GSList *all_settings, GError **error) { NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - GSList *iter, *l_iter; + GSList *iter; int i; if (!priv->method) { @@ -964,11 +929,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) } /* Validate addresses */ - for (iter = priv->addresses, l_iter = priv->address_labels, i = 0; - iter && l_iter; - iter = g_slist_next (iter), l_iter = g_slist_next (l_iter), i++) { + for (iter = priv->addresses, i = 0; iter; iter = g_slist_next (iter), i++) { NMIP4Address *addr = (NMIP4Address *) iter->data; - const char *label = (const char *) l_iter->data; guint32 prefix = nm_ip4_address_get_prefix (addr); if (!nm_ip4_address_get_address (addr)) { @@ -990,27 +952,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES); return FALSE; } - - if (label && !verify_label (label)) { - g_set_error (error, - NM_SETTING_IP4_CONFIG_ERROR, - NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY, - _("%d. IPv4 address has invalid label '%s'"), - i+1, label); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, "address-labels"); - return FALSE; - } - } - - if (iter || l_iter) { - g_set_error (error, - NM_SETTING_IP4_CONFIG_ERROR, - NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY, - _("IPv4 address / label count mismatch (%d vs %d)"), - g_slist_length (priv->addresses), - g_slist_length (priv->address_labels)); - g_prefix_error (error, "%s.%s: ", NM_SETTING_IP4_CONFIG_SETTING_NAME, "address-labels"); - return FALSE; } /* Validate routes */ @@ -1066,7 +1007,6 @@ finalize (GObject *object) g_slist_free_full (priv->dns_search, g_free); g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref); - g_slist_free_full (priv->address_labels, g_free); g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref); G_OBJECT_CLASS (nm_setting_ip4_config_parent_class)->finalize (object); @@ -1074,11 +1014,10 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object); NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); - GSList *iter; switch (prop_id) { case PROP_METHOD: @@ -1098,29 +1037,14 @@ set_property (GObject *object, guint prop_id, case PROP_ADDRESSES: g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref); priv->addresses = nm_utils_ip4_addresses_from_gvalue (value); - - if (g_slist_length (priv->addresses) != g_slist_length (priv->address_labels)) { - g_slist_free_full (priv->address_labels, g_free); - priv->address_labels = NULL; - for (iter = priv->addresses; iter; iter = iter->next) - priv->address_labels = g_slist_prepend (priv->address_labels, NULL); - } - break; - case PROP_ADDRESS_LABELS: - g_slist_free_full (priv->address_labels, g_free); - priv->address_labels = g_value_dup_boxed (value); - /* NULLs get converted to "" when this is sent over D-Bus. */ - for (iter = priv->address_labels; iter; iter = iter->next) { - if (!g_strcmp0 (iter->data, "")) { - g_free (iter->data); - iter->data = NULL; - } - } break; case PROP_ROUTES: g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref); priv->routes = nm_utils_ip4_routes_from_gvalue (value); break; + case PROP_ROUTE_METRIC: + priv->route_metric = g_value_get_int64 (value); + break; case PROP_IGNORE_AUTO_ROUTES: priv->ignore_auto_routes = g_value_get_boolean (value); break; @@ -1152,7 +1076,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object); NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); @@ -1170,12 +1094,12 @@ get_property (GObject *object, guint prop_id, case PROP_ADDRESSES: nm_utils_ip4_addresses_to_gvalue (priv->addresses, value); break; - case PROP_ADDRESS_LABELS: - g_value_set_boxed (value, priv->address_labels); - break; case PROP_ROUTES: nm_utils_ip4_routes_to_gvalue (priv->routes, value); break; + case PROP_ROUTE_METRIC: + g_value_set_int64 (value, priv->route_metric); + break; case PROP_IGNORE_AUTO_ROUTES: g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_routes (setting)); break; @@ -1236,27 +1160,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_METHOD, - g_param_spec_string (NM_SETTING_IP4_CONFIG_METHOD, - "Method", - "IPv4 configuration method. If 'auto' is specified " - "then the appropriate automatic method (DHCP, PPP, " - "etc) is used for the interface and most other " - "properties can be left unset. If 'link-local' " - "is specified, then a link-local address in the " - "169.254/16 range will be assigned to the " - "interface. If 'manual' is specified, static IP " - "addressing is used and at least one IP address " - "must be given in the 'addresses' property. If " - "'shared' is specified (indicating that this " - "connection will provide network access to other " - "computers) then the interface is assigned an " - "address in the 10.42.x.1/24 range and a DHCP and " - "forwarding DNS server are started, and the " - "interface is NAT-ed to the current default network " - "connection. 'disabled' means IPv4 will not be " - "used on this connection. This property must be set.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_IP4_CONFIG_METHOD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:dns: @@ -1270,18 +1178,10 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DNS, - _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS, - "DNS", - "List of DNS servers (network byte order). For " - "the 'auto' method, these DNS servers are " - "appended to those (if any) returned by automatic " - "configuration. DNS servers cannot be used with " - "the 'shared', 'link-local', or 'disabled' " - "methods as there is no upstream network. In all " - "other methods, these DNS servers are used as the " - "only DNS servers for this connection.", - DBUS_TYPE_G_UINT_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS, "", "", + DBUS_TYPE_G_UINT_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:dns-search: @@ -1294,18 +1194,10 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DNS_SEARCH, - _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS_SEARCH, - "DNS search", - "List of DNS search domains. For the 'auto' " - "method, these search domains are appended to " - "those returned by automatic configuration. " - "Search domains cannot be used with the 'shared', " - "'link-local', or 'disabled' methods as there is " - "no upstream network. In all other methods, these " - "search domains are used as the only search domains " - "for this connection.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_DNS_SEARCH, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:addresses: @@ -1321,35 +1213,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ADDRESSES, - _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ADDRESSES, - "Addresses", - "Array of IPv4 address structures. Each IPv4 " - "address structure is composed of 3 32-bit values; " - "the first being the IPv4 address (network byte " - "order), the second the prefix (1 - 32), and " - "last the IPv4 gateway (network byte order). The " - "gateway may be left as 0 if no gateway exists " - "for that subnet. For the 'auto' method, given " - "IP addresses are appended to those returned by " - "automatic configuration. Addresses cannot be " - "used with the 'shared', 'link-local', or " - "'disabled' methods as addressing is either " - "automatic or disabled with these methods.", - DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); - - /** - * NMSettingIP4Config:address-labels: - * - * Internal use only. - **/ - g_object_class_install_property - (object_class, PROP_ADDRESS_LABELS, - _nm_param_spec_specialized ("address-labels", - "Address labels", - "Internal use only", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ADDRESSES, "", "", + DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:routes: @@ -1365,22 +1233,33 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ROUTES, - _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ROUTES, - "Routes", - "Array of IPv4 route structures. Each IPv4 route " - "structure is composed of 4 32-bit values; the " - "first being the destination IPv4 network or " - "address (network byte order), the second the " - "destination network or address prefix (1 - 32), " - "the third being the next-hop (network byte order) " - "if any, and the fourth being the route metric. " - "For the 'auto' method, given IP routes are " - "appended to those returned by automatic " - "configuration. Routes cannot be used with the " - "'shared', 'link-local', or 'disabled', methods " - "as there is no upstream network.", - DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ROUTES, "", "", + DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIP4Config:route-metric: + * + * The default metric for routes that don't explicitly specify a metric. + * The default value -1 means that the metric is choosen automatically + * based on the device type. + * The metric applies to dynamic routes, manual (static) routes that + * don't have an explicit metric setting, address prefix routes, and + * the default route. + * As the linux kernel accepts zero (0) as a valid metric, zero is + * a valid value. + * + * Since: 1.0 + **/ + g_object_class_install_property + (object_class, PROP_ROUTE_METRIC, + g_param_spec_int64 (NM_SETTING_IP4_CONFIG_ROUTE_METRIC, "", "", + -1, G_MAXUINT32, -1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:ignore-auto-routes: @@ -1391,14 +1270,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IGNORE_AUTO_ROUTES, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, - "Ignore automatic routes", - "When the method is set to 'auto' and this property " - "to TRUE, automatically configured routes are " - "ignored and only routes specified in the 'routes' " - "property, if any, are used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:ignore-auto-dns: @@ -1411,15 +1287,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IGNORE_AUTO_DNS, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, - "Ignore automatic DNS", - "When the method is set to 'auto' and this property " - "to TRUE, automatically configured nameservers and " - "search domains are ignored and only nameservers and " - "search domains specified in the 'dns' and 'dns-search' " - "properties, if any, are used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:dhcp-client-id: @@ -1429,13 +1301,10 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DHCP_CLIENT_ID, - g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, - "DHCP Client ID", - "A string sent to the DHCP server to identify the " - "local machine which the DHCP server may use to " - "customize the DHCP lease and options.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:dhcp-send-hostname: @@ -1448,17 +1317,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DHCP_SEND_HOSTNAME, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, - "Send DHCP hostname", - "If TRUE, a hostname is sent to the DHCP server when " - "acquiring a lease. Some DHCP servers use this " - "hostname to update DNS databases, essentially " - "providing a static hostname for the computer. If " - "the 'dhcp-hostname' property is empty and this " - "property is TRUE, the current persistent hostname " - "of the computer is sent.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:dhcp-hostname: @@ -1468,13 +1331,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DHCP_HOSTNAME, - g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, - "DHCP Hostname", - "If the 'dhcp-send-hostname' property is TRUE, then " - "the specified name will be sent to the DHCP server " - "when acquiring a lease.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:never-default: @@ -1484,13 +1345,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NEVER_DEFAULT, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, - "Never default", - "If TRUE, this connection will never be the default " - "IPv4 connection, meaning it will never be assigned " - "the default route by NetworkManager.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP4Config:may-fail: @@ -1504,18 +1363,11 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAY_FAIL, - g_param_spec_boolean (NM_SETTING_IP4_CONFIG_MAY_FAIL, - "May Fail", - "If TRUE, allow overall network configuration to " - "proceed even if IPv4 configuration times out. " - "Note that at least one IP configuration must " - "succeed or overall network configuration will still " - "fail. For example, in IPv6-only networks, setting " - "this property to TRUE allows the overall network " - "configuration to succeed if IPv4 configuration " - "fails but IPv6 configuration completes successfully.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP4_CONFIG_MAY_FAIL, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } @@ -1977,4 +1829,3 @@ nm_ip4_route_set_metric (NMIP4Route *route, guint32 metric) route->metric = metric; } - diff --git a/libnm-util/nm-setting-ip4-config.h b/libnm-util/nm-setting-ip4-config.h index 3f0d006bf..6e9a9a227 100644 --- a/libnm-util/nm-setting-ip4-config.h +++ b/libnm-util/nm-setting-ip4-config.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_IP4_CONFIG_H @@ -63,6 +60,7 @@ GQuark nm_setting_ip4_config_error_quark (void); #define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search" #define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses" #define NM_SETTING_IP4_CONFIG_ROUTES "routes" +#define NM_SETTING_IP4_CONFIG_ROUTE_METRIC "route-metric" #define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" #define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" #define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id" @@ -217,6 +215,9 @@ NM_AVAILABLE_IN_0_9_10 gboolean nm_setting_ip4_config_remove_route_by_value (NMSettingIP4Config *setting, NMIP4Route *route); void nm_setting_ip4_config_clear_routes (NMSettingIP4Config *setting); +NM_AVAILABLE_IN_1_0 +gint64 nm_setting_ip4_config_get_route_metric (NMSettingIP4Config *setting); + gboolean nm_setting_ip4_config_get_ignore_auto_routes (NMSettingIP4Config *setting); gboolean nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting); const char * nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting); diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index b027ee96a..654f04962 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * David Cantrell <dcantrel@redhat.com> - * * 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 @@ -19,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ +#include "config.h" + #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-ip6-config.h" #include "nm-param-spec-specialized.h" @@ -78,6 +77,7 @@ typedef struct { GSList *dns_search; /* list of strings */ GSList *addresses; /* array of NMIP6Address */ GSList *routes; /* array of NMIP6Route */ + gint64 route_metric; gboolean ignore_auto_routes; gboolean ignore_auto_dns; gboolean never_default; @@ -94,6 +94,7 @@ enum { PROP_DNS_SEARCH, PROP_ADDRESSES, PROP_ROUTES, + PROP_ROUTE_METRIC, PROP_IGNORE_AUTO_ROUTES, PROP_IGNORE_AUTO_DNS, PROP_NEVER_DEFAULT, @@ -174,7 +175,7 @@ const struct in6_addr * nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; - + g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); @@ -712,6 +713,26 @@ nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting) } /** + * nm_setting_ip6_config_get_route_metric: + * @setting: the #NMSettingIP6Config + * + * Returns the value contained in the #NMSettingIP6Config:route-metric + * property. + * + * Returns: the route metric that is used for IPv6 routes that don't explicitly + * specify a metric. See #NMSettingIP6Config:route-metric for more details. + * + * Since: 1.0 + **/ +gint64 +nm_setting_ip6_config_get_route_metric (NMSettingIP6Config *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), -1); + + return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->route_metric; +} + +/** * nm_setting_ip6_config_get_ignore_auto_routes: * @setting: the #NMSettingIP6Config * @@ -905,7 +926,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); @@ -930,6 +951,9 @@ set_property (GObject *object, guint prop_id, g_slist_free_full (priv->routes, g_free); priv->routes = nm_utils_ip6_routes_from_gvalue (value); break; + case PROP_ROUTE_METRIC: + priv->route_metric = g_value_get_int64 (value); + break; case PROP_IGNORE_AUTO_ROUTES: priv->ignore_auto_routes = g_value_get_boolean (value); break; @@ -957,7 +981,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (object); @@ -977,6 +1001,9 @@ get_property (GObject *object, guint prop_id, case PROP_ROUTES: nm_utils_ip6_routes_to_gvalue (priv->routes, value); break; + case PROP_ROUTE_METRIC: + g_value_set_int64 (value, priv->route_metric); + break; case PROP_IGNORE_AUTO_ROUTES: g_value_set_boolean (value, priv->ignore_auto_routes); break; @@ -1032,24 +1059,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_METHOD, - g_param_spec_string (NM_SETTING_IP6_CONFIG_METHOD, - "Method", - "IPv6 configuration method. If 'auto' is specified " - "then the appropriate automatic method (PPP, router " - "advertisement, etc) is used for the device and " - "most other properties can be left unset. To force " - "the use of DHCP only, specify 'dhcp'; this method " - "is only valid for Ethernet-based hardware. If " - "'link-local' is specified, then an IPv6 link-local " - "address will be assigned to the interface. If " - "'manual' is specified, static IP addressing is " - "used and at least one IP address must be given in " - " the 'addresses' property. If 'ignore' is " - "specified, IPv6 configuration is not done. This " - "property must be set. Note: the 'shared' method " - "is not yet supported.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_IP6_CONFIG_METHOD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:dhcp-hostname: @@ -1061,12 +1075,10 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DHCP_HOSTNAME, - g_param_spec_string (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, - "DHCP Hostname", - "The specified name will be sent to the DHCP server " - "when acquiring a lease.", + g_param_spec_string (NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, "", "", NULL, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:dns: @@ -1081,20 +1093,10 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DNS, - _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_DNS, - "DNS", - "Array of DNS servers, where each member of the " - "array is a byte array containing the IPv6 address " - "of the DNS server (in network byte order). For " - "the 'auto' method, these DNS servers are " - "appended to those (if any) returned by automatic " - "configuration. DNS servers cannot be used with " - "the 'shared' or 'link-local' methods as there is " - "no usptream network. In all other methods, " - "these DNS servers are used as the only DNS " - "servers for this connection.", - DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_DNS, "", "", + DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:dns-search: @@ -1107,18 +1109,10 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DNS_SEARCH, - _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_DNS_SEARCH, - "DNS search", - "List of DNS search domains. For the 'auto' " - "method, these search domains are appended to " - "those returned by automatic configuration. " - "Search domains cannot be used with the 'shared' " - "or 'link-local' methods as there is no upstream " - "network. In all other methods, these search " - "domains are used as the only search domains for " - "this connection.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_DNS_SEARCH, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:addresses: @@ -1136,25 +1130,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ADDRESSES, - _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_ADDRESSES, - "Addresses", - "Array of IPv6 address structures. Each IPv6 " - "address structure is composed of 3 members, the " - "first being a byte array containing the IPv6 " - "address (network byte order), the second a " - "32-bit integer containing the IPv6 address " - "prefix, and the third a byte array containing " - "the IPv6 address (network byte order) of the " - "gateway associated with this address, if any. " - "If no gateway is given, the third element should " - "be given as all zeros. For the 'auto' method, " - "given IP addresses are appended to those returned " - "by automatic configuration. Addresses cannot be " - "used with the 'shared' or 'link-local' methods " - "as the interface is automatically assigned an " - "address with these methods.", - DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_ADDRESSES, "", "", + DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:routes: @@ -1170,22 +1150,33 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ROUTES, - _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_ROUTES, - "Routes", - "Array of IPv6 route structures. Each IPv6 route " - "structure is composed of 4 members; the first " - "being the destination IPv6 network or address " - "(network byte order) as a byte array, the second " - "the destination network or address IPv6 prefix, " - "the third being the next-hop IPv6 address " - "(network byte order) if any, and the fourth " - "being the route metric. For the 'auto' method, " - "given IP routes are appended to those returned " - "by automatic configuration. Routes cannot be " - "used with the 'shared' or 'link-local' methods " - "because there is no upstream network.", - DBUS_TYPE_G_ARRAY_OF_IP6_ROUTE, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_IP6_CONFIG_ROUTES, "", "", + DBUS_TYPE_G_ARRAY_OF_IP6_ROUTE, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIP6Config:route-metric: + * + * The default metric for routes that don't explicitly specify a metric. + * The default value -1 means that the metric is choosen automatically + * based on the device type. + * The metric applies to dynamic routes, manual (static) routes that + * don't have an explicit metric setting, address prefix routes, and + * the default route. + * As the linux kernel replaces zero (0) by 1024 (user-default), setting + * this property to 0 means effectively setting it to 1024. + * + * Since: 1.0 + **/ + g_object_class_install_property + (object_class, PROP_ROUTE_METRIC, + g_param_spec_int64 (NM_SETTING_IP6_CONFIG_ROUTE_METRIC, "", "", + -1, G_MAXUINT32, -1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:ignore-auto-routes: @@ -1196,14 +1187,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IGNORE_AUTO_ROUTES, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, - "Ignore automatic routes", - "When the method is set to 'auto' or 'dhcp' and this " - "property is set to TRUE, automatically configured " - "routes are ignored and only routes specified in the " - "'routes' property, if any, are used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:ignore-auto-dns: @@ -1216,15 +1204,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IGNORE_AUTO_DNS, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, - "Ignore DHCPv6/RDNSS DNS", - "When the method is set to 'auto' or 'dhcp' and this " - "property is set to TRUE, automatically configured " - "nameservers and search domains are ignored and only " - "nameservers and search domains specified in the 'dns' " - "and 'dns-search' properties, if any, are used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:never-default: @@ -1235,13 +1219,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NEVER_DEFAULT, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, - "Never default", - "If TRUE, this connection will never be the default " - "IPv6 connection, meaning it will never be assigned " - "the default IPv6 route by NetworkManager.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:may-fail: @@ -1255,18 +1237,11 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAY_FAIL, - g_param_spec_boolean (NM_SETTING_IP6_CONFIG_MAY_FAIL, - "May Fail", - "If TRUE, allow overall network configuration to " - "proceed even if IPv6 configuration times out. " - "Note that at least one IP configuration must " - "succeed or overall network configuration will still " - "fail. For example, in IPv4-only networks, setting " - "this property to TRUE allows the overall network " - "configuration to succeed if IPv6 configuration " - "fails but IPv4 configuration completes successfully.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_IP6_CONFIG_MAY_FAIL, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingIP6Config:ip6-privacy: @@ -1281,20 +1256,13 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *setting_class) **/ g_object_class_install_property (object_class, PROP_IP6_PRIVACY, - g_param_spec_int (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, - "Configure IPv6 Privacy", - "Configure IPv6 Privacy Extensions for SLAAC, described " - "in RFC4941. If enabled, it makes the kernel generate " - "a temporary IPv6 address in addition to the public one " - "generated from MAC address via modified EUI-64. This " - "enhances privacy, but could cause problems in some " - "applications, on the other hand. The permitted values " - "are: 0: disabled, 1: enabled (prefer public address), " - "2: enabled (prefer temporary addresses).", + g_param_spec_int (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, "", "", NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } /********************************************************************/ diff --git a/libnm-util/nm-setting-ip6-config.h b/libnm-util/nm-setting-ip6-config.h index d1f4ca842..0a2f00ddc 100644 --- a/libnm-util/nm-setting-ip6-config.h +++ b/libnm-util/nm-setting-ip6-config.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * David Cantrell <dcantrel@redhat.com> - * * 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 @@ -19,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef NM_SETTING_IP6_CONFIG_H @@ -64,6 +61,7 @@ GQuark nm_setting_ip6_config_error_quark (void); #define NM_SETTING_IP6_CONFIG_DNS_SEARCH "dns-search" #define NM_SETTING_IP6_CONFIG_ADDRESSES "addresses" #define NM_SETTING_IP6_CONFIG_ROUTES "routes" +#define NM_SETTING_IP6_CONFIG_ROUTE_METRIC "route-metric" #define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" #define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" #define NM_SETTING_IP6_CONFIG_NEVER_DEFAULT "never-default" @@ -186,7 +184,7 @@ void nm_ip6_route_set_dest (NMIP6Route *route, guint32 nm_ip6_route_get_prefix (NMIP6Route *route); void nm_ip6_route_set_prefix (NMIP6Route *route, - guint32 prefix); + guint32 prefix); const struct in6_addr *nm_ip6_route_get_next_hop (NMIP6Route *route); void nm_ip6_route_set_next_hop (NMIP6Route *route, @@ -248,6 +246,9 @@ gboolean nm_setting_ip6_config_remove_route_by_value (NMSettingIP void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting); gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting); +NM_AVAILABLE_IN_1_0 +gint64 nm_setting_ip6_config_get_route_metric (NMSettingIP6Config *setting); + gboolean nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting); const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting); gboolean nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting); diff --git a/libnm-util/nm-setting-olpc-mesh.c b/libnm-util/nm-setting-olpc-mesh.c index d344fa043..e4b6dae5b 100644 --- a/libnm-util/nm-setting-olpc-mesh.c +++ b/libnm-util/nm-setting-olpc-mesh.c @@ -1,10 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * Daniel Drake <dsd@laptop.org> - * * 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 @@ -20,15 +15,17 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. - * (C) Copyright 2009 One Laptop per Child + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. + * Copyright 2009 One Laptop per Child */ +#include "config.h" + #include <string.h> #include <netinet/ether.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "NetworkManager.h" #include "nm-setting-olpc-mesh.h" @@ -175,7 +172,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingOlpcMeshPrivate *priv = NM_SETTING_OLPC_MESH_GET_PRIVATE (object); @@ -201,7 +198,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingOlpcMesh *setting = NM_SETTING_OLPC_MESH (object); @@ -243,11 +240,11 @@ nm_setting_olpc_mesh_class_init (NMSettingOlpcMeshClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SSID, - _nm_param_spec_specialized (NM_SETTING_OLPC_MESH_SSID, - "SSID", - "SSID of the mesh network to join.", + _nm_param_spec_specialized (NM_SETTING_OLPC_MESH_SSID, "", "", DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingOlpcMesh:channel: @@ -256,11 +253,12 @@ nm_setting_olpc_mesh_class_init (NMSettingOlpcMeshClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CHANNEL, - g_param_spec_uint (NM_SETTING_OLPC_MESH_CHANNEL, - "Channel", - "Channel on which the mesh network to join is located.", + g_param_spec_uint (NM_SETTING_OLPC_MESH_CHANNEL, "", "", 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingOlpcMesh:dhcp-anycast-address: @@ -271,13 +269,8 @@ nm_setting_olpc_mesh_class_init (NMSettingOlpcMeshClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DHCP_ANYCAST_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS, - "Anycast DHCP MAC address", - "Anycast DHCP MAC address used when " - "requesting an IP address via DHCP. The " - "specific anycast address used determines " - "which DHCP server class answers the " - "the request.", + _nm_param_spec_specialized (NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS, "", "", DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-olpc-mesh.h b/libnm-util/nm-setting-olpc-mesh.h index 59c03b485..54b268e2c 100644 --- a/libnm-util/nm-setting-olpc-mesh.h +++ b/libnm-util/nm-setting-olpc-mesh.h @@ -1,10 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * Daniel Drake <dsd@laptop.org> - * * 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 @@ -20,9 +15,9 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. - * (C) Copyright 2009 One Laptop per Child + * Copyright 2007 - 2008 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. + * Copyright 2009 One Laptop per Child */ #ifndef NM_SETTING_OLPC_MESH_H diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c index 237af9c89..a01d3e106 100644 --- a/libnm-util/nm-setting-ppp.c +++ b/libnm-util/nm-setting-ppp.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,11 +16,13 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ -#include <glib/gi18n.h> +#include "config.h" + +#include <glib/gi18n-lib.h> #include "nm-setting-ppp.h" #include "nm-setting-private.h" @@ -417,7 +416,7 @@ nm_setting_ppp_init (NMSettingPPP *setting) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingPPPPrivate *priv = NM_SETTING_PPP_GET_PRIVATE (object); @@ -484,7 +483,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingPPP *setting = NM_SETTING_PPP (object); @@ -572,14 +571,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NOAUTH, - g_param_spec_boolean (NM_SETTING_PPP_NOAUTH, - "NoAuth", - "If TRUE, do not require the other side (usually the " - "PPP server) to authenticate itself to the client. " - "If FALSE, require authentication from the remote " - "side. In almost all cases, this should be TRUE.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_NOAUTH, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:refuse-eap: @@ -588,11 +584,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REFUSE_EAP, - g_param_spec_boolean (NM_SETTING_PPP_REFUSE_EAP, - "Refuse EAP", - "If TRUE, the EAP authentication method will not be used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REFUSE_EAP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:refuse-pap: @@ -601,11 +597,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REFUSE_PAP, - g_param_spec_boolean (NM_SETTING_PPP_REFUSE_PAP, - "Refuse PAP", - "If TRUE, the PAP authentication method will not be used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REFUSE_PAP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:refuse-chap: @@ -614,11 +610,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REFUSE_CHAP, - g_param_spec_boolean (NM_SETTING_PPP_REFUSE_CHAP, - "Refuse CHAP", - "If TRUE, the CHAP authentication method will not be used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REFUSE_CHAP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:refuse-mschap: @@ -627,11 +623,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REFUSE_MSCHAP, - g_param_spec_boolean (NM_SETTING_PPP_REFUSE_MSCHAP, - "Refuse MSCHAP", - "If TRUE, the MSCHAP authentication method will not be used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REFUSE_MSCHAP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:refuse-mschapv2: @@ -640,11 +636,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REFUSE_MSCHAPV2, - g_param_spec_boolean (NM_SETTING_PPP_REFUSE_MSCHAPV2, - "Refuse MSCHAPv2", - "If TRUE, the MSCHAPv2 authentication method will not be used.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REFUSE_MSCHAPV2, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:nobsdcomp: @@ -653,11 +649,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NOBSDCOMP, - g_param_spec_boolean (NM_SETTING_PPP_NOBSDCOMP, - "No BSD compression", - "If TRUE, BSD compression will not be requested.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_boolean (NM_SETTING_PPP_NOBSDCOMP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:nodeflate: @@ -666,11 +663,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NODEFLATE, - g_param_spec_boolean (NM_SETTING_PPP_NODEFLATE, - "No deflate", - "If TRUE, 'deflate' compression will not be requested.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_boolean (NM_SETTING_PPP_NODEFLATE, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:no-vj-comp: @@ -679,11 +677,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NO_VJ_COMP, - g_param_spec_boolean (NM_SETTING_PPP_NO_VJ_COMP, - "No VJ compression", - "If TRUE, Van Jacobsen TCP header compression will not be requested.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_boolean (NM_SETTING_PPP_NO_VJ_COMP, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:require-mppe: @@ -695,15 +694,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REQUIRE_MPPE, - g_param_spec_boolean (NM_SETTING_PPP_REQUIRE_MPPE, - "Require MPPE", - "If TRUE, MPPE (Microsoft Point-to-Point Encrpytion) " - "will be required for the PPP session. If either " - "64-bit or 128-bit MPPE is not available the session " - "will fail. Note that MPPE is not used on mobile " - "broadband connections.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REQUIRE_MPPE, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:require-mppe-128: @@ -714,15 +709,10 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_REQUIRE_MPPE_128, - g_param_spec_boolean (NM_SETTING_PPP_REQUIRE_MPPE_128, - "Require MPPE 128", - "If TRUE, 128-bit MPPE (Microsoft Point-to-Point " - "Encrpytion) will be required for the PPP session, " - "and the '" NM_SETTING_PPP_REQUIRE_MPPE "' property " - "must also be set to TRUE. If 128-bit MPPE is not " - "available the session will fail.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_REQUIRE_MPPE_128, "", "", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:mppe-stateful: @@ -732,12 +722,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MPPE_STATEFUL, - g_param_spec_boolean (NM_SETTING_PPP_MPPE_STATEFUL, - "MPPE stateful", - "If TRUE, stateful MPPE is used. See pppd documentation " - "for more information on stateful MPPE.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_MPPE_STATEFUL, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:crtscts: @@ -748,14 +737,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CRTSCTS, - g_param_spec_boolean (NM_SETTING_PPP_CRTSCTS, - "CRTSCTS", - "If TRUE, specify that pppd should set the serial " - "port to use hardware flow control with RTS and CTS " - "signals. This value should normally be set to " - "FALSE.", - FALSE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_PPP_CRTSCTS, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:baud: @@ -766,13 +752,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BAUD, - g_param_spec_uint (NM_SETTING_PPP_BAUD, - "Baud", - "If non-zero, instruct pppd to set the serial port to " - "the specified baudrate. This value should normally be " - "left as 0 to automatically choose the speed.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_PPP_BAUD, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:mru: @@ -783,13 +768,11 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) */ g_object_class_install_property (object_class, PROP_MRU, - g_param_spec_uint (NM_SETTING_PPP_MRU, - "MRU", - "If non-zero, instruct pppd to request that the peer " - "send packets no larger than the specified size. If " - "non-zero, the MRU should be between 128 and 16384.", - 0, 16384, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_PPP_MRU, "", "", + 0, 16384, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:mtu: @@ -799,12 +782,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MTU, - g_param_spec_uint (NM_SETTING_PPP_MTU, - "MTU", - "If non-zero, instruct pppd to send packets no larger " - "than the specified size.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_PPP_MTU, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:lcp-echo-failure: @@ -816,16 +799,12 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_LCP_ECHO_FAILURE, - g_param_spec_uint (NM_SETTING_PPP_LCP_ECHO_FAILURE, - "LCP echo failure", - "If non-zero, instruct pppd to presume the connection to " - "the peer has failed if the specified number of LCP " - "echo-requests go unanswered by the peer. The " - "'" NM_SETTING_PPP_LCP_ECHO_INTERVAL "' property must " - "also be set to a non-zero value if this property is " - "used.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_PPP_LCP_ECHO_FAILURE, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPP:lcp-echo-interval: @@ -837,13 +816,10 @@ nm_setting_ppp_class_init (NMSettingPPPClass *setting_class) **/ g_object_class_install_property (object_class, PROP_LCP_ECHO_INTERVAL, - g_param_spec_uint (NM_SETTING_PPP_LCP_ECHO_INTERVAL, - "LCP echo interval", - "If non-zero, instruct pppd to send an LCP echo-request " - "frame to the peer every n seconds (where n is the " - "specified value). Note that some PPP peers will respond " - "to echo requests and some will not, and it is not " - "possible to autodetect this.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_PPP_LCP_ECHO_INTERVAL, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-ppp.h b/libnm-util/nm-setting-ppp.h index 17a7181db..5733902b8 100644 --- a/libnm-util/nm-setting-ppp.h +++ b/libnm-util/nm-setting-ppp.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2008 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_PPP_H diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c index fdae691b2..deaeb2e88 100644 --- a/libnm-util/nm-setting-pppoe.c +++ b/libnm-util/nm-setting-pppoe.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,12 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-pppoe.h" #include "nm-setting-ppp.h" @@ -210,7 +209,7 @@ nm_setting_pppoe_init (NMSettingPPPOE *setting) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingPPPOEPrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (object); @@ -238,7 +237,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingPPPOE *setting = NM_SETTING_PPPOE (object); @@ -299,16 +298,10 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SERVICE, - g_param_spec_string (NM_SETTING_PPPOE_SERVICE, - "Service", - "If specified, instruct PPPoE to only initiate sessions " - "with access concentrators that provide the specified " - "service. For most providers, this should be left " - "blank. It is only required if there are multiple " - "access concentrators or a specific service is known " - "to be required.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_PPPOE_SERVICE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPPOE:username: @@ -317,11 +310,10 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class) **/ g_object_class_install_property (object_class, PROP_USERNAME, - g_param_spec_string (NM_SETTING_PPPOE_USERNAME, - "Username", - "Username used to authenticate with the PPPoE service.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_PPPOE_USERNAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPPOE:password: @@ -330,23 +322,23 @@ nm_setting_pppoe_class_init (NMSettingPPPOEClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PASSWORD, - g_param_spec_string (NM_SETTING_PPPOE_PASSWORD, - "Password", - "Password used to authenticate with the PPPoE service.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_PPPOE_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingPPPOE:password-flags: * * Flags indicating how to handle the #NMSettingPPPOE:password property. **/ - g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_PPPOE_PASSWORD_FLAGS, - "Password Flags", - "Flags indicating how to handle the PPPoE password.", + g_object_class_install_property + (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_PPPOE_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-pppoe.h b/libnm-util/nm-setting-pppoe.h index 9be90ddb5..9d04af9e2 100644 --- a/libnm-util/nm-setting-pppoe.h +++ b/libnm-util/nm-setting-pppoe.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_PPPOE_H diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h index c3ec9d199..1b271d0c7 100644 --- a/libnm-util/nm-setting-private.h +++ b/libnm-util/nm-setting-private.h @@ -15,13 +15,12 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 Red Hat, Inc. + * Copyright 2011 Red Hat, Inc. */ #ifndef NM_SETTING_PRIVATE_H #define NM_SETTING_PRIVATE_H -#include "nm-setting.h" #include "nm-glib-compat.h" #define NM_SETTING_SECRET_FLAGS_ALL \ @@ -30,6 +29,22 @@ NM_SETTING_SECRET_FLAG_NOT_SAVED | \ NM_SETTING_SECRET_FLAG_NOT_REQUIRED) +/** + * NMSettingVerifyResult: + * @NM_SETTING_VERIFY_SUCCESS: the setting verifies successfully + * @NM_SETTING_VERIFY_ERROR: the setting has a serious misconfiguration + * @NM_SETTING_VERIFY_NORMALIZABLE: the setting is valid but has properties + * that should be normalized + * @NM_SETTING_VERIFY_NORMALIZABLE_ERROR: the setting is invalid but the + * errors can be fixed by nm_connection_normalize(). + */ +typedef enum { + NM_SETTING_VERIFY_SUCCESS = TRUE, + NM_SETTING_VERIFY_ERROR = FALSE, + NM_SETTING_VERIFY_NORMALIZABLE = 2, + NM_SETTING_VERIFY_NORMALIZABLE_ERROR = 3, +} NMSettingVerifyResult; + void _nm_register_setting (const char *name, const GType type, const guint32 priority, @@ -40,10 +55,13 @@ void _nm_register_setting (const char *name, gboolean _nm_setting_is_base_type (NMSetting *setting); gboolean _nm_setting_type_is_base_type (GType type); +guint32 _nm_setting_get_setting_priority (NMSetting *setting); GType _nm_setting_lookup_setting_type (const char *name); GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark); gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b); +gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value); + typedef enum NMSettingUpdateSecretResult { NM_SETTING_UPDATE_SECRET_ERROR = FALSE, NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED = TRUE, @@ -87,10 +105,18 @@ static void __attribute__((constructor)) register_setting (void) \ NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name); -/* Private NMSettingIP4Config methods */ -#include "nm-setting-ip4-config.h" -const char *nm_setting_ip4_config_get_address_label (NMSettingIP4Config *setting, guint32 i); -gboolean nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting, NMIP4Address *address, const char *label); +NMSettingVerifyResult _nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name, + gboolean allow_missing, + const char *setting_name, + const char *setting_property, + GQuark error_quark, + gint e_invalid_property, + gint e_missing_property, + GSList *all_settings, + GError **error); -#endif /* NM_SETTING_PRIVATE_H */ +NMSettingVerifyResult _nm_setting_verify (NMSetting *setting, + GSList *all_settings, + GError **error); +#endif /* NM_SETTING_PRIVATE_H */ diff --git a/libnm-util/nm-setting-serial.c b/libnm-util/nm-setting-serial.c index 70152bb3c..24f2c8980 100644 --- a/libnm-util/nm-setting-serial.c +++ b/libnm-util/nm-setting-serial.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,10 +16,12 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include "nm-setting-serial.h" @@ -183,7 +182,7 @@ nm_setting_serial_init (NMSettingSerial *setting) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingSerialPrivate *priv = NM_SETTING_SERIAL_GET_PRIVATE (object); @@ -211,7 +210,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingSerial *setting = NM_SETTING_SERIAL (object); @@ -261,14 +260,11 @@ nm_setting_serial_class_init (NMSettingSerialClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BAUD, - g_param_spec_uint (NM_SETTING_SERIAL_BAUD, - "Baud", - "Speed to use for communication over the serial port. " - "Note that this value usually has no effect for mobile " - "broadband modems as they generally ignore speed " - "settings and use the highest available speed.", - 0, G_MAXUINT, 57600, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_SERIAL_BAUD, "", "", + 0, G_MAXUINT, 57600, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingSerial:bits: @@ -277,12 +273,11 @@ nm_setting_serial_class_init (NMSettingSerialClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BITS, - g_param_spec_uint (NM_SETTING_SERIAL_BITS, - "Bits", - "Byte-width of the serial communication. The 8 in " - "'8n1' for example.", - 5, 8, 8, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_SERIAL_BITS, "", "", + 5, 8, 8, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingSerial:parity: @@ -292,12 +287,11 @@ nm_setting_serial_class_init (NMSettingSerialClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PARITY, - g_param_spec_char (NM_SETTING_SERIAL_PARITY, - "Parity", - "Parity setting of the serial port. Either 'E' for even " - "parity, 'o' for odd parity, or 'n' for no parity.", - 'E', 'o', 'n', - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_char (NM_SETTING_SERIAL_PARITY, "", "", + 'E', 'o', 'n', + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingSerial:stopbits: @@ -307,12 +301,11 @@ nm_setting_serial_class_init (NMSettingSerialClass *setting_class) **/ g_object_class_install_property (object_class, PROP_STOPBITS, - g_param_spec_uint (NM_SETTING_SERIAL_STOPBITS, - "Stopbits", - "Number of stop bits for communication on the serial " - "port. Either 1 or 2. The 1 in '8n1' for example.", - 1, 2, 1, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_SERIAL_STOPBITS, "", "", + 1, 2, 1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingSerial:send-delay: @@ -321,10 +314,9 @@ nm_setting_serial_class_init (NMSettingSerialClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SEND_DELAY, - g_param_spec_uint64 (NM_SETTING_SERIAL_SEND_DELAY, - "SendDelay", - "Time to delay between each byte sent to the modem, " - "in microseconds.", - 0, G_MAXUINT64, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint64 (NM_SETTING_SERIAL_SEND_DELAY, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-serial.h b/libnm-util/nm-setting-serial.h index 5a73d1030..44d46cf37 100644 --- a/libnm-util/nm-setting-serial.h +++ b/libnm-util/nm-setting-serial.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2008 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2008 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_SERIAL_H diff --git a/libnm-util/nm-setting-team-port.c b/libnm-util/nm-setting-team-port.c index c0b7748bd..6bc71c981 100644 --- a/libnm-util/nm-setting-team-port.c +++ b/libnm-util/nm-setting-team-port.c @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -16,13 +14,17 @@ * 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 2013 Jiri Pirko <jiri@resnulli.us> */ +#include "config.h" + #include <string.h> #include <ctype.h> #include <stdlib.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-team-port.h" #include "nm-utils.h" @@ -176,13 +178,9 @@ nm_setting_team_port_class_init (NMSettingTeamPortClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CONFIG, - g_param_spec_string (NM_SETTING_TEAM_PORT_CONFIG, - "Config", - "JSON configuration for the team port. " - "The property should contain raw JSON configuration data " - "suitable for teamd, because the value is passed directly to " - "teamd. If not specified, the dafault configuration is used. " - "See man teamd.conf for the format details.", + g_param_spec_string (NM_SETTING_TEAM_PORT_CONFIG, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-team-port.h b/libnm-util/nm-setting-team-port.h index 50b9f7e36..4e8022202 100644 --- a/libnm-util/nm-setting-team-port.h +++ b/libnm-util/nm-setting-team-port.h @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -16,6 +14,8 @@ * 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 2013 Jiri Pirko <jiri@resnulli.us> */ #ifndef NM_SETTING_TEAM_PORT_H diff --git a/libnm-util/nm-setting-team.c b/libnm-util/nm-setting-team.c index af9da62c0..19bc95965 100644 --- a/libnm-util/nm-setting-team.c +++ b/libnm-util/nm-setting-team.c @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -16,12 +14,16 @@ * 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 2013 Jiri Pirko <jiri@resnulli.us> */ +#include "config.h" + #include <string.h> #include <stdlib.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-team.h" #include "nm-param-spec-specialized.h" @@ -134,25 +136,13 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) { NMSettingTeamPrivate *priv = NM_SETTING_TEAM_GET_PRIVATE (setting); - if (!priv->interface_name || !strlen(priv->interface_name)) { - g_set_error_literal (error, - NM_SETTING_TEAM_ERROR, - NM_SETTING_TEAM_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_TEAM_SETTING_NAME, NM_SETTING_TEAM_INTERFACE_NAME); - return FALSE; - } - - if (!nm_utils_iface_valid_name (priv->interface_name)) { - g_set_error_literal (error, - NM_SETTING_TEAM_ERROR, - NM_SETTING_TEAM_ERROR_INVALID_PROPERTY, - _("property is invalid")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_TEAM_SETTING_NAME, NM_SETTING_TEAM_INTERFACE_NAME); - return FALSE; - } - - return TRUE; + return _nm_setting_verify_deprecated_virtual_iface_name ( + priv->interface_name, FALSE, + NM_SETTING_TEAM_SETTING_NAME, NM_SETTING_TEAM_INTERFACE_NAME, + NM_SETTING_TEAM_ERROR, + NM_SETTING_TEAM_ERROR_INVALID_PROPERTY, + NM_SETTING_TEAM_ERROR_MISSING_PROPERTY, + all_settings, error); } static const char * @@ -242,11 +232,11 @@ nm_setting_team_class_init (NMSettingTeamClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_TEAM_INTERFACE_NAME, - "InterfaceName", - "The name of the virtual in-kernel team network interface", + g_param_spec_string (NM_SETTING_TEAM_INTERFACE_NAME, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingTeam:config: @@ -258,13 +248,9 @@ nm_setting_team_class_init (NMSettingTeamClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CONFIG, - g_param_spec_string (NM_SETTING_TEAM_CONFIG, - "Config", - "JSON configuration for the team network interface. " - "The property should contain raw JSON configuration data " - "suitable for teamd, because the value is passed directly to " - "teamd. If not specified, the default configuration is used. " - "See man teamd.conf for the format details.", + g_param_spec_string (NM_SETTING_TEAM_CONFIG, "", "", NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-team.h b/libnm-util/nm-setting-team.h index 978eed07b..d67c8c71b 100644 --- a/libnm-util/nm-setting-team.h +++ b/libnm-util/nm-setting-team.h @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -16,6 +14,8 @@ * 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 2013 Jiri Pirko <jiri@resnulli.us> */ #ifndef NM_SETTING_TEAM_H diff --git a/libnm-util/nm-setting-vlan.c b/libnm-util/nm-setting-vlan.c index ef91b5f12..43b6a91c1 100644 --- a/libnm-util/nm-setting-vlan.c +++ b/libnm-util/nm-setting-vlan.c @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Weiping Pan <wpan@redhat.com> - * * 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 @@ -18,13 +16,15 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2014 Red Hat, Inc. + * Copyright 2011 - 2014 Red Hat, Inc. */ +#include "config.h" + #include <stdlib.h> #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-vlan.h" #include "nm-param-spec-specialized.h" @@ -260,7 +260,8 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting, list = get_map (setting, map); item = priority_map_new_from_str (map, str); - g_return_val_if_fail (item != NULL, FALSE); + if (!item) + g_return_val_if_reached (FALSE); /* Duplicates get replaced */ for (iter = list; iter; iter = g_slist_next (iter)) { @@ -537,20 +538,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) s_wired = iter->data; } - /* If interface_name is specified, it must be a valid interface name. We - * don't check that it matches parent and/or id, because we allowing - * renaming vlans to arbitrary names. - */ - if (priv->interface_name && !nm_utils_iface_valid_name (priv->interface_name)) { - g_set_error (error, - NM_SETTING_VLAN_ERROR, - NM_SETTING_VLAN_ERROR_INVALID_PROPERTY, - _("'%s' is not a valid interface name"), - priv->interface_name); - g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_INTERFACE_NAME); - return FALSE; - } - if (priv->parent) { if (nm_utils_is_uuid (priv->parent)) { /* If we have an NMSettingConnection:master with slave-type="vlan", @@ -582,7 +569,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) priv->parent); g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_PARENT); return FALSE; - } + } } else { /* If parent is NULL, the parent must be specified via * NMSettingWired:mac-address. @@ -609,7 +596,17 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } - return TRUE; + /* If interface_name is specified, it must be a valid interface name. We + * don't check that it matches parent and/or id, because we allow + * renaming vlans to arbitrary names. + */ + return _nm_setting_verify_deprecated_virtual_iface_name ( + priv->interface_name, TRUE, + NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_INTERFACE_NAME, + NM_SETTING_VLAN_ERROR, + NM_SETTING_VLAN_ERROR_INVALID_PROPERTY, + NM_SETTING_VLAN_ERROR_MISSING_PROPERTY, + all_settings, error); } static const char * @@ -758,17 +755,12 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INTERFACE_NAME, - g_param_spec_string (NM_SETTING_VLAN_INTERFACE_NAME, - "InterfaceName", - "If given, specifies the kernel name of the VLAN " - "interface. If not given, a default name will be " - "constructed from the interface described by the " - "parent interface and the 'id' property, ex " - "'eth2.1'. The parent interface may be given by " - "the 'parent' property or by the 'mac-address' " - "property of a 'wired' setting.", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_VLAN_INTERFACE_NAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVlan:parent: @@ -780,15 +772,12 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PARENT, - g_param_spec_string (NM_SETTING_VLAN_PARENT, - "Parent", - "If given, specifies the parent interface name or " - "parent connection UUID from which this VLAN " - "interface should be created. If this property is " - "not specified, the connection must contain a " - "'wired' setting with a 'mac-address' property.", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_VLAN_PARENT, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVlan:id: @@ -798,12 +787,12 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_ID, - g_param_spec_uint (NM_SETTING_VLAN_ID, - "VLAN ID", - "The VLAN indentifier the interface created by " - "this connection should be assigned.", + g_param_spec_uint (NM_SETTING_VLAN_ID, "", "", 0, 4095, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVlan:flags: @@ -816,16 +805,12 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_FLAGS, - g_param_spec_uint (NM_SETTING_VLAN_FLAGS, - "VLAN flags", - "One or more flags which control the behavior and " - "features of the VLAN interface. Flags include " - "reordering of output packet headers (0x01), use " - "of the GVRP protocol (0x02), and loose binding " - "of the interface to its master device's operating " - "state (0x04).", + g_param_spec_uint (NM_SETTING_VLAN_FLAGS, "", "", 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_INFERRABLE)); + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVlan:ingress-priority-map: @@ -836,15 +821,11 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_INGRESS_PRIORITY_MAP, - _nm_param_spec_specialized (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, - "VLAN ingress priority mapping", - "For incoming packets, a list of mappings " - "from 802.1p priorities to Linux SKB " - "priorities. The mapping is given in the " - "format 'from:to' where both 'from' and " - "'to' are unsigned integers, ie '7:3'.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVlan:egress-priority-map: @@ -855,13 +836,9 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class) **/ g_object_class_install_property (object_class, PROP_EGRESS_PRIORITY_MAP, - _nm_param_spec_specialized (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, - "VLAN egress priority mapping", - "For outgoing packets, a list of mappings " - "from Linux SKB priorities to 802.1p " - "priorities. The mapping is given in the " - "format 'from:to' where both 'from' and " - "'to' are unsigned integers, ie '7:3'.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-vlan.h b/libnm-util/nm-setting-vlan.h index ca77f6fed..3e209480c 100644 --- a/libnm-util/nm-setting-vlan.h +++ b/libnm-util/nm-setting-vlan.h @@ -1,8 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Weiping Pan <wpan@redhat.com> - * * 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 @@ -18,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2014 Red Hat, Inc. + * Copyright 2011 - 2014 Red Hat, Inc. */ #ifndef NM_SETTING_VLAN_H diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index 4b479b8f3..1feeb588a 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -1,8 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -18,15 +15,17 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <errno.h> #include <stdlib.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-vpn.h" #include "nm-param-spec-specialized.h" @@ -84,6 +83,11 @@ typedef struct { */ char *user_name; + /* Whether the VPN stays up across link changes, until the user + * explicitly disconnects it. + */ + gboolean persistent; + /* The hash table is created at setting object * init time and should not be replaced. It is * a char * -> char * mapping, and both the key @@ -107,6 +111,7 @@ enum { PROP_0, PROP_SERVICE_TYPE, PROP_USER_NAME, + PROP_PERSISTENT, PROP_DATA, PROP_SECRETS, @@ -158,6 +163,20 @@ nm_setting_vpn_get_user_name (NMSettingVPN *setting) } /** + * nm_setting_vpn_get_persistent: + * @setting: the #NMSettingVPN + * + * Returns: the #NMSettingVPN:persistent property of the setting + **/ +gboolean +nm_setting_vpn_get_persistent (NMSettingVPN *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_VPN (setting), FALSE); + + return NM_SETTING_VPN_GET_PRIVATE (setting)->persistent; +} + +/** * nm_setting_vpn_get_num_data_items: * @setting: the #NMSettingVPN * @@ -479,7 +498,7 @@ update_secret_hash (NMSetting *setting, if (!value || !strlen (value)) { g_set_error (error, NM_SETTING_ERROR, NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH, - "Secret %s value was empty", name); + "Secret %s value was empty", name); return NM_SETTING_UPDATE_SECRET_ERROR; } } @@ -548,29 +567,31 @@ get_secret_flags (NMSetting *setting, char *flags_key; gpointer val; unsigned long tmp; + NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; flags_key = g_strdup_printf ("%s-flags", secret_name); if (g_hash_table_lookup_extended (priv->data, flags_key, NULL, &val)) { errno = 0; tmp = strtoul ((const char *) val, NULL, 10); if ((errno == 0) && (tmp <= NM_SETTING_SECRET_FLAGS_ALL)) { - if (out_flags) - *out_flags = (guint32) tmp; + flags = (NMSettingSecretFlags) tmp; success = TRUE; } else { g_set_error (error, NM_SETTING_ERROR, NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH, - "Failed to convert '%s' value '%s' to uint", + _("Failed to convert '%s' value '%s' to uint"), flags_key, (const char *) val); } } else { g_set_error (error, NM_SETTING_ERROR, NM_SETTING_ERROR_PROPERTY_NOT_FOUND, - "Secret flags property '%s' not found", flags_key); + _("Secret flags property '%s' not found"), flags_key); } g_free (flags_key); + if (out_flags) + *out_flags = flags; return success; } @@ -659,9 +680,9 @@ compare_property (NMSetting *setting, static gboolean clear_secrets_with_flags (NMSetting *setting, - GParamSpec *pspec, - NMSettingClearSecretsWithFlagsFn func, - gpointer user_data) + GParamSpec *pspec, + NMSettingClearSecretsWithFlagsFn func, + gpointer user_data) { NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting); GHashTableIter iter; @@ -731,7 +752,7 @@ copy_hash (gpointer key, gpointer value, gpointer user_data) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (object); GHashTable *new_hash; @@ -745,6 +766,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->user_name); priv->user_name = g_value_dup_string (value); break; + case PROP_PERSISTENT: + priv->persistent = g_value_get_boolean (value); + break; case PROP_DATA: /* Must make a deep copy of the hash table here... */ g_hash_table_remove_all (priv->data); @@ -767,7 +791,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingVPN *setting = NM_SETTING_VPN (object); NMSettingVPNPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting); @@ -779,6 +803,9 @@ get_property (GObject *object, guint prop_id, case PROP_USER_NAME: g_value_set_string (value, nm_setting_vpn_get_user_name (setting)); break; + case PROP_PERSISTENT: + g_value_set_boolean (value, priv->persistent); + break; case PROP_DATA: g_value_set_boxed (value, priv->data); break; @@ -822,14 +849,10 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SERVICE_TYPE, - g_param_spec_string (NM_SETTING_VPN_SERVICE_TYPE, - "Service type", - "D-Bus service name of the VPN plugin that this " - "setting uses to connect to its network. i.e. " - "org.freedesktop.NetworkManager.vpnc for the vpnc " - "plugin.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_VPN_SERVICE_TYPE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVPN:user-name: @@ -843,18 +866,24 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) **/ g_object_class_install_property (object_class, PROP_USER_NAME, - g_param_spec_string (NM_SETTING_VPN_USER_NAME, - "User name", - "If the VPN connection requires a user name for " - "authentication, that name should be provided here. " - "If the connection is available to more than one " - "user, and the VPN requires each user to supply a " - "different name, then leave this property empty. If " - "this property is empty, NetworkManager will " - "automatically supply the username of the user which " - "requested the VPN connection.", + g_param_spec_string (NM_SETTING_VPN_USER_NAME, "", "", NULL, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingVPN:persistent: + * + * If the VPN service supports persistence, and this property is %TRUE, + * the VPN will attempt to stay connected across link changes and outages, + * until explicitly disconnected. + **/ + g_object_class_install_property + (object_class, PROP_PERSISTENT, + g_param_spec_boolean (NM_SETTING_VPN_PERSISTENT, "", "", + FALSE, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVPN:data: @@ -864,13 +893,10 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DATA, - _nm_param_spec_specialized (NM_SETTING_VPN_DATA, - "Data", - "Dictionary of key/value pairs of VPN plugin " - "specific data. Both keys and values must be " - "strings.", - DBUS_TYPE_G_MAP_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_VPN_DATA, "", "", + DBUS_TYPE_G_MAP_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingVPN:secrets: @@ -880,12 +906,9 @@ nm_setting_vpn_class_init (NMSettingVPNClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SECRETS, - _nm_param_spec_specialized (NM_SETTING_VPN_SECRETS, - "Secrets", - "Dictionary of key/value pairs of VPN plugin " - "specific secrets like passwords or private keys." - " Both keys and values must be strings.", - DBUS_TYPE_G_MAP_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + _nm_param_spec_specialized (NM_SETTING_VPN_SECRETS, "", "", + DBUS_TYPE_G_MAP_OF_STRING, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm-util/nm-setting-vpn.h b/libnm-util/nm-setting-vpn.h index 259384bfd..fbc9fe34f 100644 --- a/libnm-util/nm-setting-vpn.h +++ b/libnm-util/nm-setting-vpn.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2013 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2013 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_VPN_H @@ -57,6 +54,7 @@ GQuark nm_setting_vpn_error_quark (void); #define NM_SETTING_VPN_SERVICE_TYPE "service-type" #define NM_SETTING_VPN_USER_NAME "user-name" +#define NM_SETTING_VPN_PERSISTENT "persistent" #define NM_SETTING_VPN_DATA "data" #define NM_SETTING_VPN_SECRETS "secrets" @@ -88,6 +86,7 @@ GType nm_setting_vpn_get_type (void); NMSetting *nm_setting_vpn_new (void); const char *nm_setting_vpn_get_service_type (NMSettingVPN *setting); const char *nm_setting_vpn_get_user_name (NMSettingVPN *setting); +gboolean nm_setting_vpn_get_persistent (NMSettingVPN *setting); guint32 nm_setting_vpn_get_num_data_items (NMSettingVPN *setting); void nm_setting_vpn_add_data_item (NMSettingVPN *setting, diff --git a/libnm-util/nm-setting-wimax.c b/libnm-util/nm-setting-wimax.c index 8bf16b3de..acb00f5e9 100644 --- a/libnm-util/nm-setting-wimax.c +++ b/libnm-util/nm-setting-wimax.c @@ -16,14 +16,16 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2011 - 2013 Red Hat, Inc. - * (C) Copyright 2009 Novell, Inc. + * Copyright 2011 - 2013 Red Hat, Inc. + * Copyright 2009 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <net/ethernet.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-wimax.h" #include "nm-param-spec-specialized.h" @@ -179,7 +181,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingWimaxPrivate *priv = NM_SETTING_WIMAX_GET_PRIVATE (object); @@ -201,7 +203,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingWimax *setting = NM_SETTING_WIMAX (object); @@ -241,12 +243,10 @@ nm_setting_wimax_class_init (NMSettingWimaxClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NETWORK_NAME, - g_param_spec_string (NM_SETTING_WIMAX_NETWORK_NAME, - "NetworkName", - "Network Service Provider (NSP) name of the WiMAX " - "network this connection should use.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIMAX_NETWORK_NAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWimax:mac-address: @@ -257,12 +257,8 @@ nm_setting_wimax_class_init (NMSettingWimaxClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_WIMAX_MAC_ADDRESS, - "MAC Address", - "If specified, this connection will only apply to " - "the WiMAX device whose MAC address matches. " - "This property does not change the MAC address " - "of the device (known as MAC spoofing).", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIMAX_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-wimax.h b/libnm-util/nm-setting-wimax.h index 935960d8f..781d717c2 100644 --- a/libnm-util/nm-setting-wimax.h +++ b/libnm-util/nm-setting-wimax.h @@ -16,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2009 Novell, Inc. + * Copyright 2009 Novell, Inc. */ #ifndef NM_SETTING_WIMAX_H diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c index a956a52f0..8d927921d 100644 --- a/libnm-util/nm-setting-wired.c +++ b/libnm-util/nm-setting-wired.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,15 +16,17 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <net/ethernet.h> #include <netinet/ether.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-wired.h" #include "nm-param-spec-specialized.h" @@ -877,16 +876,10 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_PORT, - g_param_spec_string (NM_SETTING_WIRED_PORT, - "Port", - "Specific port type to use if multiple the device " - "supports multiple attachment methods. One of " - "'tp' (Twisted Pair), 'aui' (Attachment Unit Interface), " - "'bnc' (Thin Ethernet) or 'mii' (Media Independent " - "Interface. If the device supports only one port " - "type, this setting is ignored.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRED_PORT, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:speed: @@ -896,12 +889,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SPEED, - g_param_spec_uint (NM_SETTING_WIRED_SPEED, - "Speed", - "If non-zero, request that the device use only the " - "specified speed. In Mbit/s, ie 100 == 100Mbit/s.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_WIRED_SPEED, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:duplex: @@ -911,12 +903,10 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_DUPLEX, - g_param_spec_string (NM_SETTING_WIRED_DUPLEX, - "Duplex", - "If specified, request that the device only use the " - "specified duplex mode. Either 'half' or 'full'.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRED_DUPLEX, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:auto-negotiate: @@ -927,14 +917,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_AUTO_NEGOTIATE, - g_param_spec_boolean (NM_SETTING_WIRED_AUTO_NEGOTIATE, - "AutoNegotiate", - "If TRUE, allow auto-negotiation of port speed and " - "duplex mode. If FALSE, do not allow auto-negotiation," - "in which case the 'speed' and 'duplex' properties " - "should be set.", - TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_boolean (NM_SETTING_WIRED_AUTO_NEGOTIATE, "", "", + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:mac-address: @@ -945,14 +932,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_WIRED_MAC_ADDRESS, - "Device MAC Address", - "If specified, this connection will only apply to " - "the Ethernet device whose permanent MAC address matches. " - "This property does not change the MAC address " - "of the device (i.e. MAC spoofing).", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_WIRED_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:cloned-mac-address: @@ -962,13 +946,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CLONED_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_WIRED_CLONED_MAC_ADDRESS, - "Cloned MAC Address", - "If specified, request that the device use " - "this MAC address instead of its permanent MAC address. " - "This is known as MAC cloning or spoofing.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_WIRED_CLONED_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:mac-address-blacklist: @@ -980,14 +962,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS_BLACKLIST, - _nm_param_spec_specialized (NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST, - "MAC Address Blacklist", - "If specified, this connection will never apply to " - "the Ethernet device whose permanent MAC address matches " - "an address in the list. Each MAC address is in the " - "standard hex-digits-and-colons notation (00:11:22:33:44:55).", + _nm_param_spec_specialized (NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST, "", "", DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:mtu: @@ -997,13 +976,12 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MTU, - g_param_spec_uint (NM_SETTING_WIRED_MTU, - "MTU", - "If non-zero, only transmit packets of the specified " - "size or smaller, breaking larger packets up into " - "multiple Ethernet frames.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_WIRED_MTU, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:s390-subchannels: @@ -1018,19 +996,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_S390_SUBCHANNELS, - _nm_param_spec_specialized (NM_SETTING_WIRED_S390_SUBCHANNELS, - "z/VM Subchannels", - "Identifies specific subchannels that this " - "network device uses for communcation with z/VM " - "or s390 host. Like the 'mac-address' property " - "for non-z/VM devices, this property can be used " - "to ensure this connection only applies to the " - "network device that uses these subchannels. The " - "list should contain exactly 3 strings, and each " - "string may only be composed of hexadecimal " - "characters and the period (.) character.", - DBUS_TYPE_G_ARRAY_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_WIRED_S390_SUBCHANNELS, "", "", + DBUS_TYPE_G_ARRAY_OF_STRING, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:s390-nettype: @@ -1040,13 +1010,11 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_S390_NETTYPE, - g_param_spec_string (NM_SETTING_WIRED_S390_NETTYPE, - "s390 Net Type", - "s390 network device type; one of 'qeth', 'lcs', or " - "'ctc', representing the different types of virtual " - "network devices available on s390 systems.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + g_param_spec_string (NM_SETTING_WIRED_S390_NETTYPE, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWired:s390-options: @@ -1058,13 +1026,9 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class) **/ g_object_class_install_property (object_class, PROP_S390_OPTIONS, - _nm_param_spec_specialized (NM_SETTING_WIRED_S390_OPTIONS, - "s390 Options", - "Dictionary of key/value pairs of s390-specific " - "device options. Both keys and values must be " - "strings. Allowed keys include 'portno', " - "'layer2', 'portname', 'protocol', among others.", - DBUS_TYPE_G_MAP_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE)); + _nm_param_spec_specialized (NM_SETTING_WIRED_S390_OPTIONS, "", "", + DBUS_TYPE_G_MAP_OF_STRING, + G_PARAM_READWRITE | + NM_SETTING_PARAM_INFERRABLE | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm-util/nm-setting-wired.h b/libnm-util/nm-setting-wired.h index 9580b0a8b..33d6d54dd 100644 --- a/libnm-util/nm-setting-wired.h +++ b/libnm-util/nm-setting-wired.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_WIRED_H diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c index 40c561813..5e3456ceb 100644 --- a/libnm-util/nm-setting-wireless-security.c +++ b/libnm-util/nm-setting-wireless-security.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,14 +16,15 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ -#include <config.h> +#include "config.h" + #include <string.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "nm-setting-wireless-security.h" #include "nm-setting-8021x.h" @@ -1068,7 +1066,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) g_set_error_literal (error, NM_SETTING_WIRELESS_SECURITY_ERROR, NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY, - _("property is invalid")); + _("property is invalid")); g_prefix_error (error, "%s.%s: ", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PAIRWISE); return FALSE; } @@ -1183,7 +1181,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingWirelessSecurity *setting = NM_SETTING_WIRELESS_SECURITY (object); NMSettingWirelessSecurityPrivate *priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting); @@ -1263,7 +1261,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingWirelessSecurity *setting = NM_SETTING_WIRELESS_SECURITY (object); NMSettingWirelessSecurityPrivate *priv = NM_SETTING_WIRELESS_SECURITY_GET_PRIVATE (setting); @@ -1355,15 +1353,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_KEY_MGMT, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, - "Key management", - "Key management used for the connection. One of " - "'none' (WEP), 'ieee8021x' (Dynamic WEP), 'wpa-none' " - "(WPA-PSK Ad-Hoc), 'wpa-psk' (infrastructure WPA-PSK), " - "or 'wpa-eap' (WPA-Enterprise). This property must " - "be set for any Wi-Fi connection that uses security.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_REQUIRED)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_REQUIRED | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-tx-keyidx: @@ -1375,15 +1369,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_TX_KEYIDX, - g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, - "WEP TX key index", - "When static WEP is used (ie, key-mgmt = 'none') and a " - "non-default WEP key index is used by the AP, put that " - "WEP key index here. Valid values are 0 (default key) " - "through 3. Note that some consumer access points " - "(like the Linksys WRT54G) number the keys 1 - 4.", - 0, 3, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, "", "", + 0, 3, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:auth-alg: @@ -1396,17 +1386,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_AUTH_ALG, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, - "AuthAlg", - "When WEP is used (ie, key-mgmt = 'none' or " - "'ieee8021x') indicate the 802.11 authentication " - "algorithm required by the AP here. One of 'open' for " - "Open System, 'shared' for Shared Key, or 'leap' for " - "Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = " - "'ieee8021x' and auth-alg = 'leap') the 'leap-username' " - "and 'leap-password' properties must be specified.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:proto: @@ -1417,15 +1400,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_PROTO, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_PROTO, - "Proto", - "List of strings specifying the allowed WPA " - "protocol versions to use. Each element may be " - "one 'wpa' (allow WPA) or 'rsn' (allow " - "WPA2/RSN). If not specified, both WPA and RSN " - "connections are allowed.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_PROTO, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:pairwise: @@ -1437,16 +1415,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_PAIRWISE, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_PAIRWISE, - "Pairwise", - "A list of pairwise encryption algorithms which " - "prevents connections to Wi-Fi networks that do " - "not utilize one of the algorithms in the list. " - "For maximum compatibility leave this property " - "empty. Each list element may be one of 'tkip' " - "or 'ccmp'.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_PAIRWISE, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:group: @@ -1458,16 +1430,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_GROUP, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_GROUP, - "Group", - "A list of group/broadcast encryption algorithms " - "which prevents connections to Wi-Fi networks " - "that do not utilize one of the algorithms in " - "the list. For maximum compatibility leave this " - "property empty. Each list element may be one " - " of 'wep40', 'wep104', 'tkip', or 'ccmp'.", - DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_SECURITY_GROUP, "", "", + DBUS_TYPE_G_LIST_OF_STRING, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:leap-username: @@ -1477,12 +1443,10 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_LEAP_USERNAME, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, - "LEAP Username", - "The login username for legacy LEAP connections " - "(ie, key-mgmt = 'ieee8021x' and auth-alg = 'leap').", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key0: @@ -1492,13 +1456,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_KEY0, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, - "WEP key0", - "Index 0 WEP key. This is the WEP key used in most " - "networks. See the 'wep-key-type' property for a " - "description of how this key is interpreted.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key1: @@ -1508,13 +1470,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_KEY1, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, - "WEP key1", - "Index 1 WEP key. This WEP index is not used by most " - "networks. See the 'wep-key-type' property for a " - "description of how this key is interpreted.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key2: @@ -1524,13 +1484,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_KEY2, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, - "WEP key2", - "Index 2 WEP key. This WEP index is not used by most " - "networks. See the 'wep-key-type' property for a " - "description of how this key is interpreted.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key3: @@ -1540,13 +1498,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_KEY3, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, - "WEP key3", - "Index 3 WEP key. This WEP index is not used by most " - "networks. See the 'wep-key-type' property for a " - "description of how this key is interpreted.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key-flags: @@ -1555,14 +1511,14 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting * #NMSettingWirelessSecurity:wep-key1, #NMSettingWirelessSecurity:wep-key2, * and #NMSettingWirelessSecurity:wep-key3 properties. **/ - g_object_class_install_property (object_class, PROP_WEP_KEY_FLAGS, - g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, - "WEP Key Flags", - "Flags indicating how to handle the WEP keys.", + g_object_class_install_property + (object_class, PROP_WEP_KEY_FLAGS, + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:psk: @@ -1576,18 +1532,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_PSK, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_PSK, - "PSK", - "Pre-Shared-Key for WPA networks. If the key is " - "64-characters long, it must contain only hexadecimal " - "characters and is interpreted as a hexadecimal WPA " - "key. Otherwise, the key must be between 8 and 63 " - "ASCII characters (as specified in the 802.11i standard) " - "and is interpreted as a WPA passphrase, and is hashed " - "to derive the actual WPA-PSK used when connecting to " - "the Wi-Fi network.", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_PSK, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:psk-flags: @@ -1595,14 +1544,14 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting * Flags indicating how to handle the #NMSettingWirelessSecurity:psk * property. **/ - g_object_class_install_property (object_class, PROP_PSK_FLAGS, - g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, - "PSK Flags", - "Flags indicating how to handle the WPA PSK key.", + g_object_class_install_property + (object_class, PROP_PSK_FLAGS, + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:leap-password: @@ -1612,12 +1561,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_LEAP_PASSWORD, - g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, - "LEAP Password", - "The login password for legacy LEAP connections " - "(ie, key-mgmt = 'ieee8021x' and auth-alg = 'leap').", - NULL, - G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET)); + g_param_spec_string (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, "", "", + NULL, + G_PARAM_READWRITE | + NM_SETTING_PARAM_SECRET | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:leap-password-flags: @@ -1625,14 +1573,14 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting * Flags indicating how to handle the * #NMSettingWirelessSecurity:leap-password property. **/ - g_object_class_install_property (object_class, PROP_LEAP_PASSWORD_FLAGS, - g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS, - "LEAP Password Flags", - "Flags indicating how to handle the LEAP password.", + g_object_class_install_property + (object_class, PROP_LEAP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS, "", "", NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_SECRET_FLAGS_ALL, NM_SETTING_SECRET_FLAG_NONE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWirelessSecurity:wep-key-type: @@ -1646,18 +1594,11 @@ nm_setting_wireless_security_class_init (NMSettingWirelessSecurityClass *setting **/ g_object_class_install_property (object_class, PROP_WEP_KEY_TYPE, - g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, - "WEP Key Type", - "Controls the interpretation of WEP keys. Allowed values " - "are 1 (interpret WEP keys as hexadecimal or ASCII keys) " - "or 2 (interpret WEP keys as WEP Passphrases). If set to " - "1 and the keys are hexadecimal, they must be either 10 or " - "26 characters in length. If set to 1 and the keys are " - "ASCII keys, they must be either 5 or 13 characters in " - "length. If set to 2, the passphrase is hashed using " - " the de-facto MD5 method to derive the actual WEP key.", - NM_WEP_KEY_TYPE_UNKNOWN, - NM_WEP_KEY_TYPE_LAST, - NM_WEP_KEY_TYPE_UNKNOWN, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, "", "", + NM_WEP_KEY_TYPE_UNKNOWN, + NM_WEP_KEY_TYPE_LAST, + NM_WEP_KEY_TYPE_UNKNOWN, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-wireless-security.h b/libnm-util/nm-setting-wireless-security.h index df5d77aba..97a456b04 100644 --- a/libnm-util/nm-setting-wireless-security.h +++ b/libnm-util/nm-setting-wireless-security.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_WIRELESS_SECURITY_H diff --git a/libnm-util/nm-setting-wireless.c b/libnm-util/nm-setting-wireless.c index ca53d6f95..99f4c9b14 100644 --- a/libnm-util/nm-setting-wireless.c +++ b/libnm-util/nm-setting-wireless.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,15 +16,17 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> #include <net/ethernet.h> #include <netinet/ether.h> #include <dbus/dbus-glib.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include "NetworkManager.h" #include "nm-setting-wireless.h" @@ -731,7 +730,7 @@ nm_setting_wireless_get_num_seen_bssids (NMSettingWireless *setting) **/ const char * nm_setting_wireless_get_seen_bssid (NMSettingWireless *setting, - guint32 i) + guint32 i) { g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), NULL); @@ -894,7 +893,7 @@ finalize (GObject *object) static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMSettingWirelessPrivate *priv = NM_SETTING_WIRELESS_GET_PRIVATE (object); @@ -962,7 +961,7 @@ set_property (GObject *object, guint prop_id, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMSettingWireless *setting = NM_SETTING_WIRELESS (object); @@ -1037,11 +1036,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SSID, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_SSID, - "SSID", - "SSID of the Wi-Fi network. Must be specified.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_SSID, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:mode: @@ -1051,12 +1049,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MODE, - g_param_spec_string (NM_SETTING_WIRELESS_MODE, - "Mode", - "Wi-Fi network mode; one of 'infrastructure', " - "'adhoc' or 'ap'. If blank, infrastructure is assumed.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRELESS_MODE, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:band: @@ -1070,18 +1066,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BAND, - g_param_spec_string (NM_SETTING_WIRELESS_BAND, - "Band", - "802.11 frequency band of the network. One of 'a' " - "for 5GHz 802.11a or 'bg' for 2.4GHz 802.11. This " - "will lock associations to the Wi-Fi network to the " - "specific band, i.e. if 'a' is specified, the device " - "will not associate with the same network in the " - "2.4GHz band even if the network's settings are " - "compatible. This setting depends on specific driver " - "capability and may not work with all drivers.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRELESS_BAND, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:channel: @@ -1093,15 +1081,11 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CHANNEL, - g_param_spec_uint (NM_SETTING_WIRELESS_CHANNEL, - "Channel", - "Wireless channel to use for the Wi-Fi connection. The " - "device will only join (or create for Ad-Hoc networks) " - "a Wi-Fi network on the specified channel. Because " - "channel numbers overlap between bands, this property " - "also requires the 'band' property to be set.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_param_spec_uint (NM_SETTING_WIRELESS_CHANNEL, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:bssid: @@ -1113,16 +1097,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_BSSID, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_BSSID, - "BSSID", - "If specified, directs the device to only associate " - "with the given access point. This capability is " - "highly driver dependent and not supported by all " - "devices. Note: this property does not control " - "the BSSID used when creating an Ad-Hoc network " - "and is unlikely to in the future.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_BSSID, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:rate: @@ -1134,15 +1112,12 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_RATE, - g_param_spec_uint (NM_SETTING_WIRELESS_RATE, - "Rate", - "If non-zero, directs the device to only use the " - "specified bitrate for communication with the access " - "point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This " - "property is highly driver dependent and not all devices " - "support setting a static bitrate.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_WIRELESS_RATE, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:tx-power: @@ -1153,14 +1128,12 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_TX_POWER, - g_param_spec_uint (NM_SETTING_WIRELESS_TX_POWER, - "TX Power", - "If non-zero, directs the device to use the specified " - "transmit power. Units are dBm. This property is highly " - "driver dependent and not all devices support setting a " - "static transmit power.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_WIRELESS_TX_POWER, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:mac-address: @@ -1171,14 +1144,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_MAC_ADDRESS, - "Device MAC Address", - "If specified, this connection will only apply to " - "the Wi-Fi device whose permanent MAC address matches. " - "This property does not change the MAC address " - "of the device (i.e. MAC spoofing).", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:cloned-mac-address: @@ -1188,13 +1157,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_CLONED_MAC_ADDRESS, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, - "Spoof MAC Address", - "If specified, request that the Wi-Fi device use " - "this MAC address instead of its permanent MAC address. " - "This is known as MAC cloning or spoofing.", - DBUS_TYPE_G_UCHAR_ARRAY, - G_PARAM_READWRITE)); + _nm_param_spec_specialized (NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, "", "", + DBUS_TYPE_G_UCHAR_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:mac-address-blacklist: @@ -1205,15 +1171,11 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MAC_ADDRESS_BLACKLIST, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, - "MAC Address Blacklist", - "A list of permanent MAC addresses of Wi-Fi " - "devices to which this connection should " - "never apply. Each MAC address should be " - "given in the standard hex-digits-and-colons " - "notation (eg '00:11:22:33:44:55').", + _nm_param_spec_specialized (NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, "", "", DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:seen-bssids: @@ -1227,18 +1189,11 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SEEN_BSSIDS, - _nm_param_spec_specialized (NM_SETTING_WIRELESS_SEEN_BSSIDS, - "Seen BSSIDS", - "A list of BSSIDs (each BSSID formatted as a MAC " - "address like 00:11:22:33:44:55') that have been " - "detected as part of the Wi-Fi network. " - "NetworkManager internally tracks previously seen " - "BSSIDs. The property is only meant for reading " - "and reflects the BSSID list of NetworkManager. " - "The changes you make to this property will not be " - "preserved.", + _nm_param_spec_specialized (NM_SETTING_WIRELESS_SEEN_BSSIDS, "", "", DBUS_TYPE_G_LIST_OF_STRING, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE)); + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:mtu: @@ -1248,13 +1203,12 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_MTU, - g_param_spec_uint (NM_SETTING_WIRELESS_MTU, - "MTU", - "If non-zero, only transmit packets of the specified " - "size or smaller, breaking larger packets up into " - "multiple Ethernet frames.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE)); + g_param_spec_uint (NM_SETTING_WIRELESS_MTU, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:security: @@ -1270,15 +1224,10 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_SEC, - g_param_spec_string (NM_SETTING_WIRELESS_SEC, - "Security", - "If the wireless connection has any security " - "restrictions, like 802.1x, WEP, or WPA, set this " - "property to '" NM_SETTING_WIRELESS_SECURITY_SETTING_NAME "' " - "and ensure the connection contains a valid " - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME " setting.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_WIRELESS_SEC, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); /** * NMSettingWireless:hidden: @@ -1291,15 +1240,8 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) **/ g_object_class_install_property (object_class, PROP_HIDDEN, - g_param_spec_boolean (NM_SETTING_WIRELESS_HIDDEN, - "Hidden", - "If TRUE, indicates this network is a non-broadcasting " - "network that hides its SSID. In this case various " - "workarounds may take place, such as probe-scanning " - "the SSID for more reliable network discovery. " - "However, these workarounds expose inherent " - "insecurities with hidden SSID networks, and thus " - "hidden SSID networks should be used with caution.", + g_param_spec_boolean (NM_SETTING_WIRELESS_HIDDEN, "", "", FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-util/nm-setting-wireless.h b/libnm-util/nm-setting-wireless.h index 221a921a3..18f78cff6 100644 --- a/libnm-util/nm-setting-wireless.h +++ b/libnm-util/nm-setting-wireless.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2014 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_WIRELESS_H @@ -155,11 +152,11 @@ guint32 nm_setting_wireless_get_mtu (NMSettingWireless gboolean nm_setting_wireless_get_hidden (NMSettingWireless *setting); gboolean nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting, - const char *bssid); + const char *bssid); guint32 nm_setting_wireless_get_num_seen_bssids (NMSettingWireless *setting); const char *nm_setting_wireless_get_seen_bssid (NMSettingWireless *setting, - guint32 i); + guint32 i); gboolean nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless, NMSettingWirelessSecurity *s_wireless_sec, diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 0e8a06c4d..105981bc3 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,11 +16,14 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ +#include "config.h" + #include <string.h> +#include <glib/gi18n-lib.h> #include "nm-setting.h" #include "nm-setting-private.h" @@ -211,6 +211,17 @@ _get_setting_type_priority (GType type) return info->priority; } +guint32 +_nm_setting_get_setting_priority (NMSetting *setting) +{ + NMSettingPrivate *priv; + + g_return_val_if_fail (NM_IS_SETTING (setting), G_MAXUINT32); + priv = NM_SETTING_GET_PRIVATE (setting); + _ensure_setting_info (setting, priv); + return priv->info->priority; +} + gboolean _nm_setting_type_is_base_type (GType type) { @@ -262,8 +273,8 @@ _nm_setting_compare_priority (gconstpointer a, gconstpointer b) { guint32 prio_a, prio_b; - prio_a = _get_setting_type_priority (G_OBJECT_TYPE (a)); - prio_b = _get_setting_type_priority (G_OBJECT_TYPE (b)); + prio_a = _nm_setting_get_setting_priority ((NMSetting *) a); + prio_b = _nm_setting_get_setting_priority ((NMSetting *) b); if (prio_a < prio_b) return -1; @@ -291,7 +302,7 @@ destroy_gvalue (gpointer data) * Converts the #NMSetting into a #GHashTable mapping each setting property * name to a GValue describing that property, suitable for marshalling over * D-Bus or serializing. The mapping is string to GValue. - * + * * Returns: (transfer full) (element-type utf8 GObject.Value): a new #GHashTable * describing the setting's properties **/ @@ -306,11 +317,6 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags) g_return_val_if_fail (NM_IS_SETTING (setting), NULL); property_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (setting), &n_property_specs); - if (!property_specs) { - g_warning ("%s: couldn't find property specs for object of type '%s'", - __func__, g_type_name (G_OBJECT_TYPE (setting))); - return NULL; - } hash = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, destroy_gvalue); @@ -343,12 +349,6 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags) } g_free (property_specs); - /* Don't return empty hashes, except for base types */ - if (g_hash_table_size (hash) < 1 && !_nm_setting_is_base_type (setting)) { - g_hash_table_destroy (hash); - hash = NULL; - } - return hash; } @@ -364,7 +364,7 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags) * are strongly typed, thus the GValue type of the hash value must be correct. * See the documentation on each #NMSetting object subclass for the correct * property names and value types. - * + * * Returns: a new #NMSetting object populated with the properties from the * hash table, or %NULL on failure **/ @@ -396,19 +396,16 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash) param_spec = g_object_class_find_property (class, prop_name); if (!param_spec) { - /* Oh, we're so nice and only warn, maybe it should be a fatal error? */ - g_warning ("Ignoring invalid property '%s'", prop_name); + /* Assume that any unrecognized property either can be ignored, or + * else has a backward-compatibility equivalent. + */ + g_debug ("Ignoring unrecognized property '%s'", prop_name); continue; } g_value_init (dst_value, G_VALUE_TYPE (src_value)); - if (g_value_transform (src_value, dst_value)) - params[n_params++].name = prop_name; - else { - g_warning ("Ignoring property '%s' with invalid type (%s)", - prop_name, G_VALUE_TYPE_NAME (src_value)); - g_value_unset (dst_value); - } + g_value_copy (src_value, dst_value); + params[n_params++].name = prop_name; } setting = (NMSetting *) g_object_newv (setting_type, n_params, params); @@ -422,6 +419,27 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash) return setting; } +gboolean +_nm_setting_get_property (NMSetting *setting, const char *property_name, GValue *value) +{ + GParamSpec *prop_spec; + + g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); + g_return_val_if_fail (property_name, FALSE); + g_return_val_if_fail (value, FALSE); + + prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name); + + if (!prop_spec) { + g_value_unset (value); + return FALSE; + } + + g_value_init (value, prop_spec->value_type); + g_object_get_property (G_OBJECT (setting), property_name, value); + return TRUE; +} + static void duplicate_setting (NMSetting *setting, const char *name, @@ -517,20 +535,31 @@ nm_setting_get_name (NMSetting *setting) gboolean nm_setting_verify (NMSetting *setting, GSList *all_settings, GError **error) { - g_return_val_if_fail (NM_IS_SETTING (setting), FALSE); - g_return_val_if_fail (!error || *error == NULL, FALSE); + NMSettingVerifyResult result = _nm_setting_verify (setting, all_settings, error); + + if (result == NM_SETTING_VERIFY_NORMALIZABLE) + g_clear_error (error); + + return result == NM_SETTING_VERIFY_SUCCESS || result == NM_SETTING_VERIFY_NORMALIZABLE; +} + +NMSettingVerifyResult +_nm_setting_verify (NMSetting *setting, GSList *all_settings, GError **error) +{ + g_return_val_if_fail (NM_IS_SETTING (setting), NM_SETTING_VERIFY_ERROR); + g_return_val_if_fail (!error || *error == NULL, NM_SETTING_VERIFY_ERROR); if (NM_SETTING_GET_CLASS (setting)->verify) return NM_SETTING_GET_CLASS (setting)->verify (setting, all_settings, error); - return TRUE; + return NM_SETTING_VERIFY_SUCCESS; } static gboolean compare_property (NMSetting *setting, - NMSetting *other, - const GParamSpec *prop_spec, - NMSettingCompareFlags flags) + NMSetting *other, + const GParamSpec *prop_spec, + NMSettingCompareFlags flags) { GValue value1 = G_VALUE_INIT; GValue value2 = G_VALUE_INIT; @@ -541,8 +570,12 @@ compare_property (NMSetting *setting, NMSettingSecretFlags a_secret_flags = NM_SETTING_SECRET_FLAG_NONE; NMSettingSecretFlags b_secret_flags = NM_SETTING_SECRET_FLAG_NONE; - nm_setting_get_secret_flags (setting, prop_spec->name, &a_secret_flags, NULL); - nm_setting_get_secret_flags (other, prop_spec->name, &b_secret_flags, NULL); + g_return_val_if_fail (!NM_IS_SETTING_VPN (setting), FALSE); + + if (!nm_setting_get_secret_flags (setting, prop_spec->name, &a_secret_flags, NULL)) + g_return_val_if_reached (FALSE); + if (!nm_setting_get_secret_flags (other, prop_spec->name, &b_secret_flags, NULL)) + g_return_val_if_reached (FALSE); /* If the secret flags aren't the same the settings aren't the same */ if (a_secret_flags != b_secret_flags) @@ -610,7 +643,7 @@ nm_setting_compare (NMSetting *a, /* Fuzzy compare ignores secrets and properties defined with the FUZZY_IGNORE flag */ if ( (flags & NM_SETTING_COMPARE_FLAG_FUZZY) - && (prop_spec->flags & (NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_SECRET))) + && (prop_spec->flags & (NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_SECRET))) continue; if ((flags & NM_SETTING_COMPARE_FLAG_INFERRABLE) && !(prop_spec->flags & NM_SETTING_PARAM_INFERRABLE)) @@ -647,7 +680,16 @@ should_compare_prop (NMSetting *setting, if (comp_flags & NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS) return FALSE; - nm_setting_get_secret_flags (setting, prop_name, &secret_flags, NULL); + if ( NM_IS_SETTING_VPN (setting) + && g_strcmp0 (prop_name, NM_SETTING_VPN_SECRETS) == 0) { + /* FIXME: NMSettingVPN:NM_SETTING_VPN_SECRETS has NM_SETTING_PARAM_SECRET. + * nm_setting_get_secret_flags() quite possibly fails, but it might succeed if the + * setting accidently uses a key "secrets". */ + return FALSE; + } + + if (!nm_setting_get_secret_flags (setting, prop_name, &secret_flags, NULL)) + g_return_val_if_reached (FALSE); if ( (comp_flags & NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS) && (secret_flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)) @@ -699,6 +741,8 @@ nm_setting_diff (NMSetting *a, guint i; NMSettingDiffResult a_result = NM_SETTING_DIFF_RESULT_IN_A; NMSettingDiffResult b_result = NM_SETTING_DIFF_RESULT_IN_B; + NMSettingDiffResult a_result_default = NM_SETTING_DIFF_RESULT_IN_A_DEFAULT; + NMSettingDiffResult b_result_default = NM_SETTING_DIFF_RESULT_IN_B_DEFAULT; gboolean results_created = FALSE; g_return_val_if_fail (results != NULL, FALSE); @@ -708,6 +752,12 @@ nm_setting_diff (NMSetting *a, g_return_val_if_fail (G_OBJECT_TYPE (a) == G_OBJECT_TYPE (b), FALSE); } + if ((flags & (NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT | NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT)) == + (NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT | NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT)) { + /* conflicting flags: default to WITH_DEFAULT (clearing NO_DEFAULT). */ + flags &= ~NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT; + } + /* If the caller is calling this function in a pattern like this to get * complete diffs: * @@ -720,6 +770,8 @@ nm_setting_diff (NMSetting *a, if (invert_results) { a_result = NM_SETTING_DIFF_RESULT_IN_B; b_result = NM_SETTING_DIFF_RESULT_IN_A; + a_result_default = NM_SETTING_DIFF_RESULT_IN_B_DEFAULT; + b_result_default = NM_SETTING_DIFF_RESULT_IN_A_DEFAULT; } if (*results == NULL) { @@ -732,8 +784,7 @@ nm_setting_diff (NMSetting *a, for (i = 0; i < n_property_specs; i++) { GParamSpec *prop_spec = property_specs[i]; - NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN, tmp; - gboolean different = TRUE; + NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN; /* Handle compare flags */ if (!should_compare_prop (a, prop_spec->name, flags, prop_spec->flags)) @@ -742,28 +793,58 @@ nm_setting_diff (NMSetting *a, continue; if (b) { + gboolean different; + different = !NM_SETTING_GET_CLASS (a)->compare_property (a, b, prop_spec, flags); if (different) { + gboolean a_is_default, b_is_default; GValue value = G_VALUE_INIT; g_value_init (&value, prop_spec->value_type); g_object_get_property (G_OBJECT (a), prop_spec->name, &value); - if (!g_param_value_defaults (prop_spec, &value)) - r |= a_result; + a_is_default = g_param_value_defaults (prop_spec, &value); g_value_reset (&value); g_object_get_property (G_OBJECT (b), prop_spec->name, &value); - if (!g_param_value_defaults (prop_spec, &value)) - r |= b_result; + b_is_default = g_param_value_defaults (prop_spec, &value); g_value_unset (&value); + if ((flags & NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT) == 0) { + if (!a_is_default) + r |= a_result; + if (!b_is_default) + r |= b_result; + } else { + r |= a_result | b_result; + if (a_is_default) + r |= a_result_default; + if (b_is_default) + r |= b_result_default; + } } - } else + } else if ((flags & (NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT | NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT)) == 0) r = a_result; /* only in A */ + else { + GValue value = G_VALUE_INIT; - if (different) { - tmp = GPOINTER_TO_UINT (g_hash_table_lookup (*results, prop_spec->name)); - g_hash_table_insert (*results, g_strdup (prop_spec->name), GUINT_TO_POINTER (tmp | r)); + g_value_init (&value, prop_spec->value_type); + g_object_get_property (G_OBJECT (a), prop_spec->name, &value); + if (!g_param_value_defaults (prop_spec, &value)) + r |= a_result; + else if (flags & NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT) + r |= a_result | a_result_default; + + g_value_unset (&value); + } + + if (r != NM_SETTING_DIFF_RESULT_UNKNOWN) { + void *p; + + if (g_hash_table_lookup_extended (*results, prop_spec->name, NULL, &p)) { + if ((r & GPOINTER_TO_UINT (p)) != r) + g_hash_table_insert (*results, g_strdup (prop_spec->name), GUINT_TO_POINTER (r | GPOINTER_TO_UINT (p))); + } else + g_hash_table_insert (*results, g_strdup (prop_spec->name), GUINT_TO_POINTER (r)); } } g_free (property_specs); @@ -788,8 +869,8 @@ nm_setting_diff (NMSetting *a, **/ void nm_setting_enumerate_values (NMSetting *setting, - NMSettingValueIterFn func, - gpointer user_data) + NMSettingValueIterFn func, + gpointer user_data) { GParamSpec **property_specs; guint n_property_specs; @@ -862,15 +943,19 @@ _nm_setting_clear_secrets (NMSetting *setting) static gboolean clear_secrets_with_flags (NMSetting *setting, - GParamSpec *pspec, - NMSettingClearSecretsWithFlagsFn func, - gpointer user_data) + GParamSpec *pspec, + NMSettingClearSecretsWithFlagsFn func, + gpointer user_data) { NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; gboolean changed = FALSE; + g_return_val_if_fail (!NM_IS_SETTING_VPN (setting), FALSE); + /* Clear the secret if the user function says to do so */ - nm_setting_get_secret_flags (setting, pspec->name, &flags, NULL); + if (!nm_setting_get_secret_flags (setting, pspec->name, &flags, NULL)) + g_return_val_if_reached (FALSE); + if (func (setting, pspec->name, flags, user_data) == TRUE) { GValue value = G_VALUE_INIT; @@ -963,7 +1048,6 @@ static int update_one_secret (NMSetting *setting, const char *key, GValue *value, GError **error) { GParamSpec *prop_spec; - GValue transformed_value = G_VALUE_INIT; prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), key); if (!prop_spec) { @@ -995,11 +1079,6 @@ update_one_secret (NMSetting *setting, const char *key, GValue *value, GError ** g_object_set_property (G_OBJECT (setting), prop_spec->name, value); return NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED; } - if (g_value_transform (value, &transformed_value)) { - g_object_set_property (G_OBJECT (setting), prop_spec->name, &transformed_value); - g_value_unset (&transformed_value); - return NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED; - } g_set_error (error, NM_SETTING_ERROR, NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH, @@ -1016,7 +1095,7 @@ update_one_secret (NMSetting *setting, const char *key, GValue *value, GError ** * * Update the setting's secrets, given a hash table of secrets intended for that * setting (deserialized from D-Bus for example). - * + * * Returns: %TRUE if the secrets were successfully updated, %FALSE on failure to * update one or more of the secrets. **/ @@ -1095,8 +1174,11 @@ get_secret_flags (NMSetting *setting, char *flags_prop; NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; - if (verify_secret) - g_return_val_if_fail (is_secret_prop (setting, secret_name, error), FALSE); + if (verify_secret && !is_secret_prop (setting, secret_name, error)) { + if (out_flags) + *out_flags = NM_SETTING_SECRET_FLAG_NONE; + return FALSE; + } flags_prop = g_strdup_printf ("%s-flags", secret_name); g_object_get (G_OBJECT (setting), flags_prop, &flags, NULL); @@ -1199,8 +1281,6 @@ nm_setting_to_string (NMSetting *setting) g_return_val_if_fail (NM_IS_SETTING (setting), NULL); property_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (setting), &n_property_specs); - if (!property_specs) - return NULL; string = g_string_new (nm_setting_get_name (setting)); g_string_append_c (string, '\n'); @@ -1259,6 +1339,87 @@ nm_setting_get_virtual_iface_name (NMSetting *setting) return NULL; } + +NMSettingVerifyResult +_nm_setting_verify_deprecated_virtual_iface_name (const char *interface_name, + gboolean allow_missing, + const char *setting_name, + const char *setting_property, + GQuark error_quark, + gint e_invalid_property, + gint e_missing_property, + GSList *all_settings, + GError **error) +{ + NMSettingConnection *s_con; + const char *con_name; + + s_con = NM_SETTING_CONNECTION (nm_setting_find_in_list (all_settings, NM_SETTING_CONNECTION_SETTING_NAME)); + con_name = s_con ? nm_setting_connection_get_interface_name (s_con) : NULL; + if (!interface_name && !con_name) { + if (allow_missing) + return NM_SETTING_VERIFY_SUCCESS; + + g_set_error_literal (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY, + _("property is missing")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); + return NM_SETTING_VERIFY_ERROR; + } + if (!con_name && !nm_utils_iface_valid_name (interface_name)) { + /* the interface_name is invalid, we cannot normalize it. Only do this if !con_name, + * because if con_name is set, it can overwrite interface_name. */ + g_set_error_literal (error, + error_quark, + e_invalid_property, + _("property is invalid")); + g_prefix_error (error, "%s.%s: ", setting_name, setting_property); + return NM_SETTING_VERIFY_ERROR; + } + if (!con_name) { + /* NMSettingConnection has interface not set, it should be normalized to interface_name */ + g_set_error_literal (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY, + _("property is missing")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); + return NM_SETTING_VERIFY_NORMALIZABLE; + } + if (!nm_utils_iface_valid_name (con_name)) { + /* NMSettingConnection:interface_name is invalid, we cannot normalize it. */ + g_set_error_literal (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is invalid")); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME); + return NM_SETTING_VERIFY_ERROR; + } + if (!interface_name) { + /* Normalize by setting NMSettingConnection:interface_name. */ + g_set_error_literal (error, + error_quark, + e_missing_property, + _("property is missing")); + g_prefix_error (error, "%s.%s: ", setting_name, setting_property); + return NM_SETTING_VERIFY_NORMALIZABLE; + } + if (strcmp (con_name, interface_name) != 0) { + /* con_name and interface_name are different. It can be normalized by setting interface_name + * to con_name. */ + g_set_error_literal (error, + error_quark, + e_invalid_property, + _("property is invalid")); + g_prefix_error (error, "%s.%s: ", setting_name, setting_property); + /* we would like to make this a NORMALIZEABLE_ERROR, but that might + * break older connections. */ + return NM_SETTING_VERIFY_NORMALIZABLE; + } + + return NM_SETTING_VERIFY_SUCCESS; +} + /*****************************************************************************/ static void @@ -1348,13 +1509,8 @@ nm_setting_class_init (NMSettingClass *setting_class) **/ g_object_class_install_property (object_class, PROP_NAME, - g_param_spec_string (NM_SETTING_NAME, - "Name", - "The setting's name; these names are defined by the " - "specification and cannot be changed after the object " - "has been created. Each setting class has a name, and " - "all objects of that class share the same name.", - NULL, - G_PARAM_READWRITE)); + g_param_spec_string (NM_SETTING_NAME, "", "", + NULL, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h index 51e7de48a..28c6975a8 100644 --- a/libnm-util/nm-setting.h +++ b/libnm-util/nm-setting.h @@ -1,9 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * * 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 @@ -19,8 +16,8 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #ifndef NM_SETTING_H @@ -127,6 +124,20 @@ typedef enum { * @NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS: ignore secrets for which * the secret's flags indicate the secret should not be saved to persistent * storage (ie, the secret's flag includes @NM_SETTING_SECRET_FLAG_NOT_SAVED) + * @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT: if this flag is set, + * nm_setting_diff() and nm_connection_diff() will also include properties that + * are set to their default value. See also @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT. + * @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT: if this flag is set, + * nm_setting_diff() and nm_connection_diff() will not include properties that + * are set to their default value. This is the opposite of + * @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT. If both flags are set together, + * @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT wins. If both flags are unset, + * this means to exclude default properties if there is a setting to compare, + * but include all properties, if the setting 'b' is missing. This is the legacy + * behaviour of libnm-util, where nm_setting_diff() behaved differently depending + * on whether the setting 'b' was available. If @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT + * is set, nm_setting_diff() will also set the flags @NM_SETTING_DIFF_RESULT_IN_A_DEFAULT + * and @NM_SETTING_DIFF_RESULT_IN_B_DEFAULT, if the values are default values. * * These flags modify the comparison behavior when comparing two settings or * two connections. @@ -138,7 +149,9 @@ typedef enum { NM_SETTING_COMPARE_FLAG_IGNORE_ID = 0x00000002, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS = 0x00000004, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS = 0x00000008, - NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS = 0x00000010 + NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS = 0x00000010, + NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT = 0x00000020, + NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT = 0x00000040, /* 0x80000000 is used for a private flag */ } NMSettingCompareFlags; @@ -173,7 +186,7 @@ typedef struct { GObjectClass parent; /* Virtual functions */ - gboolean (*verify) (NMSetting *setting, + gint (*verify) (NMSetting *setting, GSList *all_settings, GError **error); @@ -270,6 +283,10 @@ gboolean nm_setting_compare (NMSetting *a, * @NM_SETTING_DIFF_RESULT_UNKNOWN: unknown result * @NM_SETTING_DIFF_RESULT_IN_A: the property is present in setting A * @NM_SETTING_DIFF_RESULT_IN_B: the property is present in setting B + * @NM_SETTING_DIFF_RESULT_IN_A_DEFAULT: the property is present in + * setting A but is set to the default value. This flag is only set, + * if you specify @NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT. + * @NM_SETTING_DIFF_RESULT_IN_B_DEFAULT: analog to @NM_SETTING_DIFF_RESULT_IN_A_DEFAULT. * * These values indicate the result of a setting difference operation. **/ @@ -277,6 +294,8 @@ typedef enum { NM_SETTING_DIFF_RESULT_UNKNOWN = 0x00000000, NM_SETTING_DIFF_RESULT_IN_A = 0x00000001, NM_SETTING_DIFF_RESULT_IN_B = 0x00000002, + NM_SETTING_DIFF_RESULT_IN_A_DEFAULT = 0x00000004, + NM_SETTING_DIFF_RESULT_IN_B_DEFAULT = 0x00000004, } NMSettingDiffResult; gboolean nm_setting_diff (NMSetting *a, @@ -318,4 +337,3 @@ const char *nm_setting_get_virtual_iface_name (NMSetting *setting); G_END_DECLS #endif /* NM_SETTING_H */ - diff --git a/libnm-util/nm-utils-enum-types.c b/libnm-util/nm-utils-enum-types.c index 9b3eb4f4d..6ef157da3 100644 --- a/libnm-util/nm-utils-enum-types.c +++ b/libnm-util/nm-utils-enum-types.c @@ -47,6 +47,7 @@ nm_connection_error_get_type (void) { NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, "NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND", "ConnectionSettingNotFound" }, { NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, "NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID", "ConnectionTypeInvalid" }, { NM_CONNECTION_ERROR_SETTING_NOT_FOUND, "NM_CONNECTION_ERROR_SETTING_NOT_FOUND", "SettingNotFound" }, + { NM_CONNECTION_ERROR_INVALID_SETTING, "NM_CONNECTION_ERROR_INVALID_SETTING", "InvalidSetting" }, { 0, NULL, NULL } }; GType g_define_type_id = @@ -112,6 +113,8 @@ nm_setting_compare_flags_get_type (void) { NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, "NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS", "ignore-secrets" }, { NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, "NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS", "ignore-agent-owned-secrets" }, { NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, "NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS", "ignore-not-saved-secrets" }, + { NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT, "NM_SETTING_COMPARE_FLAG_DIFF_RESULT_WITH_DEFAULT", "diff-result-with-default" }, + { NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT, "NM_SETTING_COMPARE_FLAG_DIFF_RESULT_NO_DEFAULT", "diff-result-no-default" }, { 0, NULL, NULL } }; GType g_define_type_id = @@ -152,6 +155,8 @@ nm_setting_diff_result_get_type (void) { NM_SETTING_DIFF_RESULT_UNKNOWN, "NM_SETTING_DIFF_RESULT_UNKNOWN", "unknown" }, { NM_SETTING_DIFF_RESULT_IN_A, "NM_SETTING_DIFF_RESULT_IN_A", "in-a" }, { NM_SETTING_DIFF_RESULT_IN_B, "NM_SETTING_DIFF_RESULT_IN_B", "in-b" }, + { NM_SETTING_DIFF_RESULT_IN_A_DEFAULT, "NM_SETTING_DIFF_RESULT_IN_A_DEFAULT", "in-a-default" }, + { NM_SETTING_DIFF_RESULT_IN_B_DEFAULT, "NM_SETTING_DIFF_RESULT_IN_B_DEFAULT", "in-b-default" }, { 0, NULL, NULL } }; GType g_define_type_id = diff --git a/libnm-util/nm-utils-enum-types.h b/libnm-util/nm-utils-enum-types.h deleted file mode 100644 index 9b14a5d3c..000000000 --- a/libnm-util/nm-utils-enum-types.h +++ /dev/null @@ -1,101 +0,0 @@ - - - -/* Generated by glib-mkenums. Do not edit */ - -#ifndef __NM_UTILS_ENUM_TYPES_H__ -#define __NM_UTILS_ENUM_TYPES_H__ - -#include <glib-object.h> - -G_BEGIN_DECLS -GType nm_connection_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_CONNECTION_ERROR (nm_connection_error_get_type ()) -GType nm_setting_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_ERROR (nm_setting_error_get_type ()) -GType nm_setting_secret_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_SECRET_FLAGS (nm_setting_secret_flags_get_type ()) -GType nm_setting_compare_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_COMPARE_FLAGS (nm_setting_compare_flags_get_type ()) -GType nm_setting_hash_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_HASH_FLAGS (nm_setting_hash_flags_get_type ()) -GType nm_setting_diff_result_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_DIFF_RESULT (nm_setting_diff_result_get_type ()) -GType nm_setting_802_1x_ck_format_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_802_1X_CK_FORMAT (nm_setting_802_1x_ck_format_get_type ()) -GType nm_setting_802_1x_ck_scheme_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_802_1X_CK_SCHEME (nm_setting_802_1x_ck_scheme_get_type ()) -GType nm_setting_802_1x_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_802_1X_ERROR (nm_setting_802_1x_error_get_type ()) -GType nm_setting_adsl_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_ADSL_ERROR (nm_setting_adsl_error_get_type ()) -GType nm_setting_bluetooth_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_BLUETOOTH_ERROR (nm_setting_bluetooth_error_get_type ()) -GType nm_setting_bond_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_BOND_ERROR (nm_setting_bond_error_get_type ()) -GType nm_setting_team_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_TEAM_ERROR (nm_setting_team_error_get_type ()) -GType nm_setting_team_port_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_TEAM_PORT_ERROR (nm_setting_team_port_error_get_type ()) -GType nm_setting_bridge_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_BRIDGE_ERROR (nm_setting_bridge_error_get_type ()) -GType nm_setting_bridge_port_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_BRIDGE_PORT_ERROR (nm_setting_bridge_port_error_get_type ()) -GType nm_setting_connection_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_CONNECTION_ERROR (nm_setting_connection_error_get_type ()) -GType nm_setting_dcb_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_DCB_ERROR (nm_setting_dcb_error_get_type ()) -GType nm_setting_dcb_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_DCB_FLAGS (nm_setting_dcb_flags_get_type ()) -GType nm_setting_infiniband_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_INFINIBAND_ERROR (nm_setting_infiniband_error_get_type ()) -GType nm_setting_ip4_config_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_IP4_CONFIG_ERROR (nm_setting_ip4_config_error_get_type ()) -GType nm_setting_vlan_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_VLAN_ERROR (nm_setting_vlan_error_get_type ()) -GType nm_vlan_priority_map_get_type (void) G_GNUC_CONST; -#define NM_TYPE_VLAN_PRIORITY_MAP (nm_vlan_priority_map_get_type ()) -GType nm_vlan_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_VLAN_FLAGS (nm_vlan_flags_get_type ()) -GType nm_setting_ip6_config_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_IP6_CONFIG_ERROR (nm_setting_ip6_config_error_get_type ()) -GType nm_setting_ip6_config_privacy_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_IP6_CONFIG_PRIVACY (nm_setting_ip6_config_privacy_get_type ()) -GType nm_setting_ppp_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_PPP_ERROR (nm_setting_ppp_error_get_type ()) -GType nm_setting_pppoe_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_PPPOE_ERROR (nm_setting_pppoe_error_get_type ()) -GType nm_setting_serial_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_SERIAL_ERROR (nm_setting_serial_error_get_type ()) -GType nm_setting_generic_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_GENERIC_ERROR (nm_setting_generic_error_get_type ()) -GType nm_setting_gsm_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_GSM_ERROR (nm_setting_gsm_error_get_type ()) -GType nm_setting_gsm_network_type_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_GSM_NETWORK_TYPE (nm_setting_gsm_network_type_get_type ()) -GType nm_setting_gsm_network_band_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_GSM_NETWORK_BAND (nm_setting_gsm_network_band_get_type ()) -GType nm_setting_cdma_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_CDMA_ERROR (nm_setting_cdma_error_get_type ()) -GType nm_setting_olpc_mesh_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_OLPC_MESH_ERROR (nm_setting_olpc_mesh_error_get_type ()) -GType nm_setting_wimax_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_WIMAX_ERROR (nm_setting_wimax_error_get_type ()) -GType nm_setting_wired_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_WIRED_ERROR (nm_setting_wired_error_get_type ()) -GType nm_setting_wireless_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_WIRELESS_ERROR (nm_setting_wireless_error_get_type ()) -GType nm_setting_wireless_security_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_WIRELESS_SECURITY_ERROR (nm_setting_wireless_security_error_get_type ()) -GType nm_wep_key_type_get_type (void) G_GNUC_CONST; -#define NM_TYPE_WEP_KEY_TYPE (nm_wep_key_type_get_type ()) -GType nm_setting_vpn_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SETTING_VPN_ERROR (nm_setting_vpn_error_get_type ()) -GType nm_utils_security_type_get_type (void) G_GNUC_CONST; -#define NM_TYPE_UTILS_SECURITY_TYPE (nm_utils_security_type_get_type ()) -G_END_DECLS - -#endif /* __NM_UTILS_ENUM_TYPES_H__ */ - - - diff --git a/libnm-util/nm-utils-private.h b/libnm-util/nm-utils-private.h index 9d73a939f..0e7be21e2 100644 --- a/libnm-util/nm-utils-private.h +++ b/libnm-util/nm-utils-private.h @@ -1,10 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * Ray Strode <rstrode@redhat.com> - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * +/* * 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 @@ -20,7 +15,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2005 - 2008 Red Hat, Inc. + * Copyright 2005 - 2008 Red Hat, Inc. */ #ifndef __NM_UTILS_PRIVATE_H__ @@ -39,32 +34,4 @@ gboolean _nm_utils_gvalue_array_validate (GValueArray *elements, void _nm_value_transforms_register (void); -/***********************************************************/ - -typedef struct NMUtilsPrivateData { - const char * (*nm_setting_ip4_config_get_address_label) (NMSettingIP4Config *setting, - guint32 i); - gboolean (*nm_setting_ip4_config_add_address_with_label) (NMSettingIP4Config *setting, - NMIP4Address *address, - const char *label); -} NMUtilsPrivateData; - -const NMUtilsPrivateData *nm_utils_get_private (void); - -/** - * NM_UTILS_PRIVATE_CALL: - * @call: a call to a private libnm-util function - * - * Used to call private libnm-util functions. Eg, if there was a - * private function called nm_foo_get_bar(), you could call it like: - * - * bar = NM_UTILS_PRIVATE_CALL (nm_foo_get_bar (foo, x, y, z)); - * - * This macro only exists inside the NetworkManager source tree and - * is not part of the public API. - * - * Since: 0.9.10 - */ -#define NM_UTILS_PRIVATE_CALL(call) (nm_utils_get_private ()->call) - #endif diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 0176d9c3c..203803f23 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -1,11 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * Ray Strode <rstrode@redhat.com> - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * +/* * 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 @@ -21,7 +16,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2005 - 2013 Red Hat, Inc. + * Copyright 2005 - 2013 Red Hat, Inc. */ #include "config.h" @@ -31,6 +26,10 @@ #include <netinet/ether.h> #include <linux/if_infiniband.h> #include <uuid/uuid.h> +#include <libintl.h> +#include <gmodule.h> +#include <gio/gio.h> +#include <glib/gi18n-lib.h> #include "nm-utils.h" #include "nm-utils-private.h" @@ -38,13 +37,17 @@ #include "nm-dbus-glib-types.h" #include "nm-setting-private.h" #include "crypto.h" +#include "nm-utils-internal.h" + +/* Embed the commit id in the build binary */ +static const char *const __nm_git_sha = STRLEN (NM_GIT_SHA) > 0 ? "NM_GIT_SHA:"NM_GIT_SHA : ""; /** * SECTION:nm-utils * @short_description: Utility functions * @include: nm-utils.h * - * A collection of utility functions for working SSIDs, IP addresses, Wi-Fi + * A collection of utility functions for working with SSIDs, IP addresses, Wi-Fi * access points and devices, among other things. */ @@ -144,7 +147,7 @@ init_lang_to_encodings_hash (void) langToEncodings5 = g_hash_table_new (g_str_hash, g_str_equal); while (enc->lang) { g_hash_table_insert (langToEncodings5, (gpointer) enc->lang, - (gpointer) &enc->encodings); + (gpointer) &enc->encodings); enc++; } } @@ -155,7 +158,7 @@ init_lang_to_encodings_hash (void) langToEncodings2 = g_hash_table_new (g_str_hash, g_str_equal); while (enc->lang) { g_hash_table_insert (langToEncodings2, (gpointer) enc->lang, - (gpointer) &enc->encodings); + (gpointer) &enc->encodings); enc++; } } @@ -184,8 +187,7 @@ get_encodings_for_lang (const char *lang, init_lang_to_encodings_hash (); tmp_lang = g_strdup (lang); - if ((encodings = g_hash_table_lookup (langToEncodings5, tmp_lang))) - { + if ((encodings = g_hash_table_lookup (langToEncodings5, tmp_lang))) { *encoding1 = (char *) encodings->encoding1; *encoding2 = (char *) encodings->encoding2; *encoding3 = (char *) encodings->encoding3; @@ -195,8 +197,7 @@ get_encodings_for_lang (const char *lang, /* Truncate tmp_lang to length of 2 */ if (strlen (tmp_lang) > 2) tmp_lang[2] = '\0'; - if (!success && (encodings = g_hash_table_lookup (langToEncodings2, tmp_lang))) - { + if (!success && (encodings = g_hash_table_lookup (langToEncodings2, tmp_lang))) { *encoding1 = (char *) encodings->encoding1; *encoding2 = (char *) encodings->encoding2; *encoding3 = (char *) encodings->encoding3; @@ -209,25 +210,40 @@ get_encodings_for_lang (const char *lang, /* init, deinit for libnm_util */ +static void __attribute__((constructor)) +_check_symbols (void) +{ + GModule *self; + gpointer func; + + self = g_module_open (NULL, 0); + if (g_module_symbol (self, "nm_device_state_get_type", &func)) + g_error ("libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported"); + g_module_close (self); +} + static gboolean initialized = FALSE; /** * nm_utils_init: * @error: location to store error, or %NULL * - * Initializes libnm-util; should be called when starting and program that - * uses libnm-util. Sets up an atexit() handler to ensure de-initialization - * is performed, but calling nm_utils_deinit() to explicitly deinitialize - * libnm-util can also be done. This function can be called more than once. - * + * Initializes libnm-util; should be called when starting any program that + * uses libnm-util. This function can be called more than once. + * * Returns: %TRUE if the initialization was successful, %FALSE on failure. **/ gboolean nm_utils_init (GError **error) { + (void) __nm_git_sha; + if (!initialized) { initialized = TRUE; + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!crypto_init (error)) return FALSE; @@ -239,18 +255,12 @@ nm_utils_init (GError **error) /** * nm_utils_deinit: * - * Frees all resources used internally by libnm-util. This function is called - * from an atexit() handler, set up by nm_utils_init(), but is safe to be called - * more than once. Subsequent calls have no effect until nm_utils_init() is - * called again. + * No-op. Although this function still exists for ABI compatibility reasons, it + * does not have any effect, and does not ever need to be called. **/ void nm_utils_deinit (void) { - if (initialized) { - crypto_deinit (); - initialized = FALSE; - } } /* ssid helpers */ @@ -340,16 +350,16 @@ nm_utils_ssid_to_utf8 (const GByteArray *ssid) gboolean nm_utils_is_empty_ssid (const guint8 * ssid, int len) { - /* Single white space is for Linksys APs */ - if (len == 1 && ssid[0] == ' ') - return TRUE; + /* Single white space is for Linksys APs */ + if (len == 1 && ssid[0] == ' ') + return TRUE; - /* Otherwise, if the entire ssid is 0, we assume it is hidden */ - while (len--) { - if (ssid[len] != '\0') - return FALSE; - } - return TRUE; + /* Otherwise, if the entire ssid is 0, we assume it is hidden */ + while (len--) { + if (ssid[len] != '\0') + return FALSE; + } + return TRUE; } #define ESSID_MAX_SIZE 32 @@ -475,8 +485,8 @@ nm_utils_gvalue_hash_dup (GHashTable *hash) g_return_val_if_fail (hash != NULL, NULL); table = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - value_destroy); + (GDestroyNotify) g_free, + value_destroy); g_hash_table_foreach (hash, value_dup, table); @@ -675,7 +685,7 @@ nm_utils_security_valid (NMUtilsSecurityType type, || ((type == NMU_SEC_LEAP) && !adhoc)) { if (wifi_caps & (NM_WIFI_DEVICE_CAP_CIPHER_WEP40 | NM_WIFI_DEVICE_CAP_CIPHER_WEP104)) return TRUE; - else + else return FALSE; } } @@ -894,7 +904,7 @@ nm_utils_wpa_psk_valid (const char *psk) * this serialization is not guaranteed to be stable and the #GArray may be * extended in the future. * - * Returns: (transfer full) (element-type NetworkManager.IP4Address): a newly allocated #GSList of #NMIP4Address objects + * Returns: (transfer full) (element-type NMIP4Address): a newly allocated #GSList of #NMIP4Address objects **/ GSList * nm_utils_ip4_addresses_from_gvalue (const GValue *value) @@ -912,7 +922,7 @@ nm_utils_ip4_addresses_from_gvalue (const GValue *value) g_warning ("Ignoring invalid IP4 address"); continue; } - + addr = nm_ip4_address_new (); nm_ip4_address_set_address (addr, g_array_index (array, guint32, 0)); nm_ip4_address_set_prefix (addr, g_array_index (array, guint32, 1)); @@ -976,7 +986,7 @@ nm_utils_ip4_addresses_to_gvalue (GSList *list, GValue *value) * format of this serialization is not guaranteed to be stable and may be * extended in the future. * - * Returns: (transfer full) (element-type NetworkManager.IP4Route): a newly allocated #GSList of #NMIP4Route objects + * Returns: (transfer full) (element-type NMIP4Route): a newly allocated #GSList of #NMIP4Route objects **/ GSList * nm_utils_ip4_routes_from_gvalue (const GValue *value) @@ -1133,7 +1143,7 @@ nm_utils_ip4_get_default_prefix (guint32 ip) * this serialization is not guaranteed to be stable and the #GValueArray may be * extended in the future. * - * Returns: (transfer full) (element-type NetworkManager.IP6Address): a newly allocated #GSList of #NMIP6Address objects + * Returns: (transfer full) (element-type NMIP6Address): a newly allocated #GSList of #NMIP6Address objects **/ GSList * nm_utils_ip6_addresses_from_gvalue (const GValue *value) @@ -1168,7 +1178,7 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) ba_addr = g_value_get_boxed (tmp); if (ba_addr->len != 16) { g_warning ("%s: ignoring invalid IP6 address of length %d", - __func__, ba_addr->len); + __func__, ba_addr->len); continue; } @@ -1176,7 +1186,7 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) prefix = g_value_get_uint (tmp); if (prefix > 128) { g_warning ("%s: ignoring invalid IP6 prefix %d", - __func__, prefix); + __func__, prefix); continue; } @@ -1185,7 +1195,7 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) ba_gw = g_value_get_boxed (tmp); if (ba_gw->len != 16) { g_warning ("%s: ignoring invalid IP6 gateway address of length %d", - __func__, ba_gw->len); + __func__, ba_gw->len); continue; } } @@ -1270,7 +1280,7 @@ nm_utils_ip6_addresses_to_gvalue (GSList *list, GValue *value) * into a #GSList of #NMIP6Route objects. The specific format of this serialization * is not guaranteed to be stable and may be extended in the future. * - * Returns: (transfer full) (element-type NetworkManager.IP6Route): a newly allocated #GSList of #NMIP6Route objects + * Returns: (transfer full) (element-type NMIP6Route): a newly allocated #GSList of #NMIP6Route objects **/ GSList * nm_utils_ip6_routes_from_gvalue (const GValue *value) @@ -1298,7 +1308,7 @@ nm_utils_ip6_routes_from_gvalue (const GValue *value) dest = g_value_get_boxed (g_value_array_get_nth (route_values, 0)); if (dest->len != 16) { g_warning ("%s: ignoring invalid IP6 dest address of length %d", - __func__, dest->len); + __func__, dest->len); continue; } @@ -1307,7 +1317,7 @@ nm_utils_ip6_routes_from_gvalue (const GValue *value) next_hop = g_value_get_boxed (g_value_array_get_nth (route_values, 2)); if (next_hop->len != 16) { g_warning ("%s: ignoring invalid IP6 next_hop address of length %d", - __func__, next_hop->len); + __func__, next_hop->len); continue; } @@ -1334,7 +1344,7 @@ nm_utils_ip6_routes_from_gvalue (const GValue *value) * Utility function to convert a #GSList of #NMIP6Route objects into a #GPtrArray of * #GValueArrays of (#GArray of #guchars), #guint32, (#GArray of #guchars), and #guint32 * representing a list of NetworkManager IPv6 routes (which is a tuple of destination, - * prefix, next hop, and metric). The specific format of this serialization is not + * prefix, next hop, and metric). The specific format of this serialization is not * guaranteed to be stable and may be extended in the future. **/ void @@ -1485,9 +1495,11 @@ char * nm_utils_uuid_generate_from_string (const char *s) { GError *error = NULL; - uuid_t *uuid; + uuid_t uuid; char *buf = NULL; + g_return_val_if_fail (s && *s, NULL); + if (!nm_utils_init (&error)) { g_warning ("error initializing crypto: (%d) %s", error ? error->code : 0, @@ -1497,21 +1509,18 @@ nm_utils_uuid_generate_from_string (const char *s) return NULL; } - uuid = g_malloc0 (sizeof (*uuid)); - if (!crypto_md5_hash (NULL, 0, s, strlen (s), (char *) uuid, sizeof (*uuid), &error)) { + if (!crypto_md5_hash (NULL, 0, s, strlen (s), (char *) uuid, sizeof (uuid), &error)) { g_warning ("error generating UUID: (%d) %s", error ? error->code : 0, error ? error->message : "unknown"); if (error) g_error_free (error); - goto out; + return NULL; } buf = g_malloc0 (37); - uuid_unparse_lower (*uuid, &buf[0]); + uuid_unparse_lower (uuid, &buf[0]); -out: - g_free (uuid); return buf; } @@ -1721,9 +1730,9 @@ nm_utils_rsa_key_encrypt_aes (const GByteArray *data, * nm_utils_file_is_pkcs12: * @filename: name of the file to test * - * Utility function to find out if the @filename is in PKCS#12 format. + * Utility function to find out if the @filename is in PKCS#<!-- -->12 format. * - * Returns: %TRUE if the file is PKCS#12, %FALSE if it is not + * Returns: %TRUE if the file is PKCS#<!-- -->12, %FALSE if it is not **/ gboolean nm_utils_file_is_pkcs12 (const char *filename) @@ -1731,6 +1740,82 @@ nm_utils_file_is_pkcs12 (const char *filename) return crypto_is_pkcs12_file (filename, NULL); } +/**********************************************************************************************/ + +/** + * nm_utils_file_search_in_paths: + * @progname: the helper program name, like "iptables" + * Must be a non-empty string, without path separator (/). + * @try_first: (allow-none): a custom path to try first before searching. + * It is silently ignored if it is empty or not an absolute path. + * @paths: (allow-none): a %NULL terminated list of search paths. + * Can be empty or %NULL, in which case only @try_first is checked. + * @file_test_flags: the flags passed to g_file_test() when searching + * for @progname. Set it to 0 to skip the g_file_test(). + * @predicate: (scope call): if given, pass the file name to this function + * for additional checks. This check is performed after the check for + * @file_test_flags. You cannot omit both @file_test_flags and @predicate. + * @user_data: (closure): (allow-none): user data for @predicate function. + * @error: on failure, a "not found" error using @error_domain and @error_code + * + * Searches for a @progname file in a list of search @paths. + * + * Returns: (transfer none): the full path to the helper, if found, or %NULL if not found. + * The returned string is not owned by the caller, but later + * invocations of the function might overwrite it. + */ +const char * +nm_utils_file_search_in_paths (const char *progname, + const char *try_first, + const char *const *paths, + GFileTest file_test_flags, + NMUtilsFileSearchInPathsPredicate predicate, + gpointer user_data, + GError **error) +{ + GString *tmp; + const char *ret; + + g_return_val_if_fail (!error || !*error, NULL); + g_return_val_if_fail (progname && progname[0] && !strchr (progname, '/'), NULL); + g_return_val_if_fail (file_test_flags || predicate, NULL); + + /* Only consider @try_first if it is a valid, absolute path. This makes + * it simpler to pass in a path from configure checks. */ + if ( try_first + && try_first[0] == '/' + && (file_test_flags == 0 || g_file_test (try_first, file_test_flags)) + && (!predicate || predicate (try_first, user_data))) + return g_intern_string (try_first); + + if (!paths || !*paths) + goto NOT_FOUND; + + tmp = g_string_sized_new (50); + for (; *paths; paths++) { + if (!*paths) + continue; + g_string_append (tmp, *paths); + if (tmp->str[tmp->len - 1] != '/') + g_string_append_c (tmp, '/'); + g_string_append (tmp, progname); + if ( (file_test_flags == 0 || g_file_test (tmp->str, file_test_flags)) + && (!predicate || predicate (tmp->str, user_data))) { + ret = g_intern_string (tmp->str); + g_string_free (tmp, TRUE); + return ret; + } + g_string_set_size (tmp, 0); + } + g_string_free (tmp, TRUE); + +NOT_FOUND: + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("Could not find \"%s\" binary"), progname); + return NULL; +} + +/**********************************************************************************************/ + /* Band, channel/frequency stuff for wireless */ struct cf_pair { guint32 chan; @@ -1899,7 +1984,7 @@ nm_utils_wifi_find_next_channel (guint32 channel, int direction, char *band) if (channel == pair->chan) return channel; if ((channel < (pair+1)->chan) && (channel > pair->chan)) { - if (direction > 0) + if (direction > 0) return (pair+1)->chan; else return pair->chan; @@ -1942,7 +2027,8 @@ nm_utils_wifi_is_channel_valid (guint32 channel, const char *band) /** * nm_utils_hwaddr_len: - * @type: the type of address; either %ARPHRD_ETHER or %ARPHRD_INFINIBAND + * @type: the type of address; either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal> * * Returns the length in octets of a hardware address of type @type. * @@ -1963,11 +2049,12 @@ nm_utils_hwaddr_len (int type) * nm_utils_hwaddr_type: * @len: the length of hardware address in bytes * - * Returns the type (either %ARPHRD_ETHER or %ARPHRD_INFINIBAND) of - * the raw address given its length. + * Returns the type (either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal>) of the raw address given its length. * - * Return value: the type, either %ARPHRD_ETHER or %ARPHRD_INFINIBAND. - * If the length is unexpected, return -1 (unsupported type/length). + * Return value: the type, either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal>. If the length is unexpected, return -1 + * (unsupported type/length). * * Deprecated: This could not be extended to cover other types, since * there is not a one-to-one mapping between types and lengths. This @@ -1992,7 +2079,8 @@ nm_utils_hwaddr_type (int len) /** * nm_utils_hwaddr_aton: * @asc: the ASCII representation of a hardware address - * @type: the type of address; either %ARPHRD_ETHER or %ARPHRD_INFINIBAND + * @type: the type of address; either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal> * @buffer: buffer to store the result into * * Parses @asc and converts it to binary form in @buffer. See @@ -2019,7 +2107,8 @@ nm_utils_hwaddr_aton (const char *asc, int type, gpointer buffer) /** * nm_utils_hwaddr_atoba: * @asc: the ASCII representation of a hardware address - * @type: the type of address; either %ARPHRD_ETHER or %ARPHRD_INFINIBAND + * @type: the type of address; either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal> * * Parses @asc and converts it to binary form in a #GByteArray. See * nm_utils_hwaddr_aton() if you don't want a #GByteArray. @@ -2051,7 +2140,8 @@ nm_utils_hwaddr_atoba (const char *asc, int type) /** * nm_utils_hwaddr_ntoa: * @addr: a binary hardware address - * @type: the type of address; either %ARPHRD_ETHER or %ARPHRD_INFINIBAND + * @type: the type of address; either <literal>ARPHRD_ETHER</literal> or + * <literal>ARPHRD_INFINIBAND</literal> * * Converts @addr to textual form. * @@ -2235,8 +2325,7 @@ nm_utils_bin2hexstr (const char *bytes, int len, int final_len) g_return_val_if_fail (final_len < buflen, NULL); result = g_malloc0 (buflen); - for (i = 0; i < len; i++) - { + for (i = 0; i < len; i++) { result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf]; result[2*i+1] = hex_digits[bytes[i] & 0xf]; } @@ -2385,13 +2474,14 @@ static char _nm_utils_inet_ntop_buffer[NM_UTILS_INET_ADDRSTRLEN]; /** * nm_utils_inet4_ntop: (skip) * @inaddr: the address that should be converted to string. - * @dst: the destination buffer, it must contain at least %INET_ADDRSTRLEN - * or %NM_UTILS_INET_ADDRSTRLEN characters. If set to %NULL, it will return - * a pointer to an internal, static buffer (shared with nm_utils_inet6_ntop()). - * Beware, that the internal buffer will be overwritten with ever new call - * of nm_utils_inet4_ntop() or nm_utils_inet6_ntop() that does not provied it's - * own @dst buffer. Also, using the internal buffer is not thread safe. When - * in doubt, pass your own @dst buffer to avoid these issues. + * @dst: the destination buffer, it must contain at least + * <literal>INET_ADDRSTRLEN</literal> or %NM_UTILS_INET_ADDRSTRLEN + * characters. If set to %NULL, it will return a pointer to an internal, static + * buffer (shared with nm_utils_inet6_ntop()). Beware, that the internal + * buffer will be overwritten with ever new call of nm_utils_inet4_ntop() or + * nm_utils_inet6_ntop() that does not provied it's own @dst buffer. Also, + * using the internal buffer is not thread safe. When in doubt, pass your own + * @dst buffer to avoid these issues. * * Wrapper for inet_ntop. * @@ -2410,13 +2500,14 @@ nm_utils_inet4_ntop (in_addr_t inaddr, char *dst) /** * nm_utils_inet6_ntop: (skip) * @in6addr: the address that should be converted to string. - * @dst: the destination buffer, it must contain at least %INET6_ADDRSTRLEN - * or %NM_UTILS_INET_ADDRSTRLEN characters. If set to %NULL, it will return - * a pointer to an internal, static buffer (shared with nm_utils_inet4_ntop()). - * Beware, that the internal buffer will be overwritten with ever new call - * of nm_utils_inet4_ntop() or nm_utils_inet6_ntop() that does not provied it's - * own @dst buffer. Also, using the internal buffer is not thread safe. When - * in doubt, pass your own @dst buffer to avoid these issues. + * @dst: the destination buffer, it must contain at least + * <literal>INET6_ADDRSTRLEN</literal> or %NM_UTILS_INET_ADDRSTRLEN + * characters. If set to %NULL, it will return a pointer to an internal, static + * buffer (shared with nm_utils_inet4_ntop()). Beware, that the internal + * buffer will be overwritten with ever new call of nm_utils_inet4_ntop() or + * nm_utils_inet6_ntop() that does not provied it's own @dst buffer. Also, + * using the internal buffer is not thread safe. When in doubt, pass your own + * @dst buffer to avoid these issues. * * Wrapper for inet_ntop. * @@ -2498,13 +2589,10 @@ nm_utils_check_virtual_device_compatibility (GType virtual_type, GType other_typ /***********************************************************/ -/* Unused prototype to make the compiler happy */ -const NMUtilsPrivateData *nm_util_get_private (void); +/* Unused prototypes to make the compiler happy */ +gconstpointer nm_utils_get_private (void); +gconstpointer nm_util_get_private (void); -static const NMUtilsPrivateData data = { - .nm_setting_ip4_config_get_address_label = nm_setting_ip4_config_get_address_label, - .nm_setting_ip4_config_add_address_with_label = nm_setting_ip4_config_add_address_with_label, -}; /** * nm_utils_get_private: @@ -2516,10 +2604,11 @@ static const NMUtilsPrivateData data = { * * Since: 0.9.10 */ -const NMUtilsPrivateData * +gconstpointer nm_utils_get_private (void) { - return &data; + /* We told you not to use it! */ + g_assert_not_reached (); } /** @@ -2531,9 +2620,9 @@ nm_utils_get_private (void) * * Since: 0.9.10 */ -const NMUtilsPrivateData * +gconstpointer nm_util_get_private (void) { - /* Compat function to preserve ABI */ - return nm_utils_get_private (); + /* We told you not to use it! */ + g_assert_not_reached (); } diff --git a/libnm-util/nm-utils.h b/libnm-util/nm-utils.h index bb8786a14..530fe8332 100644 --- a/libnm-util/nm-utils.h +++ b/libnm-util/nm-utils.h @@ -1,10 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * Ray Strode <rstrode@redhat.com> - * Dan Williams <dcbw@redhat.com> - * Tambet Ingo <tambet@gmail.com> - * +/* * 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 @@ -20,7 +15,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2005 - 2013 Red Hat, Inc. + * Copyright 2005 - 2013 Red Hat, Inc. */ #ifndef NM_UTILS_H @@ -126,6 +121,16 @@ GByteArray *nm_utils_rsa_key_encrypt_aes (const GByteArray *data, GError **error); gboolean nm_utils_file_is_pkcs12 (const char *filename); +typedef gboolean (*NMUtilsFileSearchInPathsPredicate) (const char *filename, gpointer user_data); + +const char *nm_utils_file_search_in_paths (const char *progname, + const char *try_first, + const char *const *paths, + GFileTest file_test_flags, + NMUtilsFileSearchInPathsPredicate predicate, + gpointer user_data, + GError **error); + guint32 nm_utils_wifi_freq_to_channel (guint32 freq); guint32 nm_utils_wifi_channel_to_freq (guint32 channel, const char *band); guint32 nm_utils_wifi_find_next_channel (guint32 channel, int direction, char *band); @@ -134,9 +139,8 @@ gboolean nm_utils_wifi_is_channel_valid (guint32 channel, const char *band); /** * NM_UTILS_HWADDR_LEN_MAX: * - * The maximum length of a hardware address of a type known by - * nm_utils_hwaddr_len() or nm_utils_hwaddr_aton(). This can be used - * as the size of the buffer passed to nm_utils_hwaddr_aton(). + * The maximum length of hardware addresses handled by NetworkManager itself, + * nm_utils_hwaddr_len(), and nm_utils_hwaddr_aton(). */ #define NM_UTILS_HWADDR_LEN_MAX 20 /* INFINIBAND_ALEN */ diff --git a/libnm-util/nm-value-transforms.c b/libnm-util/nm-value-transforms.c index f92596dc6..00e7e7757 100644 --- a/libnm-util/nm-value-transforms.c +++ b/libnm-util/nm-value-transforms.c @@ -1,7 +1,6 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * +/* * 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 @@ -115,7 +114,7 @@ static void _string_array_to_string (const GPtrArray *strings, GValue *dest_value) { GString *printable; - int i; + guint i; printable = g_string_new (NULL); for (i = 0; strings && i < strings->len; i++) { @@ -544,7 +543,7 @@ _nm_value_transforms_register (void) g_value_register_transform_func (DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, _nm_utils_convert_op_to_string); - g_value_register_transform_func (G_TYPE_STRV, + g_value_register_transform_func (G_TYPE_STRV, DBUS_TYPE_G_LIST_OF_STRING, _nm_utils_convert_strv_to_slist); g_value_register_transform_func (DBUS_TYPE_G_LIST_OF_STRING, @@ -554,7 +553,7 @@ _nm_value_transforms_register (void) DBUS_TYPE_G_ARRAY_OF_STRING, _nm_utils_convert_strv_to_ptrarray); g_value_register_transform_func (DBUS_TYPE_G_LIST_OF_STRING, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_string_list_to_string); g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_STRING, G_TYPE_STRING, @@ -563,28 +562,28 @@ _nm_value_transforms_register (void) G_TYPE_STRING, _nm_utils_convert_op_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_UINT_ARRAY, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_uint_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_ip4_addr_route_struct_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_MAP_OF_VARIANT, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_gvalue_hash_to_string); g_value_register_transform_func (DBUS_TYPE_G_MAP_OF_STRING, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_string_hash_to_string); g_value_register_transform_func (DBUS_TYPE_G_UCHAR_ARRAY, G_TYPE_STRING, _nm_utils_convert_byte_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_ip6_dns_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_ip6_addr_struct_array_to_string); g_value_register_transform_func (DBUS_TYPE_G_ARRAY_OF_IP6_ROUTE, - G_TYPE_STRING, + G_TYPE_STRING, _nm_utils_convert_ip6_route_struct_array_to_string); g_value_register_transform_func (OLD_DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS, DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS, diff --git a/libnm-util/nm-version.h.in b/libnm-util/nm-version.h.in new file mode 100644 index 000000000..0a33ac295 --- /dev/null +++ b/libnm-util/nm-version.h.in @@ -0,0 +1,123 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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 2011 Red Hat, Inc. + */ + +#ifndef NM_VERSION_H +#define NM_VERSION_H + +/** + * NM_MAJOR_VERSION: + * + * Evaluates to the major version number of NetworkManager which this source + * is compiled against. + */ +#define NM_MAJOR_VERSION (@NM_MAJOR_VERSION@) + +/** + * NM_MINOR_VERSION: + * + * Evaluates to the minor version number of NetworkManager which this source + * is compiled against. + */ +#define NM_MINOR_VERSION (@NM_MINOR_VERSION@) + +/** + * NM_MICRO_VERSION: + * + * Evaluates to the micro version number of NetworkManager which this source + * compiled against. + */ +#define NM_MICRO_VERSION (@NM_MICRO_VERSION@) + +/** + * NM_CHECK_VERSION: + * @major: major version (e.g. 1 for version 1.2.5) + * @minor: minor version (e.g. 2 for version 1.2.5) + * @micro: micro version (e.g. 5 for version 1.2.5) + * + * Returns: %TRUE if the version of the NetworkManager header files + * is the same as or newer than the passed-in version. + */ +#define NM_CHECK_VERSION(major,minor,micro) \ + (NM_MAJOR_VERSION > (major) || \ + (NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION > (minor)) || \ + (NM_MAJOR_VERSION == (major) && NM_MINOR_VERSION == (minor) && NM_MICRO_VERSION >= (micro))) + + +/* Deprecation / Availability macros */ + +#define NM_ENCODE_VERSION(major,minor,micro) ((major) << 16 | (minor) << 8 | (micro)) + +#define NM_VERSION_0_9_8 (NM_ENCODE_VERSION (0, 9, 8)) +#define NM_VERSION_0_9_10 (NM_ENCODE_VERSION (0, 9, 10)) +#define NM_VERSION_1_0 (NM_ENCODE_VERSION (1, 0, 0)) + +#define NM_VERSION_CUR_STABLE NM_VERSION_0_9_10 +#define NM_VERSION_NEXT_STABLE NM_VERSION_1_0 + +#if !defined (NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) +# undef NM_VERSION_MIN_REQUIRED +# define NM_VERSION_MIN_REQUIRED (NM_VERSION_CUR_STABLE) +#endif + +#if !defined (NM_VERSION_MAX_ALLOWED) || (NM_VERSION_MAX_ALLOWED == 0) +# undef NM_VERSION_MAX_ALLOWED +# define NM_VERSION_MAX_ALLOWED (NM_VERSION_CUR_STABLE) +#endif + +/* sanity checks */ +#if NM_VERSION_MIN_REQUIRED > NM_VERSION_NEXT_STABLE +#error "NM_VERSION_MIN_REQUIRED must be <= NM_VERSION_NEXT_STABLE" +#endif +#if NM_VERSION_MAX_ALLOWED < NM_VERSION_MIN_REQUIRED +#error "NM_VERSION_MAX_ALLOWED must be >= NM_VERSION_MIN_REQUIRED" +#endif +#if NM_VERSION_MIN_REQUIRED < NM_VERSION_0_9_8 +#error "NM_VERSION_MIN_REQUIRED must be >= NM_VERSION_0_9_8" +#endif + +#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_0_9_10 +# define NM_DEPRECATED_IN_0_9_10 G_DEPRECATED +# define NM_DEPRECATED_IN_0_9_10_FOR(f) G_DEPRECATED_FOR(f) +#else +# define NM_DEPRECATED_IN_0_9_10 +# define NM_DEPRECATED_IN_0_9_10_FOR(f) +#endif + +#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_0 +# define NM_DEPRECATED_IN_1_0 G_DEPRECATED +# define NM_DEPRECATED_IN_1_0_FOR(f) G_DEPRECATED_FOR(f) +#else +# define NM_DEPRECATED_IN_1_0 +# define NM_DEPRECATED_IN_1_0_FOR(f) +#endif + +#if NM_VERSION_MAX_ALLOWED < NM_VERSION_0_9_10 +# define NM_AVAILABLE_IN_0_9_10 G_UNAVAILABLE(0.9,10) +#else +# define NM_AVAILABLE_IN_0_9_10 +#endif + +#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_0 +# define NM_AVAILABLE_IN_1_0 G_UNAVAILABLE(1,0) +#else +# define NM_AVAILABLE_IN_1_0 +#endif + +#endif /* NM_VERSION_H */ diff --git a/libnm-util/tests/Makefile.am b/libnm-util/tests/Makefile.am index 6d3d225ef..690bdbf65 100644 --- a/libnm-util/tests/Makefile.am +++ b/libnm-util/tests/Makefile.am @@ -1,18 +1,16 @@ if ENABLE_TESTS -SUBDIRS=certs - AM_CPPFLAGS = \ -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ -I$(top_builddir)/libnm-util \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-util/tests/certs/\" + -DBUILD_DIR=\"$(abs_builddir)\" \ + -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-core/tests/certs/\" -noinst_PROGRAMS = \ +TESTS = \ test-settings-defaults \ test-crypto \ test-secrets \ @@ -20,6 +18,10 @@ noinst_PROGRAMS = \ test-setting-8021x \ test-setting-dcb +noinst_PROGRAMS = \ + $(TESTS) \ + test-libnm-linking + test_settings_defaults_SOURCES = \ test-settings-defaults.c @@ -52,6 +54,8 @@ test_general_LDADD = \ $(GLIB_LIBS) \ $(DBUS_LIBS) +test_general_DEPENDENCIES = test-libnm-linking + test_setting_8021x_SOURCES = \ test-setting-8021x.c @@ -68,66 +72,13 @@ test_setting_dcb_LDADD = \ $(GLIB_LIBS) \ $(DBUS_LIBS) -check-local: test-crypto test-setting-8021x -# Private key and CA certificate in the same file (PEM) - $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test_key_and_cert.pem "test" - -# Private key by itself (PEM) - $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test-key-only.pem "test" - -# PKCS#8 private key by itself (PEM) - $(abs_builddir)/test-setting-8021x $(srcdir)/certs/pkcs8-enc-key.pem "1234567890" - -# Private key and CA certificate in the same file (pkcs12) - $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test-cert.p12 "test" - -# Normal CA certificate - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_ca_cert.pem - -# Another CA certificate - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test2_ca_cert.pem - -# Normal CA certificate (DER format) - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_ca_cert.der - -# CA certificate without an ending newline - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/ca-no-ending-newline.pem +test_libnm_linking_SOURCES = \ + test-libnm-linking.c -# Combined user cert and private key - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_key_and_cert.pem - -# Another combined user cert and private key - $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test2_key_and_cert.pem - -# Private key with 8 bytes of tail padding - $(abs_builddir)/test-crypto --key \ - $(srcdir)/certs/test_key_and_cert.pem \ - "test" \ - $(srcdir)/certs/test-key-only-decrypted.der - -# Private key only (not combined with a cert) - $(abs_builddir)/test-crypto --key \ - $(srcdir)/certs/test-key-only.pem \ - "test" \ - $(srcdir)/certs/test-key-only-decrypted.der - -# Private key with 6 bytes of tail padding - $(abs_builddir)/test-crypto --key $(srcdir)/certs/test2_key_and_cert.pem "12345testing" - -# PKCS#12 file - $(abs_builddir)/test-crypto --p12 $(srcdir)/certs/test-cert.p12 "test" - -# Another PKCS#12 file - $(abs_builddir)/test-crypto --p12 $(srcdir)/certs/test2-cert.p12 "12345testing" - -# PKCS#8 encrypted private key - $(abs_builddir)/test-crypto --pkcs8 \ - $(srcdir)/certs/pkcs8-enc-key.pem \ - "1234567890" - -# Private key with AES cipher - $(abs_builddir)/test-crypto --key $(srcdir)/certs/test-aes-key.pem "test-aes-password" - -TESTS = test-settings-defaults test-secrets test-general test-setting-dcb +test_libnm_linking_LDADD = \ + $(top_builddir)/libnm/libnm.la \ + $(top_builddir)/libnm-util/libnm-util.la \ + $(GLIB_LIBS) \ + $(DBUS_LIBS) endif diff --git a/libnm-util/tests/Makefile.in b/libnm-util/tests/Makefile.in index de57f25a5..9ef02e8c8 100644 --- a/libnm-util/tests/Makefile.in +++ b/libnm-util/tests/Makefile.in @@ -78,14 +78,13 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-settings-defaults$(EXEEXT) \ +@ENABLE_TESTS_TRUE@TESTS = test-settings-defaults$(EXEEXT) \ @ENABLE_TESTS_TRUE@ test-crypto$(EXEEXT) test-secrets$(EXEEXT) \ @ENABLE_TESTS_TRUE@ test-general$(EXEEXT) \ @ENABLE_TESTS_TRUE@ test-setting-8021x$(EXEEXT) \ @ENABLE_TESTS_TRUE@ test-setting-dcb$(EXEEXT) -@ENABLE_TESTS_TRUE@TESTS = test-settings-defaults$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-secrets$(EXEEXT) test-general$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-setting-dcb$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) \ +@ENABLE_TESTS_TRUE@ test-libnm-linking$(EXEEXT) subdir = libnm-util/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/depcomp @@ -109,6 +108,11 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +@ENABLE_TESTS_TRUE@am__EXEEXT_1 = test-settings-defaults$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-crypto$(EXEEXT) test-secrets$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-general$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-setting-8021x$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-setting-dcb$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__test_crypto_SOURCES_DIST = test-crypto.c @ENABLE_TESTS_TRUE@am_test_crypto_OBJECTS = test-crypto.$(OBJEXT) @@ -124,7 +128,12 @@ am__v_lt_1 = am__test_general_SOURCES_DIST = test-general.c @ENABLE_TESTS_TRUE@am_test_general_OBJECTS = test-general.$(OBJEXT) test_general_OBJECTS = $(am_test_general_OBJECTS) -@ENABLE_TESTS_TRUE@test_general_DEPENDENCIES = \ +am__test_libnm_linking_SOURCES_DIST = test-libnm-linking.c +@ENABLE_TESTS_TRUE@am_test_libnm_linking_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test-libnm-linking.$(OBJEXT) +test_libnm_linking_OBJECTS = $(am_test_libnm_linking_OBJECTS) +@ENABLE_TESTS_TRUE@test_libnm_linking_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ @ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ @ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__test_secrets_SOURCES_DIST = test-secrets.c @@ -189,35 +198,21 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(test_crypto_SOURCES) $(test_general_SOURCES) \ - $(test_secrets_SOURCES) $(test_setting_8021x_SOURCES) \ - $(test_setting_dcb_SOURCES) $(test_settings_defaults_SOURCES) + $(test_libnm_linking_SOURCES) $(test_secrets_SOURCES) \ + $(test_setting_8021x_SOURCES) $(test_setting_dcb_SOURCES) \ + $(test_settings_defaults_SOURCES) DIST_SOURCES = $(am__test_crypto_SOURCES_DIST) \ $(am__test_general_SOURCES_DIST) \ + $(am__test_libnm_linking_SOURCES_DIST) \ $(am__test_secrets_SOURCES_DIST) \ $(am__test_setting_8021x_SOURCES_DIST) \ $(am__test_setting_dcb_SOURCES_DIST) \ $(am__test_settings_defaults_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -259,33 +254,7 @@ am__tty_colors = { \ std='[m'; \ fi; \ } -DIST_SUBDIRS = certs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ @@ -295,6 +264,8 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ +BLUEZ5_LIBS = @BLUEZ5_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -418,6 +389,7 @@ NEWT_CFLAGS = @NEWT_CFLAGS@ NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ +NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ @@ -437,6 +409,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -463,7 +436,7 @@ 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@ +UDEV_DIR = @UDEV_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ @@ -542,16 +515,15 @@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ with_valgrind = @with_valgrind@ -@ENABLE_TESTS_TRUE@SUBDIRS = certs @ENABLE_TESTS_TRUE@AM_CPPFLAGS = \ @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@ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ @ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ @ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ -@ENABLE_TESTS_TRUE@ -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-util/tests/certs/\" +@ENABLE_TESTS_TRUE@ -DBUILD_DIR=\"$(abs_builddir)\" \ +@ENABLE_TESTS_TRUE@ -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-core/tests/certs/\" @ENABLE_TESTS_TRUE@test_settings_defaults_SOURCES = \ @ENABLE_TESTS_TRUE@ test-settings-defaults.c @@ -585,6 +557,7 @@ with_valgrind = @with_valgrind@ @ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ @ENABLE_TESTS_TRUE@ $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@test_general_DEPENDENCIES = test-libnm-linking @ENABLE_TESTS_TRUE@test_setting_8021x_SOURCES = \ @ENABLE_TESTS_TRUE@ test-setting-8021x.c @@ -601,7 +574,16 @@ with_valgrind = @with_valgrind@ @ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ @ENABLE_TESTS_TRUE@ $(DBUS_LIBS) -all: all-recursive +@ENABLE_TESTS_TRUE@test_libnm_linking_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-libnm-linking.c + +@ENABLE_TESTS_TRUE@test_libnm_linking_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) + +all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj @@ -653,6 +635,10 @@ test-general$(EXEEXT): $(test_general_OBJECTS) $(test_general_DEPENDENCIES) $(EX @rm -f test-general$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_general_OBJECTS) $(test_general_LDADD) $(LIBS) +test-libnm-linking$(EXEEXT): $(test_libnm_linking_OBJECTS) $(test_libnm_linking_DEPENDENCIES) $(EXTRA_test_libnm_linking_DEPENDENCIES) + @rm -f test-libnm-linking$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_libnm_linking_OBJECTS) $(test_libnm_linking_LDADD) $(LIBS) + test-secrets$(EXEEXT): $(test_secrets_OBJECTS) $(test_secrets_DEPENDENCIES) $(EXTRA_test_secrets_DEPENDENCIES) @rm -f test-secrets$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_secrets_OBJECTS) $(test_secrets_LDADD) $(LIBS) @@ -677,6 +663,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-crypto.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-general.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-libnm-linking.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-secrets.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setting-8021x.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setting-dcb.Po@am__quote@ @@ -709,61 +696,14 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive +tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ @@ -776,7 +716,7 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive +ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) @@ -789,7 +729,7 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive +cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ @@ -931,47 +871,20 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -@ENABLE_TESTS_FALSE@check-local: check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local -check: check-recursive + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am all-am: Makefile $(PROGRAMS) -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-recursive +installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ @@ -993,155 +906,94 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive +clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am -distclean: distclean-recursive +distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-recursive +dvi: dvi-am dvi-am: -html: html-recursive +html: html-am html-am: -info: info-recursive +info: info-am info-am: install-data-am: -install-dvi: install-dvi-recursive +install-dvi: install-dvi-am install-dvi-am: install-exec-am: -install-html: install-html-recursive +install-html: install-html-am install-html-am: -install-info: install-info-recursive +install-info: install-info-am install-info-am: install-man: -install-pdf: install-pdf-recursive +install-pdf: install-pdf-am install-pdf-am: -install-ps: install-ps-recursive +install-ps: install-ps-am install-ps-am: installcheck-am: -maintainer-clean: maintainer-clean-recursive +maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-recursive +pdf: pdf-am pdf-am: -ps: ps-recursive +ps: ps-am ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) check-am install-am install-strip +.MAKE: check-am install-am install-strip -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-TESTS check-am check-local clean clean-generic \ - clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am -@ENABLE_TESTS_TRUE@check-local: test-crypto test-setting-8021x -# Private key and CA certificate in the same file (PEM) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test_key_and_cert.pem "test" - -# Private key by itself (PEM) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test-key-only.pem "test" - -# PKCS#8 private key by itself (PEM) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-setting-8021x $(srcdir)/certs/pkcs8-enc-key.pem "1234567890" - -# Private key and CA certificate in the same file (pkcs12) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-setting-8021x $(srcdir)/certs/test-cert.p12 "test" - -# Normal CA certificate -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_ca_cert.pem - -# Another CA certificate -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test2_ca_cert.pem - -# Normal CA certificate (DER format) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_ca_cert.der - -# CA certificate without an ending newline -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/ca-no-ending-newline.pem - -# Combined user cert and private key -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test_key_and_cert.pem - -# Another combined user cert and private key -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --cert $(srcdir)/certs/test2_key_and_cert.pem - -# Private key with 8 bytes of tail padding -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --key \ -@ENABLE_TESTS_TRUE@ $(srcdir)/certs/test_key_and_cert.pem \ -@ENABLE_TESTS_TRUE@ "test" \ -@ENABLE_TESTS_TRUE@ $(srcdir)/certs/test-key-only-decrypted.der - -# Private key only (not combined with a cert) -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --key \ -@ENABLE_TESTS_TRUE@ $(srcdir)/certs/test-key-only.pem \ -@ENABLE_TESTS_TRUE@ "test" \ -@ENABLE_TESTS_TRUE@ $(srcdir)/certs/test-key-only-decrypted.der - -# Private key with 6 bytes of tail padding -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --key $(srcdir)/certs/test2_key_and_cert.pem "12345testing" - -# PKCS#12 file -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --p12 $(srcdir)/certs/test-cert.p12 "test" - -# Another PKCS#12 file -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --p12 $(srcdir)/certs/test2-cert.p12 "12345testing" - -# PKCS#8 encrypted private key -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --pkcs8 \ -@ENABLE_TESTS_TRUE@ $(srcdir)/certs/pkcs8-enc-key.pem \ -@ENABLE_TESTS_TRUE@ "1234567890" - -# Private key with AES cipher -@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-crypto --key $(srcdir)/certs/test-aes-key.pem "test-aes-password" - # 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. .NOEXPORT: diff --git a/libnm-util/tests/certs/Makefile.am b/libnm-util/tests/certs/Makefile.am deleted file mode 100644 index 309925174..000000000 --- a/libnm-util/tests/certs/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# test-cert.p12 created with: -# -# openssl pkcs12 -export \ -# -in test_key_and_cert.pem \ -# -inkey test_key_and_cert.pem \ -# -certfile test_ca_cert.pem \ -# -name "test-pkcs12" \ -# -out test-cert.p12 - -EXTRA_DIST = \ - test_ca_cert.pem \ - test_ca_cert.der \ - test_key_and_cert.pem \ - test-cert.p12 \ - test2_ca_cert.pem \ - test2_key_and_cert.pem \ - test2-cert.p12 \ - ca-no-ending-newline.pem \ - test-key-only.pem \ - test-key-only-decrypted.der \ - pkcs8-enc-key.pem \ - pkcs8-noenc-key.pem \ - pkcs8-decrypted.der \ - test-aes-key.pem - diff --git a/libnm-util/tests/certs/Makefile.in b/libnm-util/tests/certs/Makefile.in deleted file mode 100644 index 218cb48d2..000000000 --- a/libnm-util/tests/certs/Makefile.in +++ /dev/null @@ -1,597 +0,0 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# test-cert.p12 created with: -# -# openssl pkcs12 -export \ -# -in test_key_and_cert.pem \ -# -inkey test_key_and_cert.pem \ -# -certfile test_ca_cert.pem \ -# -name "test-pkcs12" \ -# -out test-cert.p12 -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = libnm-util/tests/certs -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_warnings.m4 \ - $(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/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 -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -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@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ -DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -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@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -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@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -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@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -PPPOE_PATH = @PPPOE_PATH@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_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@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -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@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -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@ -with_valgrind = @with_valgrind@ -EXTRA_DIST = \ - test_ca_cert.pem \ - test_ca_cert.der \ - test_key_and_cert.pem \ - test-cert.p12 \ - test2_ca_cert.pem \ - test2_key_and_cert.pem \ - test2-cert.p12 \ - ca-no-ending-newline.pem \ - test-key-only.pem \ - test-key-only-decrypted.der \ - pkcs8-enc-key.pem \ - pkcs8-noenc-key.pem \ - pkcs8-decrypted.der \ - test-aes-key.pem - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libnm-util/tests/certs/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu libnm-util/tests/certs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - - -# 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. -.NOEXPORT: diff --git a/libnm-util/tests/certs/ca-no-ending-newline.pem b/libnm-util/tests/certs/ca-no-ending-newline.pem deleted file mode 100644 index 664e299aa..000000000 --- a/libnm-util/tests/certs/ca-no-ending-newline.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE-----
-MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD
-VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv
-bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv
-b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV
-UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
-cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
-b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH
-iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS
-r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4
-04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r
-GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9
-3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P
-lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/
------END CERTIFICATE-----
\ No newline at end of file diff --git a/libnm-util/tests/certs/pkcs8-decrypted.der b/libnm-util/tests/certs/pkcs8-decrypted.der Binary files differdeleted file mode 100644 index 2cbdeb5e3..000000000 --- a/libnm-util/tests/certs/pkcs8-decrypted.der +++ /dev/null diff --git a/libnm-util/tests/certs/pkcs8-enc-key.pem b/libnm-util/tests/certs/pkcs8-enc-key.pem deleted file mode 100644 index 0d08f2d29..000000000 --- a/libnm-util/tests/certs/pkcs8-enc-key.pem +++ /dev/null @@ -1,29 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIE6TAbBgkqhkiG9w0BBQMwDgQIwiGFT4Jz6RsCAggABIIEyJNMddDYofbhydUp -J3VyrYIjv3LziJ7dkTXE3+mEYRCQrGLgljWBbib2JOLVCFt8melL6Yv1RcoVR7X7 -vrRqyycu0DumI4f5+Bf4wc234JNVhSaLYsw244fFtcnK2Gyn4IaVmWmrNvrwfX/w -SKcVmO30D5C5PCKzv2bou5FmnJLKdDQV1t816cr9T8pTx7MHvBzSZXbh86334BhF -T3zNwo8j2/+Gq2NBWUn+2GTTV8/r26aIwPcFi4QH6I2ghBwFmFHqU3/PoRm6nkmg -CqJj2Dggy+8zE5qg0iId7lrio0OjCH+Qed6NGwIa2lgv/bhuJVP3FOk4gqamJWHi -WMaq9McmS+03q2iokYeSQGbx85x+I90RTFZKhFx4dkerf6oTC/YoL4F++ff0e91v -sOrQsBkgRhrRtFwa9OFCzbsknlixONdd+ITkyX490xz1wcZTDkKtMDRLIPWa2O0b -MEq75jPYThZ5pF1vc5r+rqPafN7SfI+DDmhzJYEQNRoCWA4pH9Gwv0ayKnOgoj4K -TuFhXvcyWzTnVXmcqEFyf3CRrB0Ti+Z61enupC+FCuYV5lGsx9kJaTumTk2UPD02 -9Ap3asDLozdEPSXBG3+oCM2s01/IJlxtR84C97r9rpmWTc9K6DCBScETe9KnIghW -PU7XFogueG5Gwpe+x+IlTDq+qiyUNVX1uMGDcIaCC3VsoWqZrpnGGBhsovwBaXKt -T9fT2nE27Fd6DRWso4fgos6PPx7RVveu17BTMVQeUq9L8GrV4JNrE3a9aoXdbUhc -6gMiyAqxh/HEyciYoXsR9oVNi+VM0y8q3hL5nIcgDrCZr/c9aQ8+fuQBDXRrmrQd -bR2iwNLCBnbmQmM/vM333VhJ4MSOKd3SGw/j41K+Nr3uP5KRZUwV+5yy3ef/hGxU -i9JjCmSUt2bfWRUFlNaf1hCTYaKD0xnVr1SLFU4snIgh2qKawyqVc9EE2f+FcOM5 -0RtwQ3ku6FOk3cy6/xeKpResCHbWDS6nQaIKYyLukV+gm5MJIhOMkj2z4T1eXGUr -Nu/L7Gz+ps7ct0lM8W82n5lzSEa5/l1eNGM0wtQoAwutFEZp7Nx/IBKK87jVttr6 -82UVJeRk7rO2Mpobfw2LbKwga4rsuLrx3UwVDBWdLx7dNIc1rGoAxhsc72+skFgF -Uztwy4Yv1Uiji4T6v+mObPZD/HiIDL0vF02Pz08rNlgB0DgaTKrpql2FutIuQAdf -AciffQIoh9VGERlJoWuunG/UTxg2XRl2m1vCDrgBMInax+PXCv7/5Vh21AQc3fWP -uf4k6JSy46hYni7VTVKn6C/Di9z7oIrGl/jDkDsaenAbToyX9VWr3s7EBwnhTQ/I -OQ9bkWCagHIQlwJbu4M4/VAbiR26NrcR0C3JXBlPlT0qvFFB8gKbJAQEXtwIFS2h -m2fe0k6mQASMwdbJYXZ/wfsg5PPAWsKtny1aMvi0mTPSD5uRhIfEGEuR+AT4UbEW -BkEIE0lgGly4P1SpunKDQQE6m/e7h8Nl4pi8SMSme3YoX5MJwCP/CNkLBDVenAZI -oBrdoVox86SjwnUozVG192lcEAULlk+3ZGt6T9JXLBQl9hpNtyTC6SFh84R+5RoN -AevNl1bDfO+Vci0uJw== ------END ENCRYPTED PRIVATE KEY----- diff --git a/libnm-util/tests/certs/pkcs8-noenc-key.pem b/libnm-util/tests/certs/pkcs8-noenc-key.pem deleted file mode 100644 index f73fb55ab..000000000 --- a/libnm-util/tests/certs/pkcs8-noenc-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQC80HGgFdlFIL2F -W5rHQ99xOkMrWcZ7an9YurDebAE3M0UwqxM24+5mWbxc8FJ8yYugdMzuI5Nq77IA -DwJpv9ZjMfnKC1VDMj3bmmMdPurfx8pLdLw/jhk3wBaYk6vMvh4z66Yvmb7valGq -Pxh6CRTnekNGI9XA7me4JNBlisl0Qasn9g4pl9PiGJAruEamS4Pk6dSWbfw58bs7 -/Yo5ejyt/Mn1n0Q/r3Gv/lAS0qRvmrW6GE1rMtANMfuGRNlAln21TzNcJzykm+sp -RWptxXEI0NY7u9+RP4M3C1mJxWir7AZDbtinpOZH6vF+92yMzgEYOLK/WZVdSPdW -tROv9xtPAgMBAAECggEBAJAfp+vjYZJjuGaYEuAxjdhW+biYcWn5U7V9484TsSXa -i+DnZOZMO8iCjMaAZuZ7zYmwPlE0dK12w29KBbSEy3eySRIRboa5TgBXq3pCcXRZ -g6/vLlZw+AzXIiha6BODt3g4UwUYnWcQx79lJCDa18sNR1a9ucbn8+Har/wiYT3M -JjTbUT6wR6rKEXchB58ZugYGhOTfugSDQg4U/dwEHPIaJ/wme++JUV5B/tjeGCG3 -F43o2Oos5vjfrDSpUKIYZn+2BdhP434jkwj22wQ2sy0ruU/kQx8nogMTRfP1v4GU -9QmNXj/DB24K388ZxcDmcxBJxrGAJ0MohYFo28DqRBECgYEA6hyKEqe2UbJx/+B6 -8mYgHb+pS2j0M4jPl11q9MMLVxLnDY9xZ85IEyWHQEC0GavPSAois0oiDeGAm32c -j6TFyV3/oPTmZSyV93/agWgnH9Xtc481pbNAb0GMfyotvRRE/+6ti9+Cl7oH9Qmm -ldMk7Hn6sK9t2mUOW8idPjKqlqcCgYEAzne25BryLJoIinbRMZg9KTfxfgUE6EKc -Tk5+9CFQn0/AItQJuKbIUyggYH4psWW5hWq6hFlmMYMR48FKv9ry7pZTB0djaoYD -lN+wSuhzUYWXedkAjvPmekITmf6rbnPfwOZvsr8CGMEUekqJPnPLzsQy+Ea2y/fb -QY4SHe7gExkCgYEAr+1scOJpZvFjK7ckjT3jipd6ADpJsORxo7zG4FImFnQU/6K4 -xRpGHWVJQyaccOIkrW04cGUYPDgmrjJx0ZwwKceijvEaphMgS1JgAHklVY4sl3ea -CAAxPqoSi4lFv94Yj/9rmT4IZD6fNivfbJ20FKUBl37tXX4tkRmr2I64lOcCgYEA -x3eqzrclrmdlxvfBZOuScwbkHP6WXhk0TwbQ6eRhsnfmxP8bITSoJoaGuRJKD2Oa -l0WkSobgDwd0uhecsrvBpTS/pDGY32n3fdWZyNTHzEOHMyWtv23tBcJek5ERaBU0 -X3WBBiw4x1eKBBeMfjR6+xhbsbcHlQiw36V05UxJWMkCgYEAhtcYvrfU4K48IJTU -qp03nvd+dMY3IUTdZNOCh8bswLKyn3aq3MfWF9Vp7kDAI3cfyMpSrAQnmg4nVcn6 -Gf3wakG8bpiSRbJnGN+iLm8JsD+3Vw9KzvKOOQVmpT7xt5Kupx1hWvLHQWvfYgOG -qEtTM8/+LD7W3I7midJNt50CD8A= ------END PRIVATE KEY----- diff --git a/libnm-util/tests/certs/test-aes-key.pem b/libnm-util/tests/certs/test-aes-key.pem deleted file mode 100644 index aab8f463c..000000000 --- a/libnm-util/tests/certs/test-aes-key.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,800391B7DD72364B4C2562E0B6AEA000 - -E9dgNCIATOr4CN5c8o6B+8wdqq/I1BLmPmW2qT7YZepoF7E+RUb8ZLjo1VO2XsJw -Ir4EzuH7837zBD9dP5CjlY8cWfR63gZpEWRY5Jub8kzvqiL4UZ0Qr8IHOZxAkKEz -EL1Pn7e+tYt4kA372LPZHWO3vRCgmL1iSJj2/k3avPWAx7NUie4bzGI+00WNv699 -ClKzsJbWB1eiQvYgOr4aVV26oWfa896JkBoGhgZQ6ckqFpsdAos8m46iOSVZrwgq -Y2/d1CvfQod+87c8LRatwAjf+d6YAJJaeMyxjCGuAY6/JyDsorUkM2OlvbTt6WOA -gSPWO8I+Ov6THb4IuPhpIJ30Sl88tc6MlIByW49EWu2G1jPw3L8iqRzZ50Z85dyz -N9yFP91wEwi5F0Zed4iEpg3NVfklEe/VYqCldc5f9fZ84G5V98ZlAdNSqwd/UNBU -iPTflGqVpp1u+J2isOk+Agpj1MCxh2q0RNuvY9KHzOYBScirfbG4DKNbQgS/5Zw7 -3g9YL5Wbo7BczHLiXf/2adu6T8wI1LKRjkeLV9dK1Vw3ZaGy3mB9oFhCgjh9BNHw -wC78CVcUErjtOXdQagiCQn5k5EGeAB97QFROoAFjAmGvq3xCi4EHd9Sk6fcMm7Oi -1fuVR5EXUubF4Llq06lFzQp01s2F73noH49bs3qwdf0n8nrL2XhKB0XCOV/I3K5c -Y3W+YSl361QGjZ/NUcFLIIy+Uro90MmUBNk6af+wGHRJeflpVnK0ATX1PtpNHziz -jiMiIZicjgfVLxl1a5zTl6KUmGWKlZb533adQ0s6q9Qmi5Vk5L5W/GdMjcFtZbM6 -GU7EOkwihMLb3DVsNbm7vb8tUXqe/e5RmXtij8Yb+2a6/M9yaOHa0VjHzdiKHecr -eEYaKQDj7NCWLslNnRRh9GmgXcu2pqBhqRM3HAt3cEaHKKWHTcoWcz11pFwMHNtn -bU9GjGRVc3lCGhVNRiloO0zrKHmcBpDVLw2+ycXXpj/RaBW2fy0xRLKolyla+jEr -zdLzVI61O50ZMycOtPmE7DVZpkokn32hGer1eCOFnsN1lywi4cWLvU0jbQC+CJyw -T9vS8zB3WgOl8rC1AHsfQ4KYajlKleQm89deurQymnt/Qx49SiQA+TpwG9Xvx2TP -3Vc1NwZfM9ZZ1+6xit/rTuS3LhnmhEnGnV5ZyvAdmkCcV2iHjOnLnQWWQn24MHU3 -8Y9D4AdpI5V7Igwr3vH2NZMiw1W2Yc5EJuPAT8nIs5sgOYhXB/QLPJvulvOQhuNC -NPwJ6A505JrVNfHuEaoGUyA+mPeWuLwQo8y8cM6ZdFMG3RrwFNzuYTrc1Z/9GsmA -C0UfHf5dL0r7oWZ1SbpSvsmHYqc8sIypq0ohuLEbpegS/hWP8b2/XDRTjfTiJOrM -4LsUH9PMOJSxDlwS+7e3FdcGfgXfsMgB3aOjQvNpKEolOuv4A5LVFeMrrwtw4Xo1 -EuhstZwyarUTJenDUXzkakhA+8Yw/g2a7RsnANVTkeBuv2PbqFL4zdlsWvcpkz41 -ESxx1siSeU1E9beOII0zSi8vUD0IAevRHaWSlfU2po600IzX1FN97pa4DJV2ycgn ------END RSA PRIVATE KEY----- diff --git a/libnm-util/tests/certs/test-cert.p12 b/libnm-util/tests/certs/test-cert.p12 Binary files differdeleted file mode 100644 index ae4a68304..000000000 --- a/libnm-util/tests/certs/test-cert.p12 +++ /dev/null diff --git a/libnm-util/tests/certs/test-key-only-decrypted.der b/libnm-util/tests/certs/test-key-only-decrypted.der Binary files differdeleted file mode 100644 index c8652537a..000000000 --- a/libnm-util/tests/certs/test-key-only-decrypted.der +++ /dev/null diff --git a/libnm-util/tests/certs/test-key-only.pem b/libnm-util/tests/certs/test-key-only.pem deleted file mode 100644 index 5ef530e9a..000000000 --- a/libnm-util/tests/certs/test-key-only.pem +++ /dev/null @@ -1,92 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,B29FCA6ECB7C0C48 - -KuRV4sEVQkY0r0E+E81Se2qpm54HeboUMIJcMVqAt/HIeYwpjEzmXHUywXgayA5k -r5Uvru95vymFz80q/rl6i4Mt3ckEQ3/VHmBI4pPj/JeRbiDhqTyLqpB5zMgbuti+ -PsEemlbiaCMZFdJk8rJBWADTkirGbXs5ciLwTJyrJXhkBVTqoHtphSWMELxcrnQj -5bAXZ+rnApWA7LR3yCY1UE0Nj39Yu8lkzDJtbsSXPJVO//OQiGuQRcY6roAUzeS/ -amLdIYqoZm3OF83Ro88XZCIDCG6XjgKoqojtekClVIytB6mHWk+IHhI7DgU/pDBj -yOskzVRMja9ECnqaVX+bmlmJGZBgcd7+XiebCXNY9IAx/ZQDMbDJDoJusvH6npJR -PBgag8QBSzwpFyEP/1LrlyVyggZcGuXDWfUiM2rt2UvLm8QYeT5WGfUI+QwW6JRV -xEz2QwRiPsmj0uK2fXLKHbY0Pv79IMLqgesCAUbndWsi94kjAhpJGa/WfKVb8Dpg -T+mVa2OT0pgewPWJ3h5f47ag27WDJthsIUHAvNZ03uM23DIqDh6o03/B3/4r1Uab -HzsLWhUOzbLihO08qcPk/JqtDVCv579mpgvy7bL2ZsZUzefnmg+ah+1bhLguryZu -Zrt1hTu5WTz27UbYwWNtkxWnWcM9sSF9y+KVwumYhIUGTvg3Jds/jmp/Z5ad8tev -0RQuWmqnXVD51Y92tOXobJH7JwGbQ4GeRNG/UX7DS9Lvb6rPgmmxvGbXMcjEMapB -m5DLjCD7Lz4++sfzhCic3/nL8e8fjoYZmCbL/SpYjGjTrfoNaGYaT0De8MxCSjPf -rNT+ldWFD0oAOTmT0uqOFkeIx3vxczSQUyRfzGOLqtb9mAXk8lvdb8Myb5atfe8f -FNBL5ocz6Szv2AmKmjZE5P6NKSllyryCYl+H2QU0e3OyY8S9aG2aG8fqeVKaA01S -uOOjsK6IKMpkit+VFDP7RWvS8p1FTwTVRdbMZzASW8+D98OHsTlOENtQuuFyvNaN -vPHrbHltTkwDlYVab9UpFr/ZRW3cNJrmcl0hyeCJxk5u8B9UwW6yZmd24hxda2xt -1QjnxfWlX0i5KTmfWFyPmRYt1WH9rdVaH6wqRbGNbMRT7Lez0E/2+LXjFiiEe0Vh -ZuryhyhUXpHY8yyHxFY92XT504Z3wPUaJ1tQxGhdziZ7HcqFT8f4oTNJdBNtzqNw -l63gSTaKUkSB14CBOyR84cqpgSMwZvWZb3RQFYY4GSALWwhnn6PWeRhjWAXPms2v -tRmfEyDUCyPxDarezvS9kUir3XbvnCkoJOrK/lw4a8ygGBCBqRKOdI0SRUf1Nnjm -aZBrKrXHv5vP66fyC7cGMTq35+iiHbE//rRDGPrf9vpmw3ki3FlDMyAXOC5yWDco -0n+cNDyHJDdIW3+3nfZvSgPPMwmTdfNO90X3YczSmMTGjnIuhQMf7FMFmMZOSrqD -u234vYCjIIlph3aVpbzjOqKg3d4nuP9oouyAgRAr+vShgHRmq0jvsAiGH3Q6RqEj -DvkM1NgoloMy5RhKF4hIeaQM/UlgoXrcEx0RGCJHykQcQmVa5cf5EwjrO7b+w2Lg ------END RSA PRIVATE KEY----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Berkshire, L=Newbury, O=My Company Ltd, OU=test, CN=test/emailAddress=test@test.com - Validity - Not Before: Feb 2 02:22:25 2009 GMT - Not After : Jan 31 02:22:25 2019 GMT - Subject: C=US, ST=Berkshire, O=My Company Ltd, OU=test-client, CN=test-client/emailAddress=test-client@test.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): - 00:ce:d2:e9:fb:f4:a4:ce:66:87:cc:8b:2d:d2:c3: - b8:fa:be:ea:53:08:95:9e:27:4a:04:78:31:a1:36: - d2:e5:42:f5:76:f7:24:71:b8:d3:10:fd:b7:57:86: - 68:29:02:1b:e9:93:2b:af:c0:7e:3d:58:16:34:10: - 25:85:7e:28:2d:42:fc:34:7f:d6:4f:0a:e7:b6:b9: - 40:51:c8:e5:89:60:cd:73:51:63:67:e1:59:36:31: - 5e:d0:87:4b:5d:97:8a:42:22:d3:42:f2:83:62:79: - 84:45:5b:d8:20:97:e2:d1:34:23:5e:ec:bf:8a:41: - 7c:ad:80:50:f3:9b:1c:51:5d:e4:29:1c:c1:c6:7c: - a1:00:70:0f:f6:79:77:03:22:f5:4b:ab:76:ca:20: - ab:e1:4e:53:6c:86:68:e9:d6:0f:6e:95:4b:b5:b5: - cf:d3:6c:d4:73:db:c0:3d:1d:20:20:72:ab:3e:25: - bb:3f:cd:5f:2d:77:fd:d7:0b:a8:eb:0c:73:c0:3f: - 74:27:17:56:cf:31:9a:a9:ed:c1:39:27:c7:aa:e9: - 77:48:f4:6d:56:89:35:5c:79:5b:f6:2f:8c:9f:93: - bc:13:1c:d0:74:5f:30:1b:15:43:71:8e:ff:1a:df: - 65:65:69:c2:8a:5a:ab:04:4a:80:de:20:29:8d:48: - 1c:83 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 34:E9:5C:D8:FC:C7:AF:F7:5D:F4:13:D3:82:1A:CD:52:0F:4A:BB:0B - X509v3 Authority Key Identifier: - keyid:52:33:2E:22:66:79:82:E5:41:2E:8D:3B:B2:E5:CC:FA:BE:99:33:8E - DirName:/C=US/ST=Berkshire/L=Newbury/O=My Company Ltd/OU=test/CN=test/emailAddress=test@test.com - serial:E6:4C:5C:96:26:5E:D6:D0 - - Signature Algorithm: md5WithRSAEncryption - 88:c4:dd:c5:4a:a6:8e:1f:36:62:80:31:6b:2b:85:34:0d:6c: - a7:dc:e1:5a:3c:dd:74:57:db:59:be:8b:f2:79:40:2d:bd:9b: - e1:ab:0e:03:75:20:75:2f:ea:97:f9:d4:7e:15:75:c2:82:f5: - b1:37:e4:8b:24:d4:ef:02:3b:19:6a:56:bb:9f:c3:a5:b4:c4: - 39:a0:64:96:5b:c3:a8:19:74:ec:0b:cf:33:df:f3:12:f3:e2: - ab:1d:7d:de:21:64:cd:b1:a0:6f:7a:77:84:d4:62:8a:50:e6: - 76:5d:af:3a:ef:1a:87:0e:1a:38:c4:f9:0d:2f:14:e0:20:32: - 4c:2e:70:d2:71:82:d5:e5:c9:13:2c:4e:b4:c8:63:65:1d:48: - e8:c3:56:6d:88:84:57:65:13:1e:42:48:b4:03:25:71:4e:12: - 9d:1a:88:65:d5:71:21:3b:0e:be:37:1c:f0:88:6b:45:0c:0e: - 6c:e5:60:cb:86:bf:bf:40:30:c4:cf:94:f8:1c:60:d4:1b:df: - 88:02:7a:45:7e:d1:c6:f3:07:b9:b1:8f:2a:55:2f:be:77:9f: - d1:46:64:05:b7:67:c5:b2:ac:8c:42:8f:6a:51:a4:0d:2b:16: - a4:d6:39:a5:f8:25:ed:68:25:13:b5:19:ac:6c:e9:ec:ee:03: - 6b:80:38:6e - diff --git a/libnm-util/tests/certs/test2-cert.p12 b/libnm-util/tests/certs/test2-cert.p12 Binary files differdeleted file mode 100644 index 9d5732b0a..000000000 --- a/libnm-util/tests/certs/test2-cert.p12 +++ /dev/null diff --git a/libnm-util/tests/certs/test2_ca_cert.pem b/libnm-util/tests/certs/test2_ca_cert.pem deleted file mode 100644 index 9a487ca4b..000000000 --- a/libnm-util/tests/certs/test2_ca_cert.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEpDCCA4ygAwIBAgIJANDnVhixAO1GMA0GCSqGSIb3DQEBBQUAMIGSMQswCQYD -VQQGEwJVUzEWMBQGA1UECBMNTWFzc2FjaHVzZXR0czERMA8GA1UEBxMIV2VzdGZv -cmQxFjAUBgNVBAoTDVJlZCBIYXQsIEluYy4xFDASBgNVBAsTC0VuZ2luZWVyaW5n -MRAwDgYDVQQDEwdlYXB0ZXN0MRgwFgYJKoZIhvcNAQkBFglpdEBpdC5jb20wHhcN -MDcxMTA5MTU0ODI1WhcNMTcxMTA2MTU0ODI1WjCBkjELMAkGA1UEBhMCVVMxFjAU -BgNVBAgTDU1hc3NhY2h1c2V0dHMxETAPBgNVBAcTCFdlc3Rmb3JkMRYwFAYDVQQK -Ew1SZWQgSGF0LCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEQMA4GA1UEAxMH -ZWFwdGVzdDEYMBYGCSqGSIb3DQEJARYJaXRAaXQuY29tMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEAz9zRLSiQyQangDgEliEP8xSpnPJS7GjXzrkZS3sk -gZLuVuwoFeZRq3Hsrq/wGd/vM0KUFNmEaMc+47jnuv0UHQcQ45ZACO7s4/Aflhzj -lkmud/z06hVknIzjXmvS6q2ttCviHsXnfokl+wAxuUhsd+le0xjP9H1jXny4YBuS -jP+yGUz7PL4w1sFFghKIPrlB7m4GkFbQRqvH7FSJg86GWopPwJvNvIzhOZiO1a1D -CAAL4Ru3jxtNFxqWT87C/qUEe/2Qb7jtNyqFcKfwZyZh4u1bo0c8bjErlUZERbWz -zM3hTFypuw+i2v+0h3A8/Xb0hTjcHkUoJgfSdbsOLC5TOwIDAQABo4H6MIH3MB0G -A1UdDgQWBBR+UOaH4e8nrEuMcEXJl7UN5r/wDTCBxwYDVR0jBIG/MIG8gBR+UOaH -4e8nrEuMcEXJl7UN5r/wDaGBmKSBlTCBkjELMAkGA1UEBhMCVVMxFjAUBgNVBAgT -DU1hc3NhY2h1c2V0dHMxETAPBgNVBAcTCFdlc3Rmb3JkMRYwFAYDVQQKEw1SZWQg -SGF0LCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEQMA4GA1UEAxMHZWFwdGVz -dDEYMBYGCSqGSIb3DQEJARYJaXRAaXQuY29tggkA0OdWGLEA7UYwDAYDVR0TBAUw -AwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAmE2jqUymfxN2Vv7bPafoK/EpZwGPxu+z -phRFsgUgWVzidc/GtOxN81LduJ+ow8MEbQIabo4JV/MdKzuPuhAHToAQdeb0LIWa -p59vTIZiVhUt0cMAbQwKcTnfmDnXw9wytvtKgeAXJq0Jd6F+uNXTiR1btlYLZqmF -oSu54cHQlXpUT9z0BnQ8eXd7m0TwfzGQkTHQI7xBa87lZDAkJaTlhv7fR5vPmJYY -0LiXii71ce+4hxdlp7hQfwQ2sb8FPY3RlVboTRD0CvGaWypWhdSZnS790dBXgZOs -NCge6NGuHzW5LtiZE9ppuv8qJysVcIFdAqt8dkx58ksOqFcARCerXw== ------END CERTIFICATE----- diff --git a/libnm-util/tests/certs/test2_key_and_cert.pem b/libnm-util/tests/certs/test2_key_and_cert.pem deleted file mode 100644 index a668596ee..000000000 --- a/libnm-util/tests/certs/test2_key_and_cert.pem +++ /dev/null @@ -1,119 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,5FA2D6D6242C26D0 - -dyNdbh115sczbUEhiaGYJ6fazyvJss5thPFEmkP6aftYlvXY6vPtc++xFCCktiSd -qFVEyi6oDyV4iGPmX7pCJ0e+pSI6uFNXKFtxh5/+/wXZcOEMCvfu7w2IrvYF2LHY -qJDljcISSRxeINuYO7TETD5fLLRKj2X9vwwkwVN02b2N5jsrm6Bt//WbatqSB3ln -FHyQhVKkvdl9Hr1XNmEfgGfZSxxDoPu1DjhtZ5ja2LZj64C2CXdI0oq2wcAVvQNn -rZeeg9sinQJkz9rwsNaWqlYw4X+YD2JRSwZuvwkWRydYMwgb1XS/jCxtuFF8NXWP -RBAOAZZUy7onzohsJHVVa05wCKQ4klo+PEfI3vn7BeuHyciCc0eFqGRvz8eFDybH -ZdPbU/3vGp+mOB7gd27TptttTCQQy9uM5CIyovNSYsAIw1Z583Ea4q8eXgzkgD6D -isCqkGXMfPbNXU3myQGDnQwWRi2CqX+rXM8PJUhdewLAlmHRz/aYSuql2BRixJKx -eASzmFBYdAjrvafda5D+xTyJwXEwdq/HlqMK9cY28ZbNrzA2Kor2X23EKC1+VG8k -B67OsfUhW27j4u6aV5JdLf87OtF3mHFRR+Lzs7i7LYvJ8ACE+jiIi7PboZjK5Oiv -JqTK0BwDaeNYjkd6jiJh8It/ReMbLk65J3eldOklN0VMPYiqcQnHvSPC2DD1YAy+ -Rv/JVj6TvzvgEAj+hgH6MAAF6u3ARj6+10DlvhUubkOC5RztLKReu8B+427TuuDb -T03gFpHD6X9IqSiq/QfYFyHFojCVSrv6wDZOcHc1s71kpJ8R14YIVe+DrrZN/0D4 -M631jdNg3JARMZXcXTHrghGIdPmOtrsRyTTRZuGoVup/DW9MRzOzCTMSNCX8T+eq -13HMSNQEO9lMwy0sYeO5c7sjHY4K1ubZuVE1mvXq4JLz3YxXJIvgp8TUvqDnAsK+ -Fv63bDoTg5Tq63XvnaKc7Lawneyg5ZAMzPN3nM0/1EZcn/2ICI5c4Yepc5t63EI5 -KytuXx86Mcx234enj3uMeuM22POQ1SnKOef6dFzK/CE8J8eUEY/aDhX4eBl/s3nd -U4+aaFKYz3HTazePayt2SC6rP/KKMmS14q59bOQA1DiWxCvmA2ypRyP87fV5DstH -I53RD5xp1P38iaO8U/divD0W2dkv748s9DQqYrHPtWALT9esxNU07CgB8Zt070si -7pzjQ8FDCZ8ygDmwWGNSBz1nA90Cpd6gAFDrep7HAtDE4qgNfokycpaJZkXBei/U -tC4tWYRbqDEsEbeBHvQRJzzqWzk9e/P4fQoelM3aryKzKLG5z7KvywVifKMLECQ+ -tIpzoRp06nuTA/O+iLFdkCy3JEWszfvvOwTwtIIV6+3s8TU0k9MmzEe3rGL+QqT/ -Tf+9/dN5LK+LWyc99BfmCOrBuFtQmHyEXkfe6EuFYEwj0B2ZfnLCon6cdRujjK7H -IJslC1B/cBVqG3KCrbBzjeygKfJ5Ijo72oXZJOCFTLeJefZKGGWJCp9nG9h9Wrcf -fEN/mj3wBvTa90/PYFj9NuaBtrvMF8Rn9XDeYPq2JGL8YkNdPuO8A+2Yko8wcvST ------END RSA PRIVATE KEY----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 2 (0x2) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Massachusetts, L=Westford, O=Red Hat, Inc., OU=Engineering, CN=eaptest/emailAddress=it@it.com - Validity - Not Before: Nov 9 15:50:14 2007 GMT - Not After : Nov 6 15:50:14 2017 GMT - Subject: C=US, ST=Massachusetts, O=Red Hat, Inc., OU=Engineering, CN=client/emailAddress=it@it.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): - 00:b0:8f:4f:1c:93:d4:43:e7:87:b7:22:33:55:a8: - 35:a1:c4:01:b0:f1:ed:26:23:96:ab:65:c2:c2:54: - db:79:22:03:ad:3f:6f:22:e3:63:3f:f4:21:6d:fa: - 88:c8:8f:1a:ce:55:49:7c:98:33:6a:67:8a:8d:d9: - 34:b0:c3:42:f4:72:a4:45:43:05:72:5d:0c:d3:42: - f8:9c:66:3b:b8:f8:77:ea:f6:b6:94:d7:cc:5d:62: - 34:2a:14:48:0a:bc:65:94:f5:7a:63:98:6c:88:4c: - 25:d8:95:f1:40:3d:00:d2:fb:43:28:fa:02:fb:2c: - 80:b3:e1:33:e7:8c:ce:8a:a0:1b:3d:04:4d:bc:a1: - b6:a2:42:8b:8e:f3:5b:4a:72:34:7d:8d:ba:d8:46: - 22:35:da:5c:f8:dd:fc:6d:9e:59:22:b7:6b:e7:78: - 56:54:9f:4c:d1:e2:4a:23:a3:bc:04:ea:46:6b:70: - 8a:fb:fe:8a:73:ca:36:d5:f3:e9:17:e3:22:d5:b3: - 70:05:e7:f7:37:b7:21:b5:90:53:27:27:ea:36:9b: - 00:ff:35:b0:66:3d:dc:a9:2f:95:d2:21:18:98:4f: - 28:07:09:70:20:a8:b1:82:aa:a5:df:ae:0f:e3:36: - be:68:8c:9e:80:d3:33:d0:f5:84:17:d9:0f:eb:9d: - af:0b - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 71:AB:BB:91:B7:04:DE:43:35:36:07:8A:35:CA:BE:5C:3E:EB:B1:09 - X509v3 Authority Key Identifier: - keyid:7E:50:E6:87:E1:EF:27:AC:4B:8C:70:45:C9:97:B5:0D:E6:BF:F0:0D - DirName:/C=US/ST=Massachusetts/L=Westford/O=Red Hat, Inc./OU=Engineering/CN=eaptest/emailAddress=it@it.com - serial:D0:E7:56:18:B1:00:ED:46 - - Signature Algorithm: md5WithRSAEncryption - ce:43:6d:f7:f8:4a:66:fd:8a:2c:41:a6:e0:03:0e:60:30:d4: - 41:01:ba:46:ba:81:97:64:68:83:25:9c:e1:2c:03:8b:2d:ca: - 85:cf:bc:fa:ca:22:c4:59:28:23:8f:ff:50:94:60:1c:90:dd: - 75:f4:d4:ea:8c:fa:61:61:08:35:4a:8f:aa:a7:e9:3d:76:e9: - 08:28:55:01:c4:03:42:c7:ad:58:bb:ee:94:f7:09:b3:9a:9b: - 8b:d0:25:95:18:a6:22:d5:2c:fc:b7:bb:91:0c:7c:03:7f:9b: - 85:de:b0:e4:95:a8:73:94:27:0a:11:4e:e3:67:ae:2b:cc:e7: - 51:29:10:23:57:5c:3e:e7:ea:47:e0:f0:8f:5b:a2:9f:26:cf: - 7f:b5:7c:44:b1:7b:83:67:3c:41:ae:c6:66:64:e0:d2:ef:57: - a4:5c:1b:94:11:ce:28:e5:91:51:ef:e1:98:b7:3b:9a:cc:f7: - b9:85:76:eb:a8:2b:15:4a:cc:1a:a3:42:fa:be:1c:ce:b8:eb: - ee:12:d7:2f:e4:a8:cf:eb:2a:8f:78:e8:91:88:fa:c2:98:75: - 6a:4c:92:3f:2e:0d:e1:20:39:36:c6:2c:be:67:30:c3:f3:c3: - 65:81:ac:e3:3c:19:6a:21:ee:ea:f5:22:66:74:b2:07:53:7c: - 9a:0c:24:a6 ------BEGIN CERTIFICATE----- -MIIEtDCCA5ygAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCVVMx -FjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxETAPBgNVBAcTCFdlc3Rmb3JkMRYwFAYD -VQQKEw1SZWQgSGF0LCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEQMA4GA1UE -AxMHZWFwdGVzdDEYMBYGCSqGSIb3DQEJARYJaXRAaXQuY29tMB4XDTA3MTEwOTE1 -NTAxNFoXDTE3MTEwNjE1NTAxNFowfjELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDU1h -c3NhY2h1c2V0dHMxFjAUBgNVBAoTDVJlZCBIYXQsIEluYy4xFDASBgNVBAsTC0Vu -Z2luZWVyaW5nMQ8wDQYDVQQDEwZjbGllbnQxGDAWBgkqhkiG9w0BCQEWCWl0QGl0 -LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALCPTxyT1EPnh7ci -M1WoNaHEAbDx7SYjlqtlwsJU23kiA60/byLjYz/0IW36iMiPGs5VSXyYM2pnio3Z -NLDDQvRypEVDBXJdDNNC+JxmO7j4d+r2tpTXzF1iNCoUSAq8ZZT1emOYbIhMJdiV -8UA9ANL7Qyj6AvssgLPhM+eMzoqgGz0ETbyhtqJCi47zW0pyNH2NuthGIjXaXPjd -/G2eWSK3a+d4VlSfTNHiSiOjvATqRmtwivv+inPKNtXz6RfjItWzcAXn9ze3IbWQ -Uycn6jabAP81sGY93KkvldIhGJhPKAcJcCCosYKqpd+uD+M2vmiMnoDTM9D1hBfZ -D+udrwsCAwEAAaOCASYwggEiMAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9w -ZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRxq7uRtwTeQzU2 -B4o1yr5cPuuxCTCBxwYDVR0jBIG/MIG8gBR+UOaH4e8nrEuMcEXJl7UN5r/wDaGB -mKSBlTCBkjELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxETAP -BgNVBAcTCFdlc3Rmb3JkMRYwFAYDVQQKEw1SZWQgSGF0LCBJbmMuMRQwEgYDVQQL -EwtFbmdpbmVlcmluZzEQMA4GA1UEAxMHZWFwdGVzdDEYMBYGCSqGSIb3DQEJARYJ -aXRAaXQuY29tggkA0OdWGLEA7UYwDQYJKoZIhvcNAQEEBQADggEBAM5Dbff4Smb9 -iixBpuADDmAw1EEBuka6gZdkaIMlnOEsA4styoXPvPrKIsRZKCOP/1CUYByQ3XX0 -1OqM+mFhCDVKj6qn6T126QgoVQHEA0LHrVi77pT3CbOam4vQJZUYpiLVLPy3u5EM -fAN/m4XesOSVqHOUJwoRTuNnrivM51EpECNXXD7n6kfg8I9bop8mz3+1fESxe4Nn -PEGuxmZk4NLvV6RcG5QRzijlkVHv4Zi3O5rM97mFduuoKxVKzBqjQvq+HM646+4S -1y/kqM/rKo946JGI+sKYdWpMkj8uDeEgOTbGLL5nMMPzw2WBrOM8GWoh7ur1ImZ0 -sgdTfJoMJKY= ------END CERTIFICATE----- diff --git a/libnm-util/tests/certs/test_ca_cert.der b/libnm-util/tests/certs/test_ca_cert.der Binary files differdeleted file mode 100644 index e844f65b2..000000000 --- a/libnm-util/tests/certs/test_ca_cert.der +++ /dev/null diff --git a/libnm-util/tests/certs/test_ca_cert.pem b/libnm-util/tests/certs/test_ca_cert.pem deleted file mode 100644 index faa3fc290..000000000 --- a/libnm-util/tests/certs/test_ca_cert.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEhjCCA26gAwIBAgIJAOZMXJYmXtbQMA0GCSqGSIb3DQEBBQUAMIGIMQswCQYD -VQQGEwJVUzESMBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcw -FQYDVQQKEw5NeSBDb21wYW55IEx0ZDENMAsGA1UECxMEdGVzdDENMAsGA1UEAxME -dGVzdDEcMBoGCSqGSIb3DQEJARYNdGVzdEB0ZXN0LmNvbTAeFw0wOTAyMDIwMjIx -NTJaFw0xOTAxMzEwMjIxNTJaMIGIMQswCQYDVQQGEwJVUzESMBAGA1UECBMJQmVy -a3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5NeSBDb21wYW55IEx0 -ZDENMAsGA1UECxMEdGVzdDENMAsGA1UEAxMEdGVzdDEcMBoGCSqGSIb3DQEJARYN -dGVzdEB0ZXN0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANZz -iHfFR6Gqdz5Gq1elSaf7J2tznfialPyMkRoqngSItrM3JWlkfBu3ZIpGSYG8+Z8H -JjaKh/zkCCH73HcjADCocm/XtgxlOlccDtBvfDqifb2dBikcmcfh0tX0o4JU9L+z -WP7sVcUkJG7C5811lA5pAsLVooJxrZnrta6XstGvFgTSxI2Y4Jowf0syM5b/AHIQ -+htsVhSyj1DWM9day3QsEMZl55SCxCLTB6ZIJLF6NmTYwdnzWWTQf4k7kcptZJU8 -Fqv60b/ATvvUf7S+ZMGLopFIIlmc1Kkn7VTseIKy4ycYuDpyimQy3Yw4flC00vhl -hTijH+5dlVOUFrRh0bsCAwEAAaOB8DCB7TAdBgNVHQ4EFgQUUjMuImZ5guVBLo07 -suXM+r6ZM44wgb0GA1UdIwSBtTCBsoAUUjMuImZ5guVBLo07suXM+r6ZM46hgY6k -gYswgYgxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAOBgNVBAcT -B05ld2J1cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMQ0wCwYDVQQLEwR0ZXN0 -MQ0wCwYDVQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRlc3QuY29tggkA -5kxcliZe1tAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAZsWzGp9D -10NWf8ts3A9mhcEb8oDgKNpCOZF9gqr2usZygJjY9MX2n0n81T8XaWDk1wZLlcDW -hzIalCY8rpE57Dj3MEmdCmYr3BrAy6GVlc/MO7ffTHxogl9ouScSYo8ETTtNMKCg -zwkDnXjGzmb1e59DIXMVHBBbTmJXJbM8XP9A2azJkVUyE2fSdWksXMP0XklGbW2p -DksJ+8G1IWkyRhnINV5GZLLNAT5gBA6sUv/iqQKwk8r2dsweMPtLoLWZPAaZErYh -sthGy00Q0GJkmkJpQl8QIlPq5vylNcMUhvc8tmzwk+rDVUj3jTJWqFwMtnHAaNyC -FXl9ynWpe5J28w== ------END CERTIFICATE----- diff --git a/libnm-util/tests/certs/test_key_and_cert.pem b/libnm-util/tests/certs/test_key_and_cert.pem deleted file mode 100644 index c00495d0b..000000000 --- a/libnm-util/tests/certs/test_key_and_cert.pem +++ /dev/null @@ -1,119 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,B29FCA6ECB7C0C48 - -KuRV4sEVQkY0r0E+E81Se2qpm54HeboUMIJcMVqAt/HIeYwpjEzmXHUywXgayA5k -r5Uvru95vymFz80q/rl6i4Mt3ckEQ3/VHmBI4pPj/JeRbiDhqTyLqpB5zMgbuti+ -PsEemlbiaCMZFdJk8rJBWADTkirGbXs5ciLwTJyrJXhkBVTqoHtphSWMELxcrnQj -5bAXZ+rnApWA7LR3yCY1UE0Nj39Yu8lkzDJtbsSXPJVO//OQiGuQRcY6roAUzeS/ -amLdIYqoZm3OF83Ro88XZCIDCG6XjgKoqojtekClVIytB6mHWk+IHhI7DgU/pDBj -yOskzVRMja9ECnqaVX+bmlmJGZBgcd7+XiebCXNY9IAx/ZQDMbDJDoJusvH6npJR -PBgag8QBSzwpFyEP/1LrlyVyggZcGuXDWfUiM2rt2UvLm8QYeT5WGfUI+QwW6JRV -xEz2QwRiPsmj0uK2fXLKHbY0Pv79IMLqgesCAUbndWsi94kjAhpJGa/WfKVb8Dpg -T+mVa2OT0pgewPWJ3h5f47ag27WDJthsIUHAvNZ03uM23DIqDh6o03/B3/4r1Uab -HzsLWhUOzbLihO08qcPk/JqtDVCv579mpgvy7bL2ZsZUzefnmg+ah+1bhLguryZu -Zrt1hTu5WTz27UbYwWNtkxWnWcM9sSF9y+KVwumYhIUGTvg3Jds/jmp/Z5ad8tev -0RQuWmqnXVD51Y92tOXobJH7JwGbQ4GeRNG/UX7DS9Lvb6rPgmmxvGbXMcjEMapB -m5DLjCD7Lz4++sfzhCic3/nL8e8fjoYZmCbL/SpYjGjTrfoNaGYaT0De8MxCSjPf -rNT+ldWFD0oAOTmT0uqOFkeIx3vxczSQUyRfzGOLqtb9mAXk8lvdb8Myb5atfe8f -FNBL5ocz6Szv2AmKmjZE5P6NKSllyryCYl+H2QU0e3OyY8S9aG2aG8fqeVKaA01S -uOOjsK6IKMpkit+VFDP7RWvS8p1FTwTVRdbMZzASW8+D98OHsTlOENtQuuFyvNaN -vPHrbHltTkwDlYVab9UpFr/ZRW3cNJrmcl0hyeCJxk5u8B9UwW6yZmd24hxda2xt -1QjnxfWlX0i5KTmfWFyPmRYt1WH9rdVaH6wqRbGNbMRT7Lez0E/2+LXjFiiEe0Vh -ZuryhyhUXpHY8yyHxFY92XT504Z3wPUaJ1tQxGhdziZ7HcqFT8f4oTNJdBNtzqNw -l63gSTaKUkSB14CBOyR84cqpgSMwZvWZb3RQFYY4GSALWwhnn6PWeRhjWAXPms2v -tRmfEyDUCyPxDarezvS9kUir3XbvnCkoJOrK/lw4a8ygGBCBqRKOdI0SRUf1Nnjm -aZBrKrXHv5vP66fyC7cGMTq35+iiHbE//rRDGPrf9vpmw3ki3FlDMyAXOC5yWDco -0n+cNDyHJDdIW3+3nfZvSgPPMwmTdfNO90X3YczSmMTGjnIuhQMf7FMFmMZOSrqD -u234vYCjIIlph3aVpbzjOqKg3d4nuP9oouyAgRAr+vShgHRmq0jvsAiGH3Q6RqEj -DvkM1NgoloMy5RhKF4hIeaQM/UlgoXrcEx0RGCJHykQcQmVa5cf5EwjrO7b+w2Lg ------END RSA PRIVATE KEY----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=US, ST=Berkshire, L=Newbury, O=My Company Ltd, OU=test, CN=test/emailAddress=test@test.com - Validity - Not Before: Feb 2 02:22:25 2009 GMT - Not After : Jan 31 02:22:25 2019 GMT - Subject: C=US, ST=Berkshire, O=My Company Ltd, OU=test-client, CN=test-client/emailAddress=test-client@test.com - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): - 00:ce:d2:e9:fb:f4:a4:ce:66:87:cc:8b:2d:d2:c3: - b8:fa:be:ea:53:08:95:9e:27:4a:04:78:31:a1:36: - d2:e5:42:f5:76:f7:24:71:b8:d3:10:fd:b7:57:86: - 68:29:02:1b:e9:93:2b:af:c0:7e:3d:58:16:34:10: - 25:85:7e:28:2d:42:fc:34:7f:d6:4f:0a:e7:b6:b9: - 40:51:c8:e5:89:60:cd:73:51:63:67:e1:59:36:31: - 5e:d0:87:4b:5d:97:8a:42:22:d3:42:f2:83:62:79: - 84:45:5b:d8:20:97:e2:d1:34:23:5e:ec:bf:8a:41: - 7c:ad:80:50:f3:9b:1c:51:5d:e4:29:1c:c1:c6:7c: - a1:00:70:0f:f6:79:77:03:22:f5:4b:ab:76:ca:20: - ab:e1:4e:53:6c:86:68:e9:d6:0f:6e:95:4b:b5:b5: - cf:d3:6c:d4:73:db:c0:3d:1d:20:20:72:ab:3e:25: - bb:3f:cd:5f:2d:77:fd:d7:0b:a8:eb:0c:73:c0:3f: - 74:27:17:56:cf:31:9a:a9:ed:c1:39:27:c7:aa:e9: - 77:48:f4:6d:56:89:35:5c:79:5b:f6:2f:8c:9f:93: - bc:13:1c:d0:74:5f:30:1b:15:43:71:8e:ff:1a:df: - 65:65:69:c2:8a:5a:ab:04:4a:80:de:20:29:8d:48: - 1c:83 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 34:E9:5C:D8:FC:C7:AF:F7:5D:F4:13:D3:82:1A:CD:52:0F:4A:BB:0B - X509v3 Authority Key Identifier: - keyid:52:33:2E:22:66:79:82:E5:41:2E:8D:3B:B2:E5:CC:FA:BE:99:33:8E - DirName:/C=US/ST=Berkshire/L=Newbury/O=My Company Ltd/OU=test/CN=test/emailAddress=test@test.com - serial:E6:4C:5C:96:26:5E:D6:D0 - - Signature Algorithm: md5WithRSAEncryption - 88:c4:dd:c5:4a:a6:8e:1f:36:62:80:31:6b:2b:85:34:0d:6c: - a7:dc:e1:5a:3c:dd:74:57:db:59:be:8b:f2:79:40:2d:bd:9b: - e1:ab:0e:03:75:20:75:2f:ea:97:f9:d4:7e:15:75:c2:82:f5: - b1:37:e4:8b:24:d4:ef:02:3b:19:6a:56:bb:9f:c3:a5:b4:c4: - 39:a0:64:96:5b:c3:a8:19:74:ec:0b:cf:33:df:f3:12:f3:e2: - ab:1d:7d:de:21:64:cd:b1:a0:6f:7a:77:84:d4:62:8a:50:e6: - 76:5d:af:3a:ef:1a:87:0e:1a:38:c4:f9:0d:2f:14:e0:20:32: - 4c:2e:70:d2:71:82:d5:e5:c9:13:2c:4e:b4:c8:63:65:1d:48: - e8:c3:56:6d:88:84:57:65:13:1e:42:48:b4:03:25:71:4e:12: - 9d:1a:88:65:d5:71:21:3b:0e:be:37:1c:f0:88:6b:45:0c:0e: - 6c:e5:60:cb:86:bf:bf:40:30:c4:cf:94:f8:1c:60:d4:1b:df: - 88:02:7a:45:7e:d1:c6:f3:07:b9:b1:8f:2a:55:2f:be:77:9f: - d1:46:64:05:b7:67:c5:b2:ac:8c:42:8f:6a:51:a4:0d:2b:16: - a4:d6:39:a5:f8:25:ed:68:25:13:b5:19:ac:6c:e9:ec:ee:03: - 6b:80:38:6e ------BEGIN CERTIFICATE----- -MIIErjCCA5agAwIBAgIBATANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMCVVMx -EjAQBgNVBAgTCUJlcmtzaGlyZTEQMA4GA1UEBxMHTmV3YnVyeTEXMBUGA1UEChMO -TXkgQ29tcGFueSBMdGQxDTALBgNVBAsTBHRlc3QxDTALBgNVBAMTBHRlc3QxHDAa -BgkqhkiG9w0BCQEWDXRlc3RAdGVzdC5jb20wHhcNMDkwMjAyMDIyMjI1WhcNMTkw -MTMxMDIyMjI1WjCBizELMAkGA1UEBhMCVVMxEjAQBgNVBAgTCUJlcmtzaGlyZTEX -MBUGA1UEChMOTXkgQ29tcGFueSBMdGQxFDASBgNVBAsTC3Rlc3QtY2xpZW50MRQw -EgYDVQQDEwt0ZXN0LWNsaWVudDEjMCEGCSqGSIb3DQEJARYUdGVzdC1jbGllbnRA -dGVzdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDO0un79KTO -ZofMiy3Sw7j6vupTCJWeJ0oEeDGhNtLlQvV29yRxuNMQ/bdXhmgpAhvpkyuvwH49 -WBY0ECWFfigtQvw0f9ZPCue2uUBRyOWJYM1zUWNn4Vk2MV7Qh0tdl4pCItNC8oNi -eYRFW9ggl+LRNCNe7L+KQXytgFDzmxxRXeQpHMHGfKEAcA/2eXcDIvVLq3bKIKvh -TlNshmjp1g9ulUu1tc/TbNRz28A9HSAgcqs+Jbs/zV8td/3XC6jrDHPAP3QnF1bP -MZqp7cE5J8eq6XdI9G1WiTVceVv2L4yfk7wTHNB0XzAbFUNxjv8a32VlacKKWqsE -SoDeICmNSByDAgMBAAGjggEcMIIBGDAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQf -Fh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUNOlc2PzH -r/dd9BPTghrNUg9Kuwswgb0GA1UdIwSBtTCBsoAUUjMuImZ5guVBLo07suXM+r6Z -M46hgY6kgYswgYgxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAO -BgNVBAcTB05ld2J1cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMQ0wCwYDVQQL -EwR0ZXN0MQ0wCwYDVQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRlc3Qu -Y29tggkA5kxcliZe1tAwDQYJKoZIhvcNAQEEBQADggEBAIjE3cVKpo4fNmKAMWsr -hTQNbKfc4Vo83XRX21m+i/J5QC29m+GrDgN1IHUv6pf51H4VdcKC9bE35Isk1O8C -OxlqVrufw6W0xDmgZJZbw6gZdOwLzzPf8xLz4qsdfd4hZM2xoG96d4TUYopQ5nZd -rzrvGocOGjjE+Q0vFOAgMkwucNJxgtXlyRMsTrTIY2UdSOjDVm2IhFdlEx5CSLQD -JXFOEp0aiGXVcSE7Dr43HPCIa0UMDmzlYMuGv79AMMTPlPgcYNQb34gCekV+0cbz -B7mxjypVL753n9FGZAW3Z8WyrIxCj2pRpA0rFqTWOaX4Je1oJRO1Gaxs6ezuA2uA -OG4= ------END CERTIFICATE----- diff --git a/libnm-util/tests/test-crypto.c b/libnm-util/tests/test-crypto.c index c11b6392f..4bf2b3be7 100644 --- a/libnm-util/tests/test-crypto.c +++ b/libnm-util/tests/test-crypto.c @@ -18,9 +18,11 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2011 Red Hat, Inc. */ +#include "config.h" + #include <glib.h> #include <unistd.h> #include <stdlib.h> @@ -92,18 +94,21 @@ out: #endif static void -test_load_cert (const char *path, const char *desc) +test_cert (gconstpointer test_data) { + char *path; GByteArray *array; NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN; GError *error = NULL; + path = g_build_filename (TEST_CERT_DIR, (const char *) test_data, NULL); + array = crypto_load_and_verify_certificate (path, &format, &error); - ASSERT (array != NULL, desc, + ASSERT (array != NULL, "cert", "couldn't read certificate file '%s': %d %s", path, error->code, error->message); - ASSERT (format == NM_CRYPTO_FILE_FORMAT_X509, desc, + ASSERT (format == NM_CRYPTO_FILE_FORMAT_X509, "cert", "%s: unexpected certificate format (expected %d, got %d)", path, NM_CRYPTO_FILE_FORMAT_X509, format); @@ -275,7 +280,7 @@ is_cipher_aes (const char *path) } g_free (contents); - return is_aes; + return is_aes; } static void @@ -330,55 +335,132 @@ test_encrypt_private_key (const char *path, g_byte_array_free (array, TRUE); } -int main (int argc, char **argv) +static void +test_key (gconstpointer test_data) +{ + char **parts, *path, *password, *decrypted_path; + int len; + + parts = g_strsplit ((const char *) test_data, ", ", -1); + len = g_strv_length (parts); + ASSERT (len == 2 || len == 3, "test-crypto", + "wrong number of arguments (<key file>, <password>, [<decrypted key file>])"); + + path = g_build_filename (TEST_CERT_DIR, parts[0], NULL); + password = parts[1]; + decrypted_path = parts[2] ? g_build_filename (TEST_CERT_DIR, parts[2], NULL) : NULL; + + test_is_pkcs12 (path, TRUE, "not-pkcs12"); + test_load_private_key (path, password, decrypted_path, FALSE, "private-key"); + test_load_private_key (path, "blahblahblah", NULL, TRUE, "private-key-bad-password"); + test_load_private_key (path, NULL, NULL, TRUE, "private-key-no-password"); + test_encrypt_private_key (path, password, "private-key-rencrypt"); + + g_free (path); + g_free (decrypted_path); + g_strfreev (parts); +} + +static void +test_pkcs12 (gconstpointer test_data) +{ + char **parts, *path, *password; + + parts = g_strsplit ((const char *) test_data, ", ", -1); + ASSERT (g_strv_length (parts) == 2, "test-crypto", + "wrong number of arguments (<file>, <password>)"); + + path = g_build_filename (TEST_CERT_DIR, parts[0], NULL); + password = parts[1]; + + test_is_pkcs12 (path, FALSE, "is-pkcs12"); + test_load_pkcs12 (path, password, FALSE, "pkcs12-private-key"); + test_load_pkcs12 (path, "blahblahblah", TRUE, "pkcs12-private-key-bad-password"); + test_load_pkcs12_no_password (path, "pkcs12-private-key-no-password"); + + g_free (path); + g_strfreev (parts); +} + +static void +test_pkcs8 (gconstpointer test_data) +{ + char **parts, *path, *password; + + parts = g_strsplit ((const char *) test_data, ", ", -1); + ASSERT (g_strv_length (parts) == 2, "test-crypto", + "wrong number of arguments (<file>, <password>)"); + + path = g_build_filename (TEST_CERT_DIR, parts[0], NULL); + password = parts[1]; + + test_is_pkcs12 (path, TRUE, "not-pkcs12"); + test_load_pkcs8 (path, password, FALSE, "pkcs8-private-key"); + /* Until gnutls and NSS grow support for all the ciphers that openssl + * can use with PKCS#8, we can't actually verify the password. So we + * expect a bad password to work for the time being. + */ + test_load_pkcs8 (path, "blahblahblah", FALSE, "pkcs8-private-key-bad-password"); + + g_free (path); + g_strfreev (parts); +} + +NMTST_DEFINE (); + +int +main (int argc, char **argv) { GError *error = NULL; - char *progname; - ASSERT (argc > 2, "test-crypto", - "wrong number of arguments (expected at least an operation and an object)"); + nmtst_init (&argc, &argv, TRUE); if (!crypto_init (&error)) FAIL ("crypto-init", "failed to initialize crypto: %s", error->message); - if (!strcmp (argv[1], "--cert")) - test_load_cert (argv[2], "cert"); - else if (!strcmp (argv[1], "--key")) { - const char *decrypted_path = (argc == 5) ? argv[4] : NULL; - - ASSERT (argc == 4 || argc == 5, "test-crypto", - "wrong number of arguments (--key <key file> <password> [<decrypted key file>])"); - - test_is_pkcs12 (argv[2], TRUE, "not-pkcs12"); - test_load_private_key (argv[2], argv[3], decrypted_path, FALSE, "private-key"); - test_load_private_key (argv[2], "blahblahblah", NULL, TRUE, "private-key-bad-password"); - test_load_private_key (argv[2], NULL, NULL, TRUE, "private-key-no-password"); - test_encrypt_private_key (argv[2], argv[3], "private-key-rencrypt"); - } else if (!strcmp (argv[1], "--p12")) { - test_is_pkcs12 (argv[2], FALSE, "is-pkcs12"); - test_load_pkcs12 (argv[2], argv[3], FALSE, "pkcs12-private-key"); - test_load_pkcs12 (argv[2], "blahblahblah", TRUE, "pkcs12-private-key-bad-password"); - test_load_pkcs12_no_password (argv[2], "pkcs12-private-key-no-password"); - } else if (!strcmp (argv[1], "--pkcs8")) { - ASSERT (argc == 4, "test-crypto", - "wrong number of arguments (--pkcs8 <key file> <password>)"); - - test_is_pkcs12 (argv[2], TRUE, "not-pkcs12"); - test_load_pkcs8 (argv[2], argv[3], FALSE, "pkcs8-private-key"); - /* Until gnutls and NSS grow support for all the ciphers that openssl - * can use with PKCS#8, we can't actually verify the password. So we - * expect a bad password to work for the time being. - */ - test_load_pkcs8 (argv[2], "blahblahblah", FALSE, "pkcs8-private-key-bad-password"); - } else { - ASSERT (argc > 2, "test-crypto", "unknown test type (not --cert, --key, or --p12)"); - } - - crypto_deinit (); - - progname = g_path_get_basename (argv[0]); - fprintf (stdout, "%s: SUCCESS\n", progname); - g_free (progname); - return 0; + g_test_add_data_func ("/libnm/crypto/cert/pem", + "test_ca_cert.pem", + test_cert); + g_test_add_data_func ("/libnm/crypto/cert/pem-2", + "test2_ca_cert.pem", + test_cert); + g_test_add_data_func ("/libnm/crypto/cert/der", + "test_ca_cert.der", + test_cert); + g_test_add_data_func ("/libnm/crypto/cert/pem-no-ending-newline", + "ca-no-ending-newline.pem", + test_cert); + g_test_add_data_func ("/libnm/crypto/cert/pem-combined", + "test_key_and_cert.pem", + test_cert); + g_test_add_data_func ("/libnm/crypto/cert/pem-combined-2", + "test2_key_and_cert.pem", + test_cert); + + g_test_add_data_func ("/libnm/crypto/key/padding-6", + "test_key_and_cert.pem, test, test-key-only-decrypted.der", + test_key); + g_test_add_data_func ("/libnm/crypto/key/key-only", + "test-key-only.pem, test, test-key-only-decrypted.der", + test_key); + g_test_add_data_func ("/libnm/crypto/key/padding-8", + "test2_key_and_cert.pem, 12345testing", + test_key); + g_test_add_data_func ("/libnm/crypto/key/aes", + "test-aes-key.pem, test-aes-password", + test_key); + + g_test_add_data_func ("/libnm/crypto/PKCS#12/1", + "test-cert.p12, test", + test_pkcs12); + g_test_add_data_func ("/libnm/crypto/PKCS#12/2", + "test2-cert.p12, 12345testing", + test_pkcs12); + + g_test_add_data_func ("/libnm/crypto/PKCS#8", + "pkcs8-enc-key.pem, 1234567890", + test_pkcs8); + + return g_test_run (); } diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 97625605c..f748fcf59 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -15,15 +15,19 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2011 Red Hat, Inc. * */ +#include "config.h" + #include <glib.h> #include <dbus/dbus-glib.h> #include <string.h> #include <netinet/ether.h> #include <linux/if_infiniband.h> +#include <sys/wait.h> +#include <sys/resource.h> #include <nm-utils.h> @@ -41,7 +45,6 @@ #include "nm-setting-vlan.h" #include "nm-setting-bond.h" #include "nm-utils.h" -#include "nm-utils-private.h" #include "nm-dbus-glib-types.h" #include "nm-test-utils.h" @@ -307,156 +310,6 @@ test_setting_vpn_modify_during_foreach (void) g_object_unref (s_vpn); } -static void -test_setting_ip4_config_labels (void) -{ - NMSettingIP4Config *s_ip4; - NMIP4Address *addr; - const char *label; - GPtrArray *addrs; - GSList *labels; - GError *error = NULL; - - s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, - NULL); - - /* addr 1 */ - addr = nm_ip4_address_new (); - nm_ip4_address_set_address (addr, 0x01010101); - nm_ip4_address_set_prefix (addr, 24); - - nm_setting_ip4_config_add_address (s_ip4, addr); - nm_ip4_address_unref (addr); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0)); - g_assert_cmpstr (label, ==, NULL); - - /* addr 2 */ - addr = nm_ip4_address_new (); - nm_ip4_address_set_address (addr, 0x02020202); - nm_ip4_address_set_prefix (addr, 24); - - NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, "eth0:1")); - nm_ip4_address_unref (addr); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1)); - g_assert_cmpstr (label, ==, "eth0:1"); - - /* addr 3 */ - addr = nm_ip4_address_new (); - nm_ip4_address_set_address (addr, 0x03030303); - nm_ip4_address_set_prefix (addr, 24); - - NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_add_address_with_label (s_ip4, addr, NULL)); - nm_ip4_address_unref (addr); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 2)); - g_assert_cmpstr (label, ==, NULL); - - /* Remove addr 1 and re-verify remaining addresses */ - nm_setting_ip4_config_remove_address (s_ip4, 0); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - - addr = nm_setting_ip4_config_get_address (s_ip4, 0); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0)); - g_assert_cmpstr (label, ==, "eth0:1"); - - addr = nm_setting_ip4_config_get_address (s_ip4, 1); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1)); - g_assert_cmpstr (label, ==, NULL); - - - /* Test explicit property assignment */ - g_object_get (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_ADDRESSES, &addrs, - "address-labels", &labels, - NULL); - - nm_setting_ip4_config_clear_addresses (s_ip4); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 0); - - /* Setting addrs but not labels will result in empty labels */ - g_object_set (G_OBJECT (s_ip4), - NM_SETTING_IP4_CONFIG_ADDRESSES, addrs, - NULL); - g_boxed_free (DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT, addrs); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2); - - addr = nm_setting_ip4_config_get_address (s_ip4, 0); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0)); - g_assert_cmpstr (label, ==, NULL); - - addr = nm_setting_ip4_config_get_address (s_ip4, 1); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1)); - g_assert_cmpstr (label, ==, NULL); - - /* Setting labels now will leave addresses untouched */ - g_object_set (G_OBJECT (s_ip4), - "address-labels", labels, - NULL); - g_boxed_free (DBUS_TYPE_G_LIST_OF_STRING, labels); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - g_assert_cmpint (nm_setting_ip4_config_get_num_addresses (s_ip4), ==, 2); - - addr = nm_setting_ip4_config_get_address (s_ip4, 0); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x02020202); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 0)); - g_assert_cmpstr (label, ==, "eth0:1"); - - addr = nm_setting_ip4_config_get_address (s_ip4, 1); - g_assert_cmpint (nm_ip4_address_get_address (addr), ==, 0x03030303); - label = NM_UTILS_PRIVATE_CALL (nm_setting_ip4_config_get_address_label (s_ip4, 1)); - g_assert_cmpstr (label, ==, NULL); - - /* Setting labels to a value that's too short or too long will result in - * the setting not verifying. - */ - labels = g_slist_append (NULL, "eth0:2"); - g_object_set (G_OBJECT (s_ip4), - "address-labels", labels, - NULL); - - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_error (error, NM_SETTING_IP4_CONFIG_ERROR, NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY); - g_assert (g_str_has_prefix (error->message, "ipv4.address-labels:")); - g_clear_error (&error); - - labels = g_slist_append (labels, "eth0:3"); - g_object_set (G_OBJECT (s_ip4), - "address-labels", labels, - NULL); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_no_error (error); - - labels = g_slist_append (labels, "eth0:4"); - g_object_set (G_OBJECT (s_ip4), - "address-labels", labels, - NULL); - nm_setting_verify (NM_SETTING (s_ip4), NULL, &error); - g_assert_error (error, NM_SETTING_IP4_CONFIG_ERROR, NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY); - g_assert (g_str_has_prefix (error->message, "ipv4.address-labels:")); - g_clear_error (&error); - - - g_object_unref (s_ip4); -} - #define OLD_DBUS_TYPE_G_IP6_ADDRESS (dbus_g_type_get_struct ("GValueArray", DBUS_TYPE_G_UCHAR_ARRAY, G_TYPE_UINT, G_TYPE_INVALID)) #define OLD_DBUS_TYPE_G_ARRAY_OF_IP6_ADDRESS (dbus_g_type_get_collection ("GPtrArray", OLD_DBUS_TYPE_G_IP6_ADDRESS)) @@ -893,7 +746,7 @@ new_connection_hash (char **out_uuid, } static void -test_connection_replace_settings () +test_connection_replace_settings (void) { NMConnection *connection; GHashTable *new_settings; @@ -932,7 +785,7 @@ test_connection_replace_settings () } static void -test_connection_replace_settings_from_connection () +test_connection_replace_settings_from_connection (void) { NMConnection *connection, *replacement; GError *error = NULL; @@ -994,7 +847,7 @@ test_connection_replace_settings_from_connection () } static void -test_connection_new_from_hash () +test_connection_new_from_hash (void) { NMConnection *connection; GHashTable *new_settings; @@ -1416,8 +1269,8 @@ test_connection_diff_a_only (void) { NM_SETTING_IP4_CONFIG_DNS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DNS_SEARCH, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_ADDRESSES, NM_SETTING_DIFF_RESULT_IN_A }, - { "address-labels", NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP4_CONFIG_ROUTE_METRIC, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A }, @@ -1980,9 +1833,9 @@ test_ip4_netmask_to_prefix (void) { int i, j; - GRand *rand = g_rand_new (); + GRand *r = g_rand_new (); - g_rand_set_seed (rand, 1); + g_rand_set_seed (r, 1); for (i = 2; i<=32; i++) { guint32 netmask = nm_utils_ip4_prefix_to_netmask (i); @@ -1991,11 +1844,11 @@ test_ip4_netmask_to_prefix (void) g_assert_cmpint (i, ==, nm_utils_ip4_netmask_to_prefix (netmask)); for (j = 0; j < 2*i; j++) { - guint32 r = g_rand_int (rand); + guint32 n = g_rand_int (r); guint32 netmask_holey; guint32 prefix_holey; - netmask_holey = (netmask & r) | netmask_lowest_bit; + netmask_holey = (netmask & n) | netmask_lowest_bit; if (netmask_holey == netmask) continue; @@ -2008,7 +1861,7 @@ test_ip4_netmask_to_prefix (void) } } - g_rand_free (rand); + g_rand_free (r); } #define ASSERT_CHANGED(statement) \ @@ -2153,7 +2006,7 @@ test_setting_ip4_changed_signal (void) ASSERT_CHANGED (nm_setting_ip4_config_add_address (s_ip4, addr)); ASSERT_CHANGED (nm_setting_ip4_config_remove_address (s_ip4, 0)); - g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, "*addr != NULL && label != NULL*"); + g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, "*elt != NULL*"); ASSERT_UNCHANGED (nm_setting_ip4_config_remove_address (s_ip4, 1)); g_test_assert_expected_messages (); @@ -2484,6 +2337,201 @@ test_setting_old_uuid (void) g_assert (success == TRUE); } +/* + * nm_connection_verify() modifies the connection by setting + * the interface-name property to the virtual_iface_name of + * the type specific settings. + * + * It would be preferable of verify() not to touch the connection, + * but as it is now, stick with it and test it. + **/ +static void +test_connection_verify_sets_interface_name (void) +{ + NMConnection *con; + NMSettingConnection *s_con; + NMSettingBond *s_bond; + GError *error = NULL; + gboolean success; + + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_object_set (G_OBJECT (s_con), + NM_SETTING_CONNECTION_ID, "test1", + NM_SETTING_CONNECTION_UUID, "22001632-bbb4-4616-b277-363dce3dfb5b", + NM_SETTING_CONNECTION_TYPE, NM_SETTING_BOND_SETTING_NAME, + NULL); + s_bond = (NMSettingBond *) nm_setting_bond_new (); + g_object_set (G_OBJECT (s_bond), + NM_SETTING_BOND_INTERFACE_NAME, "bond-x", + NULL); + + con = nm_connection_new (); + nm_connection_add_setting (con, NM_SETTING (s_con)); + nm_connection_add_setting (con, NM_SETTING (s_bond)); + + g_assert_cmpstr (nm_connection_get_interface_name (con), ==, NULL); + + /* for backward compatiblity, normalizes the interface name */ + success = nm_connection_verify (con, &error); + g_assert (success && !error); + + g_assert_cmpstr (nm_connection_get_interface_name (con), ==, "bond-x"); + + g_object_unref (con); +} + +/* + * Test normalization of interface-name + **/ +static void +test_connection_normalize_virtual_iface_name (void) +{ + NMConnection *con; + NMSettingConnection *s_con; + NMSettingVlan *s_vlan; + NMSetting *setting; + GError *error = NULL; + gboolean success; + const char *IFACE_NAME = "iface"; + const char *IFACE_VIRT = "iface-X"; + gboolean modified = FALSE; + + con = nm_connection_new (); + + setting = nm_setting_ip4_config_new (); + g_object_set (setting, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NULL); + nm_connection_add_setting (con, setting); + + setting = nm_setting_ip6_config_new (); + g_object_set (setting, + NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NULL); + nm_connection_add_setting (con, setting); + + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_object_set (G_OBJECT (s_con), + NM_SETTING_CONNECTION_ID, "test1", + NM_SETTING_CONNECTION_UUID, "22001632-bbb4-4616-b277-363dce3dfb5b", + NM_SETTING_CONNECTION_TYPE, NM_SETTING_VLAN_SETTING_NAME, + NM_SETTING_CONNECTION_INTERFACE_NAME, IFACE_NAME, + NULL); + s_vlan = (NMSettingVlan *) nm_setting_vlan_new (); + g_object_set (G_OBJECT (s_vlan), + NM_SETTING_VLAN_INTERFACE_NAME, IFACE_VIRT, + NM_SETTING_VLAN_PARENT, "eth0", + NULL); + + nm_connection_add_setting (con, NM_SETTING (s_con)); + nm_connection_add_setting (con, NM_SETTING (s_vlan)); + + g_assert_cmpstr (nm_connection_get_interface_name (con), ==, IFACE_NAME); + g_assert_cmpstr (nm_setting_vlan_get_interface_name (s_vlan), ==, IFACE_VIRT); + + /* for backward compatiblity, normalizes the interface name */ + success = nm_connection_verify (con, &error); + g_assert (success && !error); + + g_assert_cmpstr (nm_connection_get_interface_name (con), ==, IFACE_NAME); + g_assert_cmpstr (nm_setting_vlan_get_interface_name (s_vlan), ==, IFACE_VIRT); + + success = nm_connection_normalize (con, NULL, &modified, &error); + g_assert (success && !error); + g_assert (modified); + + g_assert_cmpstr (nm_connection_get_interface_name (con), ==, IFACE_NAME); + g_assert_cmpstr (nm_setting_vlan_get_interface_name (s_vlan), ==, IFACE_NAME); + + success = nm_connection_verify (con, &error); + g_assert (success && !error); + + g_object_unref (con); +} + +static void +_test_libnm_linking_setup_child_process (gpointer user_data) +{ + int val; + struct rlimit limit; + + /* the child process is supposed to crash. We don't want it + * to write a core dump. */ + + val = getrlimit (RLIMIT_CORE, &limit); + if (val == 0) { + limit.rlim_cur = 0; + val = setrlimit (RLIMIT_CORE, &limit); + if (val == 0) + return; + } + /* on error, do not crash or fail assertion. Instead just exit */ + exit (1); +} + +static void +test_libnm_linking (void) +{ + char *argv[] = { "./test-libnm-linking", NULL }; + char *out, *err; + int status; + GError *error = NULL; + + g_spawn_sync (BUILD_DIR, argv, NULL, 0 /*G_SPAWN_DEFAULT*/, + _test_libnm_linking_setup_child_process, NULL, + &out, &err, &status, &error); + g_assert_no_error (error); + + g_assert (WIFSIGNALED (status)); + + g_assert (strstr (err, "Mixing libnm") != NULL); + g_free (out); + g_free (err); +} + +/******************************************************************************/ + +static void +_test_uuid (const char *expected_uuid, const char *str) +{ + gs_free char *uuid_test = NULL; + + g_assert (str); + + uuid_test = nm_utils_uuid_generate_from_string (str); + + g_assert (uuid_test); + g_assert (nm_utils_is_uuid (uuid_test)); + + if (strcmp (uuid_test, expected_uuid)) { + g_error ("UUID test failed: text=%s, uuid=%s, expected=%s", + str, uuid_test, expected_uuid); + } +} + +static void +test_nm_utils_uuid_generate_from_string (void) +{ + gs_free char *uuid_test = NULL; + + _test_uuid ("0cc175b9-c0f1-b6a8-31c3-99e269772661", "a"); + _test_uuid ("098f6bcd-4621-d373-cade-4e832627b4f6", "test"); + _test_uuid ("59c0547b-7fe2-1c15-2cce-e328e8bf6742", "/etc/NetworkManager/system-connections/em1"); + + g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, "*nm_utils_uuid_generate_from_string*: *s && *s*"); + uuid_test = nm_utils_uuid_generate_from_string (""); + g_assert (uuid_test == NULL); + g_test_assert_expected_messages (); + + g_test_expect_message ("libnm-util", G_LOG_LEVEL_CRITICAL, "*nm_utils_uuid_generate_from_string*: *s && *s*"); + uuid_test = nm_utils_uuid_generate_from_string (NULL); + g_assert (uuid_test == NULL); + g_test_assert_expected_messages (); +} + +/******************************************************************************/ + NMTST_DEFINE (); int main (int argc, char **argv) @@ -2496,7 +2544,6 @@ int main (int argc, char **argv) test_setting_vpn_items (); test_setting_vpn_update_secrets (); test_setting_vpn_modify_during_foreach (); - test_setting_ip4_config_labels (); test_setting_ip6_config_old_address_array (); test_setting_gsm_apn_spaces (); test_setting_gsm_apn_bad_chars (); @@ -2521,6 +2568,8 @@ int main (int argc, char **argv) test_connection_replace_settings (); test_connection_replace_settings_from_connection (); test_connection_new_from_hash (); + test_connection_verify_sets_interface_name (); + test_connection_normalize_virtual_iface_name (); test_setting_connection_permissions_helpers (); test_setting_connection_permissions_property (); @@ -2558,6 +2607,10 @@ int main (int argc, char **argv) test_setting_wireless_security_changed_signal (); test_setting_802_1x_changed_signal (); + test_libnm_linking (); + + test_nm_utils_uuid_generate_from_string (); + base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); g_free (base); diff --git a/libnm-util/tests/test-libnm-linking.c b/libnm-util/tests/test-libnm-linking.c new file mode 100644 index 000000000..9738d44d7 --- /dev/null +++ b/libnm-util/tests/test-libnm-linking.c @@ -0,0 +1,48 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2014 Red Hat, Inc. + * + */ + +#include "config.h" + +#include <glib.h> +#include <nm-utils.h> + +#include "nm-glib-compat.h" + +extern GType nm_state_get_type (void); + +int +main (int argc, char **argv) +{ + /* If we reach main(), then the test has failed. */ + g_printerr ("libnm/libnm-util constructor failed to detect symbol mixing\n"); + + /* This is just to ensure that both libnm.so and libnm-util.so get pulled + * in; libnm-util doesn't have "nm_state_get_type" and libnm doesn't have + * "nm_utils_slist_free". (We intentionally choose different symbols than the + * ones that the libraries check for.) + */ + nm_state_get_type (); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + nm_utils_slist_free (NULL, g_free); + G_GNUC_END_IGNORE_DEPRECATIONS; + + g_assert_not_reached (); +} diff --git a/libnm-util/tests/test-secrets.c b/libnm-util/tests/test-secrets.c index 73fc9224b..fb0ad4c7e 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -15,10 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2011 Red Hat, Inc. * */ +#include "config.h" + #include <glib.h> #include <string.h> @@ -679,7 +681,7 @@ test_update_secrets_whole_connection_empty_base_setting (void) connection = wifi_connection_new (); secrets = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_ONLY_SECRETS); - g_assert_cmpint (g_hash_table_size (secrets), ==, 1); + g_assert_cmpint (g_hash_table_size (secrets), ==, 3); g_assert (g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SETTING_NAME)); success = nm_connection_update_secrets (connection, diff --git a/libnm-util/tests/test-setting-8021x.c b/libnm-util/tests/test-setting-8021x.c index 62889c61f..4b37d92b7 100644 --- a/libnm-util/tests/test-setting-8021x.c +++ b/libnm-util/tests/test-setting-8021x.c @@ -15,10 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2011 Red Hat, Inc. * */ +#include "config.h" + #include <glib.h> #include <string.h> @@ -404,40 +406,57 @@ test_clear_phase2_private_key (const char *path, const char *password) g_object_unref (s_8021x); } -int main (int argc, char **argv) +static void +do_8021x_test (gconstpointer test_data) { - GError *error = NULL; - char *base; - - if (argc < 3) - FAIL ("init", "need at least two arguments: <path> <password>"); + char **parts, *path, *password; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + parts = g_strsplit ((const char *) test_data, ", ", -1); + g_assert_cmpint (g_strv_length (parts), ==, 2); - if (!nm_utils_init (&error)) - FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); + path = g_build_filename (TEST_CERT_DIR, parts[0], NULL); + password = parts[1]; /* Test phase1 and phase2 path scheme */ - test_private_key_import (argv[1], argv[2], NM_SETTING_802_1X_CK_SCHEME_PATH); - test_phase2_private_key_import (argv[1], argv[2], NM_SETTING_802_1X_CK_SCHEME_PATH); + test_private_key_import (path, password, NM_SETTING_802_1X_CK_SCHEME_PATH); + test_phase2_private_key_import (path, password, NM_SETTING_802_1X_CK_SCHEME_PATH); /* Test phase1 and phase2 blob scheme */ - test_private_key_import (argv[1], argv[2], NM_SETTING_802_1X_CK_SCHEME_BLOB); - test_phase2_private_key_import (argv[1], argv[2], NM_SETTING_802_1X_CK_SCHEME_BLOB); + test_private_key_import (path, password, NM_SETTING_802_1X_CK_SCHEME_BLOB); + test_phase2_private_key_import (path, password, NM_SETTING_802_1X_CK_SCHEME_BLOB); /* Test that using a wrong password does not change existing data */ - test_wrong_password_keeps_data (argv[1], argv[2]); - test_wrong_phase2_password_keeps_data (argv[1], argv[2]); + test_wrong_password_keeps_data (path, password); + test_wrong_phase2_password_keeps_data (path, password); /* Test clearing the private key */ - test_clear_private_key (argv[1], argv[2]); - test_clear_phase2_private_key (argv[1], argv[2]); + test_clear_private_key (path, password); + test_clear_phase2_private_key (path, password); - base = g_path_get_basename (argv[0]); - fprintf (stdout, "%s: SUCCESS\n", base); - g_free (base); - return 0; + g_free (path); + g_strfreev (parts); +} + +NMTST_DEFINE (); + +int +main (int argc, char **argv) +{ + nmtst_init (&argc, &argv, TRUE); + + g_test_add_data_func ("/libnm-utils/setting-8021x/key-and-cert", + "test_key_and_cert.pem, test", + do_8021x_test); + g_test_add_data_func ("/libnm-utils/setting-8021x/key-only", + "test-key-only.pem, test", + do_8021x_test); + g_test_add_data_func ("/libnm-utils/setting-8021x/pkcs8-enc-key", + "pkcs8-enc-key.pem, 1234567890", + do_8021x_test); + g_test_add_data_func ("/libnm-utils/setting-8021x/pkcs12", + "test-cert.p12, test", + do_8021x_test); + + return g_test_run (); } diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c index de07f2c2a..1c7d78b8c 100644 --- a/libnm-util/tests/test-setting-dcb.c +++ b/libnm-util/tests/test-setting-dcb.c @@ -15,10 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2013 Red Hat, Inc. + * Copyright 2013 Red Hat, Inc. * */ +#include "config.h" + #include <glib.h> #include <string.h> #include <nm-utils.h> diff --git a/libnm-util/tests/test-settings-defaults.c b/libnm-util/tests/test-settings-defaults.c index 15412fed5..7441e1ff5 100644 --- a/libnm-util/tests/test-settings-defaults.c +++ b/libnm-util/tests/test-settings-defaults.c @@ -15,10 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2011 Red Hat, Inc. * */ +#include "config.h" + #include <glib.h> #include <string.h> |