1. 18 Apr, 2019 1 commit
    • Thomas Haller's avatar
      shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" · d984b2ce
      Thomas Haller authored
      From the files under "shared/nm-utils" we build an internal library
      that provides glib-based helper utilities.
      Move the files of that basic library to a new subdirectory
      "shared/nm-glib-aux" and rename the helper library "libnm-core-base.la"
      to "libnm-glib-aux.la".
       - the name "utils" is overused in our code-base. Everything's an
         "utils". Give this thing a more distinct name.
       - there were additional files under "shared/nm-utils", which are not
         part of this internal library "libnm-utils-base.la". All the files
         that are part of this library should be together in the same
         directory, but files that are not, should not be there.
       - the new name should better convey what this library is and what is isn't:
         it's a set of utilities and helper functions that extend glib with
         funcitonality that we commonly need.
      There are still some files left under "shared/nm-utils". They have less
      a unifying propose to be in their own directory, so I leave them there
      for now. But at least they are separate from "shared/nm-glib-aux",
      which has a very clear purpose.
      (cherry picked from commit 80db06f7)
  2. 22 Feb, 2019 1 commit
  3. 12 Feb, 2019 2 commits
  4. 25 Oct, 2018 1 commit
  5. 22 Oct, 2018 2 commits
  6. 17 Sep, 2018 1 commit
  7. 04 Sep, 2018 1 commit
    • Thomas Haller's avatar
      shared: add nm-secret-utils.h helper · b2325087
      Thomas Haller authored
      We already had nm_free_secret() to clear the secret out
      of a NUL terminated string. That works well for secrets
      which are strings, it can be used with a cleanup attribute
      (nm_auto_free_secret) and as a cleanup function for a
      However, it does not work for secrets which are binary.
      For those, we must also track the length of the allocated
      data and clear it.
      Add two new structs NMSecretPtr and NMSecretBuf to help
      with that.
  8. 23 Aug, 2018 1 commit
  9. 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' \
  10. 30 Apr, 2018 1 commit
  11. 08 Feb, 2018 1 commit
  12. 16 Jan, 2018 2 commits
  13. 15 Jan, 2018 1 commit
  14. 18 Dec, 2017 1 commit
  15. 23 Nov, 2017 3 commits
  16. 16 Nov, 2017 1 commit
    • Thomas Haller's avatar
      all: use nm_str_hash() instead of g_str_hash() · a6be2f4a
      Thomas Haller authored
      We also do this for libnm and libnm-core, where it causes visible changes
      in behavior. But if somebody would rely on the hashing implementation
      for hash tables, it would be seriously flawed.
  17. 08 Mar, 2017 1 commit
  18. 06 Feb, 2017 1 commit
  19. 24 Nov, 2016 1 commit
  20. 23 Nov, 2016 1 commit
  21. 03 Oct, 2016 1 commit
  22. 16 Jun, 2016 1 commit
    • Thomas Haller's avatar
      shared: move shared files to subdirectory "shared/nm-utils/" · 4b288136
      Thomas Haller authored
      The "shared" directory contains files that are possibly used by all components
      of NetworkManager repository.
      Some of these files are even copied as-is to other projects (VPN plugins, nm-applet)
      and used there without modification. Move those files to a separate directory.
      By moving them to a common directory, it is clearer that they belong
      together. Also, you can easier compare the copied versions to their
      original via
        $ diff -r ./shared/nm-utils/ /path/to/nm-vpn-plugin/shared/nm-utils/
  23. 15 Jun, 2016 1 commit
    • Thomas Haller's avatar
      libnm/vpn: add nm_vpn_editor_plugin_load_vt() · cf34211c
      Thomas Haller authored
      Let VPN plugins return a virtual function table to extend
      the API while bypassing libnm. This allows to add and use
      new functionality to VPN plugins without updating libnm.
      The actual definitions are in a header-only file
      "nm-vpn-editor-plugin-call.h", which can be copied to the
  24. 20 Apr, 2016 1 commit
  25. 26 Mar, 2016 1 commit
    • Thomas Haller's avatar
      libnm: accept invalid connections in NMVpnServicePlugin · 559ab7bd
      Thomas Haller authored
      When we receive a connection from NetworkManager it is not guaranteed
      that the connection verifies. For example, if the current libnm version
      is older then the NetworkManager version.
      Be more accepting and don't do any verification of the connection.
      For NMVpnPluginOld this change is uncritical, because there are probably
      no users of this API anyway.
      NMVpnServicePlugin is new API since nm-1-1. However, this API is already
      strongly used by all the plugins we ported over. So this change is
      affecting them.
      This should only matter if libnm's and NetworkManager's version differ,
      because NetworkManager just doesn't send out an invalid connection. It
      actually only matters if NetworkManager is a newer version and sends an
      invalid connection to the client. That is anyway badly tested and probably
      this changes rather improves compatibility than breaking existing users.
  26. 03 Mar, 2016 1 commit
  27. 02 Mar, 2016 1 commit
    • Dan Williams's avatar
      libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732) · abc700c5
      Dan Williams authored
      If the plugin supports interactive mode, but the VPN binary (like vpnc
      or openvpn) doesn't support it, then the plugin should return
      NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED from its connect_interactive()
      hook.  This lets NetworkManager know to fall back to plain Connect().
      Since this notification is done through an error return, the VPN service
      plugin code sees the failure and moves the plugin state back to
      STOPPED.  NetworkManager sees that state change, and terminates the
      connection attempt while waiting for a reply to the Connect() method.
      (VPN service plugins that don't support interactive mode at all don't
      have this problem because that error is returned before the plugin's
      state is moved to STARTING.)
      To fix this, do two things:
      1) if the connect_interactive() hook fails and returns the error
      state change for a few seconds to allow NM time to fall back to
      plain Connect().  We still want to move the plugin state back to
      STOPPED eventually, because otherwise it could stay in STARTING
      2) change state to STARTING only if the connect/connect_interactive
      plugin hooks were successful.  Otherwise the plugin would still be
      in STARTING state, and it's not valid to call Connect()/ConnectInteractive()
      during the STARTING state.
  28. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      - Except for <config.h> itself. Include it with angle brackets as suggested by
  29. 12 Feb, 2016 1 commit
    • Thomas Haller's avatar
      build: cleanup default includes · 2c2d9d2e
      Thomas Haller authored
      - "gsystem-local-alloc.h" and <gio/gio.h> are already included via
        "nm-default.h". No need to include them separately.
      - include "nm-macros-internal.h" via "nm-default.h" and drop all
        explict includes.
      - in the modified files, ensure that we always include "config.h"
        and "nm-default.h" first. As second, include the header file
        for the current source file (if applicable). Then follow external
        includes and finally internal nm includes.
      - include nm headers inside source code files with quotes
      - internal header files don't need to include default headers.
        They can savely assume that "nm-default.h" is already included
        and with it glib, nm-glib.h, nm-macros-internal.h, etc.
  30. 28 Jan, 2016 1 commit
  31. 13 Nov, 2015 1 commit
  32. 23 Oct, 2015 1 commit
  33. 16 Oct, 2015 1 commit
  34. 14 Oct, 2015 1 commit
  35. 13 Oct, 2015 1 commit
    • Lubomir Rintel's avatar
      libnm/vpn-service-plugin: remove nm_vpn_service_plugin_{get,set}_state() · fd61b217
      Lubomir Rintel authored
      The plugins set state only on failures and often forget to do that. Do the
      correct status transition to STOPPED in nm_vpn_service_plugin_failure() instead.
      The get_state() is only used to find out whether to fail or orderly disconnect
      depending on whether we're STARTING or already STARTED. Handle that in
      nm_vpn_service_plugin_disconnect() in a generic manner instead.