Hello community, here is the log from the commit of package wicked for openSUSE:Factory checked in at 2015-10-03 20:29:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wicked (Old) and /work/SRC/openSUSE:Factory/.wicked.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wicked" Changes: -------- --- /work/SRC/openSUSE:Factory/wicked/wicked.changes 2015-09-24 07:16:54.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.wicked.new/wicked.changes 2015-10-03 20:29:48.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Sep 25 11:21:26 UTC 2015 - pwieczorkiew...@suse.com + +- version 0.6.25 +- compat: read complete sysctl file set (bsc#928459) +- wireless: fixed to parse/format hex escapes in essid (bsc#928459) + +------------------------------------------------------------------- Old: ---- wicked-0.6.24.tar.bz2 New: ---- wicked-0.6.25.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wicked.spec ++++++ --- /var/tmp/diff_new_pack.BVSB8m/_old 2015-10-03 20:29:50.000000000 +0200 +++ /var/tmp/diff_new_pack.BVSB8m/_new 2015-10-03 20:29:50.000000000 +0200 @@ -18,7 +18,7 @@ %define release_prefix %{?snapshot:%{snapshot}}%{!?snapshot:0} Name: wicked -Version: 0.6.24 +Version: 0.6.25 Release: %{release_prefix}.0.0 Summary: Network configuration infrastructure License: GPL-2.0 ++++++ wicked-0.6.24.tar.bz2 -> wicked-0.6.25.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/ChangeLog new/wicked-0.6.25/ChangeLog --- old/wicked-0.6.24/ChangeLog 2015-09-17 18:58:43.000000000 +0200 +++ new/wicked-0.6.25/ChangeLog 2015-09-25 13:21:56.000000000 +0200 @@ -1,3 +1,42 @@ +commit c5d9fd4611d4c537a70443f2ed36be3e8452c9af +Author: Pawel Wieczorkiewicz <pwieczorkiew...@suse.de> +Date: Fri Sep 25 13:19:24 2015 +0200 + + version 0.6.25 + +commit b9dafbc68ab9e4cc3fc98b4b171292499fc0cce5 +Merge: 804c3f7 fa05c86 +Author: Pawel Wieczorkiewicz <pwieczorkiew...@suse.de> +Date: Fri Sep 25 09:53:14 2015 +0200 + + Merge pull request #594 from mtomaschewski/wlan-essid + + wireless: encode/decode ESSID as hex (bsc#941708) + +commit fa05c868cbededc4e4651c7f4feac4f735715c7e +Author: Marius Tomaschewski <m...@suse.de> +Date: Thu Sep 24 15:53:43 2015 +0200 + + wireless: dbus mode retrieving fix, invalid arg info + +commit 77e45aabb08fac721e941e12675dd1f1b7896b11 +Author: Marius Tomaschewski <m...@suse.de> +Date: Thu Sep 24 14:18:04 2015 +0200 + + wireless: set bssid vs. scan bssid confusion fix + +commit da7a32f3ae9d210ad7a6aee530011b1fc618df33 +Author: Marius Tomaschewski <m...@suse.de> +Date: Thu Sep 24 14:17:02 2015 +0200 + + wireless: encode/decode ESSID as hex (bsc#941708) + +commit 90f7e3132f8e8a5dc6d3ce2c6478cd4d52819540 +Author: Marius Tomaschewski <m...@suse.de> +Date: Wed Sep 23 13:34:58 2015 +0200 + + compat: read complete sysctl file set (bsc#928459) + commit ee5d15c87bc9deb4d6a97c248520e8075dca8fce Author: Pawel Wieczorkiewicz <pwieczorkiew...@suse.de> Date: Thu Sep 17 18:50:30 2015 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/VERSION new/wicked-0.6.25/VERSION --- old/wicked-0.6.24/VERSION 2015-09-17 18:51:31.000000000 +0200 +++ new/wicked-0.6.25/VERSION 2015-09-25 13:19:03.000000000 +0200 @@ -1 +1 @@ -0.6.24 +0.6.25 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/client/compat.c new/wicked-0.6.25/client/compat.c --- old/wicked-0.6.24/client/compat.c 2015-09-17 18:49:20.000000000 +0200 +++ new/wicked-0.6.25/client/compat.c 2015-09-25 13:18:29.000000000 +0200 @@ -960,9 +960,7 @@ return FALSE; if (net->essid.len > 0) { - ni_string_set(&tmp, (const char *) net->essid.data, net->essid.len); - xml_node_new_element("essid", network, tmp); - ni_string_free(&tmp); + xml_node_new_element("essid", network, ni_wireless_print_ssid(&net->essid)); } xml_node_new_element("scan-ssid", network, net->scan_ssid?"true":"false"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/client/suse/compat-suse.c new/wicked-0.6.25/client/suse/compat-suse.c --- old/wicked-0.6.24/client/suse/compat-suse.c 2015-09-17 18:49:20.000000000 +0200 +++ new/wicked-0.6.25/client/suse/compat-suse.c 2015-09-25 13:18:29.000000000 +0200 @@ -37,6 +37,7 @@ #include <net/ethernet.h> #include <netlink/netlink.h> #include <sys/types.h> +#include <sys/utsname.h> #include <pwd.h> #include <grp.h> @@ -110,8 +111,14 @@ __NI_SUSE_SYSCONF_DIR"/HOSTNAME", \ NULL } #define __NI_SUSE_SYSCTL_SUFFIX ".conf" -#define __NI_SUSE_SYSCTL_FILE __NI_SUSE_SYSCONF_DIR"/sysctl.conf" -#define __NI_SUSE_SYSCTL_DIR __NI_SUSE_SYSCONF_DIR"/sysctl.d" +#define __NI_SUSE_SYSCTL_BOOT "/boot/sysctl.conf-" +#define __NI_SUSE_SYSCTL_DIRS { "/lib/sysctl.d", \ + "/usr/lib/sysctl.d", \ + "/usr/local/lib/sysctl.d", \ + "/etc/sysctl.d", \ + "/run/sysctl.d", \ + NULL } +#define __NI_SUSE_SYSCTL_FILE "/etc/sysctl.conf" #define __NI_SUSE_PROC_IPV6_DIR "/proc/sys/net/ipv6" #define __NI_SUSE_SYSCONFIG_NETWORK_DIR __NI_SUSE_SYSCONF_DIR"/sysconfig/network" @@ -308,28 +315,46 @@ static ni_bool_t __ni_suse_read_global_ifsysctl(const char *root, const char *path) { + const char *sysctldirs[] = __NI_SUSE_SYSCTL_DIRS, **sysctld; ni_string_array_t files = NI_STRING_ARRAY_INIT; char dirname[PATH_MAX]; char pathbuf[PATH_MAX]; const char *name; char *real = NULL; unsigned int i; + struct utsname u; ni_var_array_destroy(&__ni_suse_global_ifsysctl); /* - * canonicalize all files to avoid parsing them multiple - * times -- there are symlinks used by default. + * first /boot/sysctl.conf-<kernelversion> */ - snprintf(dirname, sizeof(dirname), "%s%s", root, __NI_SUSE_SYSCTL_DIR); - if (ni_isdir(dirname)) { + memset(&u, 0, sizeof(u)); + if (uname(&u) == 0) { + snprintf(pathbuf, sizeof(pathbuf), "%s%s%s", root, + __NI_SUSE_SYSCTL_BOOT, u.release); + name = ni_realpath(pathbuf, &real); + if (name && ni_isreg(name)) + ni_string_array_append(&files, name); + ni_string_free(&real); + } + + /* + * then the new sysctl.d directories + */ + for (sysctld = sysctldirs; *sysctld; ++sysctld) { ni_string_array_t names = NI_STRING_ARRAY_INIT; + + snprintf(dirname, sizeof(dirname), "%s%s", root, *sysctld); + if (!ni_isdir(dirname)) + continue; + if (ni_scandir(dirname, "*"__NI_SUSE_SYSCTL_SUFFIX, &names)) { for (i = 0; i < names.count; ++i) { snprintf(pathbuf, sizeof(pathbuf), "%s/%s", dirname, names.data[i]); name = ni_realpath(pathbuf, &real); - if (name) + if (name && ni_isreg(name)) ni_string_array_append(&files, name); ni_string_free(&real); } @@ -337,6 +362,9 @@ ni_string_array_destroy(&names); } + /* + * then the old /etc/sysctl.conf + */ snprintf(pathbuf, sizeof(pathbuf), "%s%s", root, __NI_SUSE_SYSCTL_FILE); name = ni_realpath(pathbuf, &real); if (name && ni_isreg(name)) { @@ -345,6 +373,9 @@ } ni_string_free(&real); + /* + * finally ifsysctl if they exist + */ if (ni_string_empty(root)) snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, __NI_SUSE_IFSYSCTL_FILE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/configure new/wicked-0.6.25/configure --- old/wicked-0.6.24/configure 2015-09-17 18:57:39.000000000 +0200 +++ new/wicked-0.6.25/configure 2015-09-25 13:20:45.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for wicked 0.6.24. +# Generated by GNU Autoconf 2.69 for wicked 0.6.25. # # Report bugs to <http://bugs.opensuse.org>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='wicked' PACKAGE_TARNAME='wicked' -PACKAGE_VERSION='0.6.24' -PACKAGE_STRING='wicked 0.6.24' +PACKAGE_VERSION='0.6.25' +PACKAGE_STRING='wicked 0.6.25' PACKAGE_BUGREPORT='http://bugs.opensuse.org' PACKAGE_URL='https://github.com/openSUSE/wicked' @@ -1385,7 +1385,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures wicked 0.6.24 to adapt to many kinds of systems. +\`configure' configures wicked 0.6.25 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1455,7 +1455,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of wicked 0.6.24:";; + short | recursive ) echo "Configuration of wicked 0.6.25:";; esac cat <<\_ACEOF @@ -1609,7 +1609,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -wicked configure 0.6.24 +wicked configure 0.6.25 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2208,7 +2208,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by wicked $as_me 0.6.24, which was +It was created by wicked $as_me 0.6.25, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3071,7 +3071,7 @@ # Define the identity of the package. PACKAGE='wicked' - VERSION='0.6.24' + VERSION='0.6.25' cat >>confdefs.h <<_ACEOF @@ -15040,7 +15040,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by wicked $as_me 0.6.24, which was +This file was extended by wicked $as_me 0.6.25, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15107,7 +15107,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -wicked config.status 0.6.24 +wicked config.status 0.6.25 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/src/dbus-objects/wireless.c new/wicked-0.6.25/src/dbus-objects/wireless.c --- old/wicked-0.6.24/src/dbus-objects/wireless.c 2015-04-27 11:24:49.000000000 +0200 +++ new/wicked-0.6.25/src/dbus-objects/wireless.c 2015-09-25 13:18:29.000000000 +0200 @@ -116,8 +116,8 @@ case NI_WIRELESS_KEY_MGMT_PSK: if (net->wpa_psk.passphrase == NULL) { dbus_set_error(error, NI_DBUS_ERROR_AUTH_INFO_MISSING, - "wpa-psk.passphrase|PASSWORD|%.*s", - net->essid.len, net->essid.data); + "wpa-psk.passphrase|PASSWORD|%s", + ni_wireless_print_ssid(&net->essid)); goto error; } break; @@ -128,15 +128,15 @@ } if (net->wpa_eap.identity == NULL) { dbus_set_error(error, NI_DBUS_ERROR_AUTH_INFO_MISSING, - "wpa-eap.identity|USERNAME|%.*s", - net->essid.len, net->essid.data); + "wpa-eap.identity|USERNAME|%s", + ni_wireless_print_ssid(&net->essid)); goto error; } if (net->wpa_eap.phase2.method != NI_WIRELESS_EAP_NONE && net->wpa_eap.phase2.password == NULL) { dbus_set_error(error, NI_DBUS_ERROR_AUTH_INFO_MISSING, - "wpa-eap.phase2.password|PASSWORD|%.*s", - net->essid.len, net->essid.data); + "wpa-eap.phase2.password|PASSWORD|%s", + ni_wireless_print_ssid(&net->essid)); goto error; } break; @@ -168,6 +168,7 @@ { const ni_dbus_variant_t *child; const char *string; + uint32_t value; if (!ni_dbus_variant_is_dict(var)) { dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "expected dict argument"); @@ -175,18 +176,9 @@ } if ((child = ni_dbus_dict_get(var, "essid")) != NULL) { - unsigned int len; - - if (ni_dbus_variant_get_byte_array_minmax(child, net->essid.data, &len, 0, sizeof(net->essid.data))) { - net->essid.len = len; - } else - if (ni_dbus_variant_get_string(child, &string)) { - len = strlen(string); - if (len > sizeof(net->essid.data)) - return FALSE; - memcpy(net->essid.data, string, len); - net->essid.len = len; - } else { + if (!ni_dbus_variant_get_string(child, &string) || + !ni_wireless_parse_ssid(string, &net->essid)) { + dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "invald wireless ssid %s", string); return FALSE; } } @@ -195,16 +187,22 @@ ni_hwaddr_t hwaddr; unsigned int len; - if (!ni_dbus_variant_get_byte_array_minmax(child, hwaddr.data, &len, 0, sizeof(hwaddr.data)) || ni_link_address_length(ARPHRD_ETHER) != len) + if (!ni_dbus_variant_get_byte_array_minmax(child, hwaddr.data, &len, 0, + sizeof(hwaddr.data)) || ni_link_address_length(ARPHRD_ETHER) != len) { + dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "invald wireless access point address"); return FALSE; + } hwaddr.type = ARPHRD_ETHER; hwaddr.len = len; net->access_point = hwaddr; } - if (ni_dbus_dict_get_string(var, "mode", &string)) { - if (!ni_wireless_name_to_mode(string, &net->mode)) + if (ni_dbus_dict_get_uint32(var, "mode", &value)) { + if (!ni_wireless_mode_to_name(value)) { + dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, "invalid wireless mode %u", value); return FALSE; + } + net->mode = value; } if ((child = ni_dbus_dict_get(var, "wpa-psk")) != NULL) { @@ -219,7 +217,6 @@ } else if ((child = ni_dbus_dict_get(var, "wpa-eap")) != NULL) { ni_dbus_variant_t *gchild; - uint32_t value; net->auth_proto = NI_WIRELESS_AUTH_WPA2; net->keymgmt_proto = NI_WIRELESS_KEY_MGMT_EAP; @@ -365,8 +362,7 @@ { unsigned int i; - ni_dbus_dict_add_string(dict, "essid", - ni_wireless_print_ssid(&network->essid)); + ni_dbus_dict_add_string(dict, "essid", ni_wireless_print_ssid(&network->essid)); if (network->access_point.len) ni_dbus_dict_add_byte_array(dict, "access-point", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/src/wireless.c new/wicked-0.6.25/src/wireless.c --- old/wicked-0.6.24/src/wireless.c 2015-09-08 12:23:11.000000000 +0200 +++ new/wicked-0.6.25/src/wireless.c 2015-09-25 13:18:29.000000000 +0200 @@ -1083,15 +1083,17 @@ /* * Helper function to print and parse an SSID * Non-printable characters and anything fishy is represented - * as \\ooo octal escape characters + * as \\xXX hex escape characters as formated by the iwlist + * scanning command and wpa-supplicant. */ const char * ni_wireless_print_ssid(const ni_wireless_ssid_t *ssid) { static char result[4 * sizeof(ssid->data) + 1]; - unsigned int i, j; + unsigned int i, j = 0; - ni_assert(ssid->len <= sizeof(ssid->data)); + if (!ssid || ssid->len > sizeof(ssid->data)) + return NULL; for (i = j = 0; i < ssid->len; ++i) { unsigned char cc = ssid->data[i]; @@ -1099,7 +1101,7 @@ if (isalnum(cc) || cc == '-' || cc == '_' || cc == ' ') { result[j++] = cc; } else { - sprintf(result + j, "\\%03o", cc); + sprintf(result + j, "\\x%02X", cc); j += 4; } } @@ -1108,35 +1110,113 @@ return result; } +static inline unsigned int +__ni_wireless_parse_ssid_hex(unsigned char *out, const char *str, size_t len) +{ + unsigned long val; + unsigned int pos; + char *eos = NULL; + char buf[3]; + + for (pos = 0; pos < 2 && (size_t)pos < len; ) { + unsigned char cc = str[pos]; + + if (!isxdigit(cc)) + break; + + buf[pos++] = cc; + } + + if (pos) { + buf[pos] = '\0'; + val = strtoul(&buf[0], &eos, 16); + if (*eos != '\0' || val > 255) + return 0; + *out = val; + } + return pos; +} + +static inline unsigned int +__ni_wireless_parse_ssid_oct(unsigned char *out, const char *str, size_t len) +{ + unsigned int val = 0; + unsigned int pos; + + for (pos = 0; pos < 3 && (size_t)pos < len; ) { + unsigned char cc = str[pos]; + + if (cc < '0' || '7' < cc) + break; + + val = (val << 3) | (cc - '0'); + pos++; + } + if (pos) + *out = val; + return pos; +} + +static inline int +__ni_wireless_parse_ssid_put(ni_wireless_ssid_t *ssid, unsigned char cc) +{ + if (ssid->len >= sizeof(ssid->data)) + return -1; + ssid->data[ssid->len++] = cc; + return 1; +} + +static inline int +__ni_wireless_parse_ssid_esc(unsigned char *cc, const char *s, const char *e) +{ + switch (*s) { + case '\\': *cc = '\\'; return 1; + case '"': *cc = '"'; return 1; + case 'n': *cc = '\n'; return 1; + case 'r': *cc = '\r'; return 1; + case 't': *cc = '\t'; return 1; + case 'e': *cc = '\033'; return 1; + case 'x': + return __ni_wireless_parse_ssid_hex(cc, s + 1, e - s - 1) + 1; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + return __ni_wireless_parse_ssid_oct(cc, s, e - s); + default: + return 0; + } +} + ni_bool_t ni_wireless_parse_ssid(const char *string, ni_wireless_ssid_t *ssid) { - const char *s; + const char *s = string; + const char *e; + int ret; + if (!string || !ssid) + goto bad_ssid; + + e = s + ni_string_len(s); memset(ssid, 0, sizeof(*ssid)); - for (s = string; *s; ) { + while (e > s) { unsigned char cc = *s++; if (cc == '\\') { - unsigned int value = 0; - unsigned int j; - - for (j = 0; j < 3; ++j) { - cc = *s; - - if (cc < '0' || '7' < cc) - break; - - value = (value << 3) | (cc - '0'); - ++s; - } - if (j == 0) + ret = __ni_wireless_parse_ssid_esc(&cc, s, e); + if (ret < 0) goto bad_ssid; - cc = value; + s += ret; } - if (ssid->len >= sizeof(ssid->data)) + + ret = __ni_wireless_parse_ssid_put(ssid, cc); + if (ret < 0) goto bad_ssid; - ssid->data[ssid->len++] = cc; } return TRUE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/src/wpa-supplicant.c new/wicked-0.6.25/src/wpa-supplicant.c --- old/wicked-0.6.24/src/wpa-supplicant.c 2015-09-08 12:23:11.000000000 +0200 +++ new/wicked-0.6.25/src/wpa-supplicant.c 2015-09-25 13:18:29.000000000 +0200 @@ -763,8 +763,8 @@ { ni_dbus_object_t *net_object; - ni_debug_wireless("%s(dev=%s, essid=%.*s)", __func__, dev->ifname, - net->essid.len, net->essid.data); + ni_debug_wireless("%s(dev=%s, essid='%s')", __func__, dev->ifname, + ni_wireless_print_ssid(&net->essid)); /* FIXME: make sure we have all the keys/pass phrases etc to * associate. */ @@ -991,40 +991,70 @@ ni_dbus_variant_t *argument, DBusError *error) { ni_wireless_network_t *net = __wpa_get_network(object); - const char *bssid; - if (net->access_point.type != ARPHRD_ETHER || 0 == net->access_point.len) { + if (net->access_point.len != ni_link_address_length(ARPHRD_ETHER)) return __ni_dbus_property_not_present_error(error, property); - } - if (net->access_point.len != ni_link_address_length(net->access_point.type)) + ni_dbus_variant_set_byte_array(argument, net->access_point.data, net->access_point.len); + return TRUE; +} + +static dbus_bool_t +__wpa_dbus_bss_set_bssid(ni_dbus_object_t *object, const ni_dbus_property_t *property, + const ni_dbus_variant_t *argument, DBusError *error) +{ + ni_wireless_network_t *net = __wpa_get_network(object); + unsigned int len; + + if (!ni_dbus_variant_get_byte_array_minmax(argument, + net->access_point.data, &len, + 0, sizeof(net->access_point.data))) return FALSE; + if (len == ni_link_address_length(ARPHRD_ETHER)) { + net->access_point.type = ARPHRD_ETHER; + net->access_point.len = len; + } else { + ni_link_address_init(&net->access_point); + } + return TRUE; +} + + +static dbus_bool_t +__wpa_dbus_net_get_bssid(const ni_dbus_object_t *object, const ni_dbus_property_t *property, + ni_dbus_variant_t *argument, DBusError *error) +{ + ni_wireless_network_t *net = __wpa_get_network(object); + const char *bssid; + + if (net->access_point.type != ARPHRD_ETHER || + net->access_point.len != ni_link_address_length(ARPHRD_ETHER)) + return __ni_dbus_property_not_present_error(error, property); + /* Send '\0' for "any" and "off" */ if (ni_link_address_is_invalid(&net->access_point)) bssid = NULL; else bssid = ni_link_address_print(&net->access_point); - ni_dbus_variant_set_string(argument, bssid); return TRUE; } static dbus_bool_t -__wpa_dbus_bss_set_bssid(ni_dbus_object_t *object, const ni_dbus_property_t *property, +__wpa_dbus_net_set_bssid(ni_dbus_object_t *object, const ni_dbus_property_t *property, const ni_dbus_variant_t *argument, DBusError *error) { ni_wireless_network_t *net = __wpa_get_network(object); const char *bssid; - if (!ni_dbus_variant_get_string(argument, &bssid)) - return FALSE; - - if (ni_string_empty(bssid)) - ni_link_address_init(&net->access_point); - else if (ni_link_address_parse(&net->access_point, ARPHRD_ETHER, bssid)) - return FALSE; - + if (ni_dbus_variant_get_string(argument, &bssid)) { + if (ni_string_empty(bssid)) + ni_link_address_init(&net->access_point); + else + if (ni_link_address_parse(&net->access_point, ARPHRD_ETHER, bssid) != 0) + return FALSE; + } return TRUE; } @@ -1615,7 +1645,7 @@ __NI_DBUS_PROPERTY(signature, __name, __wpa_dbus_bss, rw) static ni_dbus_property_t wpa_bss_properties[] = { - WPA_BSS_PROPERTY(STRING, bssid, RO), + WPA_BSS_PROPERTY_SIGNATURE(DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING, bssid, RO), WPA_BSS_PROPERTY_SIGNATURE(DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING, ssid, RO), WPA_BSS_PROPERTY(INT32, noise, RO), WPA_BSS_PROPERTY(INT32, frequency, RO), @@ -1656,8 +1686,13 @@ .compatible = &ni_objectmodel_wpanet_class, }; +#define WPA_NET_PROPERTY(type, __name, rw) \ + NI_DBUS_PROPERTY(type, __name, __wpa_dbus_net, rw) +#define WPA_NET_PROPERTY_SIGNATURE(signature, __name, rw) \ + __NI_DBUS_PROPERTY(signature, __name, __wpa_dbus_net, rw) + static ni_dbus_property_t wpa_network_properties[] = { - WPA_BSS_PROPERTY(STRING, bssid, RO), + WPA_NET_PROPERTY(STRING, bssid, RO), WPA_BSS_PROPERTY_SIGNATURE(DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING, ssid, RO), WPA_BSS_PROPERTY(INT32, frequency, RO), @@ -1718,14 +1753,14 @@ if (!ni_dbus_object_set_properties_from_dict(proxy, &ni_wpa_bssid_service, &dict, NULL)) goto failed; - ni_debug_wireless("Updated BSS %s, freq=%.3f GHz, quality=%.2f, noise=%u, level=%.2f dBm, maxrate=%u MB/s, essid=%.*s", + ni_debug_wireless("Updated BSS %s, freq=%.3f GHz, quality=%.2f, noise=%u, level=%.2f dBm, maxrate=%u MB/s, essid='%s'", ni_link_address_print(&net->access_point), net->scan_info.frequency, net->scan_info.quality, net->scan_info.noise, net->scan_info.level, net->scan_info.max_bitrate / 1000000, - net->essid.len, net->essid.data); + ni_wireless_print_ssid(&net->essid)); if (net->notified && memcmp(&old_essid, &net->essid, sizeof(old_essid)) != 0) { ni_debug_wireless("%s: essid changed", ni_link_address_print(&net->access_point)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/testing/Makefile.am new/wicked-0.6.25/testing/Makefile.am --- old/wicked-0.6.24/testing/Makefile.am 2015-09-08 12:23:11.000000000 +0200 +++ new/wicked-0.6.25/testing/Makefile.am 2015-09-25 13:18:29.000000000 +0200 @@ -10,6 +10,7 @@ json-test \ teamd-test \ xpath-test \ + essid-test \ cstate-test AM_CPPFLAGS = -I$(top_srcdir)/src \ @@ -30,6 +31,7 @@ json_test_SOURCES = json-test.c teamd_test_SOURCES = teamd-test.c xpath_test_SOURCES = xpath-test.c +essid_test_SOURCES = essid-test.c cstate_test_SOURCES = cstate-test.c EXTRA_DIST = ibft xpath diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/testing/Makefile.in new/wicked-0.6.25/testing/Makefile.in --- old/wicked-0.6.24/testing/Makefile.in 2015-09-17 18:57:42.000000000 +0200 +++ new/wicked-0.6.25/testing/Makefile.in 2015-09-25 13:20:48.000000000 +0200 @@ -81,7 +81,7 @@ noinst_PROGRAMS = rtnl-test$(EXEEXT) hex-test$(EXEEXT) \ uuid-test$(EXEEXT) xml-test$(EXEEXT) ibft-test$(EXEEXT) \ json-test$(EXEEXT) teamd-test$(EXEEXT) xpath-test$(EXEEXT) \ - cstate-test$(EXEEXT) + essid-test$(EXEEXT) cstate-test$(EXEEXT) subdir = testing DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp @@ -102,6 +102,10 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +am_essid_test_OBJECTS = essid-test.$(OBJEXT) +essid_test_OBJECTS = $(am_essid_test_OBJECTS) +essid_test_LDADD = $(LDADD) +essid_test_DEPENDENCIES = $(top_builddir)/src/libwicked.la am_hex_test_OBJECTS = hex-test.$(OBJEXT) hex_test_OBJECTS = $(am_hex_test_OBJECTS) hex_test_LDADD = $(LDADD) @@ -168,14 +172,14 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(cstate_test_SOURCES) $(hex_test_SOURCES) \ - $(ibft_test_SOURCES) $(json_test_SOURCES) $(rtnl_test_SOURCES) \ - $(teamd_test_SOURCES) $(uuid_test_SOURCES) $(xml_test_SOURCES) \ - $(xpath_test_SOURCES) -DIST_SOURCES = $(cstate_test_SOURCES) $(hex_test_SOURCES) \ - $(ibft_test_SOURCES) $(json_test_SOURCES) $(rtnl_test_SOURCES) \ - $(teamd_test_SOURCES) $(uuid_test_SOURCES) $(xml_test_SOURCES) \ - $(xpath_test_SOURCES) +SOURCES = $(cstate_test_SOURCES) $(essid_test_SOURCES) \ + $(hex_test_SOURCES) $(ibft_test_SOURCES) $(json_test_SOURCES) \ + $(rtnl_test_SOURCES) $(teamd_test_SOURCES) \ + $(uuid_test_SOURCES) $(xml_test_SOURCES) $(xpath_test_SOURCES) +DIST_SOURCES = $(cstate_test_SOURCES) $(essid_test_SOURCES) \ + $(hex_test_SOURCES) $(ibft_test_SOURCES) $(json_test_SOURCES) \ + $(rtnl_test_SOURCES) $(teamd_test_SOURCES) \ + $(uuid_test_SOURCES) $(xml_test_SOURCES) $(xpath_test_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -369,6 +373,7 @@ json_test_SOURCES = json-test.c teamd_test_SOURCES = teamd-test.c xpath_test_SOURCES = xpath-test.c +essid_test_SOURCES = essid-test.c cstate_test_SOURCES = cstate-test.c EXTRA_DIST = ibft xpath all: all-am @@ -419,6 +424,10 @@ @rm -f cstate-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cstate_test_OBJECTS) $(cstate_test_LDADD) $(LIBS) +essid-test$(EXEEXT): $(essid_test_OBJECTS) $(essid_test_DEPENDENCIES) $(EXTRA_essid_test_DEPENDENCIES) + @rm -f essid-test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(essid_test_OBJECTS) $(essid_test_LDADD) $(LIBS) + hex-test$(EXEEXT): $(hex_test_OBJECTS) $(hex_test_DEPENDENCIES) $(EXTRA_hex_test_DEPENDENCIES) @rm -f hex-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(hex_test_OBJECTS) $(hex_test_LDADD) $(LIBS) @@ -458,6 +467,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstate-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/essid-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hex-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ibft-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-test.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/testing/essid-test.c new/wicked-0.6.25/testing/essid-test.c --- old/wicked-0.6.24/testing/essid-test.c 1970-01-01 01:00:00.000000000 +0100 +++ new/wicked-0.6.25/testing/essid-test.c 2015-09-25 13:18:29.000000000 +0200 @@ -0,0 +1,71 @@ +/* + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <wicked/wireless.h> +#include <wicked/util.h> +#include "util_priv.h" + +static const char bin_ssid1[] = { + ' ', ' ', '\\', 'p', 'o', 'w', 'e', 'r', '/', ' ', ' ', '\0' +}; +static const char bin_ssid2[] = { + '\\', 'x', '0', '-', '-', 'h', 'i', 'd', 'd', 'e', 'n', '-', '-', '\\', 'x', '4', '0', '\0' +}; +static const char *test1_essid[] = { + bin_ssid1, + bin_ssid2, + " \\power/ ", + " \\route66/ ", + "G\xe4stenetzwerk", + "//{}[],;&%\r\n\007\t\e\x01\x02\x03\xaa\xfe\xee\\\\x\xff", + NULL, +}; + +void +ssid_parse(const char *string, ni_wireless_ssid_t *ssid) +{ + const char *escaped; + const char *hex_str; + size_t len; + char *hex; + + len = ni_string_len(string); + hex = ni_sprint_hex((const unsigned char *)string, len); + + if (ni_wireless_parse_ssid(string, ssid)) { + escaped = ni_wireless_print_ssid(ssid); + hex_str = ni_print_hex(ssid->data, ssid->len); + + printf("ESSID(hex):\t'%s'", hex); + printf("\n\t=> esc:\t'%s'", escaped); + printf("\n\t=> hex:\t'%s'", hex_str); + } else { + printf("ESSID(hex):\t'%s'", hex); + printf("\tcannot be parsed"); + } + printf("\n\n"); + ni_string_free(&hex); +} + +int +main(int argc, char **argv) +{ + ni_wireless_ssid_t ssid; + int n; + + if (argc == 1) { + for (n = 0; test1_essid[n]; ++n) { + ssid_parse(test1_essid[n], &ssid); + } + } else { + for (n = 1; n < argc && argv[n]; ++n) { + ssid_parse(argv[n], &ssid); + } + } + + return 0; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.6.24/wicked.spec new/wicked-0.6.25/wicked.spec --- old/wicked-0.6.24/wicked.spec 2015-09-17 18:57:50.000000000 +0200 +++ new/wicked-0.6.25/wicked.spec 2015-09-25 13:20:56.000000000 +0200 @@ -18,7 +18,7 @@ %define release_prefix %{?snapshot:%{snapshot}}%{!?snapshot:0} Name: wicked -Version: 0.6.24 +Version: 0.6.25 Release: %{release_prefix}.0.0 Summary: Network configuration infrastructure License: GPL-2.0