1. 12 Feb, 2019 2 commits
  2. 08 Feb, 2019 1 commit
    • Thomas Haller's avatar
      shared: avoid "-Wmissing-braces" warning initalizing NMIPAddr · 395174f6
      Thomas Haller authored
      NMIPAddr contains an unnamed union. We have to either explicitly
      initialize one field, or omit it.
          ../shared/nm-utils/nm-shared-utils.c:38:36: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
          const NMIPAddr nm_ip_addr_zero = { 0 };
  3. 05 Feb, 2019 1 commit
  4. 14 Jan, 2019 1 commit
  5. 09 Jan, 2019 3 commits
  6. 07 Jan, 2019 1 commit
  7. 02 Jan, 2019 1 commit
    • Thomas Haller's avatar
      keyfile: various refactoring and restructure nm_keyfile_read() · 269c15e8
      Thomas Haller authored
      - in nm_keyfile_read(), unify _read_setting() and
        _read_setting_vpn_secret() in they way they are called
        (that is, they no longer return any value and don't accept
        any arguments aside @info).
      - use cleanup attributes
      - use nm_streq() instead of strcmp().
      - wrap lines that have multiple statements or conditions.
  8. 12 Dec, 2018 1 commit
  9. 17 Oct, 2018 2 commits
  10. 06 Oct, 2018 1 commit
    • Beniamino Galvani's avatar
      shared/nm-utils: avoid a coverity warning · e4154895
      Beniamino Galvani authored
       1. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1242: value_overwrite: Overwriting previous write to "ch" with value from "v".
       2. NetworkManager-1.14.0/shared/nm-utils/nm-shared-utils.c:1239: assigned_value: Assigning value from "++str[0]" to "ch" here, but that stored value is overwritten before it can be used.
       #  1237|   				if (ch >= '0' && ch <= '7') {
       #  1238|   					v = v * 8 + (ch - '0');
       #  1239|-> 					ch = (++str)[0];
       #  1240|   				}
       #  1241|   			}
      Don't assign ch when it is going to be overwritten.
  11. 30 Sep, 2018 1 commit
    • Rafael Fontenelle's avatar
      Fix typos · 34fd6289
      Rafael Fontenelle authored
      [thaller@redhat.com: fix generated clients/common/settings-docs.h.in file
         and fix wrong change in src/systemd/src/libsystemd/sd-event/sd-event.c]
  12. 18 Sep, 2018 1 commit
    • Thomas Haller's avatar
      shared: relax assertion in nm_utils_parse_inaddr()/nm_utils_parse_inaddr_prefix() · 9ad60ad0
      Thomas Haller authored
      The assertion fails in nmtui's ip_route_transform_from_dest_string(),
      which does not initialize the address output argument to %NULL.
      There are three possibilities how the API could work:
       - assert/require the user to pass in arguments which pre-initialized
         to NULL or unset.
       - always set the output arguments, even if the function fails.
       - don't bother and leave output values untouched, if function fails.
      It's not clear which approach is the best. Not to bother possibliy
      leaves uninitialized values, which could be error prone. Still, do
      just that.
      Fixes: 0b3197a3
  13. 17 Sep, 2018 1 commit
  14. 07 Sep, 2018 2 commits
  15. 30 Aug, 2018 1 commit
  16. 22 Aug, 2018 2 commits
    • Thomas Haller's avatar
      shared: add nm_utils_buf_utf8safe_escape() util · 57c371e3
      Thomas Haller authored
      We already have nm_utils_str_utf8safe_escape() to convert a
      NUL termianted string to an UTF-8 string. nm_utils_str_utf8safe_escape()
      operates under the assumption, that the input strig is already valid UTF-8
      and returns the input string verbatim. That way, in the common expected
      cases, the string just looks like a regular UTF-8 string.
      However, in case there are invalid UTF-8 sequences (or a backslash
      escape characters), the function will use backslash escaping to encode
      the input string as a valid UTF-8 sequence. Note that the escaped
      sequence, can be reverted to the original non-UTF-8 string via
      An example, where this is useful are file names or interface names.
      Which are not in a defined encoding, but NUL terminated and commonly ASCII or
      UTF-8 encoded.
      Extend this, to also handle not NUL terminated buffers. The same
      applies, except that the process cannot be reverted via g_strcompress()
      -- because the NUL character cannot be unescaped.
      This will be useful to escape a Wi-Fi SSID. Commonly we expect the SSID
      to be in UTF-8/ASCII encoding and we want to print it verbatim. Only
      if that is not the case, we fallback to backslash escaping. However, the
      orginal value can be fully recovered via unescape(). The difference
      between an SSID and a filename is, that the former can contain '\0'
    • Thomas Haller's avatar
  17. 11 Aug, 2018 2 commits
  18. 10 Aug, 2018 3 commits
  19. 11 Jul, 2018 1 commit
    • Thomas Haller's avatar
      all: don't use gchar/gshort/gint/glong but C types · e1c7a2b5
      Thomas Haller authored
      We commonly don't use the glib typedefs for char/short/int/long,
      but their C types directly.
          $ git grep '\<g\(char\|short\|int\|long\|float\|double\)\>' | wc -l
          $ git grep '\<\(char\|short\|int\|long\|float\|double\)\>' | wc -l
      One could argue that using the glib typedefs is preferable in
      public API (of our glib based libnm library) or where it clearly
      is related to glib, like during
        g_object_set (obj, PROPERTY, (gint) value, NULL);
      However, that argument does not seem strong, because in practice we don't
      follow that argument today, and seldomly use the glib typedefs.
      Also, the style guide for this would be hard to formalize, because
      "using them where clearly related to a glib" is a very loose suggestion.
      Also note that glib typedefs will always just be typedefs of the
      underlying C types. There is no danger of glib changing the meaning
      of these typedefs (because that would be a major API break of glib).
      A simple style guide is instead: don't use these typedefs.
      No manual actions, I only ran the bash script:
        FILES=($(git ls-files '*.[hc]'))
        sed -i \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>\( [^ ]\)/\1\2/g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>  /\1   /g' \
            -e 's/\<g\(char\|short\|int\|long\|float\|double\)\>/\1/g' \
  20. 26 May, 2018 1 commit
  21. 14 May, 2018 2 commits
    • Thomas Haller's avatar
      shared: add nm_utils_dbus_path_cmp() helper · 7ba3f4f3
      Thomas Haller authored
      At various places we sort our D-Bus paths. For example,
      server sorts them before exporting them on D-Bus.
      Server knows well, that a lot of these paths are build
      by attaching an incrementing number as last component.
      It looks nicer to sort by this number, instead of strictly
      lexical with strcmp().
      Note that this handles the cases correctly where paths have
      different prefixes, or where they don't end with a number.
    • Thomas Haller's avatar
  22. 24 Apr, 2018 1 commit
  23. 19 Apr, 2018 1 commit
    • Thomas Haller's avatar
      shared: move cmp functions to nm-shared-utils.c · bc1b15cf
      Thomas Haller authored
      For one, these functions are not often needed. No need to define them in the
      "nm-macros-internal.h" header, which is included everywhere. Move them to
      "nm-shared-utils.h", which must be explicitly included.
      Also, these functions are usually not called directly, but by passing their
      function pointer to a sort function or similar. There is no point in having
      defined in the header file.
  24. 18 Apr, 2018 1 commit
  25. 16 Apr, 2018 1 commit
  26. 27 Mar, 2018 1 commit
  27. 18 Dec, 2017 2 commits
    • Thomas Haller's avatar
      shared: add nm_utils_strv_make_deep_copied() helper · d5c212b1
      Thomas Haller authored
      At several places we create strv arrays where the
      strings themself are not deep-copied.
      This helper function iterates over such an "const char **"
      array, clones the strings, and updates the strv array
      inplace to be a "char **" strv array.
      This helper function is to reduce code duplication.
    • Thomas Haller's avatar
      shared: add nm_utils_strdict_get_keys() helper · fe7b4641
      Thomas Haller authored
      At various places we get the (string) keys of a GHashTable.
      Add a helper function that does that, including an argument
      for optional sorting.
      The helper function is there to get reduce code duplication.
  28. 08 Dec, 2017 1 commit
  29. 29 Nov, 2017 1 commit